mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
@@ -4,6 +4,7 @@
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools import float_compare
|
||||
|
||||
|
||||
class StockMove(models.Model):
|
||||
@@ -60,7 +61,18 @@ class StockMove(models.Model):
|
||||
"""
|
||||
for move in self.filtered(lambda r: r.state not in ("done", "cancel")):
|
||||
rma_receiver = move.sudo().rma_receiver_ids
|
||||
if rma_receiver and move.quantity_done != rma_receiver.product_uom_qty:
|
||||
qty_prec = self.env["decimal.precision"].precision_get(
|
||||
"Product Unit of Measure"
|
||||
)
|
||||
if (
|
||||
rma_receiver
|
||||
and float_compare(
|
||||
move.quantity_done,
|
||||
rma_receiver.product_uom_qty,
|
||||
precision_digits=qty_prec,
|
||||
)
|
||||
!= 0
|
||||
):
|
||||
raise ValidationError(
|
||||
_(
|
||||
"The quantity done for the product '%(id)s' must "
|
||||
|
||||
@@ -31,7 +31,7 @@ class StockPicking(models.Model):
|
||||
def action_view_rma(self):
|
||||
self.ensure_one()
|
||||
action = self.env["ir.actions.act_window"]._for_xml_id("rma.rma_action")
|
||||
rma = self.move_lines.mapped("rma_ids")
|
||||
rma = self.move_ids.rma_ids
|
||||
if len(rma) == 1:
|
||||
action.update(
|
||||
res_id=rma.id,
|
||||
|
||||
Reference in New Issue
Block a user