[FIX] mrp: show 'check_availability' button after reservation
Due to the setting `ready_to_produce` = `asap` on Bill of Material. The Check Availability button could be hidden even if some stock moves are still in confirmed state. Task : 2121714 closes odoo/odoo#41631 Related: odoo/enterprise#7253 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -184,8 +184,11 @@ class MrpProduction(models.Model):
|
||||
string="Stock Movements of Produced Goods")
|
||||
|
||||
unreserve_visible = fields.Boolean(
|
||||
'Allowed to Unreserve Inventory', compute='_compute_unreserve_visible',
|
||||
'Allowed to Unreserve Production', compute='_compute_unreserve_visible',
|
||||
help='Technical field to check when we can unreserve')
|
||||
reserve_visible = fields.Boolean(
|
||||
'Allowed to Reserve Production', compute='_compute_unreserve_visible',
|
||||
help='Technical field to check when we can reserve quantities')
|
||||
post_visible = fields.Boolean(
|
||||
'Allowed to Post Inventory', compute='_compute_post_visible',
|
||||
help='Technical field to check when we can post')
|
||||
@@ -421,6 +424,7 @@ class MrpProduction(models.Model):
|
||||
already_reserved = order.is_locked and order.state not in ('done', 'cancel') and order.mapped('move_raw_ids.move_line_ids')
|
||||
any_quantity_done = any([m.quantity_done > 0 for m in order.move_raw_ids])
|
||||
order.unreserve_visible = not any_quantity_done and already_reserved
|
||||
order.reserve_visible = order.state in ('confirmed', 'planned') and any(move.state == 'confirmed' for move in order.move_raw_ids)
|
||||
|
||||
@api.depends('move_finished_ids.quantity_done', 'move_finished_ids.state', 'is_locked')
|
||||
def _compute_post_visible(self):
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
<field name="confirm_cancel" invisible="1"/>
|
||||
<button name="button_mark_done" attrs="{'invisible': [('state', '!=', 'to_close')]}" string="Mark as Done" type="object" class="oe_highlight"/>
|
||||
<button name="action_confirm" attrs="{'invisible': ['|', ('state', '!=', 'draft'), ('is_locked', '=', False)]}" string="Mark as Todo" type="object" class="oe_highlight"/>
|
||||
<button name="action_assign" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('draft', 'done', 'cancel')), ('reservation_state', '=', 'assigned')]}" string="Check availability" type="object" class="oe_highlight"/>
|
||||
<button name="action_assign" attrs="{'invisible': ['|', '|', ('is_locked', '=', False), ('state', 'in', ('draft', 'done', 'cancel')), ('reserve_visible', '=', False)]}" string="Check availability" type="object" class="oe_highlight"/>
|
||||
<button name="button_plan" attrs="{'invisible': ['|', ('state', '!=', 'confirmed'), ('routing_id', '=', False)]}" type="object" string="Plan" class="oe_highlight"/>
|
||||
<button name="button_unplan" type="object" string="Unplan" attrs="{'invisible': ['|', '|', ('state', '!=', 'planned'), ('date_planned_start', '=', False), ('date_planned_finished', '=', False)]}"/>
|
||||
<button name="open_produce_product" attrs="{'invisible': ['|', '|', '|', ('state', '=', 'to_close'), ('is_locked', '=', False), ('reservation_state', '!=', 'assigned'), ('routing_id', '!=', False)]}" string="Produce" type="object" class="oe_highlight"/>
|
||||
@@ -73,6 +73,7 @@
|
||||
<field name="is_locked" invisible="1"/>
|
||||
<field name="post_visible" invisible="1"/>
|
||||
<field name="unreserve_visible" invisible="1"/>
|
||||
<field name="reserve_visible" invisible="1"/>
|
||||
<field name="consumption" invisible="1"/>
|
||||
<div class="oe_button_box" name="button_box">
|
||||
<button name="%(stock.action_stock_report)d" icon="fa-arrow-up" class="oe_stat_button" string="Traceability" type="action" states="done" groups="stock.group_production_lot"/>
|
||||
|
||||
Reference in New Issue
Block a user