[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
parent 9b58e235bf
commit 95b1d179a2
3 changed files with 23 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

View File

@@ -54,8 +54,13 @@ class TestRmaAccountUnreconciled(TestRma):
rma_line.action_rma_approve()
self.assertFalse(rma_line.unreconciled)
self.rma_customer_id.rma_line_ids.action_rma_to_approve()
<<<<<<< HEAD
wizard = self.rma_make_pickingwith_context(
**{
=======
wizard = self.rma_make_picking.with_context(
{
>>>>>>> 614c98c ([FIX] include anglo-saxon price unit calculation in refunds.)
"active_ids": self.rma_customer_id.rma_line_ids.ids,
"active_model": "rma.order.line",
"picking_type": "incoming",
@@ -73,7 +78,11 @@ class TestRmaAccountUnreconciled(TestRma):
rma_line._compute_unreconciled()
self.assertTrue(rma_line.unreconciled)
make_refund = self.rma_refund_wiz.with_context(
<<<<<<< HEAD
**{
=======
{
>>>>>>> 614c98c ([FIX] include anglo-saxon price unit calculation in refunds.)
"customer": True,
"active_ids": self.rma_customer_id.rma_line_ids.ids,
"active_model": "rma.order.line",