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 Oct 3, 2022
1 parent 6453753 commit efb2e1d
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 7 deletions.
6 changes: 6 additions & 0 deletions setup/stock_receipt_lot_info/setup.py
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,
)
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])
9 changes: 7 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,19 @@
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
2 changes: 1 addition & 1 deletion stock_receipt_lot_info/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ By default, you can only provide a lot/serial number name
when receiving products tracked by lot/serial numbers, with this module you can also
provide the following information of the lot:

* Lot/Serial End of Life Date.
* Lot/Serial Expiration Date.
* Lot/Serial Best before Date.
* Lot/Serial Removal Date.
* Lot/Serial Alert Date.
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 efb2e1d

Please sign in to comment.