52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
# The COPYRIGHT file at the top level of this repository contains the full
|
|
# copyright notices and license terms.
|
|
from trytond.model import ModelSQL, ModelSingleton, ModelView, fields
|
|
from trytond.pool import Pool
|
|
from trytond.pyson import Id
|
|
from trytond.modules.company.model import (
|
|
CompanyMultiValueMixin, CompanyValueMixin)
|
|
|
|
|
|
class Configuration(
|
|
ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin):
|
|
"""Edocument Configuration"""
|
|
__name__ = 'edocument.configuration'
|
|
|
|
edocument_sequence = fields.MultiValue(
|
|
fields.Many2One('ir.sequence', 'Electronic Document Sequence',
|
|
required=True, domain=[
|
|
('sequence_type', '=', Id('edocument_edifact',
|
|
'sequence_type_edocument'))
|
|
]))
|
|
export_path = fields.Char('Export Path')
|
|
import_path = fields.Char('Import Path')
|
|
error_path = fields.Char('Error Path')
|
|
|
|
@classmethod
|
|
def multivalue_model(cls, field):
|
|
pool = Pool()
|
|
if field == 'edocument_sequence':
|
|
return pool.get('edocument.configuration.sequence')
|
|
return super(Configuration, cls).multivalue_model(field)
|
|
|
|
|
|
class ConfigurationSequence(ModelSQL, CompanyValueMixin):
|
|
"""Edocument Configuration Sequence"""
|
|
__name__ = 'edocument.configuration.sequence'
|
|
|
|
edocument_sequence = fields.Many2One(
|
|
'ir.sequence', 'Electronic Document Sequence', required=True,
|
|
domain=[
|
|
('sequence_type', '=', Id('edocument_edifact',
|
|
'sequence_type_edocument'))
|
|
])
|
|
|
|
@classmethod
|
|
def default_edocument_sequence(cls):
|
|
pool = Pool()
|
|
ModelData = pool.get('ir.model.data')
|
|
try:
|
|
return ModelData.get_id('edocument_edifact', 'sequence_edocument')
|
|
except KeyError:
|
|
return None
|