Clear the Shopify tax adjustment before recalculating it

Closes #14143
(grafted from 27d0430555b070fcca637c9a0dab40c083d7db15)

--HG--
branch : 7.0
This commit is contained in:
Cédric Krier
2025-08-21 10:38:46 +02:00
parent 782c141134
commit f69b50af84
2 changed files with 3 additions and 1 deletions
@@ -599,7 +599,7 @@ Ignore shipment exception::
>>> sale.reload()
>>> invoice, = sale.invoices
>>> invoice.total_amount
Decimal('164.52')
Decimal('164.53')
>>> payment, = sale.payments
>>> payment.state
'succeeded'
+2
View File
@@ -573,6 +573,7 @@ class Shop(metaclass=PoolMeta):
sale.untaxed_amount_cache = None
sale.tax_amount_cache = None
sale.total_amount_cache = None
sale.shopify_tax_adjustment = None
to_update[sale] = order
states_to_restore[sale.state].append(sale)
Sale.write(list(to_update.keys()), {'state': 'draft'})
@@ -582,6 +583,7 @@ class Shop(metaclass=PoolMeta):
for sale, order in to_update.items():
sale.shopify_tax_adjustment = (
Decimal(order.current_total_price) - sale.total_amount)
Sale.save(to_update.keys())
Sale.store_cache(to_update.keys())
Amendment._clear_sale(to_update.keys())
to_process, to_quote = [], []