mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
* Guided selection of operation inside routing lines for avoiding confusions. * Homogenization of work centers selection in routing lines. You always add a workcenter line. * Limit selectable workcenters on the work order according routing line. * Views cleaning.
34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
# -*- coding: utf-8 -*-
|
|
##############################################################################
|
|
# For copyright and license notices, see __openerp__.py file in root directory
|
|
##############################################################################
|
|
from . import models
|
|
from . import wizard
|
|
from openerp import api, SUPERUSER_ID
|
|
|
|
|
|
def create_default_routing_workcenter_line(cr):
|
|
with api.Environment.manage():
|
|
env = api.Environment(cr, SUPERUSER_ID, {})
|
|
routing_wcs = env['mrp.routing.workcenter'].search(
|
|
[('op_wc_lines', '=', False)])
|
|
for routing_wc in routing_wcs:
|
|
routing_wc.op_wc_lines = [
|
|
(0, 0, {'workcenter': routing_wc.workcenter_id,
|
|
'default': True,
|
|
'custom_data': False})]
|
|
|
|
|
|
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);
|
|
""")
|
|
create_default_routing_workcenter_line(cr)
|