~yannick-buron/sale-wkfl/sale-wkfl

« back to all changes in this revision

Viewing changes to sale_cancel_reason/test/sale_order_cancel.yml

  • Committer: Guewen Baconnier
  • Date: 2014-01-10 13:51:27 UTC
  • mfrom: (19.5.4 add-sale_cancel_reason-jge)
  • Revision ID: guewen.baconnier@camptocamp.com-20140110135127-665ppsgwppory0v4
[ADD] sale_cancel_reason: When a sale order is canceled, a reason must be given, it is chosen from a configured list.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
-
 
2
  In order to test the choice of a cancel reason when canceling a sale order
 
3
  I create a new cancel reason
 
4
-
 
5
  !record {model: sale.order.cancel.reason, id: cancel_reason_test}:
 
6
    name: Canceled for tests
 
7
-
 
8
  Given I create a sale order
 
9
-
 
10
  !record {model: sale.order, id: sale_order_cancel_01}:
 
11
    partner_id: base.res_partner_2
 
12
    order_line:
 
13
      - product_id: product.product_product_7
 
14
        product_uom_qty: 8
 
15
-
 
16
  When I cancel it with the wizard asking for the reason
 
17
-
 
18
  !python {model: sale.order.cancel}: |
 
19
    context = {'active_model': 'sale.order',
 
20
               'active_ids': [ref('sale_order_cancel_01')],
 
21
               }
 
22
    reason_id = ref('cancel_reason_test')
 
23
    wizard_id = self.create(cr, uid,
 
24
                            {'reason_id': reason_id},
 
25
                            context=context)
 
26
    self.confirm_cancel(cr, uid, wizard_id, context=context)
 
27
-
 
28
  Then the sale order should be canceled
 
29
  and the reason stored
 
30
-
 
31
  !assert {model: sale.order, id: sale_order_cancel_01, string: the sale order should be canceled}:
 
32
    - state == 'cancel'
 
33
    - cancel_reason_id.id == ref('cancel_reason_test')