mirror of
https://github.com/ForgeFlow/stock-rma.git
synced 2025-01-21 12:57:49 +02:00
[IMP] rma: prevent the creation of zero qty moves
This commit is contained in:
committed by
DavidJForgeFlow
parent
2760f14ed0
commit
cdafac7a61
@@ -5,7 +5,7 @@ import time
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT as DT_FORMAT
|
||||
from odoo.tools import DEFAULT_SERVER_DATETIME_FORMAT as DT_FORMAT, float_compare
|
||||
|
||||
|
||||
class RmaMakePicking(models.TransientModel):
|
||||
@@ -148,7 +148,12 @@ class RmaMakePicking(models.TransientModel):
|
||||
else:
|
||||
qty = item.qty_to_deliver
|
||||
values = self._get_procurement_data(item, group, qty, picking_type)
|
||||
values = dict(values, rma_line_id=item.line_id, rma_id=item.line_id.rma_id)
|
||||
product = item.line_id.product_id
|
||||
if float_compare(qty, 0, product.uom_id.rounding) != 1:
|
||||
raise ValidationError(
|
||||
_("No quantity to transfer on %s shipment of product %s.")
|
||||
% (_(picking_type), product.default_code or product.name)
|
||||
)
|
||||
# create picking
|
||||
procurements = []
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user