[FIX] stock, mrp: don't allow to unlock when state 'cancel'
When a picking or a manufacturing order is in state cancel, we shouldn't be able to modify it as we didn't move anything and it won't have any impact on stock
This commit is contained in:
committed by
Pierre Masereel
parent
74493be97f
commit
2cf234df6d
@@ -526,7 +526,7 @@ class MrpProduction(models.Model):
|
||||
raw_moves = production.move_raw_ids.filtered(lambda x: x.state not in ('done', 'cancel'))
|
||||
(finish_moves | raw_moves)._action_cancel()
|
||||
|
||||
self.write({'state': 'cancel'})
|
||||
self.write({'state': 'cancel', 'is_locked': True})
|
||||
return True
|
||||
|
||||
def _cal_price(self, consumed_moves):
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
<button name="button_unreserve" type="object" string="Unreserve" attrs="{'invisible': [('unreserve_visible', '=', False)]}"/>
|
||||
<span class="label label-danger" attrs="{'invisible': ['|',('availability', 'in', ('assigned', 'none')), ('state', 'not in', ('confirmed','progress'))]}">Raw materials not available!</span>
|
||||
<field name="state" widget="statusbar" statusbar_visible="confirmed,progress,done"/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('id', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="If the manufacturing order is unlocked you can add to the initial demand."/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', '|', ('state', '=', 'cancel'), ('id', '=', False), ('is_locked', '=', False)]}" string="Unlock" groups="mrp.group_mrp_manager" type="object" help="If the manufacturing order is unlocked you can add to the initial demand."/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': [('is_locked', '=', True)]}" string="Lock" class="oe_highlight" groups="mrp.group_mrp_manager" type="object"/>
|
||||
</header>
|
||||
<sheet>
|
||||
|
||||
@@ -539,6 +539,7 @@ class Picking(models.Model):
|
||||
@api.multi
|
||||
def action_cancel(self):
|
||||
self.mapped('move_lines')._action_cancel()
|
||||
self.is_locked = True
|
||||
return True
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -217,7 +217,7 @@
|
||||
<field name="move_line_exist" invisible="1"/>
|
||||
<field name="has_packages" invisible="1"/>
|
||||
<button name="button_scrap" type="object" string="Scrap" attrs="{'invisible': ['|', '|', '&', ('picking_type_code', '!=', 'incoming'), ('state', 'in', ('draft', 'cancel', 'waiting')), '&', ('picking_type_code', '=', 'incoming'), ('state', '!=', 'done'), ('is_locked', '=', False)]}"/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('state', '=', 'draft'), ('is_locked', '=', False)]}" string="Unlock" groups="stock.group_stock_manager" type="object" help="If the picking is unlocked you can edit initial demand (for a draft picking) or done quantities (for a done picking)."/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': ['|', ('state', 'in', ('draft','cancel')), ('is_locked', '=', False)]}" string="Unlock" groups="stock.group_stock_manager" type="object" help="If the picking is unlocked you can edit initial demand (for a draft picking) or done quantities (for a done picking)."/>
|
||||
<button name="action_toggle_is_locked" attrs="{'invisible': [('is_locked', '=', True)]}" string="Lock" class="oe_highlight" groups="stock.group_stock_manager" type="object"/>
|
||||
<field name="state" widget="statusbar" statusbar_visible="draft,confirmed,partially_available,assigned,done" />
|
||||
<field name="picking_type_entire_packs" invisible="1"/>
|
||||
|
||||
Reference in New Issue
Block a user