Skip to content

Commit

Permalink
[FIX] rma_account and rma_sale: following the comments that were made…
Browse files Browse the repository at this point in the history
… during the review
  • Loading branch information
chafique-delli committed Sep 10, 2024
1 parent 79b1798 commit d030394
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 11 deletions.
13 changes: 3 additions & 10 deletions rma_account/wizards/rma_refund.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def default_get(self, fields_list):
items = []
if active_model == "rma.order":
rma = rma_obj.browse(active_ids)
lines = rma.rma_line_ids
lines = rma.rma_line_ids.filtered(lambda x: x.qty_to_refund > 0)
else:
lines = rma_line_obj.browse(active_ids)
if len(lines.mapped("partner_id")) > 1:
Expand Down Expand Up @@ -105,16 +105,9 @@ def compute_refund(self):
return new_refund

def invoice_refund(self):
rma_line_obj = self.env["rma.order.line"]
rma_obj = self.env["rma.order"]
active_ids = self.env.context.get("active_ids") or []
active_model = self.env.context.get("active_model")
if active_model == "rma.order":
rma = rma_obj.browse(active_ids)
lines = rma.rma_line_ids
else:
lines = rma_line_obj.browse(active_ids)
lines = self.item_ids.line_id
for line in lines:

if line.state != "approved":
raise ValidationError(_("RMA %s is not approved") % line.name)
new_invoice = self.compute_refund()
Expand Down
2 changes: 1 addition & 1 deletion rma_sale/wizards/rma_make_sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def default_get(self, fields_list):
items = []
if active_model == "rma.order":
rma = rma_obj.browse(active_ids)
lines = rma.rma_line_ids
lines = rma.rma_line_ids.filtered(lambda x: x.qty_to_sell > 0)
else:
lines = rma_line_obj.browse(active_ids)
for line in lines:
Expand Down

0 comments on commit d030394

Please sign in to comment.