[FIX] mrp: transfers are created from manual moves in MO
When manfacture in 2 steps is setup on warehouse, transfers are created when confirming an MO, manual moves added did not have a warehouse and thus not included in the picking. The default warehouse is set to the source location warehouse in MO. closes odoo/odoo#91879 Related: odoo/enterprise#27577 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -89,6 +89,8 @@ class MrpProduction(models.Model):
|
||||
readonly=False, required=True, precompute=True,
|
||||
domain="[('usage','=','internal'), '|', ('company_id', '=', False), ('company_id', '=', company_id)]",
|
||||
help="Location where the system will look for components.")
|
||||
# this field was added to be passed a default in view for manual raw moves
|
||||
warehouse_id = fields.Many2one(related='location_src_id.warehouse_id')
|
||||
location_dest_id = fields.Many2one(
|
||||
'stock.location', 'Finished Products Location',
|
||||
compute='_compute_locations', store=True, check_company=True,
|
||||
|
||||
@@ -274,7 +274,8 @@
|
||||
<notebook>
|
||||
<page string="Components" name="components">
|
||||
<field name="move_raw_ids"
|
||||
context="{'default_date': date_planned_start, 'default_date_deadline': date_planned_start, 'default_location_id': location_src_id, 'default_location_dest_id': production_location_id, 'default_state': 'draft', 'default_raw_material_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id}"
|
||||
context="{'default_date': date_planned_start, 'default_date_deadline': date_planned_start, 'default_location_id': location_src_id, 'default_location_dest_id': production_location_id,
|
||||
'default_warehouse_id': warehouse_id, 'default_state': 'draft', 'default_raw_material_production_id': id, 'default_picking_type_id': picking_type_id, 'default_company_id': company_id}"
|
||||
attrs="{'readonly': ['|', ('state', '=', 'cancel'), '&', ('state', '=', 'done'), ('is_locked', '=', True)]}" options="{'delete': [('state', '=', 'draft')]}">
|
||||
<tree default_order="is_done, manual_consumption desc, sequence" editable="bottom">
|
||||
<field name="product_id" force_save="1" required="1" context="{'default_detailed_type': 'product'}" attrs="{'readonly': ['|', '|', ('move_lines_count', '>', 0), ('state', '=', 'cancel'), '&', ('state', '!=', 'draft'), ('additional', '=', False) ]}"/>
|
||||
@@ -385,6 +386,7 @@
|
||||
<group>
|
||||
<field name="picking_type_id" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="location_src_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
<field name="warehouse_id" invisible="1"/>
|
||||
<field name="location_dest_id" groups="stock.group_stock_multi_locations" options="{'no_create': True}" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
|
||||
Reference in New Issue
Block a user