-
  Purchase user can also cancel order therfore test with that user which have Purchase user rights.
-
  !context
    uid: 'res_users_purchase_user'
-
   In order to test the cancel flow, I start it from canceling confirmed purchase order.
-
  I confirm the purchase order.
-
  !python {model: purchase.order}: |
    self.button_confirm(cr, uid, [ref("purchase_order_5")])
-
  I check the "Approved" status  after confirmed RFQ.
-
  !assert {model: purchase.order, id: purchase_order_5}:
    - state == 'purchase'
-
  First I cancel  receptions related to this order if order shipped.
-
  !python {model: purchase.order}: |
    order = self.browse(cr, uid, ref("purchase_order_5"))
    self.pool.get('stock.picking').action_cancel(cr, uid, [picking.id for picking in  order.picking_ids])
-
  Now I am able to cancel purchase order.
-
  !python {model: purchase.order}: |
    self.button_cancel(cr, uid, [ref("purchase_order_5")])
-
  I check that order is cancelled.
-
  !assert {model: purchase.order, id: purchase_order_5}:
    - state == 'cancel'
