# -*- coding: utf-8 -*- # This file is part of the account-invoice-xrechnung-module # from m-ds for Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. from trytond.pool import PoolMeta, Pool from trytond.model import ModelSQL, fields from trytond.modules.company.model import CompanyValueMixin from .wizard_runreport import sel_edocument class Configuration(metaclass=PoolMeta): __name__ = 'account.configuration' xrechn_default = fields.MultiValue(fields.Selection( string='Export mode', selection=sel_edocument, help='Pre-set export format for e-invoices.')) xrechn_zugferd_report = fields.MultiValue(fields.Many2One( model_name='ir.action.report', domain=[ ('model', '=', 'account.invoice'), ('extension', '=', 'pdf')], string='ZUGFeRD-Report', help='Report that is to be used to generate the ZUGFeRD PDF.')) @classmethod def multivalue_model(cls, field): """ select table """ pool = Pool() if field in {'xrechn_zugferd_report', 'xrechn_default'}: return pool.get('account_invoice_xrechnung.configuration') return super(Configuration, cls).multivalue_model(field) @classmethod def default_xrechn_default(cls, **pattern): return cls.multivalue_model('xrechn_default').default_xrechn_default() # end Configuration class ConfigurationXRechnungexport(ModelSQL, CompanyValueMixin): "Account Configuration XRechnung Export" __name__ = 'account_invoice_xrechnung.configuration' xrechn_default = fields.Selection( string='Export mode', selection=sel_edocument, help='Pre-set export format for e-invoices.') xrechn_zugferd_report = fields.Many2One( model_name='ir.action.report', string='ZUGFeRD-Report', domain=[ ('model', '=', 'account.invoice'), ('extension', '=', 'pdf')], help='Report that is to be used to generate the ZUGFeRD PDF.') @classmethod def default_xrechn_default(cls, **pattern): return 'edocument.facturxext.invoice-ferd' # end ConfigurationXRechnungexport