Merge PR #318 into 13.0

Signed-off-by pedrobaeza
This commit is contained in:
OCA-git-bot
2022-10-26 11:40:52 +00:00

View File

@@ -1134,11 +1134,14 @@ class Rma(models.Model):
self._ensure_can_be_replaced() self._ensure_can_be_replaced()
moves_before = self.delivery_move_ids moves_before = self.delivery_move_ids
self._action_launch_stock_rule(scheduled_date, warehouse, product, qty, uom) self._action_launch_stock_rule(scheduled_date, warehouse, product, qty, uom)
new_move = self.delivery_move_ids - moves_before new_moves = self.delivery_move_ids - moves_before
if new_move: self.reception_move_id.move_dest_ids += new_moves
self.reception_move_id.move_dest_ids = [(4, new_move.id)] body = ""
self.message_post( # The product replacement could explode into several moves like in the case of
body=_( # MRP BoM Kits
for new_move in new_moves:
body += (
_(
"Replacement: " "Replacement: "
'Move <a href="#" data-oe-model="stock.move" ' 'Move <a href="#" data-oe-model="stock.move" '
'data-oe-id="%d">%s</a> (Picking <a href="#" ' 'data-oe-id="%d">%s</a> (Picking <a href="#" '
@@ -1151,19 +1154,20 @@ class Rma(models.Model):
new_move.picking_id.id, new_move.picking_id.id,
new_move.picking_id.name, new_move.picking_id.name,
) )
+ "\n"
) )
else: self.message_post(
self.message_post( body=body
body=_( or _(
"Replacement:<br/>" "Replacement:<br/>"
'Product <a href="#" data-oe-model="product.product" ' 'Product <a href="#" data-oe-model="product.product" '
'data-oe-id="%d">%s</a><br/>' 'data-oe-id="%d">%s</a><br/>'
"Quantity %f %s<br/>" "Quantity %f %s<br/>"
"This replacement did not create a new move, but one of " "This replacement did not create a new move, but one of "
"the previously created moves was updated with this data." "the previously created moves was updated with this data."
)
% (product.id, product.display_name, qty, uom.name)
) )
% (product.id, product.display_name, qty, uom.name)
)
if self.state != "waiting_replacement": if self.state != "waiting_replacement":
self.state = "waiting_replacement" self.state = "waiting_replacement"