[ADD]purchase: Add "merge_purchase_order.yml"

bzr revid: dbr@tinyerp.com-20111011062929-18zttec4e7bf7atb
This commit is contained in:
DBR (OpenERP)
2011-10-11 11:59:29 +05:30
parent a1cf01c55d
commit db7100ce4f
3 changed files with 65 additions and 3 deletions
+3 -2
View File
@@ -64,8 +64,9 @@ Dashboard for purchase management that includes:
'test/process/create_invoice.yml',
'test/process/purchase_from_picking.yml',
'test/process/procurement_buy.yml',
'test/purchase_report.yml',
'test/purchase_order_cancel_draft.yml'
'test/process/purchase_report.yml',
'test/process/merge_purchase_order.yml',
#'test/purchase_order_cancel_draft.yml'
],
'demo': [
'purchase_demo.xml',
@@ -0,0 +1,61 @@
-
In order to merge purchase orders, I have to check some condition.
Like PO must in Draft state.
PO belong to same suppliers.
PO have same stock location and same price list.
-
I create first purchase order for 'Metal Cleats' product.
-
!record {model: purchase.order, id: purchase_order_po2}:
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: Metal Cleats
price_unit: 100.0
product_id: product.product_product_metalcleats0
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 purchase order is in the draft state.
-
!assert {model: purchase.order, id: purchase_order_po3}:
- state == 'draft'
-
I create Second purchase order for 'Side Panel' product.
-
!record {model: purchase.order, id: purchase_order_po2}:
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: Metal Cleats
price_unit: 100.0
product_id: product.product_product_sidepanel0
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
-
I test for Copy Purchase order in Draft state.
-
!python {model: purchase.order}: |
copy_id = self.copy(cr, uid, ref("purchase_order_po2"))
ids = [ref("purchase_order_po2"),copy_id]
context.update({'active_ids': ids})
-
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}: |
ids = context.get('active_ids')
self.merge_orders(cr, uid, ids, context)
@@ -111,4 +111,4 @@
self.fields_view_get(cr, uid, context={'active_ids': ids})
self.merge_orders(cr, uid, [1], context={'active_ids': ids})