From 4cceb26875bbba0999a5206ee4b07c3f01f4ac9a Mon Sep 17 00:00:00 2001 From: Frederik Jaeckel Date: Thu, 5 Dec 2024 17:31:45 +0100 Subject: [PATCH] configuration for pdf-invoice --- __init__.py | 3 +++ configuration.py | 48 +++++++++++++++++++++++++++++++++++++ configuration.xml | 15 ++++++++++++ locale/de.po | 32 +++++++++++++++++++++++++ locale/en.po | 23 ++++++++++++++++++ tryton.cfg | 1 + view/configuration_form.xml | 16 +++++++++++++ 7 files changed, 138 insertions(+) create mode 100644 configuration.py create mode 100644 configuration.xml create mode 100644 view/configuration_form.xml diff --git a/__init__.py b/__init__.py index cb86728..f5712e6 100644 --- a/__init__.py +++ b/__init__.py @@ -7,10 +7,13 @@ from trytond.pool import Pool from .wizard_runreport import RunXRechnungReport, RunXRechnungReportStart from .invoice import InvoiceLine from .xreport import XReport +from .configuration import ConfigurationXRechnungexport, Configuration def register(): Pool.register( + Configuration, + ConfigurationXRechnungexport, InvoiceLine, RunXRechnungReportStart, module='account_invoice_xrechnung', type_='model') diff --git a/configuration.py b/configuration.py new file mode 100644 index 0000000..b308c5e --- /dev/null +++ b/configuration.py @@ -0,0 +1,48 @@ +# -*- 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 + + +class Configuration(metaclass=PoolMeta): + __name__ = 'account.configuration' + + 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'}: + return pool.get('account_invoice_xrechnung.configuration') + return super(Configuration, cls).multivalue_model(field) + +# end Configuration + + +class ConfigurationXRechnungexport(ModelSQL, CompanyValueMixin): + "Account Configuration XRechnung Export" + __name__ = 'account_invoice_xrechnung.configuration' + + 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.') + +# end ConfigurationXRechnungexport diff --git a/configuration.xml b/configuration.xml new file mode 100644 index 0000000..fdcbe15 --- /dev/null +++ b/configuration.xml @@ -0,0 +1,15 @@ + + + + + + + account.configuration + + configuration_form + + + + diff --git a/locale/de.po b/locale/de.po index 92b2ed1..00f6e09 100644 --- a/locale/de.po +++ b/locale/de.po @@ -73,3 +73,35 @@ msgstr "Export" msgctxt "model:account_invoice_xrechnung.export,name:" msgid "eDocument Export" msgstr "eDocument Export" + + +######################### +# account.configuration # +######################### +msgctxt "view:account.configuration:" +msgid "ZUGFeRD - e-Invoice" +msgstr "ZUGFeRD - e-Rechnung" + +msgctxt "field:account.configuration,xrechn_zugferd_report:" +msgid "ZUGFeRD-Report" +msgstr "ZUGFeRD-Report" + +msgctxt "help:account.configuration,xrechn_zugferd_report:" +msgid "Report that is to be used to generate the ZUGFeRD PDF." +msgstr "Report, welcher zum erzeugen der ZUGFeRD-PDF verwendet werden soll." + + +########################################### +# account_invoice_xrechnung.configuration # +########################################### +msgctxt "model:account_invoice_xrechnung.configuration:" +msgid "Account Configuration XRechnung Export" +msgstr "Buchhaltung Konfiguration XRechnung Export" + +msgctxt "field:account_invoice_xrechnung.configuration,xrechn_zugferd_report:" +msgid "ZUGFeRD-Report" +msgstr "ZUGFeRD-Report" + +msgctxt "help:account_invoice_xrechnung.configuration,xrechn_zugferd_report:" +msgid "Report that is to be used to generate the ZUGFeRD PDF." +msgstr "Report, welcher zum erzeugen der ZUGFeRD-PDF verwendet werden soll." diff --git a/locale/en.po b/locale/en.po index cd77d2b..c6ad0ce 100644 --- a/locale/en.po +++ b/locale/en.po @@ -58,3 +58,26 @@ msgctxt "model:account_invoice_xrechnung.export,name:" msgid "eDocument Export" msgstr "eDocument Export" +msgctxt "view:account.configuration:" +msgid "ZUGFeRD - e-Invoice" +msgstr "ZUGFeRD - e-Invoice" + +msgctxt "field:account.configuration,xrechn_zugferd_report:" +msgid "ZUGFeRD-Report" +msgstr "ZUGFeRD-Report" + +msgctxt "help:account.configuration,xrechn_zugferd_report:" +msgid "Report that is to be used to generate the ZUGFeRD PDF." +msgstr "Report that is to be used to generate the ZUGFeRD PDF." + +msgctxt "model:account_invoice_xrechnung.configuration:" +msgid "Account Configuration XRechnung Export" +msgstr "Account Configuration XRechnung Export" + +msgctxt "field:account_invoice_xrechnung.configuration,xrechn_zugferd_report:" +msgid "ZUGFeRD-Report" +msgstr "ZUGFeRD-Report" + +msgctxt "help:account_invoice_xrechnung.configuration,xrechn_zugferd_report:" +msgid "Report that is to be used to generate the ZUGFeRD PDF." +msgstr "Report that is to be used to generate the ZUGFeRD PDF." diff --git a/tryton.cfg b/tryton.cfg index 8e71a4a..272e243 100644 --- a/tryton.cfg +++ b/tryton.cfg @@ -6,5 +6,6 @@ depends: edocument_xrechnung xml: message.xml + configuration.xml wizard_runreport.xml xreport.xml diff --git a/view/configuration_form.xml b/view/configuration_form.xml new file mode 100644 index 0000000..94b22b3 --- /dev/null +++ b/view/configuration_form.xml @@ -0,0 +1,16 @@ + + + + + + + + + +