-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] l10n_pt_stock_vehicle_daily (16.0)
- Loading branch information
Showing
14 changed files
with
204 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
Goods may be loaded and stored in a company vehicle, and not be a customer delivery or a | ||
supplier pickup. | ||
|
||
Examples are a travelling salesman carrying stock that might be later sold, or a | ||
maintenance and repair technician carrying tools and spare parts. | ||
|
||
Portuguese Tax Authorities require these to be electronically communicated every day to | ||
their system. | ||
|
||
This feature provides a quick way generate such document. | ||
|
||
CONFIGURATION | ||
|
||
- Create an Operation Type, for the vehicle daily document, of type Internal, and enable | ||
the "Show Move On Hand Stock" checkbox. | ||
- Create an internal Stock Location por each vehicle, and set the "License Plate" field. | ||
|
||
USAGE | ||
|
||
- On the Inventory Dashboard, the daily vehicle document card shows a "Move on Hand" | ||
button at the bottom. Click on it to open an assisstant window. | ||
- On the "Move from location" form, select the Origin Location for the Vehicle. | ||
- The destination location will be automatically set as the same as the origin | ||
location. | ||
- The "License Plate" field will be automatically populated. | ||
- The location's current stock will be selected in the lines. | ||
- Click on "Immediate Transfer" to create the supporting transfer, or "Planned Transfer" | ||
if changes to the stock content are needed. | ||
- On the craeted Transfer, you can print the Delivery Slip. | ||
|
||
CONTRIBUTORS | ||
|
||
- Daniel Reis <dreis@opensourceintegrators.com> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Transport Documents for Vehicle Stock", | ||
"summary": "Daily documente with vehicle content, " | ||
"to communicate to Portuguese Tax Authorities", | ||
"website": "https://github.com/OCA/l10n-portugal", | ||
"license": "AGPL-3", | ||
"author": "Luz de Airbag, Open Source Integrators, Odoo Community Association (OCA)", | ||
"category": "Warehouse", | ||
"version": "16.0.1.0.0", | ||
"depends": [ | ||
"stock_move_location", # from OCA/stock-logistics-warehouse | ||
], | ||
"data": [ | ||
"views/stock_location_views.xml", | ||
"views/stock_picking_views.xml", | ||
"wizard/stock_move_location_views.xml", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from . import stock_location | ||
from . import stock_picking | ||
from . import stock_picking_type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockLocation(models.Model): | ||
_inherit = "stock.location" | ||
|
||
l10n_pt_license_plate = fields.Char("License Plate") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Copyright 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class StockPicking(models.Model): | ||
_inherit = "stock.picking" | ||
|
||
l10n_pt_license_plate = fields.Char("License Plate") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import models | ||
|
||
|
||
class StockPickingType(models.Model): | ||
_inherit = "stock.picking.type" | ||
|
||
def action_move_location(self): | ||
action = super().action_move_location() | ||
# The Vehicle Locatin needs to be selected, | ||
# So by default enable editing the location field | ||
if self.code == "internal": | ||
action["context"]["default_edit_locations"] = True | ||
return action | ||
16 changes: 16 additions & 0 deletions
16
l10n_pt_stock_vehicle_daily/views/stock_location_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="view_location_form_ext" model="ir.ui.view"> | ||
<field name="model">stock.location</field> | ||
<field name="inherit_id" ref="stock.view_location_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<group name="additional_info" position="inside"> | ||
<field name="l10n_pt_license_plate" /> | ||
</group> | ||
|
||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="view_picking_form_ext" model="ir.ui.view"> | ||
<field name="model">stock.picking</field> | ||
<field name="inherit_id" ref="stock.view_picking_form" /> | ||
<field name="arch" type="xml"> | ||
|
||
<group name="other_infos" position="inside"> | ||
<field name="l10n_pt_license_plate" /> | ||
</group> | ||
|
||
</field> | ||
</record> | ||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_move_location |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Copyright 2024 Open Source Integrators | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class StockMoveLocationWizard(models.TransientModel): | ||
_inherit = "wiz.stock.move.location" | ||
|
||
@api.depends("origin_location_id", "picking_type_id") | ||
def _compute_destination_location_id(self): | ||
for wiz in self: | ||
# Copy the Origin Location to the Destination Location | ||
# If it is an Internal move and the Location has is a vehicle/has a Plate | ||
type_is_internal = wiz.picking_type_id.code == "internal" | ||
location_has_plate = bool(wiz.origin_location_id.l10n_pt_license_plate) | ||
if type_is_internal and location_has_plate: | ||
wiz.destination_location_id = wiz.origin_location_id | ||
|
||
@api.depends("origin_location_id") | ||
def _compute_l10n_pt_license_plate(self): | ||
for wiz in self: | ||
# Set the Default License Plate configured in the Location | ||
wiz.l10n_pt_license_plate = wiz.origin_location_id.l10n_pt_license_plate | ||
|
||
destination_location_id = fields.Many2one( | ||
# extend to add automatic calculation | ||
compute="_compute_destination_location_id", | ||
store=True, | ||
readonly=False, | ||
) | ||
|
||
l10n_pt_license_plate = fields.Char( | ||
string="License Plate", | ||
compute="_compute_l10n_pt_license_plate", | ||
store=True, | ||
readonly=False, | ||
) | ||
|
||
def _create_picking(self): | ||
# Extend to set License Plate | ||
picking = super()._create_picking() | ||
picking.write({"l10n_pt_license_plate": self.l10n_pt_license_plate}) | ||
return picking | ||
26 changes: 26 additions & 0 deletions
26
l10n_pt_stock_vehicle_daily/wizard/stock_move_location_views.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo> | ||
|
||
<record id="view_wiz_stock_move_location_form_ext" model="ir.ui.view"> | ||
<field name="model">wiz.stock.move.location</field> | ||
<field | ||
name="inherit_id" | ||
ref="stock_move_location.view_wiz_stock_move_location_form_stock_move_location" | ||
/> | ||
<field name="arch" type="xml"> | ||
|
||
<group name="main" position="inside"> | ||
<field name="l10n_pt_license_plate" /> | ||
</group> | ||
<!-- | ||
Opionated: Picking Type is not editable | ||
to avoid user change it by mistake | ||
--> | ||
<field name="picking_type_id" position="attributes"> | ||
<attribute name="readonly">True</attribute> | ||
</field> | ||
|
||
</field> | ||
</record> | ||
|
||
</odoo> |
1 change: 1 addition & 0 deletions
1
setup/l10n_pt_stock_vehicle_daily/odoo/addons/l10n_pt_stock_vehicle_daily
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../l10n_pt_stock_vehicle_daily |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |