~unifield-team/unifield-wm/us-826

« back to all changes in this revision

Viewing changes to sourcing/test/2lines_supplier.yml

  • Committer: Quentin THEURET
  • Date: 2012-02-02 10:10:59 UTC
  • mto: This revision was merged to the branch mainline in revision 587.
  • Revision ID: qt@tempo-consulting.fr-20120202101059-y8gkodfqbdmf93sb
UF-716 [IMP] Change columns titles

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
-
2
 
  I create a product category
3
 
-
4
 
  !record {model: product.category, id: prod_cat1}:
5
 
    name: Categ1
6
 
-
7
 
    I create the product P1
8
 
-
9
 
  !record {model: product.product, id: product1}:
10
 
    categ_id: prod_cat1
11
 
    cost_method: standard
12
 
    mes_type: fixed
13
 
    name: P1
14
 
    price_margin: 2.0
15
 
    procure_method: make_to_order
16
 
    property_stock_inventory: stock.location_inventory
17
 
    property_stock_procurement: stock.location_procurement
18
 
    property_stock_production: stock.location_production
19
 
    seller_delay: '1'
20
 
    standard_price: 12.00
21
 
    supply_method: buy
22
 
    type: product
23
 
    uom_id: product.product_uom_unit
24
 
    uom_po_id: product.product_uom_unit
25
 
    volume : 0.0
26
 
    warranty: 0.0
27
 
    weight: 0.0
28
 
    weight_net: 0.0
29
 
    seller_ids:
30
 
      - sequence: 10
31
 
        min_qty: 0.00
32
 
        name: res_partner_a0
33
 
-
34
 
    I create the product P2
35
 
-
36
 
  !record {model: product.product, id: product2}:
37
 
    categ_id: prod_cat1
38
 
    cost_method: standard
39
 
    mes_type: fixed
40
 
    name: P2
41
 
    price_margin: 2.0
42
 
    procure_method: make_to_order
43
 
    property_stock_inventory: stock.location_inventory
44
 
    property_stock_procurement: stock.location_procurement
45
 
    property_stock_production: stock.location_production
46
 
    seller_delay: '1'
47
 
    standard_price: 25.00
48
 
    supply_method: buy
49
 
    type: product
50
 
    uom_id: product.product_uom_unit
51
 
    uom_po_id: product.product_uom_unit
52
 
    volume : 0.0
53
 
    warranty: 0.0
54
 
    weight: 0.0
55
 
    weight_net: 0.0
56
 
    seller_ids:
57
 
      - sequence: 10
58
 
        min_qty: 0.00
59
 
        name: res_partner_a0
60
 
-
61
 
    I create the product P3
62
 
-
63
 
  !record {model: product.product, id: product3}:
64
 
    categ_id: prod_cat1
65
 
    cost_method: standard
66
 
    mes_type: fixed
67
 
    name: P3
68
 
    price_margin: 2.0
69
 
    procure_method: make_to_order
70
 
    property_stock_inventory: stock.location_inventory
71
 
    property_stock_procurement: stock.location_procurement
72
 
    property_stock_production: stock.location_production
73
 
    seller_delay: '1'
74
 
    standard_price: 30.00
75
 
    supply_method: buy
76
 
    type: product
77
 
    uom_id: product.product_uom_unit
78
 
    uom_po_id: product.product_uom_unit
79
 
    volume : 0.0
80
 
    warranty: 0.0
81
 
    weight: 0.0
82
 
    weight_net: 0.0
83
 
    seller_ids:
84
 
      - sequence: 10
85
 
        min_qty: 0.00
86
 
        name: res_partner_b0
87
 
-
88
 
    I create the product P4
89
 
-
90
 
  !record {model: product.product, id: product4}:
91
 
    categ_id: prod_cat1
92
 
    cost_method: standard
93
 
    mes_type: fixed
94
 
    name: P4
95
 
    price_margin: 2.0
96
 
    procure_method: make_to_stock
97
 
    property_stock_inventory: stock.location_inventory
98
 
    property_stock_procurement: stock.location_procurement
99
 
    property_stock_production: stock.location_production
