2014-12-02 12:55:39 +01:00
|
|
|
# This file is part of Tryton. The COPYRIGHT file at the top level of
|
|
|
|
|
# this repository contains the full copyright notices and license terms.
|
2021-12-11 17:58:43 +01:00
|
|
|
from trytond.model import ModelSingleton, ModelSQL, ModelView, fields
|
|
|
|
|
from trytond.modules.company.model import (
|
|
|
|
|
CompanyMultiValueMixin, CompanyValueMixin)
|
2017-04-01 00:32:36 +02:00
|
|
|
from trytond.pool import Pool
|
2021-03-11 23:00:10 +01:00
|
|
|
from trytond.pyson import Eval, Id
|
2012-05-13 23:00:54 +02:00
|
|
|
|
|
|
|
|
|
2017-04-01 00:32:36 +02:00
|
|
|
class Configuration(
|
|
|
|
|
ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin):
|
2012-05-13 23:00:54 +02:00
|
|
|
'Production Configuration'
|
2012-09-24 22:12:50 +02:00
|
|
|
__name__ = 'production.configuration'
|
2012-05-13 23:00:54 +02:00
|
|
|
|
2017-04-01 00:32:36 +02:00
|
|
|
production_sequence = fields.MultiValue(fields.Many2One(
|
|
|
|
|
'ir.sequence', "Production Sequence", required=True,
|
|
|
|
|
domain=[
|
2012-05-13 23:00:54 +02:00
|
|
|
('company', 'in',
|
2013-10-09 18:25:40 +02:00
|
|
|
[Eval('context', {}).get('company', -1), None]),
|
2021-03-11 23:00:10 +01:00
|
|
|
('sequence_type', '=',
|
|
|
|
|
Id('production', 'sequence_type_production')),
|
2017-04-01 00:32:36 +02:00
|
|
|
]))
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def default_production_sequence(cls, **pattern):
|
|
|
|
|
return cls.multivalue_model(
|
|
|
|
|
'production_sequence').default_production_sequence()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationProductionSequence(ModelSQL, CompanyValueMixin):
|
|
|
|
|
"Production Configuration Production Sequence"
|
|
|
|
|
__name__ = 'production.configuration.production_sequence'
|
|
|
|
|
production_sequence = fields.Many2One(
|
|
|
|
|
'ir.sequence', "Production Sequence", required=True,
|
|
|
|
|
domain=[
|
|
|
|
|
('company', 'in', [Eval('company', -1), None]),
|
2021-03-11 23:00:10 +01:00
|
|
|
('sequence_type', '=',
|
|
|
|
|
Id('production', 'sequence_type_production')),
|
2022-04-08 19:07:13 +02:00
|
|
|
])
|
2017-04-01 00:32:36 +02:00
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
def default_production_sequence(cls):
|
|
|
|
|
pool = Pool()
|
|
|
|
|
ModelData = pool.get('ir.model.data')
|
2017-04-01 10:41:52 +02:00
|
|
|
try:
|
|
|
|
|
return ModelData.get_id('production', 'sequence_production')
|
|
|
|
|
except KeyError:
|
|
|
|
|
return None
|