From 644663eb4a356b06f4a135bfaf60bce98aa7ee63 Mon Sep 17 00:00:00 2001 From: William Henrotin Date: Wed, 16 Oct 2019 06:50:46 +0000 Subject: [PATCH] [FIX] mrp: rework of workorder planning This commit redo the way workorders are planned on their workcenter calendar. The resource_calendar_leaves introduced in 0679d0d is now linked to the effetives dates (date_start and date_finished). The planned dates copy their information onto effective date at the workorder plannification or any modification before the actual production (state = draft, pending or ready) This way, the gantt view and calendar view display either the plannifaction slot if the production isn't started yet and the effective production time if it's done. The plannification is also impacted by validating a production sooner than expected or cancelling it. In the first case, the date_finished is set at 'now' and in the second case, all the dates are emptied. The futur workorders will be planned on the newly recover time slot. This commit also fix the button_start() method that always rewrite the date_start even if the production had already been started. Task : 2082442 closes odoo/odoo#34038 Signed-off-by: Arnold Moyaux --- addons/mrp/models/mrp_abstract_workorder.py | 2 +- addons/mrp/wizard/mrp_product_produce_views.xml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/mrp/models/mrp_abstract_workorder.py b/addons/mrp/models/mrp_abstract_workorder.py index 910538cf57876..07fb61a433658 100644 --- a/addons/mrp/models/mrp_abstract_workorder.py +++ b/addons/mrp/models/mrp_abstract_workorder.py @@ -324,7 +324,7 @@ class MrpAbstractWorkorderLine(models.AbstractModel): lot_id = fields.Many2one( 'stock.production.lot', 'Lot/Serial Number', check_company=True, - domain="[('product_id', '=', product_id), '|', ('company_id', '=', False), ('company_id', '=', company_id)]") + domain="[('product_id', '=', product_id), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]") qty_to_consume = fields.Float('To Consume', digits='Product Unit of Measure') product_uom_id = fields.Many2one('uom.uom', string='Unit of Measure') qty_done = fields.Float('Consumed', digits='Product Unit of Measure') diff --git a/addons/mrp/wizard/mrp_product_produce_views.xml b/addons/mrp/wizard/mrp_product_produce_views.xml index 58c63e6652045..e87bd3235f7df 100644 --- a/addons/mrp/wizard/mrp_product_produce_views.xml +++ b/addons/mrp/wizard/mrp_product_produce_views.xml @@ -31,7 +31,7 @@ - + @@ -47,7 +47,7 @@ - +