bemade-addons/mo_back_to_draft/models/mrp_production.py

17 lines
439 B
Python
Raw Normal View History

2024-06-11 14:55:22 -04:00
from odoo import models, fields, _
from odoo.exceptions import UserError
class MrpProduction(models.Model):
_inherit = "mrp.production"
def action_back_to_draft(self):
self.ensure_one()
if self.state != 'cancel':
raise UserError(_(
2024-06-11 19:03:39 -04:00
'Only manufacturing orders in canceled'
2024-06-11 14:55:22 -04:00
'state can be set back to draft.'
))
self.state = False
return True