100
 
    seller_delay: '1'
101
 
    standard_price: 70.00
102
 
    supply_method: buy
103
 
    type: product
104
 
    uom_id: product.product_uom_unit
105
 
    uom_po_id: product.product_uom_unit
106
 
    volume : 0.0
107
 
    warranty: 0.0
108
 
    weight: 0.0
109
 
    weight_net: 0.0
110
 
-
111
 
  I create a sale order for this 4 products
112
 
-
113
 
  !record {model: sale.order, id: so1}:
114
 
    name: Regular1
115
 
    company_id: base.main_company
116
 
    picking_policy: direct
117
 
    order_policy: manual
118
 
    invoice_quantity: order
119
 
    partner_order_id: res_partner_address_0
120
 
    partner_invoice_id: res_partner_address_0
121
 
    partner_shipping_id: res_partner_address_0
122
 
    partner_id: res_partner_a0
123
 
    pricelist_id: product.list0
124
 
    order_type: regular
125
 
    order_line:
126
 
      - name: P1
127
 
        price_unit: 5000
128
 
        product_uom: product.product_uom_unit
129
 
        product_uom_qty: 5.0
130
 
        state: draft
131
 
        delay: 7.0
132
 
        product_id: product1
133
 
        product_uos_qty: 5.0
134
 
        th_weight: 0.0
135
 
        type: make_to_order
136
 
      - name: P4
137
 
        price_unit: 5000
138
 
        product_uom: product.product_uom_unit
139
 
        product_uom_qty: 2.0
140
 
        state: draft
141
 
        delay: 7.0
142
 
        product_id: product4
143
 
        product_uos_qty: 2.0
144
 
        th_weight: 0.0
145
 
        type: make_to_stock
146
 
      - name: P2
147
 
        price_unit: 200
148
 
        product_uom: product.product_uom_unit
149
 
        product_uom_qty: 1.0
150
 
        state: draft
151
 
        delay: 7.0
152
 
        product_id: product2
153
 
        product_uos_qty: 1.0
154
 
        th_weight: 0.0
155
 
        type: make_to_order
156
 
      - name: P3
157
 
        price_unit: 100
158
 
        product_uom: product.product_uom_unit
159
 
        product_uom_qty: 3.0
160
 
        state: draft
161
 
        delay: 7.0
162
 
        product_id: product3
163
 
        product_uos_qty: 3.0
164
 
        th_weight: 0.0
165
 
        type: make_to_order
166
 
-
167
 
  I confirm this sale order
168
 
-
169
 
  !workflow {model: sale.order, action: order_confirm, ref: so1}
170
 
-
171
 
  I run the scheduler
172
 
-
173
 
  !python {model: procurement.order}: |
174
 
    self.run_scheduler(cr, uid)
175
 
-
176
 
  I check if a PO lines has been created
177
 
-
178
 
  !python {model: purchase.order.line}: |
179
 
    p4_line_ids = self.search(cr, uid, [('product_id', '=', ref('product4'))])
180
 
    assert not p4_line_ids, "A line has been created for the product P4"
181
 
    p1_line_ids = self.search(cr, uid, [('product_id', '=', ref('product1'))])
182
 
    assert len(p1_line_ids) == 1, "No line created for the product P1"
183
 
    p2_line_ids = self.search(cr, uid, [('product_id', '=', ref('product2'))])
184
 
    assert len(p2_line_ids) == 1, "No line created for the product P2"
185
 
    p3_line_ids = self.search(cr, uid, [('product_id', '=', ref('product3'))])
186
 
    assert len(p3_line_ids) == 1, "NO line created for the product P3"
187
 
 
188
 
    p1_line = self.browse(cr, uid, p1_line_ids[0])
189
 
    p2_line = self.browse(cr, uid, p2_line_ids[0])
190
 
    p3_line = self.browse(cr, uid, p3_line_ids[0])
191
 
    assert p1_line.order_id.id == p2_line.order_id.id, "The system has generated 2 PO for P1 and P2 instead of only one"
192
 
    assert p3_line.order_id.id != p1_line.order_id.id, "The system has generated one PO for P1 and P3 instead of 2"