blob: 56f091067e1b0d060df50b26903ffde0f42f7042 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
from .common import PurchaseTestCommon
class TestPurchaseOrderProcess(PurchaseTestCommon):
def test_00_cancel_purchase_order_flow(self):
""" Test cancel purchase order with group user."""
# In order to test the cancel flow,start it from canceling confirmed purchase order.
purchase_order = self.env['purchase.order'].create({
'partner_id': self.env['res.partner'].create({'name': 'My Partner'}).id,
'state': 'draft',
})
po_edit_with_user = purchase_order.with_user(self.res_users_purchase_user)
# Confirm the purchase order.
po_edit_with_user.button_confirm()
# Check the "Approved" status after confirmed RFQ.
self.assertEqual(po_edit_with_user.state, 'purchase', 'Purchase: PO state should be "Purchase')
# First cancel receptions related to this order if order shipped.
po_edit_with_user.picking_ids.action_cancel()
# Able to cancel purchase order.
po_edit_with_user.button_cancel()
# Check that order is cancelled.
self.assertEqual(po_edit_with_user.state, 'cancel', 'Purchase: PO state should be "Cancel')
|