[FIX] include anglo-saxon price unit calculation in refunds.

Otherwise the anglo saxon entries won't be correct.
For example, the Interim (Delivered) account should balance
after receiving and triggering a refund on a customer rma.
This commit is contained in:
Jordi Ballester Alomar
2022-11-21 15:13:06 +01:00
committed by JasminSForgeFlow
parent 9f1b57f221
commit 5b6225b843
2 changed files with 14 additions and 0 deletions

View File

@@ -234,8 +234,15 @@ class AccountMoveLine(models.Model):
and bool(l.move_id.reversed_entry_id) == is_line_reversing
)
qty_refunded = sum(
<<<<<<< HEAD
x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id)
for x in posted_invoice_lines
=======
[
x.product_uom_id._compute_quantity(x.quantity, x.product_id.uom_id)
for x in posted_invoice_lines
]
>>>>>>> 614c98c ([FIX] include anglo-saxon price unit calculation in refunds.)
)
product = self.product_id.with_company(self.company_id).with_context(
is_returned=is_line_reversing

View File

@@ -20,4 +20,11 @@ class StockMove(models.Model):
!= self.product_id.categ_id.property_stock_valuation_account_id.id
):
line[2]["rma_line_id"] = self.rma_line_id.id
def _account_entry_move(self, qty, description, svl_id, cost):
res = super(StockMove, self)._account_entry_move(qty, description, svl_id, cost)
if self.company_id.anglo_saxon_accounting:
# Eventually reconcile together the invoice and valuation accounting
# entries on the stock interim accounts
self.rma_line_id._stock_account_anglo_saxon_reconcile_valuation()
return res