2 Create new global procurement rule from Stock -> Output
4 !record {model: procurement.rule, id: global_proc_rule}:
7 picking_type_id: stock.picking_type_internal
8 location_src_id: stock.stock_location_stock
9 location_id: stock.stock_location_output
11 Create Delivery Order from Output -> Customer
13 !record {model: stock.picking, id: pick_output}:
14 name: Delivery order for procurement
15 partner_id: base.res_partner_2
16 picking_type_id: stock.picking_type_out
18 - product_id: product.product_product_3
19 product_uom_qty: 10.00
20 location_id: stock.stock_location_output
21 location_dest_id: stock.stock_location_customers
22 procure_method: make_to_order
24 Confirm delivery order.
26 !python {model: stock.picking}: |
27 self.action_confirm(cr, uid, [ref('pick_output')])
31 !python {model: procurement.order}: |
32 self.run_scheduler(cr, uid)
34 Check a picking was created from stock to output.
36 !python {model: stock.move }: |
37 picking = self.pool.get("stock.picking").browse(cr, uid, ref("pick_output"))
38 move_id = self.search(cr, uid, [('product_id', '=', ref('product.product_product_3')),('location_id', '=', ref('stock.stock_location_stock')),
39 ('location_dest_id', '=', ref('stock.stock_location_output')), ('move_dest_id', '=', picking.move_lines[0].id)])
40 assert len(move_id) == 1, "It should have created a picking from Stock to Output with the original picking as destination"