Skip to content

Commit

Permalink
[FIX] mrp: rework of workorder planning
Browse files Browse the repository at this point in the history
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 #34038

Signed-off-by: Arnold Moyaux <amoyaux@users.noreply.github.com>
  • Loading branch information
Whenrow committed Oct 16, 2019
1 parent e8a3fb9 commit 644663e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addons/mrp/models/mrp_abstract_workorder.py
Expand Up @@ -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')
Expand Down
4 changes: 2 additions & 2 deletions addons/mrp/wizard/mrp_product_produce_views.xml
Expand Up @@ -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"/>
Expand All @@ -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"/>
Expand Down

0 comments on commit 644663e

Please sign in to comment.