configuration for pdf-invoice

This commit is contained in:
Frederik Jaeckel 2024-12-05 17:31:45 +01:00
parent eda7216907
commit 4cceb26875
7 changed files with 138 additions and 0 deletions

View file

@ -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')

48
configuration.py Normal file
View file

@ -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

15
configuration.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!-- 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. -->
<tryton>
<data>
<record model="ir.ui.view" id="configuration_view_form">
<field name="model">account.configuration</field>
<field name="inherit" ref="account.configuration_view_form"/>
<field name="name">configuration_form</field>
</record>
</data>
</tryton>

View file

@ -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."

View file

@ -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."

View file

@ -6,5 +6,6 @@ depends:
edocument_xrechnung
xml:
message.xml
configuration.xml
wizard_runreport.xml
xreport.xml

View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!-- This file is part of the account-datev-module from m-ds for Tryton.
The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. -->
<data>
<xpath expr="/form/separator[@id='currency_exchange']" position="before">
<separator id="xrechnung" colspan="4" string="ZUGFeRD - e-Invoice"/>
<label name="xrechn_zugferd_report"/>
<field name="xrechn_zugferd_report"/>
<newline/>
</xpath>
</data>