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
|
-
Creating a res.partner record
-
!record {model: res.partner, id: res_partner_a0}:
credit_limit: 0.0
debit_limit: 0.0
name: A
supplier: true
-
Creating a res.partner.address record
-
!record {model: res.partner.address, id: res_partner_address_0}:
partner_id: res_partner_a0
street: A
-
Creating a product.product record
-
!record {model: product.product, id: product_product_p0}:
default_code: P0
name: product 0 test
international_status: product_attributes.int_1
-
Creating a sale.order record
-
!record {model: sale.order, id: sale_order_so0}:
partner_id: res_partner_a0
partner_invoice_id: res_partner_address_0
partner_order_id: res_partner_address_0
partner_shipping_id: res_partner_address_0
pricelist_id: product.list0
shop_id: sale.shop
-
Creating a sale.order.line record
-
!record {model: sale.order.line, id: sale_order_line_p0}:
order_id: sale_order_so0
price_unit: 1.0
product_id: product_product_p0
product_uom: product.product_uom_unit
product_uom_qty: 1.0
type: make_to_stock
-
I validate the sale order
-
!python {model: sale.order}: |
import netsvc
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'sale.order', ref("sale_order_so0"), 'order_confirm', cr)
-
I check the draft picking creation and create picking object.
And confirm the stock.picking and process.
-
!python {model: stock.picking}: |
ids = self.search(cr, uid, [('sale_id', '=', ref("sale_order_so0")), ('state', '=', 'draft')], context=context)
assert len(ids) == 1, 'number of created draft picking is wrong, 1 - %s'%len(ids)
# test the button
delivered = self.read(cr, uid, ids[0], ['delivered'], context=context)['delivered']
assert not delivered, 'delivered is set to True - %s'%delivered
self.set_delivered(cr, uid, ids, context=context)
delivered = self.read(cr, uid, ids[0], ['delivered'], context=context)['delivered']
assert delivered, 'delivered is not set to True - %s'%delivered
# copy the out - check delivered is False
new_out_id = self.copy(cr, uid, ids[0], {}, context=context)
new_delivered = self.read(cr, uid, new_out_id, ['delivered'], context=context)['delivered']
assert not new_delivered, 'delivered of new out is wrong - False - %s'%new_delivered
|