[FIX] stock: prevent creating lot based on picking type

Since 4da8c6ebca, the lot creation when filling a stock move line is
done via the stock quant "pick from" field. We thus don't have the
'active_picking_id' key that was set on lot_id field to check if the
user can create or not new stock lot for a particular picking.

This commit add this context key back on the stock move line one2many
for it to be available at the stock quant creation.

closes odoo/odoo#152915

Task: 3670447
X-original-commit: ce4f6f668cf8308b4b9af14ffc74f0df6428a771
Signed-off-by: Steve Van Essche <svs@odoo.com>
Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
William Henrotin
2024-02-16 13:51:53 +00:00
parent fc8452600f
commit 022a8435de
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -179,7 +179,7 @@
</div>
<field name="move_line_ids"
readonly="state == 'cancel' or (state == 'done' and is_locked) or not product_id"
context="{'tree_view_ref': 'stock.view_stock_move_line_operation_tree', 'form_view_ref': 'stock.view_move_line_mobile_form', 'default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_company_id': company_id}"
context="{'tree_view_ref': 'stock.view_stock_move_line_operation_tree', 'form_view_ref': 'stock.view_move_line_mobile_form', 'default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id, 'default_company_id': company_id, 'active_picking_id': picking_id}"
widget="sml_x2_many"/>
</form>
</field>
+1 -1
View File
@@ -395,7 +395,7 @@ in this location. That leads to a negative stock.
<field name="product_id" force_save="1" invisible="1"/>
<field name="lot_id" domain="[('product_id', '=', product_id)]"
groups="stock.group_production_lot" readonly="context.get('readonly_form')"
context="{'default_product_id': product_id, 'default_company_id': company_id}"/>
context="{'default_product_id': product_id, 'default_company_id': company_id, 'active_picking_id': context.get('active_picking_id')}"/>
<field name="location_id" groups="stock.group_stock_multi_locations" readonly="context.get('readonly_form')"/>
<field name="package_id" groups="stock.group_tracking_lot" invisible="context.get('readonly_form')"/>
<field name="owner_id" groups="stock.group_tracking_owner" invisible="context.get('readonly_form')"/>