Skip to content
Snippets Groups Projects
Commit 02f820fb authored by Julien Van Roy's avatar Julien Van Roy
Browse files

[FIX] account_edi_ubl_cii: if no VAT PartyTaxScheme should appear


If a partner has no VAT number (for instance: a public administration),
the xml tag `PartyTaxScheme` should not appear for UBL Bis 3.

opw-3263542

closes odoo/odoo#119094

Signed-off-by: default avatarLaurent Smet <las@odoo.com>
parent 54e58b3e
No related branches found
No related tags found
No related merge requests found
...@@ -50,6 +50,9 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel): ...@@ -50,6 +50,9 @@ class AccountEdiXmlUBLBIS3(models.AbstractModel):
# EXTENDS account.edi.xml.ubl_21 # EXTENDS account.edi.xml.ubl_21
vals_list = super()._get_partner_party_tax_scheme_vals_list(partner, role) vals_list = super()._get_partner_party_tax_scheme_vals_list(partner, role)
if not partner.vat:
return []
for vals in vals_list: for vals in vals_list:
vals.pop('registration_name', None) vals.pop('registration_name', None)
vals.pop('registration_address_vals', None) vals.pop('registration_address_vals', None)
......
<?xml version='1.0' encoding='UTF-8'?>
<Invoice xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2" xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
<cbc:CustomizationID>urn:cen.eu:en16931:2017#compliant#urn:fdc:peppol.eu:2017:poacc:billing:3.0</cbc:CustomizationID>
<cbc:ProfileID>urn:fdc:peppol.eu:2017:poacc:billing:01:1.0</cbc:ProfileID>
<cbc:ID>INV/2017/01/0002</cbc:ID>
<cbc:IssueDate>2017-01-01</cbc:IssueDate>
<cbc:DueDate>2017-02-28</cbc:DueDate>
<cbc:InvoiceTypeCode>380</cbc:InvoiceTypeCode>
<cbc:Note>test narration</cbc:Note>
<cbc:DocumentCurrencyCode>USD</cbc:DocumentCurrencyCode>
<cbc:BuyerReference>ref_partner_2</cbc:BuyerReference>
<cac:OrderReference>
<cbc:ID>ref_move</cbc:ID>
</cac:OrderReference>
<cac:AccountingSupplierParty>
<cac:Party>
<cbc:EndpointID schemeID="9925">BE0202239951</cbc:EndpointID>
<cac:PartyName>
<cbc:Name>partner_1</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Chauss&#233;e de Namur 40</cbc:StreetName>
<cbc:CityName>Ramillies</cbc:CityName>
<cbc:PostalZone>1367</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyTaxScheme>
<cbc:CompanyID>BE0202239951</cbc:CompanyID>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:PartyTaxScheme>
<cac:PartyLegalEntity>
<cbc:RegistrationName>partner_1</cbc:RegistrationName>
<cbc:CompanyID>BE0202239951</cbc:CompanyID>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:Name>partner_1</cbc:Name>
</cac:Contact>
</cac:Party>
</cac:AccountingSupplierParty>
<cac:AccountingCustomerParty>
<cac:Party>
<cac:PartyName>
<cbc:Name>partner_2</cbc:Name>
</cac:PartyName>
<cac:PostalAddress>
<cbc:StreetName>Rue des Bourlottes 9</cbc:StreetName>
<cbc:CityName>Ramillies</cbc:CityName>
<cbc:PostalZone>1367</cbc:PostalZone>
<cac:Country>
<cbc:IdentificationCode>BE</cbc:IdentificationCode>
</cac:Country>
</cac:PostalAddress>
<cac:PartyLegalEntity>
<cbc:RegistrationName>partner_2</cbc:RegistrationName>
</cac:PartyLegalEntity>
<cac:Contact>
<cbc:Name>partner_2</cbc:Name>
</cac:Contact>
</cac:Party>
</cac:AccountingCustomerParty>
<cac:PaymentMeans>
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode>
<cbc:PaymentID>+++000/0000/05959+++</cbc:PaymentID>
<cac:PayeeFinancialAccount>
<cbc:ID>BE15001559627230</cbc:ID>
</cac:PayeeFinancialAccount>
</cac:PaymentMeans>
<cac:PaymentTerms>
<cbc:Note>30% Advance End of Following Month</cbc:Note>
</cac:PaymentTerms>
<cac:TaxTotal>
<cbc:TaxAmount currencyID="USD">42.00</cbc:TaxAmount>
<cac:TaxSubtotal>
<cbc:TaxableAmount currencyID="USD">200.00</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="USD">42.00</cbc:TaxAmount>
<cac:TaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>21.0</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
<cac:LegalMonetaryTotal>
<cbc:LineExtensionAmount currencyID="USD">200.00</cbc:LineExtensionAmount>
<cbc:TaxExclusiveAmount currencyID="USD">200.00</cbc:TaxExclusiveAmount>
<cbc:TaxInclusiveAmount currencyID="USD">242.00</cbc:TaxInclusiveAmount>
<cbc:PrepaidAmount currencyID="USD">0.00</cbc:PrepaidAmount>
<cbc:PayableAmount currencyID="USD">242.00</cbc:PayableAmount>
</cac:LegalMonetaryTotal>
<cac:InvoiceLine>
<cbc:ID>234</cbc:ID>
<cbc:InvoicedQuantity unitCode="C62">2.0</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="USD">200.00</cbc:LineExtensionAmount>
<cac:Item>
<cbc:Description>product_a</cbc:Description>
<cbc:Name>product_a</cbc:Name>
<cac:ClassifiedTaxCategory>
<cbc:ID>S</cbc:ID>
<cbc:Percent>21.0</cbc:Percent>
<cac:TaxScheme>
<cbc:ID>VAT</cbc:ID>
</cac:TaxScheme>
</cac:ClassifiedTaxCategory>
</cac:Item>
<cac:Price>
<cbc:PriceAmount currencyID="USD">100.00</cbc:PriceAmount>
</cac:Price>
</cac:InvoiceLine>
</Invoice>
...@@ -214,6 +214,42 @@ class TestUBLBE(TestUBLCommon): ...@@ -214,6 +214,42 @@ class TestUBLBE(TestUBLCommon):
def test_encoding_in_attachment_ubl(self): def test_encoding_in_attachment_ubl(self):
self._test_encoding_in_attachment('ubl_bis3', 'INV_2017_01_0002_ubl_bis3.xml') self._test_encoding_in_attachment('ubl_bis3', 'INV_2017_01_0002_ubl_bis3.xml')
def test_sending_to_public_admin(self):
""" A public administration has no VAT, but has an arbitrary number (see:
https://pch.gouvernement.lu/fr/peppol.html). When a partner has no VAT, the node PartyTaxScheme should
not appear.
NB: The `EndpointID` node should be filled with this arbitrary number, that is why `l10n_lu_peppol_id`
module was created. However we cannot use it here because it would require adding it to the dependencies of
`l10n_account_edi_ubl_cii_tests` in stable.
"""
self.partner_2.vat = None
invoice = self._generate_move(
self.partner_1,
self.partner_2,
move_type='out_invoice',
invoice_line_ids=[
{
'product_id': self.product_a.id,
'quantity': 2,
'price_unit': 100,
'tax_ids': [(6, 0, self.tax_21.ids)],
}
],
)
self._assert_invoice_attachment(
invoice,
xpaths='''
<xpath expr="./*[local-name()='PaymentMeans']/*[local-name()='PaymentID']" position="replace">
<PaymentID>___ignore___</PaymentID>
</xpath>
<xpath expr=".//*[local-name()='InvoiceLine'][1]/*[local-name()='ID']" position="replace">
<ID>___ignore___</ID>
</xpath>
''',
expected_file='from_odoo/bis3_out_invoice_public_admin.xml',
)
#################################################### ####################################################
# Test import # Test import
#################################################### ####################################################
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment