Skip to content

Commit

Permalink
[15.0][MIG] stock_receipt_lot_info
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisRForgeFlow committed Mar 23, 2022
1 parent 31e5995 commit 026e062
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
4 changes: 2 additions & 2 deletions stock_receipt_lot_info/__manifest__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Copyright 2021 ForgeFlow, S.L.
# Copyright 2021-22 ForgeFlow, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).

{
"name": "Stock Receipt Lot Info",
"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",
Expand Down
18 changes: 18 additions & 0 deletions stock_receipt_lot_info/migrations/15.0.1.0.0/pre-migration.py
Original file line number Diff line number Diff line change
@@ -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])
4 changes: 2 additions & 2 deletions stock_receipt_lot_info/model/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions stock_receipt_lot_info/views/stock_move_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<field name="arch" type="xml">
<field name="lot_name" position="after">
<field
name="lot_life_date"
name="lot_expiration_date"
groups="stock.group_production_lot"
optional="hide"
attrs="{'readonly': [('package_level_id', '!=', False), ('parent.picking_type_entire_packs', '=', True)]}"
Expand Down Expand Up @@ -53,7 +53,7 @@
<field name="arch" type="xml">
<field name="lot_name" position="after">
<field
name="lot_life_date"
name="lot_expiration_date"
optional="hide"
groups="stock.group_production_lot"
attrs="{'column_invisible': [('parent.show_lots_text', '=', False)], 'invisible': [('lots_visible', '=', False)]}"
Expand Down

0 comments on commit 026e062

Please sign in to comment.