-
Notifications
You must be signed in to change notification settings - Fork 23.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIX] account_edi_ubl_cii: invert negative unit price with quantity
Currently, when we use eCommerce with automatic invoicing enabled, and we have the Peppol format enabled in the invoicing settings, there is an issue when coupons or discount codes are applied. These discounts create a sale order line (and afterwards a move line) with a negative unit price. Since UBL BIS3 does not allow negative unit prices, the automatic generation of the e-invoice is not executed and the customer receives a "proforma invoice" PDF instead (which has no official value). A message is logged in the chatter, but the user has no notification or anything. We can do better, and instead invert both the unit price and quantity fields (since UBL BIS3 does allow negative quantities), to have the same result when generating the e-invoice. task-3916181 closes #164966 X-original-commit: 6f0642d Signed-off-by: Julien Van Roy (juvr) <juvr@odoo.com> Signed-off-by: Dylan Kiss (dyki) <dyki@odoo.com>
- Loading branch information
Showing
3 changed files
with
195 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
165 changes: 165 additions & 0 deletions
165
...unt_edi_ubl_cii_tests/tests/test_files/from_odoo/bis3_out_invoice_negative_unit_price.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,165 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<Invoice xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2" | ||
xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-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>___ignore___</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>___ignore___</cbc:ID> | ||
</cac:OrderReference> | ||
<cac:AdditionalDocumentReference> | ||
<cbc:ID>___ignore___</cbc:ID> | ||
<cbc:Attachment> | ||
<cbc:EmbeddedDocumentBinaryObject mimeCode="___ignore___" filename="___ignore___"> | ||
___ignore___ | ||
</cbc:EmbeddedDocumentBinaryObject> | ||
</cbc:Attachment> | ||
</cac:AdditionalDocumentReference> | ||
<cac:AccountingSupplierParty> | ||
<cac:Party> | ||
<cbc:EndpointID schemeID="0208">0202239951</cbc:EndpointID> | ||
<cac:PartyName> | ||
<cbc:Name>partner_1</cbc:Name> | ||
</cac:PartyName> | ||
<cac:PostalAddress> | ||
<cbc:StreetName>Chaussé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> | ||
<cbc:EndpointID schemeID="0208">0477472701</cbc:EndpointID> | ||
<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:PartyTaxScheme> | ||
<cbc:CompanyID>BE0477472701</cbc:CompanyID> | ||
<cac:TaxScheme> | ||
<cbc:ID>VAT</cbc:ID> | ||
</cac:TaxScheme> | ||
</cac:PartyTaxScheme> | ||
<cac:PartyLegalEntity> | ||
<cbc:RegistrationName>partner_2</cbc:RegistrationName> | ||
<cbc:CompanyID>BE0477472701</cbc:CompanyID> | ||
</cac:PartyLegalEntity> | ||
<cac:Contact> | ||
<cbc:Name>partner_2</cbc:Name> | ||
</cac:Contact> | ||
</cac:Party> | ||
</cac:AccountingCustomerParty> | ||
<cac:Delivery> | ||
<cac:DeliveryLocation> | ||
<cac:Address> | ||
<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:Address> | ||
</cac:DeliveryLocation> | ||
</cac:Delivery> | ||
<cac:PaymentMeans> | ||
<cbc:PaymentMeansCode name="credit transfer">30</cbc:PaymentMeansCode> | ||
<cbc:PaymentID>___ignore___</cbc:PaymentID> | ||
<cac:PayeeFinancialAccount> | ||
<cbc:ID>BE15001559627230</cbc:ID> | ||
</cac:PayeeFinancialAccount> | ||
</cac:PaymentMeans> | ||
<cac:PaymentTerms> | ||
<cbc:Note>Payment terms: 30% Advance End of Following Month</cbc:Note> | ||
</cac:PaymentTerms> | ||
<cac:TaxTotal> | ||
<cbc:TaxAmount currencyID="USD">15.75</cbc:TaxAmount> | ||
<cac:TaxSubtotal> | ||
<cbc:TaxableAmount currencyID="USD">75.00</cbc:TaxableAmount> | ||
<cbc:TaxAmount currencyID="USD">15.75</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">75.00</cbc:LineExtensionAmount> | ||
<cbc:TaxExclusiveAmount currencyID="USD">75.00</cbc:TaxExclusiveAmount> | ||
<cbc:TaxInclusiveAmount currencyID="USD">90.75</cbc:TaxInclusiveAmount> | ||
<cbc:PrepaidAmount currencyID="USD">0.00</cbc:PrepaidAmount> | ||
<cbc:PayableAmount currencyID="USD">90.75</cbc:PayableAmount> | ||
</cac:LegalMonetaryTotal> | ||
<cac:InvoiceLine> | ||
<cbc:ID>___ignore___</cbc:ID> | ||
<cbc:InvoicedQuantity unitCode="C62">1.0</cbc:InvoicedQuantity> | ||
<cbc:LineExtensionAmount currencyID="USD">100.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.0</cbc:PriceAmount> | ||
</cac:Price> | ||
</cac:InvoiceLine> | ||
<cac:InvoiceLine> | ||
<cbc:ID>___ignore___</cbc:ID> | ||
<cbc:InvoicedQuantity unitCode="C62">-1.0</cbc:InvoicedQuantity> | ||
<cbc:LineExtensionAmount currencyID="USD">-25.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">25.0</cbc:PriceAmount> | ||
</cac:Price> | ||
</cac:InvoiceLine> | ||
</Invoice> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters