4 !record {model: res.partner, id: supplier_dropship}:
5 name: Supplier of Dropshipping test
7 Create new product without any routes
9 !record {model: product.product, id: drop_shop_product}:
12 categ_id: product.product_category_1
18 name: supplier_dropship
21 uom_id: product.product_uom_unit
22 uom_po_id: product.product_uom_unit
24 Create a sales order with a line of 200 PCE incoming shipment, with route_id drop shipping.
26 !record {model: sale.order, id: sale_order_drp_shpng}:
27 partner_id: base.res_partner_2
28 note: Create sale order for drop shipping
29 payment_term: account.account_payment_term
31 - product_id: drop_shop_product
34 route_id: route_drop_shipping
38 !workflow {model: sale.order, action: order_confirm, ref: sale_order_drp_shpng}
40 Check the sales order created a procurement group which has a procurement of 200 pieces
42 !python {model: procurement.group}: |
43 sale_record = self.pool.get("sale.order").browse(cr, uid, ref('sale_order_drp_shpng'))
44 assert self.browse(cr, uid, sale_record.procurement_group_id.id).procurement_ids[0].product_qty == 200
48 !python {model: procurement.order}: |
49 self.run_scheduler(cr, uid)
51 Check a quotation was created to a certain supplier and confirm so it becomes a confirmed purchase order
53 !python {model: purchase.order}: |
54 from openerp import netsvc, workflow
55 sale_record = self.pool.get("sale.order").browse(cr, uid, ref('sale_order_drp_shpng'))
56 procurement_order = self.pool.get("procurement.group").browse(cr, uid, sale_record.procurement_group_id.id).procurement_ids[0]
57 purchase_id = procurement_order.purchase_line_id.order_id.id
59 workflow.trg_validate(uid, 'purchase.order', purchase_id, 'purchase_confirm', cr)
60 po_id = self.pool.get('purchase.order').search(cr, uid, [('partner_id', '=', ref('supplier_dropship'))])
61 assert self.browse(cr, uid, purchase_id).state == 'approved', 'Purchase order should be in the approved state'
63 Use 'Receive Products' button to immediately view this picking, it should have created a picking with 200 pieces
65 !python {model: purchase.order}: |
66 po_id = self.search(cr, uid, [('partner_id', '=', ref('supplier_dropship'))])
67 self.view_picking(cr, uid, po_id)
71 !python {model: stock.picking}: |
72 po_id = self.pool.get('purchase.order').search(cr, uid, [('partner_id', '=', ref('supplier_dropship'))])
73 assert po_id and len(po_id) == 1, 'Problem with the Purchase Order detected'
74 picking_ids = [pick.id for pick in self.pool.get('purchase.order').browse(cr, uid, po_id[0]).picking_ids]
75 self.do_transfer(cr, uid, picking_ids)
77 Check one quant was created in Customers location with 200 pieces and one move in the history_ids
79 !python {model: stock.quant}: |
80 quant_ids = self.search(cr, uid, [('location_id', '=', ref('stock.stock_location_customers')),('qty', '=', 200), ('product_id', '=', ref("drop_shop_product"))])
81 assert quant_ids, 'No Quant found'
82 assert len(quant_ids) == 1
83 assert len(self.browse(cr, uid, quant_ids)[0].history_ids) == 1