[IMP] rma: Added serial/lot selection on from stock move wizard on rma groups

- added restriction to approve rma with product tracking on serial, should be only one to receive
This commit is contained in:
Christopher Ormaza
2022-01-25 11:26:23 -05:00
committed by Florian da Costa
parent 3c51940502
commit f1581f1ba4
3 changed files with 68 additions and 7 deletions

View File

@@ -595,7 +595,19 @@ class RmaOrderLine(models.Model):
self.reference_move_id = False
return True
def _check_production_lot_assigned(self):
for rec in self:
if rec.product_id.tracking == "serial" and rec.product_qty != 1:
raise ValidationError(
_(
"Product %s has serial tracking configuration, "
"quantity to receive should be 1"
)
% (rec.product_id.display_name)
)
def action_rma_to_approve(self):
self._check_production_lot_assigned()
self.write({"state": "to_approve"})
for rec in self:
if rec.product_id.rma_approval_policy == "one_step":