~unifield-team/unifield-wm/wm-2418-rw-fix

« back to all changes in this revision

Viewing changes to analytic_distribution_supply/test/commitment.yml

  • Committer: pierre-marie
  • Date: 2012-07-25 14:13:53 UTC
  • mfrom: (1038 unifield-wm)
  • mto: This revision was merged to the branch mainline in revision 1060.
  • Revision ID: pierre-marie@pierre-marie-laptop-20120725141353-9iwjdr1kltbei90e
Merge

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
-
2
 
  I create a purchase order
 
2
  I create a regular purchase order
3
3
-
4
4
  !record {model: purchase.order, id: purchase_order_po0}:
5
5
    amount_tax: 0.0
38
38
  We validate the purchase
39
39
-
40
40
  !workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po0}
 
41
-
 
42
  We check that a commitment have been created for this PO 0. Then check commitment <-> PO link.
 
43
-
 
44
  !python {model: account.commitment}: |
 
45
    search_ids = self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_po0"))])
 
46
    assert search_ids != False, "No commitment found"
 
47
    purchase = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_po0"))
 
48
    for id in search_ids:
 
49
        assert id in [x.id for x in purchase.commitment_ids], "No link between commitments and PO"
 
50
-
 
51
  I create a PO with an Intermission partner.
 
52
-
 
53
  !record {model: purchase.order, id: purchase_order_po1}:
 
54
    amount_tax: 0.0
 
55
    amount_total: 1.0
 
56
    amount_untaxed: 1.0
 
57
    company_id: base.main_company
 
58
    date_order: !eval time.strftime('%Y-%m-%d')
 
59
    invoice_method: picking
 
60
    location_id: stock.stock_location_stock
 
61
    minimum_planned_date: !eval time.strftime('%Y-%m-%d')
 
62
    partner_address_id: res_partner_address_42
 
63
    partner_id: res_partner_mission_42
 
64
    pricelist_id: purchase.list0
 
65
    from_yml_test: False
 
66
    delivery_confirmed_date: !eval time.strftime('%Y-%m-%d')
 
67
    analytic_distribution_id: global_distrib_1
 
68
-
 
69
  Then I add an order line to this purchase
 
70
-
 
71
  !record {model: purchase.order.line, id: purchase_order_line_book_0}:
 
72
    company_id: base.main_company
 
73
    date_planned: !eval time.strftime('%Y-%m-%d')
 
74
    order_id: purchase_order_po1
 
75
    partner_id: res_partner_africom0
 
76
    price_unit: 100
 
77
    product_id: product_product_book0
 
78
    product_qty: 1.0
 
79
    product_uom: product.product_uom_unit
 
80
    state: draft
 
81
    analytic_distribution_id: global_distrib_1
 
82
-
 
83
  We confirm the purchase
 
84
-
 
85
  !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
 
86
-
 
87
  We validate the purchase
 
88
-
 
89
  !workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po1}
 
90
-
 
91
  We check that NO commitments have been created for this PO 1. Then check commitment <-> PO link.
 
92
-
 
93
  !python {model: account.commitment}: |
 
94
    search_ids = self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_po1"))])
 
95
    assert search_ids == [], "Commitment found. This should not!"
 
96
    purchase = self.pool.get('purchase.order').browse(cr, uid, ref("purchase_order_po1"))
 
97
    commitment_ids = [x.id for x in purchase.commitment_ids]
 
98
    assert not commitment_ids, "This PO shouln't have ANY commitment!"