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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
|
-
In order to test the new purchase order line screen, we first create new partners.
We then create new products with different internal and supplier configuration (code and name).
Finally we create purchase orders with purchase order lines for these different products.
Creating a product.category record
-
!record {model: product.category, id: product_category_testproducts0}:
name: Test products
sequence: 0.0
-
I create the first partner,
Name AFRICOM
Customer <checked>
Supplier <checked>
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_africom0}:
credit_limit: 0.0
debit_limit: 0.0
name: AFRICOM
supplier: true
-
I create the second partner,
Name AlainDeLoin
Customer <checked>
Supplier <checked>
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_alaindeloin0}:
credit_limit: 0.0
debit_limit: 0.0
name: AlainDeLoin
supplier: true
-
I create the third partner,
Name Berthe
Customer <checked>
Supplier <checked>
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_berthe0}:
credit_limit: 0.0
debit_limit: 0.0
name: Berthe
supplier: true
-
I create the corresponding addresses
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.au
partner_id: res_partner_africom0
street: street
type: default
zip: '1234'
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_alaindeloin0
street: street
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_berthe0
street: street
-
I create the first product, with no specified suppliers,
Name Boite à chaussures
Reference CHAUSS INT 1234
Creating a product.product record
-
!record {model: product.product, id: product_product_boitechaussures0}:
categ_id: product_category_testproducts0
cost_method: standard
default_code: CHAUSS-INT-1234
mes_type: fixed
name: Boite \xc3\xa0 chaussures
name_template: Boite \xc3\xa0 chaussures
procure_method: make_to_stock
seller_delay: '1'
seller_qty: 0.0
standard_price: 1.0
supply_method: buy
type: consu
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
valuation: manual_periodic
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
I create the second product, with one specified supplier,
Name Camembert
Reference CAM-INT-1234
Supplier AFRICOM
* Supplier product Name Fromage qui pue Africom
* Supplier product Code PUE AFRI 1234
Creating a product.product record
-
!record {model: product.product, id: product_product_camembert0}:
categ_id: product_category_testproducts0
cost_method: standard
default_code: CAM-INT-1234
mes_type: fixed
name: Camembert
name_template: Camembert
procure_method: make_to_stock
seller_delay: '1'
seller_id: res_partner_africom0
seller_ids:
- delay: 1
min_qty: 0.0
name: res_partner_africom0
product_code: PUE-AFRI-1234
product_name: Fromage qui pue Africom
seller_qty: 0.0
standard_price: 1.0
supply_method: buy
type: consu
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
valuation: manual_periodic
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
I create the third product, with two specified supplier, the first one with supplier info, the second one without,
Name Pneu
Reference PNEU INT 1234
Supplier AlainDeLoin
* Supplier product Name Pneu AlainDeLoin
* Supplier product Code PNEU ALAIN 1234
Supplier Berthe
Creating a product.product record
-
!record {model: product.product, id: product_product_pneu0}:
categ_id: product_category_testproducts0
cost_method: standard
default_code: PNEU-INT-1234
mes_type: fixed
name: Pneu
name_template: Pneu
procure_method: make_to_stock
seller_delay: '1'
seller_id: res_partner_alaindeloin0
seller_ids:
- delay: 1
min_qty: 0.0
name: res_partner_alaindeloin0
product_code: PNEU-ALAIN-1234
product_name: Pneu AlainDeLoin
- delay: 1
min_qty: 0.0
name: res_partner_berthe0
seller_qty: 0.0
standard_price: 1.0
supply_method: buy
type: consu
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
valuation: manual_periodic
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
I create the first purchase order
Supplier AFRICOM
The selected product has AFRICOM as specified supplier
-
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po1}:
amount_tax: 0.0
amount_total: 1.0
amount_untaxed: 1.0
company_id: base.main_company
date_order: '2011-03-15'
invoice_method: order
location_id: stock.stock_location_stock
minimum_planned_date: '2011-03-15'
partner_address_id: res_partner_address_0
partner_id: res_partner_africom0
pricelist_id: purchase.list0
-
I create the order line
Creating a purchase.order.line record
-
!record {model: purchase.order.line, id: purchase_order_line_boitechaussures0}:
company_id: base.main_company
date_planned: '2011-03-15'
internal_code: CHAUSS-INT-1234
internal_name: Boite \xc3\xa0 chaussures
name: Boite \xc3\xa0 chaussures
order_id: purchase_order_po1
partner_id: res_partner_africom0
price_unit: 1.0
product_id: product_product_boitechaussures0
product_qty: 1.0
product_uom: product.product_uom_unit
state: draft
-
I check the onchange function, it should correspond
to data from selected product supplier
gather corresponding purchase order line
retrieve the values from onChange function
compare the data with the one from pol
name
internal_code
internal_name
supplier_code
supplier_name
-
!python {model: purchase.order.line}: |
pol = self.browse(cr, uid, ref("purchase_order_line_boitechaussures0"))
result = pol.product_id_change(pol.order_id.pricelist_id.id, pol.product_id.id,
pol.product_qty, pol.product_uom.id, pol.order_id.partner_id.id,
pol.order_id.date_order, pol.order_id.fiscal_position.id,
pol.date_planned, pol.name, pol.price_unit, pol.notes)
innerDic = result['value']
assert innerDic['name'] == pol.name
assert (innerDic['internal_code'] or '') == (pol.internal_code or ''), "internal_code %s vs %s" % (innerDic['internal_code'], pol.internal_code)
assert (innerDic['internal_name'] or '') == (pol.internal_name or ''), "internal_name %s vs %s" % (innerDic['internal_name'], pol.internal_name)
assert (innerDic['supplier_code'] or '') == (pol.supplier_code or ''), "supplier_code %s vs %s" % (innerDic['supplier_code'], pol.supplier_code)
assert (innerDic['supplier_name'] or '') == (pol.supplier_name or ''), "supplier_name %s vs %s" % (innerDic['supplier_name'], pol.supplier_name)
-
create a PO with supplier alaindeloin and product pneu
pneu has alaindeloin as one of its supplier. Supplier
information is specified
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po0}:
amount_tax: 0.0
amount_total: 1.0
amount_untaxed: 1.0
company_id: base.main_company
date_order: '2011-03-15'
invoice_method: order
location_id: stock.stock_location_stock
minimum_planned_date: '2011-03-16'
partner_address_id: res_partner_address_2
partner_id: res_partner_alaindeloin0
pricelist_id: purchase.list0
-
I create the order line
Creating a purchase.order.line record
-
!record {model: purchase.order.line, id: purchase_order_line_pneu2}:
company_id: base.main_company
date_planned: '2011-03-16'
internal_code: PNEU-INT-1234
internal_name: Pneu
name: Pneu
order_id: purchase_order_po0
partner_id: res_partner_alaindeloin0
price_unit: 1.0
product_id: product_product_pneu0
product_qty: 1.0
product_uom: product.product_uom_unit
state: draft
supplier_code: PNEU-ALAIN-1234
supplier_name: Pneu AlainDeLoin
-
I check the onchange function, it should correspond
to data from selected product supplier
gather corresponding purchase order line
retrieve the values from onChange function
compare the data with the one from pol
name
internal_code
internal_name
supplier_code
supplier_name
-
!python {model: purchase.order.line}: |
pol = self.browse(cr, uid, ref("purchase_order_line_pneu2"))
result = pol.product_id_change(pol.order_id.pricelist_id.id, pol.product_id.id,
pol.product_qty, pol.product_uom.id, pol.order_id.partner_id.id,
pol.order_id.date_order, pol.order_id.fiscal_position.id,
pol.date_planned, pol.name, pol.price_unit, pol.notes)
innerDic = result['value']
assert innerDic['name'] == pol.name
assert (innerDic['internal_code'] or '') == (pol.internal_code or ''), "internal_code %s vs %s" % (innerDic['internal_code'], pol.internal_code)
assert (innerDic['internal_name'] or '') == (pol.internal_name or ''), "internal_name %s vs %s" % (innerDic['internal_name'], pol.internal_name)
assert (innerDic['supplier_code'] or '') == (pol.supplier_code or ''), "supplier_code %s vs %s" % (innerDic['supplier_code'], pol.supplier_code)
assert (innerDic['supplier_name'] or '') == (pol.supplier_name or ''), "supplier_name %s vs %s" % (innerDic['supplier_name'], pol.supplier_name)
-
create a PO with berthe as its supplier and pneu. berthe
is one of the specified supplier for pneu, but with no
supplier information (code and name)
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po2}:
amount_tax: 0.0
amount_total: 1.0
amount_untaxed: 1.0
company_id: base.main_company
date_order: '2011-03-15'
invoice_method: order
location_id: stock.stock_location_stock
minimum_planned_date: '2011-03-16'
partner_address_id: res_partner_address_3
partner_id: res_partner_berthe0
pricelist_id: purchase.list0
-
I create the order line
Creating a purchase.order.line record
-
!record {model: purchase.order.line, id: purchase_order_line_pneu1}:
company_id: base.main_company
date_planned: '2011-03-16'
internal_code: PNEU-INT-1234
internal_name: Pneu
name: Pneu
order_id: purchase_order_po2
partner_id: res_partner_berthe0
price_unit: 1.0
product_id: product_product_pneu0
product_qty: 1.0
product_uom: product.product_uom_unit
state: draft
-
I check the onchange function, it should correspond
to data from selected product supplier
gather corresponding purchase order line
retrieve the values from onChange function
compare the data with the one from pol
name
internal_code
internal_name
supplier_code
supplier_name
-
!python {model: purchase.order.line}: |
pol = self.browse(cr, uid, ref("purchase_order_line_pneu1"))
result = pol.product_id_change(pol.order_id.pricelist_id.id, pol.product_id.id,
pol.product_qty, pol.product_uom.id, pol.order_id.partner_id.id,
pol.order_id.date_order, pol.order_id.fiscal_position.id,
pol.date_planned, pol.name, pol.price_unit, pol.notes)
innerDic = result['value']
assert innerDic['name'] == pol.name
assert (innerDic['internal_code'] or '') == (pol.internal_code or ''), "internal_code %s vs %s" % (innerDic['internal_code'], pol.internal_code)
assert (innerDic['internal_name'] or '') == (pol.internal_name or ''), "internal_name %s vs %s" % (innerDic['internal_name'], pol.internal_name)
assert (innerDic['supplier_code'] or '') == (pol.supplier_code or ''), "supplier_code %s vs %s" % (innerDic['supplier_code'], pol.supplier_code)
assert (innerDic['supplier_name'] or '') == (pol.supplier_name or ''), "supplier_name %s vs %s" % (innerDic['supplier_name'], pol.supplier_name)
-
create a PO with supplier AFRICOM. and product Pneu,
Pneu has two suppliers specified but none of them is AFRICOM
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po3}:
amount_tax: 0.0
amount_total: 1.0
amount_untaxed: 1.0
company_id: base.main_company
date_order: '2011-03-15'
invoice_method: order
location_id: stock.stock_location_stock
minimum_planned_date: '2011-03-16'
partner_address_id: res_partner_address_0
partner_id: res_partner_africom0
pricelist_id: purchase.list0
-
I create the order line
Creating a purchase.order.line record
-
!record {model: purchase.order.line, id: purchase_order_line_pneu0}:
company_id: base.main_company
date_planned: '2011-03-16'
internal_code: PNEU-INT-1234
internal_name: Pneu
name: Pneu
order_id: purchase_order_po3
partner_id: res_partner_africom0
price_unit: 1.0
product_id: product_product_pneu0
product_qty: 1.0
product_uom: product.product_uom_unit
state: draft
-
I check the onchange function, it should correspond
to data from selected product supplier
gather corresponding purchase order line
retrieve the values from onChange function
compare the data with the one from pol
name
internal_code
internal_name
supplier_code
supplier_name
-
!python {model: purchase.order.line}: |
pol = self.browse(cr, uid, ref("purchase_order_line_pneu0"))
result = pol.product_id_change(pol.order_id.pricelist_id.id, pol.product_id.id,
pol.product_qty, pol.product_uom.id, pol.order_id.partner_id.id,
pol.order_id.date_order, pol.order_id.fiscal_position.id,
pol.date_planned, pol.name, pol.price_unit, pol.notes)
innerDic = result['value']
assert innerDic['name'] == pol.name
assert (innerDic['internal_code'] or '') == (pol.internal_code or ''), "internal_code %s vs %s" % (innerDic['internal_code'], pol.internal_code)
assert (innerDic['internal_name'] or '') == (pol.internal_name or ''), "internal_name %s vs %s" % (innerDic['internal_name'], pol.internal_name)
assert (innerDic['supplier_code'] or '') == (pol.supplier_code or ''), "supplier_code %s vs %s" % (innerDic['supplier_code'], pol.supplier_code)
assert (innerDic['supplier_name'] or '') == (pol.supplier_name or ''), "supplier_name %s vs %s" % (innerDic['supplier_name'], pol.supplier_name)
|