[IMP]purchase: Add Functionality to test onchange Warehouse id , product_id, uom_id
bzr revid: aag@tinyerp.com-20110729104540-9a2pvv34rw1rm8yk
This commit is contained in:
@@ -21,6 +21,29 @@
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
Create second new product 'Pen Drive2'
|
||||
-
|
||||
!record {model: product.product, id: product_product_pendrive2}:
|
||||
categ_id: 'product.product_category_3'
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: Pen Drive 2
|
||||
price_margin: 1.0
|
||||
procure_method: make_to_order
|
||||
property_stock_inventory: stock.location_inventory
|
||||
property_stock_procurement: stock.location_procurement
|
||||
property_stock_production: stock.location_production
|
||||
seller_delay: '1'
|
||||
standard_price: 500.0
|
||||
supply_method: buy
|
||||
type: product
|
||||
uom_id: product.product_uom_unit
|
||||
uom_po_id: product.product_uom_unit
|
||||
volume: 0.0
|
||||
warranty: 0.0
|
||||
weight: 0.0
|
||||
weight_net: 0.0
|
||||
-
|
||||
In order to test the purchase order flow,I create a new record where "invoice_method" is From Order.
|
||||
-
|
||||
@@ -47,6 +70,27 @@
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_pendrive1}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I test onchanged on Wharehouse ,Product , Uom .
|
||||
-
|
||||
!python {model: purchase.order}: |
|
||||
from tools.translate import _
|
||||
ids = []
|
||||
ids.append(ref("purchase_order_pendrive1"))
|
||||
self.onchange_warehouse_id(cr, uid, ids , 1)
|
||||
part_obj = self.pool.get('res.partner')
|
||||
price_obj = self.pool.get('product.pricelist')
|
||||
product_obj = self.pool.get('product.product')
|
||||
addrss_obj = self.pool.get('res.partner.address')
|
||||
po_line_obj = self.pool.get('purchase.order.line')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
price_id = price_obj.search(cr, uid, [('name','=','Default Purchase Pricelist')])
|
||||
product_id = product_obj.search(cr, uid, [('name','=','Pen Drive 2')])
|
||||
uom_id = uom_obj.search(cr, uid, [('name','=','PCE')])
|
||||
part_ids = part_obj.search(cr, uid, [('name','=','Distrib PC')])
|
||||
line_id = po_line_obj.search(cr, uid, [('order_id','=',ids[0])])
|
||||
po_line_obj.product_id_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
|
||||
po_line_obj.product_uom_change(cr, uid, line_id[0], price_id[0], product_id[0], 10, uom_id[0], part_ids[0])
|
||||
-
|
||||
I confirm the purchase order for Pen Drive1.
|
||||
-
|
||||
|
||||
Reference in New Issue
Block a user