Skip to content

Commit

Permalink
[MIG]stock_picking_info_lot: Migration to 17.0
Browse files Browse the repository at this point in the history
  • Loading branch information
aravindh8838 committed Sep 24, 2024
1 parent b6326bb commit b80cbaa
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion stock_picking_info_lot/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "AGPL-3",
"author": "S.P.O.C., Odoo Community Association (OCA)",
"category": "Warehouse",
"version": "16.0.1.0.0",
"version": "17.0.1.0.0",
"application": False,
"installable": True,
"depends": ["stock"],
Expand Down
9 changes: 7 additions & 2 deletions stock_picking_info_lot/models/stock_picking.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ def _check_required_lot_info(self):
lambda x: x.lot_info_usage == "required" and not x.lot_info
)
if lines_missing_lotinfo:
product_names = ", ".join(
lines_missing_lotinfo.mapped("product_id.display_name")
)
raise exceptions.UserError(
_("Missing Lot Info for Products %s.")
% ", ".join(lines_missing_lotinfo.product_id.mapped("display_name"))
_(
"Missing Lot Info for Products: %(product_names)s.",
product_names=product_names,
)
)

def button_validate(self):
Expand Down
2 changes: 1 addition & 1 deletion stock_picking_info_lot/tests/test_picking_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def _create_move(self, product, src, dest, quantity=5.0, picking=None):
"picking_id": picking.id if picking is not None else None,
"product_id": product.id,
"product_uom_qty": quantity,
"quantity_done": quantity,
"quantity": quantity,
"product_uom": product.uom_id.id,
"location_id": src.id,
"location_dest_id": dest.id,
Expand Down
5 changes: 1 addition & 4 deletions stock_picking_info_lot/views/product_template_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
<field name="inherit_id" ref="stock.view_template_property_form" />
<field name="arch" type="xml">
<group name="traceability" position="after">
<group
name="lot_info_group"
attrs="{'invisible': [('type', '=', 'service')]}"
>
<group name="lot_info_group" invisible="type == 'service'">
<field name="lot_info_usage" widget="radio" />
</group>
</group>
Expand Down
16 changes: 6 additions & 10 deletions stock_picking_info_lot/views/stock_move_line_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,11 @@
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" />
<field name="arch" type="xml">
<xpath expr="//field[@name='lot_name']" position="after">
<field name="lot_info_usage" invisible="1" />
<field name="lot_info_usage" column_invisible="True" />
<field
name="lot_info"
attrs="{
'readonly': [('lot_info_usage', '=', 'no')],
'required': [('lot_info_usage', '=', 'required')],
}"
readonly="lot_info_usage == 'no'"
required="lot_info_usage =='required'"
/>
</xpath>
</field>
Expand All @@ -60,13 +58,11 @@
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='lot_name']" position="after">
<field name="lot_info_usage" invisible="1" />
<field name="lot_info_usage" column_invisible="True" />
<field
name="lot_info"
attrs="{
'readonly': [('lot_info_usage', '=', 'no')],
'required': [('lot_info_usage', '=', 'required')],
}"
readonly="lot_info_usage == 'no'"
required="lot_info_usage == 'required'"
/>
</xpath>
</field>
Expand Down

0 comments on commit b80cbaa

Please sign in to comment.