[FIX] repair: pick moves automaticaly in repair
Since PR #137864 We do not have quantity done anymore and we use the picked field to know if something is picked or not. But we remove the immediate transfer wizard and we consider instead than if nothing is mark as pick, everything is pick. We will do the same for repair because it would confusing to have a different behavior closes odoo/odoo#140322 Signed-off-by: William Henrotin (whe) <whe@odoo.com>
This commit is contained in:
@@ -385,6 +385,8 @@ class Repair(models.Model):
|
||||
no_service_policy = 'service_policy' not in self.env['product.template']
|
||||
#SOL qty delivered = repair.move_ids.quantity
|
||||
for repair in self:
|
||||
if all(not move.picked for move in repair.move_ids):
|
||||
repair.move_ids.picked = True
|
||||
if repair.sale_order_line_id:
|
||||
ro_origin_product = repair.sale_order_line_id.product_template_id
|
||||
# TODO: As 'service_policy' only appears with 'sale_project' module, isolate conditions related to this field in a 'sale_project_repair' module if it's worth
|
||||
@@ -392,6 +394,7 @@ class Repair(models.Model):
|
||||
repair.sale_order_line_id.qty_delivered = repair.sale_order_line_id.product_uom_qty
|
||||
if not repair.product_id:
|
||||
continue
|
||||
|
||||
if repair.product_id.product_tmpl_id.tracking != 'none' and not repair.lot_id:
|
||||
raise ValidationError(_(
|
||||
"Serial number is required for product to repair : %s",
|
||||
@@ -412,6 +415,7 @@ class Repair(models.Model):
|
||||
'partner_id': repair.partner_id.id,
|
||||
'location_id': repair.location_id.id,
|
||||
'location_dest_id': repair.location_id.id,
|
||||
'picked': True,
|
||||
'move_line_ids': [(0, 0, {
|
||||
'product_id': repair.product_id.id,
|
||||
'lot_id': repair.lot_id.id,
|
||||
@@ -436,7 +440,6 @@ class Repair(models.Model):
|
||||
move_id = repair_move.get(repair.id, False)
|
||||
if move_id:
|
||||
repair.move_id = move_id
|
||||
self.sale_order_line_id.move_ids.picked = True
|
||||
all_moves = self.move_ids + product_moves
|
||||
all_moves._action_done()
|
||||
|
||||
|
||||
@@ -414,7 +414,6 @@ class TestRepair(common.TransactionCase):
|
||||
repair_order.action_repair_start()
|
||||
for line in repair_order.move_ids:
|
||||
line.quantity = line.product_uom_qty
|
||||
repair_order.move_ids.picked = True
|
||||
repair_order.action_repair_end()
|
||||
self.assertTrue(float_is_zero(order_line.qty_delivered, 2))
|
||||
self.assertEqual(float_compare(sol_part_0.product_uom_qty, ro_line_0.quantity, 2), 0)
|
||||
|
||||
Reference in New Issue
Block a user