/usr/lib/python2.7/dist-packages/trytond/modules/production_routing/production.py is in tryton-modules-production-routing 4.2.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 | # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from trytond.pool import PoolMeta
from trytond.model import fields
from trytond.pyson import Eval
__all__ = ['Production']
class Production:
__metaclass__ = PoolMeta
__name__ = 'production'
routing = fields.Many2One('production.routing', 'Routing',
domain=[
('boms', '=', Eval('bom', 0)),
],
states={
'readonly': ~Eval('state').in_(['request', 'draft']),
'invisible': ~Eval('bom'),
},
depends=['bom', 'state'])
@fields.depends('bom', 'routing')
def on_change_bom(self):
super(Production, self).on_change_bom()
if self.bom:
if self.routing:
if self.bom not in self.routing.boms:
self.routing = None
else:
self.routing = None
@fields.depends('routing')
def on_change_with_planned_start_date(self, pattern=None):
if pattern is None:
pattern = {}
pattern.setdefault(
'routing', self.routing.id if self.routing else None)
return super(Production, self).on_change_with_planned_start_date(
pattern=pattern)
@classmethod
def compute_request(cls, product, warehouse, quantity, date, company):
production = super(Production, cls).compute_request(
product, warehouse, quantity, date, company)
production.routing = product.boms[0].routing if product.boms else None
return production
|