Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] Wrong line price with UBL Import due to wrong calculated unit price #16

Closed
bosd opened this issue Mar 8, 2017 · 4 comments
Closed

Comments

@bosd
Copy link
Contributor

bosd commented Mar 8, 2017

I have imported a UBL Invoice of my fuel pass supplier.
It has multiple lines, besides fuel it also contains some parking costs.
I set the Method of Invoice Line to ”Multi Line, No Product”.
The expected result is that in Odoo I have the same invoice line price as in the UBL file.

Current behavior:
The price does not match UBL file.
The first invoice line should be €71,41 instead of €71,01.

image

Input code for the first line:
cac:InvoiceLine
cbc:ID1</cbc:ID>
<cbc:InvoicedQuantity unitCode="LTR">70.31</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">71.41</cbc:LineExtensionAmount>
cac:OrderLineReference
cbc:LineID1</cbc:LineID>
</cac:OrderLineReference>
cac:TaxTotal
<cbc:TaxAmount currencyID="EUR">15.00</cbc:TaxAmount>
cac:TaxSubtotal
<cbc:TaxableAmount currencyID="EUR">71.41</cbc:TaxableAmount>
<cbc:TaxAmount currencyID="EUR">15.00</cbc:TaxAmount>
cac:TaxCategory
<cbc:ID schemeID="UNCL5305" schemeAgencyID="6">S</cbc:ID>
cbc:Percent21.00</cbc:Percent>
cac:TaxScheme
<cbc:ID schemeID="UN/ECE 5153" schemeAgencyID="6">VAT</cbc:ID>
</cac:TaxScheme>
</cac:TaxCategory>
</cac:TaxSubtotal>
</cac:TaxTotal>
cac:Item
cbc:DescriptionDiesel</cbc:Description>
cbc:NameDiesel</cbc:Name>
</cac:Item>
</cac:InvoiceLine>

complete input
UBLInvoice.0006311117.xml.txt

@alexis-via
Copy link
Contributor

@bosd : Would you agree if we add your UBL invoice to the automated test suite, so that when the bug is fixed (I plan to work on it this month) we are sure it doesn't "come back" ? Do you want to anonymise some stuff in the XML before adding it to the test suite ?

@alexis-via
Copy link
Contributor

This is what happens for the 1st line: it reads:
<cbc:InvoicedQuantity unitCode="LTR">70.31</cbc:InvoicedQuantity>
<cbc:LineExtensionAmount currencyID="EUR">71.41</cbc:LineExtensionAmount>

So it writes in invoice line:
qty = 70.31
price unit = 71.41 / 70.31 = 1.01564
As the decimal precision for price unit is 2 by default, it writes price unit = 1.01 (should be 1.02...)
So the subtotal is 1.01 * 70.31 = 71.01

I see 3 solutions for this:
a) higher decimal precision for price unit => I exclude this solution because it impacts all invoices, including customer invoices
b) when this case happens, write:
qty = 1
price unit = price subtotal = 71.41
We loose the information about the exact qty...
c) keep the current behavior and add a line "Adjustement" which has the difference between the total untaxed computed by Odoo and the total untaxed of the invoice.

For the moment, I prefer option c (even if, in this particular case for gas, loosing the info of the qty is not important, so option b would be fine). @bosd what do you think ?

@bosd
Copy link
Contributor Author

bosd commented Aug 13, 2017

@alexis-via
Yes you may use the UBL file in the test suite. It is already annonimzed. As the adress is on sesamestreet :)

Well, maybe it is in my lack of knowledge of odoo. But I was expecting to have the quantity and price unit to be dynamic. Though that will be more something into the core of odoo.

As a sollution I also prefer option C . So the total quantity of the product will still be visible.

@alexis-via
Copy link
Contributor

I implemented option c) on v10 tonight and I'm pretty happy with the result. I have 2 levels of adjustments:

  1. when, for a particular line, the price_subtotal is different between odoo and the XML file -> il create an adjustment line related to that line (same properties, same taxes, etc..)
  2. after those per-line adjustement, if there is still a difference between the amount_untaxed in Odoo and the monetary summation in the XML, I add a global adjustment line that has no tax and no product.

I added the invoice of this bug report to the automated test suite. I'll push the code to github when @bosd will confirm he agrees on that.

