diff --git a/stock_receipt_lot_info/__manifest__.py b/stock_receipt_lot_info/__manifest__.py index 968973b05320..015c4ea751c7 100644 --- a/stock_receipt_lot_info/__manifest__.py +++ b/stock_receipt_lot_info/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2021 ForgeFlow, S.L. +# Copyright 2021-22 ForgeFlow, S.L. # License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). { @@ -6,7 +6,7 @@ "summary": "Be able to introduce more info on lot/serial " "number while processing a receipt.", "author": "ForgeFlow, Odoo Community Association (OCA)", - "version": "13.0.1.0.0", + "version": "15.0.1.0.0", "category": "Warehouse Management", "website": "https://github.com/OCA/stock-logistics-workflow", "license": "LGPL-3", diff --git a/stock_receipt_lot_info/migrations/15.0.1.0.0/pre-migration.py b/stock_receipt_lot_info/migrations/15.0.1.0.0/pre-migration.py new file mode 100644 index 000000000000..ed76bfd8eed2 --- /dev/null +++ b/stock_receipt_lot_info/migrations/15.0.1.0.0/pre-migration.py @@ -0,0 +1,18 @@ +# Copyright 2022 ForgeFlow, S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openupgradelib import openupgrade # pylint: disable=W7936 + +_field_renames = [ + ("stock.move.line", "stock_move_line", "lot_life_date", "lot_expiration_date"), +] + + +@openupgrade.migrate() +def migrate(env, version): + cr = env.cr + for field in _field_renames: + if openupgrade.table_exists(cr, field[1]) and openupgrade.column_exists( + cr, field[1], field[2] + ): + openupgrade.rename_fields(env, [field]) diff --git a/stock_receipt_lot_info/model/stock_move_line.py b/stock_receipt_lot_info/model/stock_move_line.py index 96b7a1246888..5d3a641e783f 100644 --- a/stock_receipt_lot_info/model/stock_move_line.py +++ b/stock_receipt_lot_info/model/stock_move_line.py @@ -7,14 +7,14 @@ class StockMoveLine(models.Model): _inherit = "stock.move.line" - lot_life_date = fields.Datetime(string="Lot/Serial End of Life Date") + lot_expiration_date = fields.Datetime(string="Lot/Serial Expiration Date") lot_use_date = fields.Datetime(string="Lot/Serial Best before Date") lot_removal_date = fields.Datetime(string="Lot/Serial Removal Date") lot_alert_date = fields.Datetime(string="Lot/Serial Alert Date") def _prepare_new_lot_vals(self): vals = super()._prepare_new_lot_vals() - creation_lot_fields = ["life_date", "use_date", "removal_date", "alert_date"] + creation_lot_fields = ["expiration_date", "use_date", "removal_date", "alert_date"] for field in creation_lot_fields: value = getattr(self, "lot_" + field) if value: diff --git a/stock_receipt_lot_info/views/stock_move_line_views.xml b/stock_receipt_lot_info/views/stock_move_line_views.xml index abda3b03aac2..2ff7e0857754 100644 --- a/stock_receipt_lot_info/views/stock_move_line_views.xml +++ b/stock_receipt_lot_info/views/stock_move_line_views.xml @@ -11,7 +11,7 @@