Skip to content

Commit

Permalink
fixup! [ADD] More test coverage for notify_user
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiplangatdan committed Aug 5, 2024
1 parent 02d7fea commit a433d8f
Showing 1 changed file with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -722,3 +722,32 @@ def test_notify_picking_problem(self):
self.assertEqual(
warning_activity.user_id, so_picking_id.company_id.notify_user_id
)

def test_raise_picking_problem(self):
self.company_a.sync_picking = True
self.company_b.sync_picking = True
self.company_a.sync_picking_failure_action = "raise"
self.company_b.sync_picking_failure_action = "raise"

purchase = self._create_purchase_order(
self.partner_company_b, self.consumable_product
)
purchase_2 = self._create_purchase_order(
self.partner_company_b, self.consumable_product
)
purchase.order_line += purchase.order_line.copy({"product_qty": 2})
sale = self._approve_po(purchase)
sale.action_confirm()

# validate the SO picking
so_picking_id = sale.picking_ids

# Link to a new purchase order so it can trigger
# `PO does not exist or has no receipts` in _sync_receipt_with_delivery
sale.auto_purchase_order_id = purchase_2

# Set quantities done on the picking and validate
for move in so_picking_id.move_lines:
move.quantity_done = move.product_uom_qty
with self.assertRaises(UserError):
so_picking_id.button_validate()

0 comments on commit a433d8f

Please sign in to comment.