diff --git a/mrp_bom_version/README.rst b/mrp_bom_version/README.rst index f501525d1..4fd4702b4 100644 --- a/mrp_bom_version/README.rst +++ b/mrp_bom_version/README.rst @@ -6,7 +6,13 @@ MRP - BoM Version ================= This module provides a state in the BoM whether to allow their use in -manufacturing, to do the following states are defined: +manufacturing. + + +Usage +===== + +The following states are defined: * **Draft**: The form will be available for data entry, and may move to "active" state. @@ -31,9 +37,6 @@ to be unique. changing state to draft -Usage -===== - .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot :target: https://runbot.odoo-community.org/runbot/129/8.0 diff --git a/mrp_bom_version/models/mrp_bom.py b/mrp_bom_version/models/mrp_bom.py index a8161e590..aa9627825 100644 --- a/mrp_bom_version/models/mrp_bom.py +++ b/mrp_bom_version/models/mrp_bom.py @@ -78,10 +78,11 @@ class MrpBom(models.Model): @api.multi def button_draft(self): - self.ensure_one() - self.active = (self.company_id.active_draft if self.company_id else - self.env.user.company_id.active_draft) - self.state = 'draft' + self.write({ + 'active': (self.company_id.active_draft if self.company_id else + self.env.user.company_id.active_draft), + 'state': 'draft', + }) @api.multi def button_new_version(self): @@ -108,7 +109,6 @@ class MrpBom(models.Model): @api.multi def button_activate(self): - self.ensure_one() self.write({ 'active': True, 'state': 'active' @@ -116,7 +116,6 @@ class MrpBom(models.Model): @api.multi def button_historical(self): - self.ensure_one() self.write({ 'active': False, 'state': 'historical',