44 lines
1.5 KiB
Python
44 lines
1.5 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.modules.company.model import (
|
||
|
CompanyMultiValueMixin, CompanyValueMixin)
|
||
|
|
||
|
__all__ = ['Configuration', 'ConfigurationSequence']
|
||
|
|
||
|
|
||
|
class Configuration(
|
||
|
ModelSingleton, ModelSQL, ModelView, CompanyMultiValueMixin):
|
||
|
"""Edocument Configuration"""
|
||
|
__name__ = 'edocument.configuration'
|
||
|
|
||
|
edocument_sequence = fields.MultiValue(
|
||
|
fields.Many2One('ir.sequence', 'Electronic Document Sequence',
|
||
|
required=True))
|
||
|
export_path = fields.Char('Export 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)
|
||
|
|
||
|
@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
|