alexis-via added a commit to akretion/edi that referenced this issue Aug 13, 2017
Add support for Tax Due Date on invoice import
njeudy pushed a commit to njeudy/edi that referenced this issue Jan 27, 2018
Add support for Tax Due Date on invoice import
njeudy pushed a commit to njeudy/edi that referenced this issue Jan 27, 2018
Add support for Tax Due Date on invoice import
hbrunn pushed a commit that referenced this issue Feb 21, 2018
Add support for Tax Due Date on invoice import
astirpe pushed a commit to njeudy/edi that referenced this issue Oct 12, 2018
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue Mar 4, 2019
Add support for Tax Due Date on invoice import
rubdos pushed a commit to rubdos/edi that referenced this issue Mar 9, 2019
Add support for Tax Due Date on invoice import
alexis-via added a commit that referenced this issue Dec 31, 2019
Add support for Tax Due Date on invoice import
astirpe pushed a commit to onesteinbv/edi that referenced this issue Jan 3, 2020
Add support for Tax Due Date on invoice import
alexis-via added a commit that referenced this issue Jan 22, 2020
Add support for Tax Due Date on invoice import
astirpe pushed a commit to onesteinbv/edi that referenced this issue Jan 22, 2020
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue Apr 14, 2020
Add support for Tax Due Date on invoice import
wpichler pushed a commit to Callino/edi that referenced this issue Jun 29, 2022
Add support for Tax Due Date on invoice import
wpichler pushed a commit to Callino/edi that referenced this issue Jun 29, 2022
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue Oct 2, 2022
Add support for Tax Due Date on invoice import
kevinxdev pushed a commit to kevinxdev/edi that referenced this issue Dec 26, 2022
Add support for Tax Due Date on invoice import
kevinxdev pushed a commit to kevinxdev/edi that referenced this issue Dec 26, 2022
Add support for Tax Due Date on invoice import
kevinxdev pushed a commit to kevinxdev/edi that referenced this issue Dec 26, 2022
Add support for Tax Due Date on invoice import
kevinxdev pushed a commit to kevinxdev/edi that referenced this issue Dec 26, 2022
Add support for Tax Due Date on invoice import
ghost pushed a commit to gbrito/edi that referenced this issue Feb 13, 2023
Add support for Tax Due Date on invoice import
yvaucher pushed a commit to yvaucher/edi that referenced this issue Feb 21, 2023
Add support for Tax Due Date on invoice import
ghost pushed a commit to gbrito/edi that referenced this issue Mar 10, 2023
Add support for Tax Due Date on invoice import
rjocoleman pushed a commit to etailer/edi that referenced this issue Mar 22, 2023
Add support for Tax Due Date on invoice import
rjocoleman pushed a commit to etailer/edi that referenced this issue Mar 22, 2023
Add support for Tax Due Date on invoice import
rjocoleman pushed a commit to etailer/edi that referenced this issue Mar 22, 2023
Add support for Tax Due Date on invoice import
rjocoleman pushed a commit to etailer/edi that referenced this issue Mar 22, 2023
Add support for Tax Due Date on invoice import
hhgabelgaard pushed a commit to steingabelgaard/edi that referenced this issue Mar 23, 2023
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue Mar 24, 2023
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue Mar 24, 2023
Add support for Tax Due Date on invoice import
ghost pushed a commit to gbrito/edi that referenced this issue Mar 28, 2023
Add support for Tax Due Date on invoice import
acsonefho pushed a commit to acsone/edi that referenced this issue Apr 25, 2023
Add support for Tax Due Date on invoice import
alexis-via added a commit to akretion/edi that referenced this issue May 4, 2023
Add support for Tax Due Date on invoice import
njeudy pushed a commit to Alusage/edi that referenced this issue May 8, 2023
Add support for Tax Due Date on invoice import
njeudy pushed a commit to Alusage/edi that referenced this issue May 8, 2023
Add support for Tax Due Date on invoice import
njeudy pushed a commit to Alusage/edi that referenced this issue May 8, 2023
Add support for Tax Due Date on invoice import
TDu pushed a commit to camptocamp/edi that referenced this issue Nov 22, 2023
Add support for Tax Due Date on invoice import
thienvh332 referenced this issue in thienvh332/edi Dec 19, 2023
[16.0] edi_oca: port as is with all changes fix/imp from edi#14.0
JaumeBforgeFlow pushed a commit to ForgeFlow/edi that referenced this issue Jan 22, 2024
Add support for Tax Due Date on invoice import
JaumeBforgeFlow pushed a commit to ForgeFlow/edi that referenced this issue Jan 22, 2024
Add support for Tax Due Date on invoice import
gurneyalex pushed a commit to gurneyalex/edi that referenced this issue Feb 20, 2024
Add support for Tax Due Date on invoice import
nguyenminhchien pushed a commit to nguyenminhchien/edi that referenced this issue Feb 20, 2024
Add support for Tax Due Date on invoice import
nguyenminhchien pushed a commit to nguyenminhchien/edi that referenced this issue Feb 20, 2024
Add support for Tax Due Date on invoice import
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants