[IMP] mrp_bom_version: use new api correctly

This commit is contained in:
oihane
2015-10-05 13:54:50 +02:00
committed by Kay K. Cross
parent 94becb864f
commit 327e3c7bf6
2 changed files with 12 additions and 10 deletions

View File

@@ -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

View File

@@ -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',