[ADD] Set default for do_production upon installation

This commit is contained in:
Stefan Rijnhart
2015-10-21 11:11:42 +02:00
committed by Pedro M. Baeza
parent 70cac50132
commit 44dd40d579
2 changed files with 14 additions and 0 deletions

View File

@@ -4,3 +4,16 @@
##############################################################################
from . import models
from . import wizard
def post_init_hook(cr, pool):
""" Set do_production on the last workcenter line of each routing """
cr.execute(
"""
UPDATE mrp_routing_workcenter SET do_production = TRUE
WHERE id IN (
SELECT (
SELECT id FROM mrp_routing_workcenter WHERE routing_id = mr.id
ORDER BY sequence DESC, id DESC LIMIT 1)
FROM mrp_routing mr);
""")

View File

@@ -60,5 +60,6 @@
"demo/mrp_routing_demo.xml",
"demo/mrp_production_demo.xml",
],
"post_init_hook": "post_init_hook",
"installable": True
}