[AAD]purchase: add yml purchase_order_merge.yml for cover more functionality of merging PO
bzr revid: aag@tinyerp.com-20110721115817-io4fomevc9v8egwk
This commit is contained in:
@@ -65,6 +65,7 @@ Dashboard for purchase management that includes:
|
||||
'purchase_unit_test.xml',
|
||||
'test/procurement_buy.yml',
|
||||
'test/purchase_report.yml',
|
||||
'test/purchase_order_merge.yml'
|
||||
],
|
||||
'demo': ['purchase_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
-
|
||||
In order to test to merge two purchase order,I start by creating a new product 'Nokia3110c'
|
||||
-
|
||||
!record {model: product.product, id: product_product_nokia3110c}:
|
||||
categ_id: 'product.product_category_3'
|
||||
cost_method: standard
|
||||
mes_type: fixed
|
||||
name: NOKIA 3110c
|
||||
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: 5000.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 merge purchase order flow,I create a new record where "invoice_method" is From Order.
|
||||
-
|
||||
I create first purchase order for Nokia3110c.
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po_nokia1}:
|
||||
company_id: base.main_company
|
||||
date_order: !eval time.strftime('%Y-%m-%d')
|
||||
invoice_method: order
|
||||
location_id: stock.stock_location_stock
|
||||
order_line:
|
||||
- date_planned: !eval time.strftime('%Y-%m-%d')
|
||||
name: NOKIA 3110c
|
||||
price_unit: 100.0
|
||||
product_id: 'product_product_nokia3110c'
|
||||
product_qty: 10.0
|
||||
product_uom: product.product_uom_unit
|
||||
state: draft
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
pricelist_id: purchase.list0
|
||||
-
|
||||
Initially first purchase order is in the draft state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po_nokia1}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I create second purchase order for Nokia3110c with same supplier,have same stock location, same pricelist as First Purchase order of Nokia3110.
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_po_nokia2}:
|
||||
company_id: base.main_company
|
||||
date_order: !eval time.strftime('%Y-%m-%d')
|
||||
invoice_method: order
|
||||
location_id: stock.stock_location_stock
|
||||
order_line:
|
||||
- date_planned: !eval time.strftime('%Y-%m-%d')
|
||||
name: NOKIA 3110c
|
||||
price_unit: 100.0
|
||||
product_id: 'product_product_nokia3110c'
|
||||
product_qty: 20.0
|
||||
product_uom: product.product_uom_unit
|
||||
state: draft
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
pricelist_id: purchase.list0
|
||||
-
|
||||
Initially second purchase order is in the draft state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_po_nokia2}:
|
||||
- state == 'draft'
|
||||
-
|
||||
I have merged first and second purchase order which are in draft state, belong to the same supplier,have same stock location, same pricelist.
|
||||
-
|
||||
!python {model: purchase.order.group}: |
|
||||
pur_obj=self.pool.get('purchase.order')
|
||||
pur_id11=pur_obj.browse(cr, uid, ref("purchase_order_po_nokia1"))
|
||||
pur_id1=pur_id11.id
|
||||
pur_id22=pur_obj.browse(cr, uid, ref("purchase_order_po_nokia2"))
|
||||
pur_id2=pur_id22.id
|
||||
ids = [pur_id1,pur_id2]
|
||||
self.fields_view_get(cr, uid, context={'active_ids': ids})
|
||||
self.merge_orders(cr, uid, [1], context={'active_ids': ids})
|
||||
Reference in New Issue
Block a user