78 lines
3.5 KiB
YAML
78 lines
3.5 KiB
YAML
-
|
|
Create new product without any routes
|
|
-
|
|
!record {model: product.product, id: drop_shop_product}:
|
|
name: Pen drive
|
|
type: product
|
|
categ_id: product.product_category_1
|
|
list_price: 100.0
|
|
standard_price: 70.0
|
|
seller_ids:
|
|
- delay: 1
|
|
name: base.res_partner_2
|
|
min_qty: 2.0
|
|
qty: 5.0
|
|
uom_id: product.product_uom_unit
|
|
uom_po_id: product.product_uom_unit
|
|
-
|
|
Create a sales order with a line of 200 PCE incoming shipment, with route_id drop shipping.
|
|
-
|
|
!record {model: sale.order, id: sale_order_drp_shpng}:
|
|
partner_id: base.res_partner_2
|
|
note: Create sale order for drop shipping
|
|
payment_term: account.account_payment_term
|
|
order_line:
|
|
- product_id: drop_shop_product
|
|
product_uom_qty: 200
|
|
price_unit: 100.00
|
|
route_id: route_drop_shipping
|
|
-
|
|
Confirm sales order
|
|
-
|
|
!workflow {model: sale.order, action: order_confirm, ref: sale_order_drp_shpng}
|
|
-
|
|
Check the sales order created a procurement group which has a procurement of 200 pieces
|
|
-
|
|
!python {model: procurement.group}: |
|
|
sale_record = self.pool.get("sale.order").browse(cr, uid, ref('sale_order_drp_shpng'))
|
|
assert self.browse(cr, uid, sale_record.procurement_group_id.id).procurement_ids[0].product_qty == 200
|
|
-
|
|
Check a quotation was created to a certain supplier and confirm so it becomes a confirmed purchase order
|
|
-
|
|
!python {model: purchase.order}: |
|
|
from openerp import netsvc
|
|
sale_record = self.pool.get("sale.order").browse(cr, uid, ref('sale_order_drp_shpng'))
|
|
procurement_order = self.pool.get("procurement.group").browse(cr, uid, sale_record.procurement_group_id.id).procurement_ids[0]
|
|
purchase_id = procurement_order.purchase_id.id
|
|
wf_service = netsvc.LocalService('workflow')
|
|
wf_service.trg_validate(uid, 'purchase.order', purchase_id, 'purchase_confirm', cr)
|
|
-
|
|
Use 'Receive Products' button to immediately view this picking, it should have created a picking with 200 pieces..
|
|
-
|
|
!python {model: purchase.order}: |
|
|
po_id = self.search(cr, uid, [('partner_id', '=', ref('base.res_partner_2'))])
|
|
picking_id = self.search(cr, uid, [('purchase_id', '=', po_id[0])])
|
|
context.update({'active_model': 'stock.picking', 'active_id': backorder_id[0], 'active_ids': backorder_id})
|
|
self.view_picking(cr, uid, po_id)
|
|
-
|
|
Send the 200 pieces.
|
|
-
|
|
!python {model: stock.picking}: |
|
|
po_id = self.pool.get('purchase.order').search(cr, uid, [('partner_id', '=', ref('base.res_partner_2'))])
|
|
picking_id = self.search(cr, uid, [('purchase_id', '=', po_id[0])])
|
|
self.do_partial(cr, uid, picking_id)
|
|
-
|
|
Check one quant was created in Customers location with 200 pieces and one move in the history_ids
|
|
-
|
|
!python {model: stock.quant}: |
|
|
quant_id = self.search(cr, uid, [('location_id', '=', ref('stock.stock_location_customers')),('qty', '=', 200)])
|
|
assert len(self.browse(cr, uid, quant_id)[0].history_ids) == 1
|
|
assert len(quant_id) == 1
|
|
-
|
|
Check the sum of the moves related to this product and the sum of the quants is equal
|
|
-
|
|
!python {model: stock.quant}: |
|
|
move_ids = self.pool.get('stock.move').search(cr, uid, [('product_id', '=', ref('drop_shop_product'))])
|
|
quant_ids = self.search(cr, uid, [('product_id', '=', ref('drop_shop_product'))])
|
|
assert len(move_ids) == len(quant_ids)
|