[FIX] factur-x: fix line chargeAmount export
The current behavior is that we are exporting the line subtotal as chargeAmount of the line. This is an issue as this field is expecting the unit price instead. A bugfix was done for importing extern invoices properly that broke importing factur-x files from Odoo as it doesn't support that custom behavior anymore. Thus, this will correct the export to properly store the unit price in the GrossPriceProductTradePrice ChargeAmount. At the same time, add the NetPriceProductTradePrice ChargeAmount, which is required and should contain the unit price with discount applied. closes odoo/odoo#83647 X-original-commit: c93f7dba0720e5e4f7d0a26ce05a854094e6a279 Signed-off-by: Laurent Smet <las@odoo.com> Signed-off-by: Florian Gilbert <flg@odoo.com> Signed-off-by: Nicolas Viseur <vin@odoo.com>
This commit is contained in:
@@ -26,10 +26,11 @@
|
||||
|
||||
<!-- Amounts. -->
|
||||
<ram:SpecifiedLineTradeAgreement>
|
||||
<!-- Line information, with discount and unit price separate -->
|
||||
<ram:GrossPriceProductTradePrice>
|
||||
<ram:ChargeAmount
|
||||
t-att-currencyID="record.currency_id.name"
|
||||
t-esc="format_monetary(line.price_subtotal, record.currency_id)"/>
|
||||
t-esc="format_monetary(line.price_unit, record.currency_id)"/>
|
||||
|
||||
<!-- Discount. -->
|
||||
<ram:AppliedTradeAllowanceCharge t-if="line.discount">
|
||||
@@ -39,6 +40,19 @@
|
||||
<ram:CalculationPercent t-esc="line.discount"/>
|
||||
</ram:AppliedTradeAllowanceCharge>
|
||||
</ram:GrossPriceProductTradePrice>
|
||||
<!-- Line unit price, with discount applied -->
|
||||
<ram:NetPriceProductTradePrice>
|
||||
<t t-if="line.quantity > 0">
|
||||
<ram:ChargeAmount
|
||||
t-att-currencyID="record.currency_id.name"
|
||||
t-esc="format_monetary(line.price_subtotal/line.quantity, record.currency_id)"/>
|
||||
</t>
|
||||
<t t-else="">
|
||||
<ram:ChargeAmount
|
||||
t-att-currencyID="record.currency_id.name"
|
||||
t-esc="format_monetary(0.0, record.currency_id)"/>
|
||||
</t>
|
||||
</ram:NetPriceProductTradePrice>
|
||||
</ram:SpecifiedLineTradeAgreement>
|
||||
|
||||
<!-- Quantity. -->
|
||||
|
||||
@@ -82,7 +82,7 @@ class TestAccountEdiFacturx(AccountEdiTestCommon):
|
||||
</SpecifiedTradeProduct>
|
||||
<SpecifiedLineTradeAgreement>
|
||||
<GrossPriceProductTradePrice>
|
||||
<ChargeAmount currencyID="Gol">1100.000</ChargeAmount>
|
||||
<ChargeAmount currencyID="Gol">275.000</ChargeAmount>
|
||||
<AppliedTradeAllowanceCharge>
|
||||
<ChargeIndicator>
|
||||
<Indicator>true</Indicator>
|
||||
@@ -90,6 +90,9 @@ class TestAccountEdiFacturx(AccountEdiTestCommon):
|
||||
<CalculationPercent>20.0</CalculationPercent>
|
||||
</AppliedTradeAllowanceCharge>
|
||||
</GrossPriceProductTradePrice>
|
||||
<NetPriceProductTradePrice>
|
||||
<ChargeAmount currencyID="Gol">220.000</ChargeAmount>
|
||||
</NetPriceProductTradePrice>
|
||||
</SpecifiedLineTradeAgreement>
|
||||
<SpecifiedLineTradeDelivery>
|
||||
<BilledQuantity>5.0</BilledQuantity>
|
||||
@@ -171,8 +174,8 @@ class TestAccountEdiFacturx(AccountEdiTestCommon):
|
||||
})
|
||||
|
||||
applied_xpath = '''
|
||||
<xpath expr="//GrossPriceProductTradePrice/ChargeAmount" position="replace">
|
||||
<ChargeAmount currencyID="Gol">1000.000</ChargeAmount>
|
||||
<xpath expr="//NetPriceProductTradePrice/ChargeAmount" position="replace">
|
||||
<ChargeAmount currencyID="Gol">200.000</ChargeAmount>
|
||||
</xpath>
|
||||
<xpath expr="//SpecifiedLineTradeSettlement" position="replace">
|
||||
<SpecifiedLineTradeSettlement>
|
||||
|
||||
Reference in New Issue
Block a user