[FIX] rma_scrap: various fixes

This commit is contained in:
Jordi Ballester Alomar
2022-11-03 18:13:52 +01:00
committed by SergiCForgeFlow
parent 70289bdadd
commit 0f59a8048f
9 changed files with 83 additions and 32 deletions

View File

@@ -8,12 +8,8 @@ class RmaOrder(models.Model):
def _compute_scrap_count(self):
for order in self:
moves = (
order.mapped("rma_line_ids.move_ids")
.filtered(lambda m: m.is_rma_scrap)
.move_line_ids
)
order.scrap_count = len(moves)
scraps = order.mapped("rma_line_ids.scrap_ids")
order.scrap_count = len(scraps)
scrap_count = fields.Integer(compute="_compute_scrap_count", string="# Scrap")