2024-12-05 16:31:45 +00:00
|
|
|
# -*- 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
|
2024-12-06 13:03:51 +00:00
|
|
|
from .wizard_runreport import sel_edocument
|
2024-12-05 16:31:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Configuration(metaclass=PoolMeta):
|
|
|
|
__name__ = 'account.configuration'
|
|
|
|
|
2024-12-06 13:03:51 +00:00
|
|
|
xrechn_default = fields.MultiValue(fields.Selection(
|
|
|
|
string='Export mode', selection=sel_edocument,
|
|
|
|
help='Pre-set export format for e-invoices.'))
|
2024-12-05 16:31:45 +00:00
|
|
|
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()
|
2024-12-06 13:03:51 +00:00
|
|
|
if field in {'xrechn_zugferd_report', 'xrechn_default'}:
|
2024-12-05 16:31:45 +00:00
|
|
|
return pool.get('account_invoice_xrechnung.configuration')
|
|
|
|
return super(Configuration, cls).multivalue_model(field)
|
|
|
|
|
2024-12-06 13:03:51 +00:00
|
|
|
@classmethod
|
|
|
|
def default_xrechn_default(cls, **pattern):
|
|
|
|
return cls.multivalue_model('xrechn_default').default_xrechn_default()
|
|
|
|
|
2024-12-05 16:31:45 +00:00
|
|
|
# end Configuration
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigurationXRechnungexport(ModelSQL, CompanyValueMixin):
|
|
|
|
"Account Configuration XRechnung Export"
|
|
|
|
__name__ = 'account_invoice_xrechnung.configuration'
|
|
|
|
|
2024-12-06 13:03:51 +00:00
|
|
|
xrechn_default = fields.Selection(
|
|
|
|
string='Export mode', selection=sel_edocument,
|
|
|
|
help='Pre-set export format for e-invoices.')
|
2024-12-05 16:31:45 +00:00
|
|
|
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.')
|
|
|
|
|
2024-12-06 13:03:51 +00:00
|
|
|
@classmethod
|
|
|
|
def default_xrechn_default(cls, **pattern):
|
|
|
|
return 'edocument.facturxext.invoice-ferd'
|
|
|
|
|
2024-12-05 16:31:45 +00:00
|
|
|
# end ConfigurationXRechnungexport
|