diff --git a/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py index 45f6b840b3f..cd183b3a956 100644 --- a/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py +++ b/purchase_sale_inter_company/tests/test_inter_company_purchase_sale.py @@ -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()