Skip to content

Commit 115829f

Browse files
committed
[MIG] l10n_pt_stock_vehicle_daily: Migration from 14.0 to 19.0
1 parent 3201686 commit 115829f

File tree

9 files changed

+54
-21
lines changed

9 files changed

+54
-21
lines changed

l10n_pt_stock_vehicle_daily/__manifest__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
"to communicate to Portuguese Tax Authorities",
77
"website": "https://github.com/OCA/l10n-portugal",
88
"license": "AGPL-3",
9-
"author": "Luz de Airbag, Open Source Integrators, Odoo Community Association (OCA)",
9+
"author": (
10+
"Luz de Airbag,Open Source Integrators,Odoo Community Association (OCA)"
11+
),
1012
"category": "Warehouse",
11-
"version": "14.0.1.1.0",
13+
"version": "19.0.1.0.0",
1214
"depends": [
1315
"stock_move_location", # from OCA/stock-logistics-warehouse
1416
],

l10n_pt_stock_vehicle_daily/i18n/l10n_pt_stock_vehicle_daily.pot

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ msgid "Last Modified on"
4848
msgstr ""
4949

5050
#. module: l10n_pt_stock_vehicle_daily
51-
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_stock_location__l10n_pt_license_plate
52-
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_stock_picking__l10n_pt_license_plate
53-
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_wiz_stock_move_location__l10n_pt_license_plate
51+
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_stock_location__license_plate
52+
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_stock_picking__license_plate
53+
#: model:ir.model.fields,field_description:l10n_pt_stock_vehicle_daily.field_wiz_stock_move_location__license_plate
5454
msgid "License Plate"
5555
msgstr ""
5656

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Copyright 2024 Open Source Integrators
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from openupgradelib import openupgrade
5+
6+
7+
@openupgrade.migrate()
8+
def migrate(env, version):
9+
"""Rename l10n_pt_license_plate to license_plate."""
10+
# Rename field in stock.location
11+
openupgrade.rename_fields(
12+
env,
13+
[
14+
(
15+
"stock.location",
16+
"stock_location",
17+
"l10n_pt_license_plate",
18+
"license_plate",
19+
),
20+
],
21+
)
22+
# Rename field in stock.picking
23+
openupgrade.rename_fields(
24+
env,
25+
[
26+
(
27+
"stock.picking",
28+
"stock_picking",
29+
"l10n_pt_license_plate",
30+
"license_plate",
31+
),
32+
],
33+
)

l10n_pt_stock_vehicle_daily/models/stock_location.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77
class StockLocation(models.Model):
88
_inherit = "stock.location"
99

10-
l10n_pt_license_plate = fields.Char("License Plate")
10+
license_plate = fields.Char()

l10n_pt_stock_vehicle_daily/models/stock_picking.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,13 @@
88
class StockPicking(models.Model):
99
_inherit = "stock.picking"
1010

11-
l10n_pt_license_plate = fields.Char(
12-
string="License Plate",
13-
compute="_compute_l10n_pt_license_plate",
11+
license_plate = fields.Char(
12+
compute="_compute_license_plate",
1413
store=True,
1514
readonly=False,
1615
)
1716

1817
@api.depends("location_id")
19-
def _compute_l10n_pt_license_plate(self):
18+
def _compute_license_plate(self):
2019
for picking in self:
21-
picking.l10n_pt_license_plate = picking.location_id.l10n_pt_license_plate
20+
picking.license_plate = picking.location_id.license_plate

l10n_pt_stock_vehicle_daily/views/stock_location_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<field name="inherit_id" ref="stock.view_location_form" />
66
<field name="arch" type="xml">
77
<group name="additional_info" position="inside">
8-
<field name="l10n_pt_license_plate" />
8+
<field name="license_plate" />
99
</group>
1010
</field>
1111
</record>

l10n_pt_stock_vehicle_daily/views/stock_picking_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<field name="inherit_id" ref="stock.view_picking_form" />
66
<field name="arch" type="xml">
77
<group name="other_infos" position="inside">
8-
<field name="l10n_pt_license_plate" />
8+
<field name="license_plate" />
99
</group>
1010
</field>
1111
</record>

l10n_pt_stock_vehicle_daily/wizard/stock_move_location.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ def _compute_destination_location_id(self):
1313
# Copy the Origin Location to the Destination Location
1414
# If it is an Internal move and the Location has is a vehicle/has a Plate
1515
type_is_internal = wiz.picking_type_id.code == "internal"
16-
location_has_plate = bool(wiz.origin_location_id.l10n_pt_license_plate)
16+
location_has_plate = bool(wiz.origin_location_id.license_plate)
1717
if type_is_internal and location_has_plate:
1818
wiz.destination_location_id = wiz.origin_location_id
1919

2020
@api.depends("origin_location_id")
21-
def _compute_l10n_pt_license_plate(self):
21+
def _compute_license_plate(self):
2222
for wiz in self:
2323
# Set the Default License Plate configured in the Location
24-
wiz.l10n_pt_license_plate = wiz.origin_location_id.l10n_pt_license_plate
24+
wiz.license_plate = wiz.origin_location_id.license_plate
2525

2626
destination_location_id = fields.Many2one(
2727
# extend to add automatic calculation
@@ -30,15 +30,14 @@ def _compute_l10n_pt_license_plate(self):
3030
readonly=False,
3131
)
3232

33-
l10n_pt_license_plate = fields.Char(
34-
string="License Plate",
35-
compute="_compute_l10n_pt_license_plate",
33+
license_plate = fields.Char(
34+
compute="_compute_license_plate",
3635
store=True,
3736
readonly=False,
3837
)
3938

4039
def _create_picking(self):
4140
# Extend to set License Plate
4241
picking = super()._create_picking()
43-
picking.write({"l10n_pt_license_plate": self.l10n_pt_license_plate})
42+
picking.write({"license_plate": self.license_plate})
4443
return picking

l10n_pt_stock_vehicle_daily/wizard/stock_move_location_views.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
/>
99
<field name="arch" type="xml">
1010
<group name="main" position="inside">
11-
<field name="l10n_pt_license_plate" />
11+
<field name="license_plate" />
1212
</group>
1313
<!--
1414
Opionated: Picking Type is not editable

0 commit comments

Comments
 (0)