Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions rma/models/rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,9 @@ def _compute_show_refund_replace(self):

def _compute_delivery_picking_count(self):
for rma in self:
rma.delivery_picking_count = len(rma.delivery_move_ids.picking_id)
moves = rma.delivery_move_ids
moves += moves.move_dest_ids.filtered(lambda x: not x.rma_receiver_ids)
rma.delivery_picking_count = len(moves.picking_id)

@api.depends(
"delivery_move_ids",
Expand Down Expand Up @@ -1006,7 +1008,9 @@ def action_view_refund(self):

def action_view_delivery(self):
"""Invoked when 'Delivery' smart button in rma form view is clicked."""
return self._action_view_pickings(self.mapped("delivery_move_ids.picking_id"))
moves = self.delivery_move_ids
moves += moves.move_dest_ids.filtered(lambda x: not x.rma_receiver_ids)
return self._action_view_pickings(moves.mapped("picking_id"))

# Validation business methods
def _ensure_required_fields(self):
Expand Down
4 changes: 2 additions & 2 deletions rma/tests/test_rma.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_rma_replace_pick_ship(self):
self.assertEqual(out_picking.picking_type_id, self.warehouse.pick_type_id)
next_transfer = out_picking._get_next_transfers()
self.assertEqual(next_transfer.picking_type_id, self.warehouse.out_type_id)
self.assertEqual(rma.delivery_picking_count, 1)
self.assertEqual(rma.delivery_picking_count, 2)

def test_rma_replace_pick_pack_ship(self):
self.warehouse.write({"delivery_steps": "pick_pack_ship"})
Expand Down Expand Up @@ -257,7 +257,7 @@ def test_rma_replace_pick_pack_ship(self):
self.assertEqual(
next_transfer_extra.picking_type_id, self.warehouse.out_type_id
)
self.assertEqual(rma.delivery_picking_count, 1)
self.assertEqual(rma.delivery_picking_count, 2)

def test_computed(self):
# If partner changes, the invoice address is set
Expand Down
Loading