mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[FIX] rma_account: Auto-reconcile supplier refunds
This commit is contained in:
@@ -99,15 +99,19 @@ class AccountMove(models.Model):
|
||||
|
||||
def _stock_account_get_last_step_stock_moves(self):
|
||||
rslt = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
|
||||
for invoice in self.filtered(lambda x: x.move_type == "out_invoice"):
|
||||
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
|
||||
lambda x: x.state == "done" and x.location_dest_id.usage == "customer"
|
||||
)
|
||||
for invoice in self.filtered(lambda x: x.move_type == "out_refund"):
|
||||
# Add refunds generated from the RMA
|
||||
for invoice in self.filtered(
|
||||
lambda x: x.move_type in ("out_invoice", "out_refund")
|
||||
):
|
||||
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
|
||||
lambda x: x.state == "done" and x.location_id.usage == "customer"
|
||||
)
|
||||
for invoice in self.filtered(
|
||||
lambda x: x.move_type in ("in_invoice", "in_refund")
|
||||
):
|
||||
# Add refunds generated from the RMA
|
||||
rslt += invoice.mapped("line_ids.rma_line_id.move_ids").filtered(
|
||||
lambda x: x.state == "done" and x.location_dest_id.usage == "supplier"
|
||||
)
|
||||
return rslt
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user