2
Creating a res.partner record
4
!record {model: res.partner, id: res_partner_a0}:
11
Creating a res.partner.address record
13
!record {model: res.partner.address, id: res_partner_address_0}:
14
partner_id: res_partner_a0
18
Creating a product.product record
20
!record {model: product.product, id: product_product_p0}:
25
Creating a sale.order record
27
!record {model: sale.order, id: sale_order_so0}:
28
partner_id: res_partner_a0
29
partner_invoice_id: res_partner_address_0
30
partner_order_id: res_partner_address_0
31
partner_shipping_id: res_partner_address_0
32
pricelist_id: product.list0
36
Creating a sale.order.line record
38
!record {model: sale.order.line, id: sale_order_line_p0}:
39
order_id: sale_order_so0
41
product_id: product_product_p0
42
product_uom: product.product_uom_unit
48
I validate the sale order
51
!python {model: sale.order}: |
53
wf_service = netsvc.LocalService("workflow")
54
wf_service.trg_validate(uid, 'sale.order', ref("sale_order_so0"), 'order_confirm', cr)
58
I check the draft picking creation and create picking object.
59
And confirm the stock.picking and process.
62
!python {model: stock.picking}: |
63
ids = self.search(cr, uid, [('sale_id', '=', ref("sale_order_so0")), ('state', '=', 'draft')], context=context)
64
assert len(ids) == 1, 'number of created draft picking is wrong, 1 - %s'%len(ids)
66
delivered = self.read(cr, uid, ids[0], ['delivered'], context=context)['delivered']
67
assert not delivered, 'delivered is set to True - %s'%delivered
68
self.set_delivered(cr, uid, ids, context=context)
69
delivered = self.read(cr, uid, ids[0], ['delivered'], context=context)['delivered']
70
assert delivered, 'delivered is not set to True - %s'%delivered