Merge branch 'main' into 7.0

This commit is contained in:
Frederik Jaeckel 2024-12-05 10:47:33 +01:00
commit 29f3c8e741
14 changed files with 132 additions and 10 deletions

View file

@ -35,6 +35,22 @@ msgid "X-Rechnung Route-ID"
msgstr "X-Rechnung Leitweg-ID"
###############
# party.party #
###############
msgctxt "view:party.party:"
msgid "X-Rechnung"
msgstr "X-Rechnung"
msgctxt "field:party.party,xrechnung_routeid:"
msgid "X-Rechnung Route-ID"
msgstr "X-Rechnung Leitweg-ID"
msgctxt "help:party.party,xrechnung_routeid:"
msgid "Enables the need for an XRechnung route ID at the party for exporting the XRechnung."
msgstr "Aktiviert die Notwendigkeit einer XRechnung-Leitweg-ID an der Partei für den Export der XRechnung."
###############
# account.tax #
###############

View file

@ -26,6 +26,18 @@ msgctxt "selection:party.configuration,identifier_types:"
msgid "X-Rechnung Route-ID"
msgstr "X-Rechnung Route-ID"
msgctxt "view:party.party:"
msgid "X-Rechnung"
msgstr "X-Rechnung"
msgctxt "field:party.party,xrechnung_routeid:"
msgid "X-Rechnung Route-ID"
msgstr "X-Rechnung Route-ID"
msgctxt "help:party.party,xrechnung_routeid:"
msgid "Enables the need for an XRechnung route ID at the party for exporting the XRechnung."
msgstr "Enables the need for an XRechnung route ID at the party for exporting the XRechnung."
msgctxt "field:account.tax,xrtax_category:"
msgid "Tax Category"
msgstr "Tax Category"
@ -66,3 +78,7 @@ msgctxt "selection:account.tax,xrtax_category:"
msgid "General indirect tax of the Canary Islands"
msgstr "General indirect tax of the Canary Islands"
msgctxt "selection:account.tax,xrtax_category:"
msgid "Tax on production; services and imports in Ceuta and Melilla"
msgstr "Tax on production; services and imports in Ceuta and Melilla"

View file

@ -6,20 +6,48 @@
from trytond.pool import PoolMeta
from trytond.exceptions import UserError
from trytond.i18n import gettext
from trytond.model import fields
class Party(metaclass=PoolMeta):
__name__ = 'party.party'
xrechnung_routeid = fields.Boolean(
string='X-Rechnung Route-ID',
help='Enables the need for an XRechnung route ID at the party ' +
'for exporting the XRechnung.')
def get_xrechnung_route_id(self):
""" search for route-id at party, fire-exception if missing
"""
for ident in self.identifiers:
if ident.type == 'edoc_route_id':
return ident.code
raise UserError(gettext(
'edocument_xrechnung.msg_missing_xrechnung_route_id',
partyname=self.rec_name))
if self.xrechnung_routeid:
raise UserError(gettext(
'edocument_xrechnung.msg_missing_xrechnung_route_id',
partyname=self.rec_name))
@classmethod
def default_xrechnung_routeid(cls):
""" default for needs-route-id
Returns:
bool: default False
"""
return False
@classmethod
def validate(cls, records):
""" validate setup of xrechnung route id
Args:
records (list): records of party.party
"""
super(Party, cls).validate(records)
for record in records:
record.get_xrechnung_route_id()
# end Party

15
party.xml Normal file
View file

@ -0,0 +1,15 @@
<?xml version="1.0"?>
<!-- # This file is part of the edocument-module for Tryton from m-ds.de.
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="party_view_form">
<field name="model">party.party</field>
<field name="inherit" ref="party.party_view_form"/>
<field name="name">party_form</field>
</record>
</data>
</tryton>

View file

@ -98,7 +98,8 @@ setup(
'trytond.modules.%s' % MODULE: (
info.get('xml', [])
+ ['tryton.cfg', 'locale/*.po', 'tests/*.py',
'template/*/*.xml', 'versiondep.txt', 'README.rst']),
'template/*/*.xml', 'versiondep.txt', 'README.rst',
'tests/*/*/*/*.xsd']),
},
install_requires=requires,

View file

@ -93,7 +93,7 @@
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -94,7 +94,7 @@
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -93,7 +93,7 @@
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -94,7 +94,7 @@
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -93,7 +93,7 @@
<cbc:CreditNoteTypeCode>${this.type_code}</cbc:CreditNoteTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -94,7 +94,7 @@
<cbc:InvoiceTypeCode>${this.type_code}</cbc:InvoiceTypeCode>
<cbc:Note py:if="this.invoice_note()">${this.invoice_note()}</cbc:Note>
<cbc:DocumentCurrencyCode>${this.invoice.currency.code}</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id()}</cbc:BuyerReference>
<cbc:BuyerReference>${this.invoice.party.get_xrechnung_route_id() or ''}</cbc:BuyerReference>
<cac:OrderReference py:if="this.invoice.reference">
<cbc:ID>${this.invoice.reference}</cbc:ID>
<cbc:SalesOrderID py:if="this.sales_order_nums()">${this.sales_order_nums()}</cbc:SalesOrderID>

View file

@ -11,12 +11,41 @@ from datetime import date
from trytond.tests.test_tryton import ModuleTestCase, with_transaction
from trytond.pool import Pool
from trytond.modules.edocument_uncefact.tests.test_module import get_invoice
from trytond.exceptions import UserError
class EdocTestCase(ModuleTestCase):
'Test e-rechnung module'
module = 'edocument_xrechnung'
@with_transaction()
def test_xrechn_check_validator(self):
""" check validation of optional route-id
"""
Party = Pool().get('party.party')
party, = Party.create([{'name': 'P1'}])
self.assertEqual(party.xrechnung_routeid, False)
Party.write(*[
[party],
{
'xrechnung_routeid': True,
'identifiers': [('create', [{
'type': 'edoc_route_id',
'code': '1234'}])]}])
self.assertEqual(party.xrechnung_routeid, True)
self.assertEqual(party.get_xrechnung_route_id(), '1234')
self.assertRaisesRegex(
UserError,
"No XRechnung routing ID is stored for the party 'P1'.",
Party.write,
*[
[party],
{'identifiers': [('delete', [party.identifiers[0].id])]}]
)
@with_transaction()
def test_xrechn_export_xml_invoice(self):
""" run export - invoice

View file

@ -7,3 +7,4 @@ depends:
account_invoice
xml:
message.xml
party.xml

16
view/party_form.xml Normal file
View file

@ -0,0 +1,16 @@
<?xml version="1.0"?>
<!-- # This file is part of the edocument-module for Tryton from m-ds.de.
The COPYRIGHT file at the top level of this repository contains the
full copyright notices and license terms. -->
<data>
<xpath expr="/form/notebook/page[@id='accounting']/separator[@id='account']"
position="before">
<separator string="X-Rechnung" colspan="4" id="xrechnung_routeid"/>
<label name="xrechnung_routeid"/>
<field name="xrechnung_routeid"/>
<newline/>
</xpath>
</data>