summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorWilliam Henrotin <whe@odoo.com>2019-10-16 06:50:46 +0000
committerWilliam Henrotin <whe@odoo.com>2019-10-16 07:34:15 +0000
commit644663eb4a356b06f4a135bfaf60bce98aa7ee63 (patch)
tree9f3dcde80d71b8123f0139ce06c3e6cedd025149 /addons
parente8a3fb9a0b37a43dc40db3d038b62019135ea1f1 (diff)
[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 <amoyaux@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/mrp/models/mrp_abstract_workorder.py2
-rw-r--r--addons/mrp/wizard/mrp_product_produce_views.xml4
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 910538cf578..07fb61a4336 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 58c63e66520..e87bd3235f7 100644
--- a/addons/mrp/wizard/mrp_product_produce_views.xml
+++ b/addons/mrp/wizard/mrp_product_produce_views.xml
@@ -31,7 +31,7 @@
<field name="raw_workorder_line_ids" attrs="{'invisible': [('raw_workorder_line_ids', '=', [])]}" nolabel="1" context="{'w_production': True, 'active_id': production_id, 'default_finished_lot_id': finished_lot_id}">
<tree editable="bottom" delete="0" decoration-danger="(qty_to_consume &lt; qty_done)">
<field name="company_id" invisible="1"/>
- <field name="product_id" attrs="{'readonly': [('move_id', '!=', False)]}" required="1" domain="[('id', '!=', parent.product_id), ('type', 'in', ['product', 'consu']), '|', ('company_id', '=', False), ('company_id', '=', company_id)]" force_save="1"/>
+ <field name="product_id" attrs="{'readonly': [('move_id', '!=', False)]}" required="1" domain="[('id', '!=', parent.product_id), ('type', 'in', ['product', 'consu']), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" force_save="1"/>
<field name="product_tracking" invisible="1"/>
<field name="lot_id" attrs="{'readonly': [('product_tracking', '=', 'none')]}" context="{'default_product_id': product_id, 'active_mo_id': parent.production_id, 'default_company_id': company_id}" groups="stock.group_production_lot"/>
<field name="qty_to_consume" readonly="1" force_save="1"/>
@@ -47,7 +47,7 @@
<field name="finished_workorder_line_ids" attrs="{'invisible': [('finished_workorder_line_ids', '=', [])]}" nolabel="1" context="{'w_production': True, 'active_id': production_id, 'default_finished_lot_id': finished_lot_id}">
<tree editable="bottom" delete="0" decoration-danger="(qty_to_consume &lt; qty_done)">
<field name="company_id" invisible="1"/>
- <field name="product_id" attrs="{'readonly': [('move_id', '!=', False)]}" required="1" domain="[('id', '!=', parent.product_id), ('type', 'in', ['product', 'consu']), '|', ('company_id', '=', False), ('company_id', '=', company_id)]" force_save="1"/>
+ <field name="product_id" attrs="{'readonly': [('move_id', '!=', False)]}" required="1" domain="[('id', '!=', parent.product_id), ('type', 'in', ['product', 'consu']), '|', ('company_id', '=', False), ('company_id', '=', parent.company_id)]" force_save="1"/>
<field name="product_tracking" invisible="1"/>
<field name="lot_id" attrs="{'readonly': [('product_tracking', '=', 'none')]}" context="{'default_product_id': product_id}" groups="stock.group_production_lot"/>
<field name="qty_to_consume" string="To Produce" readonly="1" force_save="1"/>