[FIX] account_edi: tax (included) amount shows as discount in CFDI
1. Configure MX company, make sure testing certificate and vat are loaded into the company 2. Sign an invoice with 16% included in price No errors will be shown but opening the resulting CFDI xml will show a discount "Descuento" equal to the tax amount, which is incorrect opw-2665082 closes odoo/odoo#79501 X-original-commit: 3f58aefe607e562044617e2c9dbecb1afd2de586 Related: odoo/enterprise#22170 Signed-off-by: Laurent Smet <las@openerp.com>
This commit is contained in:
committed by
Laurent Smet
parent
262d3704ae
commit
59c2d7fe53
@@ -585,16 +585,20 @@ class AccountMoveLine(models.Model):
|
||||
'''
|
||||
self.ensure_one()
|
||||
|
||||
if self.discount == 100.0:
|
||||
gross_price_subtotal = self.currency_id.round(self.price_unit * self.quantity)
|
||||
else:
|
||||
gross_price_subtotal = self.currency_id.round(self.price_subtotal / (1 - self.discount / 100.0))
|
||||
|
||||
res = {
|
||||
'line': self,
|
||||
'price_unit_after_discount': self.price_unit * (1 - (self.discount / 100.0)),
|
||||
'price_subtotal_before_discount': self.currency_id.round(self.price_unit * self.quantity),
|
||||
'price_unit_after_discount': self.currency_id.round(self.price_unit * (1 - (self.discount / 100.0))),
|
||||
'price_subtotal_before_discount': gross_price_subtotal,
|
||||
'price_subtotal_unit': self.currency_id.round(self.price_subtotal / self.quantity) if self.quantity else 0.0,
|
||||
'price_total_unit': self.currency_id.round(self.price_total / self.quantity) if self.quantity else 0.0,
|
||||
'price_discount': gross_price_subtotal - self.price_subtotal,
|
||||
'gross_price_total_unit': self.currency_id.round(gross_price_subtotal / self.quantity) if self.quantity else 0.0,
|
||||
}
|
||||
|
||||
res['price_discount'] = res['price_subtotal_before_discount'] - self.price_subtotal
|
||||
|
||||
return res
|
||||
|
||||
def reconcile(self):
|
||||
|
||||
Reference in New Issue
Block a user