[IMP] mrp: done unbuild order locked

This commit doesn't allow to cancel an unbuild order if the state is
'done'

PR:22085
TASK:38933
This commit is contained in:
William Henrotin
2018-07-26 15:22:33 +02:00
committed by Simon Lejeune
parent 996c881ce3
commit 4a9e392376
+7
View File
@@ -82,6 +82,13 @@ class MrpUnbuild(models.Model):
vals['name'] = self.env['ir.sequence'].next_by_code('mrp.unbuild') or _('New')
return super(MrpUnbuild, self).create(vals)
@api.multi
def unlink(self):
if 'done' in self.mapped('state'):
raise UserError(_('You cannot delete an unbuild order if the state'
'is "Done"'))
return super(MrpUnbuild, self).unlink()
@api.multi
def action_unbuild(self):
self.ensure_one()