mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
[IMP] <mrp_bom_version> If BoM exist it is active so state must be 'active'
This commit is contained in:
@@ -2,4 +2,15 @@
|
||||
##############################################################################
|
||||
# For copyright and license notices, see __openerp__.py file in root directory
|
||||
##############################################################################
|
||||
|
||||
from . import models
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
|
||||
def set_bom_inactive(cr, registry):
|
||||
"""Set all draft or historical state BoMs inactive."""
|
||||
mrp_bom_obj = registry['mrp.bom']
|
||||
mrp_bom_ids = mrp_bom_obj.search(cr, SUPERUSER_ID,
|
||||
[('active', '=', True)])
|
||||
for mrp_bom in mrp_bom_obj.browse(cr, SUPERUSER_ID, mrp_bom_ids):
|
||||
mrp_bom_obj.write(cr, SUPERUSER_ID, mrp_bom.id, {'state': 'active'})
|
||||
|
||||
@@ -41,5 +41,6 @@
|
||||
"views/res_config_view.xml",
|
||||
"views/mrp_bom_view.xml",
|
||||
],
|
||||
"installable": True
|
||||
"installable": True,
|
||||
"post_init_hook": "set_bom_inactive",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user