From 36bab80a14a2f0f70cdd38434d95981be7735b20 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 14:42:22 +0530 Subject: [PATCH 1/7] Task Id-617 : Add the yml for purchase_requisition_exclusive and purchase_requisition multiple bzr revid: sbh@tinyerp.com-20100511091222-ht4x9uhhgu846095 --- addons/purchase_requisition/__openerp__.py | 1 + .../test/purchase_requisition.yml | 222 ++++++++++++++++++ .../test/purchase_requisition_exclusive.yml | 139 +++++++++++ 3 files changed, 362 insertions(+) create mode 100644 addons/purchase_requisition/test/purchase_requisition.yml create mode 100644 addons/purchase_requisition/test/purchase_requisition_exclusive.yml diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index 35e7e8a82ca..bb6266aceed 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -35,6 +35,7 @@ "purchase_requisition_view.xml", "security/ir.model.access.csv","purchase_requisition_sequence.xml"], "active": False, + "test":['test/purchase_requisition.yml','test/purchase_requisition_exclusive.yml'], "installable": True } # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml new file mode 100644 index 00000000000..7ac6edccd3c --- /dev/null +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -0,0 +1,222 @@ + +- + In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + purchase flow and I will buy the required products at two different suppliers. + +- + Modifying a res.users record +- + !record {model: res.users, id: base.user_root}: + groups_id: + - base.group_system + - base.group_erp_manager + - base.group_user + - base.group_multi_company + - base.group_extended + - base.group_no_one + - base.group_partner_manager + - base.group_maintenance_manager + - product.group_uos + - product.group_product_manager + - product.group_product_variant + - account.group_account_invoice + - account.group_account_user + - account.group_account_manager + - stock.group_stock_manager + - stock.group_stock_user + - purchase.group_purchase_manager + - purchase.group_purchase_user + - mrp.group_mrp_manager + - mrp.group_mrp_user + - sale.group_sale_manager + - sale.group_sale_user + +- + I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, + with the generation of purchase requisitions. +- + !record {model: product.product, id: product_product_laptopacer0}: + categ_id: product.product_category_3 + cost_method: standard + mes_type: fixed + name: Laptop ACER + procure_method: make_to_order + purchase_requisition: 1 + seller_ids: + - delay: 1 + name: base.res_partner_asus + qty: 5.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 + list_price: 100.0 + + +- + Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001 +- + !record {model: sale.order, id: sale_order_testtender0}: + date_order: '2010-05-10' + invoice_quantity: order + name: TEST/TENDER/0001 + order_line: + - name: Laptop ACER + price_unit: 100.0 + product_uom: product.product_uom_unit + product_uom_qty: 5.0 + state: draft + delay: 7.0 + product_id: product_product_laptopacer0 + product_uos_qty: 5.0 + th_weight: 0.0 + type: make_to_order + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop + +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender0} + +- + I launch he scheduler to compute all procurements, and planify all requisitions orders. +- + !python {model: mrp.procurement.compute.all}: | + proc_obj = self.pool.get('mrp.procurement') + proc_obj._procure_confirm(cr,uid) +- + On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on + the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC + +- + Creating a purchase.requisition.partner record + +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: + partner_address_id: base.res_partner_address_7 + partner_id: base.res_partner_4 + +- + Performing an osv_memory action create_order on module purchase.requisition.partner + +- + !python {model: purchase.requisition.partner}: | + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) + self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang": + 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": + 1, "active_ids": ids, "active_id": ids[0], }) + +- + I check that I have two purchase orders on the purchase tender + +- + !python {model: purchase.order}: | + order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + assert (order_ids==2), "Purchase order hasn't Created" +- + I set the purchase requisition as 'Not Exclusive' + +- + !python {model: purchase.requisition}: | + ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) + self.write(cr,uid,ids[0],{'exclusive': 'multiple' }) +- + I change the quantities so that the purchase order for DistriPC includes 3 pieces and the + purchase order for Asustek includes 2 pieces. + +- + !python {model: purchase.order}: | + line_obj=self.pool.get('purchase.order.line') + purchase_id1= self.search(cr, uid, [('name','=','PO00001')]) + purchase_id2= self.search(cr, uid, [('name','=','PO00002')]) + order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id + order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id + line_obj.write(cr, uid, [order_line1], {'product_qty':2}) + line_obj.write(cr, uid, [order_line2], {'product_qty':3}) +- + I confirm and validate both purchase orders + +- + !python {model: purchase.order}: | + order_ids= self.search(cr, uid, []) + import netsvc + wf_service = netsvc.LocalService("workflow") + for id in order_ids: + wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr) + +- + I check that the delivery order of the customer is in state 'Waiting Goods' + +- + !python {model: stock.picking }: | + picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','delivery')]) + if picking_id: + pick=self.browse(cr,uid,picking_id[0]) + assert (pick.state) =='confirmed'," Order is not confirm" + assert(pick.move_lines[0].state=='wating'),'Order is not wating"' + +- + I receive the order of the supplier Asustek from the Incoming Products menu + +- + !python {model: stock.picking }: | + import time + picking_id = self.search(cr, uid, [('origin','=','PO00001:TEST/TENDER/0001'),('type','=','in')]) + if picking_id: + pick=self.browse(cr,uid,picking_id[0]) + move =pick.move_lines[0] + partial_datas = { + 'partner_id': 2, + 'address_id': 6, + 'delivery_date' : time.strftime('%Y-%m-%d'), + } + partial_datas['move%s'%(move.id)]= { + 'product_id': move.product_id, + 'product_qty': move.product_qty, + 'product_uom': move.product_uom.id, + } + self.do_partial(cr, uid, picking_id,partial_datas) +- + I receive the order of the supplier DistriPC from the Incoming Shipments menu + +- + !python {model: stock.picking }: | + import time + picking_id = self.search(cr, uid, [('origin','=','PO00002:TEST/TENDER/0001'),('type','=','in')]) + if picking_id: + pick=self.browse(cr,uid,picking_id[0]) + move =pick.move_lines[0] + partial_datas = { + 'partner_id': 4, + 'address_id': 7, + 'delivery_date' : time.strftime('%Y-%m-%d'), + } + partial_datas['move%s'%(move.id)]= { + 'product_id': move.product_id, + 'product_qty': move.product_qty, + 'product_uom': move.product_uom.id, + } + self.do_partial(cr, uid, picking_id,partial_datas) +- + Now, I can check that the delivery order of the customer is in the state Available + +- + !python {model: stock.picking }: | + picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','out')]) + if picking_id: + pick=self.browse(cr,uid,picking_id[0]) + assert (pick.state) =='available'," Order is not available" + diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml new file mode 100644 index 00000000000..e70e8200eef --- /dev/null +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -0,0 +1,139 @@ +- + In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + purchase flow and I will buy the required products at two different suppliers. + +- + I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, + with the generation of purchase requisitions. + +- + Modifying a res.users record +- + !record {model: res.users, id: base.user_root}: + groups_id: + - base.group_system + - base.group_erp_manager + - base.group_user + - base.group_multi_company + - base.group_extended + - base.group_no_one + - base.group_partner_manager + - base.group_maintenance_manager + - product.group_uos + - product.group_product_manager + - product.group_product_variant + - account.group_account_invoice + - account.group_account_user + - account.group_account_manager + - stock.group_stock_manager + - stock.group_stock_user + - purchase.group_purchase_manager + - purchase.group_purchase_user + - mrp.group_mrp_manager + - mrp.group_mrp_user + - sale.group_sale_manager + - sale.group_sale_user +- + !record {model: product.product, id: product_product_laptopacer1}: + categ_id: product.product_category_3 + cost_method: standard + list_price: 1000.0 + mes_type: fixed + name: Laptop ACER1 + procure_method: make_to_order + purchase_requisition: 1 + seller_ids: + - delay: 1 + name: base.res_partner_asus + qty: 5.0 + supply_method: buy + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + +- + Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0002 + +- + !record {model: sale.order, id: sale_order_testtender1}: + date_order: '2010-04-20' + invoice_quantity: order + name: TEST/TENDER/0002 + order_line: + - name: Laptop ACER1 + price_unit: 1000.0 + product_uom: product.product_uom_unit + product_uom_qty: 5.0 + state: draft + 'delay': 7.0 + 'product_id': product_product_laptopacer1 + 'type': make_to_order + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender1} + +- + I launch he scheduler to compute all procurements, and planify all requisitions orders +- + !python {model: mrp.procurement.compute.all}: | + proc_obj = self.pool.get('mrp.procurement') + proc_obj._procure_confirm(cr,uid) +- + I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for + 5 Laptop ACER, and a purchase order on the default supplier for this product +- + !python {model: purchase.requisition}: | + requisition_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + assert len(requisition_ids), "Purchase requisition hasn't Created" +- + On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on + the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC +- + Creating a purchase.requisition.partner record +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: + partner_address_id: base.res_partner_address_7 + partner_id: base.res_partner_4 + +- + Performing an osv_memory action create_order on module purchase.requisition.partner +- + !python {model: purchase.requisition.partner}: | + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang": + 'en_US', "active_model": "purchase.requisition", "tz": False, "record_id": + 1, "active_ids": ids, "active_id": ids[0], }) + +- + I set the purchase tender as 'Exclusive' +- + !python {model: purchase.requisition}: | + ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + self.write(cr,uid,ids[0],{'exclusive': 'exclusive' }) +- + I confirm and validate the RfQ of Asustek +- + !python {model: purchase.order}: | + purchase_id= self.search(cr, uid, [('name','=','PO00003')])[0] + import netsvc + wf_service = netsvc.LocalService("workflow") + if purchase_id: + wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr) +- + I check that RfQ of DistriPC is cancelled. +- + !python {model: purchase.order}: | + purchase_id= self.search(cr, uid, [('name','=','PO00004')])[0] + state=self.browse(cr,uid,purchase_id).state + assert (state=='cancel') \ No newline at end of file From aa6933aeb3a8188cad1679812781ab36d53e26c9 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 15:49:12 +0530 Subject: [PATCH 2/7] Task 529: Create a yml for stock and fix the bug in picking wizard bzr revid: sbh@tinyerp.com-20100511101912-z25438ekb15592me --- addons/stock/__openerp__.py | 2 +- addons/stock/stock.py | 2 +- addons/stock/test/stock_test.yml | 357 +++++++++++++++++++++++++++++++ 3 files changed, 359 insertions(+), 2 deletions(-) create mode 100644 addons/stock/test/stock_test.yml diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index 20e0d30d8fb..f1b60f244cd 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -68,7 +68,7 @@ Thanks to the double entry management, the inventory controlling is powerful and "security/stock_security.xml", "security/ir.model.access.csv", ], - 'demo_xml': ['stock_demo.xml'], + 'test': ['stock_test.yml'], 'installable': True, 'active': False, 'certificate': '0055421559965', diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 3795351e03a..2bc2511e871 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1006,7 +1006,7 @@ class stock_picking(osv.osv): delivered_pack = self.browse(cr, uid, delivered_pack_id, context=context) delivery_id = delivery_obj.create(cr, uid, { - 'name': delivered_pack.name, + 'name': delivered_pack.name or move.name, 'partner_id': partner_id, 'address_id': address_id, 'date': delivery_date, diff --git a/addons/stock/test/stock_test.yml b/addons/stock/test/stock_test.yml new file mode 100644 index 00000000000..ffe5596604c --- /dev/null +++ b/addons/stock/test/stock_test.yml @@ -0,0 +1,357 @@ + +- + In order to test the stock module, I will create product, + create physical inventory ,fill inventory lines from location,split inventory line into production lot + +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_asset0}: + close_method: balance + code: asset + name: Asset + sign: 1 + + +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_liability0}: + close_method: balance + code: liability + name: Liability + sign: 1 + +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_income0}: + close_method: unreconciled + code: income + name: Income + sign: 1 + + +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_expense0}: + close_method: unreconciled + code: expense + name: Expense + sign: 1 +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_cash0}: + close_method: balance + code: cash + name: Cash + sign: 1 + + +- + Creating a account.account.type record +- + !record {model: account.account.type, id: account_account_type_receivable0}: + close_method: balance + code: receivable + name: Receivable + sign: 1 +- + + Creating a account.account record +- + !record {model: account.account, id: account_account_receivable0}: + code: '40000' + company_id: base.main_company + currency_mode: current + name: Receivable + parent_left: 1 + parent_right: 2 + type: receivable + user_type: account_account_type_receivable0 +- + Creating a account.account record +- + !record {model: account.account, id: account_account_payable0}: + code: '440000' + company_id: base.main_company + currency_mode: current + name: Payable + parent_left: 3 + parent_right: 4 + type: payable + user_type: account_account_type_expense0 +- + Creating a account.journal record +- + !record {model: account.journal, id: account_journal_purchasejournal0}: + code: pur + company_id: base.main_company + name: Purchase Journal + sequence_id: account.sequence_purchase_journal + type: purchase + view_id: account.account_journal_bank_view + +- + Creating a account.journal record +- + !record {model: account.journal, id: account_journal_salejouran0}: + code: sal + company_id: base.main_company + name: Sale Jouran + sequence_id: account.sequence_sale_journal + type: sale + view_id: account.account_journal_view + +- + Creating a account.account record +- + !record {model: account.account, id: account_account_expenseaccount0}: + code: Expe + company_id: base.main_company + currency_mode: current + name: Expense Account + parent_left: 5 + parent_right: 6 + type: consolidation + user_type: account_account_type_asset0 +- + Creating a account.account record +- + !record {model: account.account, id: account_account_productsale0}: + code: '001' + company_id: base.main_company + currency_mode: current + name: Product Sale + type: other + user_type: stock.account_account_type_income0 + + +- + Creating a account.account record +- + !record {model: account.account, id: account_account_productpurchase0}: + code: '0002' + company_id: base.main_company + currency_mode: current + name: Product Purchase + type: other + user_type: account_account_type_expense0 + +- + Creating a res.partner record +- + !record {model: res.partner, id: res_partner_shawtrust0}: + address: + - country_id: base.in + - street: St James House, Vicar Lane, Sheffield + lang: en_US + name: 'Shaw Trust ' + property_account_payable: account_account_payable0 + property_account_receivable: account_account_receivable0 +- + Creating a res.partner record +- + !record {model: res.partner, id: res_partner_diasorinltd0}: + address: + - country_id: base.in + street: Ash House, Ash Road + name: DiaSorin Ltd + supplier: true + + +- + Creating a res.partner record +- + !record {model: res.partner, id: res_partner_microlinktechnologies0}: + address: + - street: Kailash Vaibhav, Parksite + name: Micro Link Technologies + property_account_payable: account_account_payable0 + property_account_receivable: account_account_receivable0 + supplier: true + +- + Creating a res.partner.address record +- + !record {model: res.partner.address, id: res_partner_address_0}: + country_id: base.in + partner_id: stock.res_partner_diasorinltd0 + street: Ash House, Ash Road + title: Ms. + + +- + Creating a product.category record +- + !record {model: product.category, id: product_category_computer0}: + name: Computer + +- + Creating a product.product record +- + !record {model: product.product, id: product_product_hppaviliondesktoppcs0}: + categ_id: stock.product_category_computer0 + cost_method: standard + mes_type: fixed + list_price: 1000.0 + name: HP Pavilion Desktop PCs + procure_method: make_to_stock + seller_ids: + - delay: 1 + name: stock.res_partner_shawtrust0 + qty: 5.0 + supply_method: buy + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + property_account_expense: account_account_productsale0 + property_account_income: account_account_productsale0 + +- + Creating a product.product record +- + !record {model: product.product, id: product_product_hpcdwriters0}: + categ_id: stock.product_category_computer0 + cost_method: standard + list_price: 1000.0 + mes_type: fixed + name: HP CD writers + procure_method: make_to_stock + seller_ids: + - delay: 1 + name: res_partner_shawtrust0 + qty: 5.0 + supply_method: buy + type: product + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + property_account_expense: account_account_productpurchase0 + property_account_income: account_account_productsale0 + +- + I have creating Physical Inventory +- + !record {model: stock.inventory, id: stock_inventory_physicalinventoy0}: + company_id: base.main_company + date: '2010-05-10 18:19:13' + date_done: '2010-05-10 18:19:59' + inventory_line_id: + - company_id: base.main_company + location_id: stock.stock_location_stock + product_id: stock.product_product_hpcdwriters0 + product_qty: 10.0 + product_uom: product.product_uom_unit + - company_id: base.main_company + location_id: stock.stock_location_stock + product_id: stock.product_product_hppaviliondesktoppcs0 + product_qty: 10.0 + product_uom: product.product_uom_unit + name: Physical inventory + state: draft + + +- + I have Confirm the Inventory +- + !python {model: stock.inventory}: | + self.action_done(cr,uid,[ref('stock_inventory_physicalinventoy0')]) +- + Creating a stock.fill.inventory record +- + !record {model: stock.fill.inventory, id: stock_fill_inventory_0}: + location_id: stock.stock_location_stock + +- + I have fill_inventory on module stock.fill.inventory +- + !python {model: stock.fill.inventory}: | + self.fill_inventory(cr, uid, [ref("stock_fill_inventory_0")], {"lang": 'en_US', + "full": "1", "tz": False, "active_model": "stock.inventory", "active_ids": + [ref("stock_inventory_physicalinventoy0")], "active_id": ref("stock_inventory_physicalinventoy0"), }) + +- + Creating a stock.move.split record +- + !record {model: stock.move.split, id: stock_move_split_0}: + line_ids: + - name: '00001' + quantity: 5 + product_id: stock.product_product_hpcdwriters0 + + +- + Split into production line +- + !python {model: stock.move.split}: | + move_obj=self.pool.get('stock.move') + product_obj=self.pool.get('product.product') + product_id=product_obj.search(cr,uid,[('name','=','HP CD writers')]) + move_ids=move_obj.search(cr,uid,[('product_id','in',product_id)]) + self.split_lot(cr, uid, [ref("stock_move_split_0")], {"lang": 'en_US', "active_model": + "stock.move", "active_ids": move_ids, "tz": False, "active_id":move_ids[0] + }) +- + + In Order to test the picking i have create picking with move lines +- + !record {model: stock.picking, id: stock_picking_0}: + address_id: res_partner_address_0 + company_id: base.main_company + date: '2010-05-11 15:18:52' + invoice_state: none + move_lines: + - company_id: base.main_company + date_planned: '2010-05-11 15:18:57' + location_dest_id: stock.stock_location_customers + location_id: stock.stock_location_stock + name: HP CD writers + product_id: stock.product_product_hpcdwriters0 + product_qty: 3.0 + product_uom: product.product_uom_unit + date: '2010-05-11 15:18:57' + product_uos_qty: 3.0 + move_type: direct + type: internal + + +- + Performing an osv_memory action draft_force_assign on module stock.picking +- + !python {model: stock.picking}: | + self.draft_force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model": + "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display": + "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id": + ref("stock.menu_action_picking_tree6"), }) + + +- + Performing an osv_memory action force_assign on module stock.picking +- + !python {model: stock.picking}: | + self.force_assign(cr, uid, [ref("stock_picking_0")], {"lang": "en_US", "active_model": + "ir.ui.menu", "tz": False, "search_default_confirmed": 1, "contact_display": + "partner", "active_ids": [ref("stock.menu_action_picking_tree6")], "active_id": + ref("stock.menu_action_picking_tree6"), }) + + +- + Performing an osv_memory action do_partial on module stock.partial.picking +- + !python {model: stock.picking }: | + import time + pick=self.browse(cr,uid,ref('stock_picking_0')) + move =pick.move_lines[0] + partial_datas = { + 'partner_id':pick.address_id.partner_id.id, + 'address_id': pick.address_id.id, + 'delivery_date' : time.strftime('%Y-%m-%d') + } + partial_datas['move%s'%(move.id)]= { + 'product_id': move.product_id, + 'product_qty': move.product_qty, + 'product_uom': move.product_uom.id, + } + self.do_partial(cr, uid, [ref('stock_picking_0')],partial_datas) \ No newline at end of file From f4744b146f68af13efc1c017b1b2d1bae835e596 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 19:11:05 +0530 Subject: [PATCH 3/7] Task 529: Create a yml for delivery bzr revid: sbh@tinyerp.com-20100511134105-s5j99ytbx2fc7gxg --- addons/delivery/__openerp__.py | 1 + addons/delivery/test/delivery_test.yml | 176 ++++++++++++++++++ .../test/purchase_requisition.yml | 7 +- .../test/purchase_requisition_exclusive.yml | 1 + 4 files changed, 181 insertions(+), 4 deletions(-) create mode 100644 addons/delivery/test/delivery_test.yml diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 9b0949e07e1..5ac26ce3d23 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -39,6 +39,7 @@ 'partner_view.xml' ], 'demo_xml': ['delivery_demo.xml'], + 'test':['delivery_test.yml',], 'installable': True, 'active': False, 'certificate': '0033981912253', diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml new file mode 100644 index 00000000000..aedb76b4926 --- /dev/null +++ b/addons/delivery/test/delivery_test.yml @@ -0,0 +1,176 @@ +- + In order to test the delivery module, I will do Configuration ‣ Delivery ‣ Delivery Method + And there are two methods for doing that + Delivery based on order quantities, + Delivery based on delivered quantities. + +- + I have creating the partner associated with the transport +- + Creating a res.partner record +- + !record {model: res.partner, id: res_partner_thepost0}: + address: + - country_id: base.in + name: Micro Link + credit_limit: 0.0 + name: The Post + property_account_payable: account.a_pay + property_account_receivable: account.a_recv + + +- + + I have creating associated product for delivery. +- + !record {model: product.product, id: product_product_deliverybypost0}: + categ_id: product.product_category_services + cost_method: standard + mes_type: fixed + name: Delivery Product + procure_method: make_to_stock + supply_method: buy + type: service + uom_id: product.product_uom_unit + uom_po_id: product.product_uom_unit + warranty: 0.0 + +- + + Creating a Delivery Method +- + !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: + name: The OpenERP Experss + partner_id: res_partner_thepost0 + product_id: product_product_deliverybypost0 +- + Creating a delivery.grid record and define the region for which the tariffs in the grid will be applicable. + Then set the condition for which this rule is applicable +- + !record {model: delivery.grid, id: delivery_grid_weight0}: + carrier_id: delivery_carrier_theopenerpexperss0 + line_ids: + - list_price: 120.0 + max_value: 250.0 + name: Weight of product + operator: <= + standard_price: 60.0 + type: weight + price_type: fixed + variable_factor: weight + - list_price: 0.0 + max_value: 500.0 + name: Price >= 500 + operator: <= + standard_price: 20.0 + type: price + price_type: fixed + variable_factor: weight + country_ids: + - base.id + - base.be + - base.in + - base.io + + name: Weight + sequence: 1 + +- + To check the Delivery based on order quantities , I have created sale order and picking_policy is direct +- + !record {model: sale.order, id: sale_order_so0}: + date_order: '2010-05-11' + invoice_quantity: order + name: Test/delivery + order_line: + - name: '[PC1] Basic PC' + price_unit: 450.0 + product_uom: product.product_uom_unit + product_uom_qty: 10.0 + state: draft + delay: 2.0 + product_id: product.product_product_pc1 + product_uos_qty: 10.0 + th_weight: 0.0 + type: make_to_stock + order_policy: manual + partner_id: base.res_partner_agrolait + partner_invoice_id: base.res_partner_address_8 + partner_order_id: base.res_partner_address_8 + partner_shipping_id: base.res_partner_address_8 + picking_policy: direct + pricelist_id: product.list0 + shop_id: sale.shop + +- + Creating a delivery.sale.order record +- + !record {model: delivery.sale.order, id: delivery_sale_order_0}: + carrier_id: delivery_carrier_theopenerpexperss0 +- + To add the delivery charges on the quotation, I have click on Delivery costs button and select the carrier +- + !python {model: delivery.sale.order}: | + self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model": + "sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")], + "active_id": ref("sale_order_so0"), }) +- + I check that I have two order line on the sale order +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_so0} + +- + To check the Invoicing based on deliveries.I have created new sale order and picking_policy is Complete Delivery +- + !record {model: sale.order, id: sale_order_test_complete0}: + name: Test/Complete Deliver + carrier_id: delivery.delivery_carrier_theopenerpexperss0 + invoice_quantity: procurement + order_line: + - name: '[PC1] Basic PC' + price_unit: 450.0 + product_uom: product.product_uom_unit + product_uom_qty: 10.0 + state: draft + delay: 2.0 + product_id: product.product_product_pc1 + product_uos_qty: 10.0 + th_weight: 0.0 + type: make_to_stock + partner_id: base.res_partner_4 + partner_order_id: base.res_partner_address_7 + partner_invoice_id: base.res_partner_address_7 + partner_shipping_id: base.res_partner_address_7 + pricelist_id: product.list0 + order_policy: picking + + +- + Performing a workflow action order_confirm on module sale.order +- + !workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0} +- + Creating a stock.invoice.onshipping record +- + !record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}: + journal_id: account.sales_journal + type: out_invoice +- + Create a Invoice form picking +- + !python {model: stock.invoice.onshipping}: | + so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) + self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US", + "tz": False, "active_model": "stock.picking", "contact_display": "partner", + "active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id }) +- + To check invoice corresponding to the delivery charge in invoice line +- + !python {model: account.invoice}: | + import base + so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) + ids=len(so.invoice_ids[0].invoice_line) + assert len(ids), "Invoice hasn't Created" + diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 7ac6edccd3c..206cd89b6df 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -97,7 +97,6 @@ proc_obj._procure_confirm(cr,uid) - On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on - the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC - Creating a purchase.requisition.partner record @@ -123,7 +122,7 @@ - !python {model: purchase.order}: | - order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) assert (order_ids==2), "Purchase order hasn't Created" - I set the purchase requisition as 'Not Exclusive' @@ -200,8 +199,8 @@ pick=self.browse(cr,uid,picking_id[0]) move =pick.move_lines[0] partial_datas = { - 'partner_id': 4, - 'address_id': 7, + 'partner_id':pick.address_id.partner_id.id, + 'address_id': pick.address_id.id, 'delivery_date' : time.strftime('%Y-%m-%d'), } partial_datas['move%s'%(move.id)]= { diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index e70e8200eef..f5e668d0d53 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -93,6 +93,7 @@ - !python {model: purchase.requisition}: | requisition_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + ids=len(requisition_ids) assert len(requisition_ids), "Purchase requisition hasn't Created" - On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on From 6243599ca5bbf23e6af9f36713d30c1a20d81bff Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 19:31:59 +0530 Subject: [PATCH 4/7] [IMP]: Improve the yml for delivery and purchase_requisition bzr revid: sbh@tinyerp.com-20100511140159-sdayvpwhwewkqpfn --- addons/delivery/__openerp__.py | 2 +- addons/delivery/test/delivery_test.yml | 2 +- .../test/purchase_requisition.yml | 34 ++----------------- .../test/purchase_requisition_exclusive.yml | 29 +--------------- addons/stock/__openerp__.py | 2 +- 5 files changed, 6 insertions(+), 63 deletions(-) diff --git a/addons/delivery/__openerp__.py b/addons/delivery/__openerp__.py index 5ac26ce3d23..684547e0a89 100644 --- a/addons/delivery/__openerp__.py +++ b/addons/delivery/__openerp__.py @@ -39,7 +39,7 @@ 'partner_view.xml' ], 'demo_xml': ['delivery_demo.xml'], - 'test':['delivery_test.yml',], + 'test':['test/delivery_test.yml',], 'installable': True, 'active': False, 'certificate': '0033981912253', diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml index aedb76b4926..3597ca523fa 100644 --- a/addons/delivery/test/delivery_test.yml +++ b/addons/delivery/test/delivery_test.yml @@ -172,5 +172,5 @@ import base so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0')) ids=len(so.invoice_ids[0].invoice_line) - assert len(ids), "Invoice hasn't Created" + assert (ids<2), "Invoice hasn't Created" diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 206cd89b6df..b70e66b3098 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -2,35 +2,6 @@ - In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. - -- - Modifying a res.users record -- - !record {model: res.users, id: base.user_root}: - groups_id: - - base.group_system - - base.group_erp_manager - - base.group_user - - base.group_multi_company - - base.group_extended - - base.group_no_one - - base.group_partner_manager - - base.group_maintenance_manager - - product.group_uos - - product.group_product_manager - - product.group_product_variant - - account.group_account_invoice - - account.group_account_user - - account.group_account_manager - - stock.group_stock_manager - - stock.group_stock_user - - purchase.group_purchase_manager - - purchase.group_purchase_user - - mrp.group_mrp_manager - - mrp.group_mrp_user - - sale.group_sale_manager - - sale.group_sale_user - - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, with the generation of purchase requisitions. @@ -55,8 +26,6 @@ weight: 0.0 weight_net: 0.0 list_price: 100.0 - - - Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001 - @@ -123,7 +92,8 @@ - !python {model: purchase.order}: | order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) - assert (order_ids==2), "Purchase order hasn't Created" + ids=len(order_ids) + assert (ids==2), "Purchase order hasn't Created" - I set the purchase requisition as 'Not Exclusive' diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index f5e668d0d53..ee6d5b60d01 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -6,34 +6,7 @@ I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, with the generation of purchase requisitions. -- - Modifying a res.users record -- - !record {model: res.users, id: base.user_root}: - groups_id: - - base.group_system - - base.group_erp_manager - - base.group_user - - base.group_multi_company - - base.group_extended - - base.group_no_one - - base.group_partner_manager - - base.group_maintenance_manager - - product.group_uos - - product.group_product_manager - - product.group_product_variant - - account.group_account_invoice - - account.group_account_user - - account.group_account_manager - - stock.group_stock_manager - - stock.group_stock_user - - purchase.group_purchase_manager - - purchase.group_purchase_user - - mrp.group_mrp_manager - - mrp.group_mrp_user - - sale.group_sale_manager - - sale.group_sale_user -- +- !record {model: product.product, id: product_product_laptopacer1}: categ_id: product.product_category_3 cost_method: standard diff --git a/addons/stock/__openerp__.py b/addons/stock/__openerp__.py index f1b60f244cd..ec7ce1c6cee 100644 --- a/addons/stock/__openerp__.py +++ b/addons/stock/__openerp__.py @@ -68,7 +68,7 @@ Thanks to the double entry management, the inventory controlling is powerful and "security/stock_security.xml", "security/ir.model.access.csv", ], - 'test': ['stock_test.yml'], + 'test': ['test/stock_test.yml'], 'installable': True, 'active': False, 'certificate': '0055421559965', From 56a7a70876c0f1a3b49c1bb73707862e44e52f7a Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 20:10:39 +0530 Subject: [PATCH 5/7] [IMP]: Improve the yml purchase_requisition bzr revid: sbh@tinyerp.com-20100511144039-tecj6p1k6crajjg2 --- .../test/purchase_requisition.yml | 20 ++++++++++++------- .../test/purchase_requisition_exclusive.yml | 7 ++++--- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index b70e66b3098..ef2331a3518 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -108,12 +108,15 @@ - !python {model: purchase.order}: | line_obj=self.pool.get('purchase.order.line') - purchase_id1= self.search(cr, uid, [('name','=','PO00001')]) - purchase_id2= self.search(cr, uid, [('name','=','PO00002')]) + partner_obj=self.pool.get('res.partner') + partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] + partner_id2=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] + purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1)]) + purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2)]) order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id - order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id - line_obj.write(cr, uid, [order_line1], {'product_qty':2}) - line_obj.write(cr, uid, [order_line2], {'product_qty':3}) + order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id + line_obj.write(cr, uid, order_line1, {'product_qty':2}) + line_obj.write(cr, uid, order_line2, {'product_qty':3}) - I confirm and validate both purchase orders @@ -143,7 +146,9 @@ - !python {model: stock.picking }: | import time - picking_id = self.search(cr, uid, [('origin','=','PO00001:TEST/TENDER/0001'),('type','=','in')]) + partner_obj=self.pool.get('res.partner') + partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] + picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) move =pick.move_lines[0] @@ -164,7 +169,8 @@ - !python {model: stock.picking }: | import time - picking_id = self.search(cr, uid, [('origin','=','PO00002:TEST/TENDER/0001'),('type','=','in')]) + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] + picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: pick=self.browse(cr,uid,picking_id[0]) move =pick.move_lines[0] diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index ee6d5b60d01..c6efc38dc60 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -95,10 +95,11 @@ ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) self.write(cr,uid,ids[0],{'exclusive': 'exclusive' }) - - I confirm and validate the RfQ of Asustek + I confirm and validate the RfQ of ASUStek - !python {model: purchase.order}: | - purchase_id= self.search(cr, uid, [('name','=','PO00003')])[0] + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] + purchase_id= self.search(cr, uid, [('partner_id','=','partner_id)])[0] import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: @@ -108,6 +109,6 @@ I check that RfQ of DistriPC is cancelled. - !python {model: purchase.order}: | - purchase_id= self.search(cr, uid, [('name','=','PO00004')])[0] + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') \ No newline at end of file From ac7a461f4ef317e648b9aec9533d46f9f7883684 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Tue, 11 May 2010 20:15:06 +0530 Subject: [PATCH 6/7] [IMP]: Improve the yml purchase_requisition bzr revid: sbh@tinyerp.com-20100511144506-tigiwtgb1vz6109v --- .../test/purchase_requisition_exclusive.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index c6efc38dc60..cc59649577e 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -99,7 +99,7 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=','partner_id)])[0] + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: @@ -110,5 +110,6 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') \ No newline at end of file From c1eb9abf86ab548491eb27c4659e560baa0378b7 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Thu, 13 May 2010 12:18:32 +0530 Subject: [PATCH 7/7] [IMP]: Improve the yml for purchase_requisition and delivery bzr revid: sbh@tinyerp.com-20100513064832-rbv0erf9aujoj42n --- addons/delivery/test/delivery_test.yml | 6 +++--- .../test/purchase_requisition.yml | 11 +++++++---- .../test/purchase_requisition_exclusive.yml | 10 +++++++--- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/addons/delivery/test/delivery_test.yml b/addons/delivery/test/delivery_test.yml index 3597ca523fa..36bc6ec7e19 100644 --- a/addons/delivery/test/delivery_test.yml +++ b/addons/delivery/test/delivery_test.yml @@ -1,5 +1,5 @@ - - In order to test the delivery module, I will do Configuration ‣ Delivery ‣ Delivery Method + In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method And there are two methods for doing that Delivery based on order quantities, Delivery based on delivered quantities. @@ -37,14 +37,14 @@ - - Creating a Delivery Method + I create the Delivery Method - !record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}: name: The OpenERP Experss partner_id: res_partner_thepost0 product_id: product_product_deliverybypost0 - - Creating a delivery.grid record and define the region for which the tariffs in the grid will be applicable. + I Create a delivery grid record and define the region for which the tariffs in the grid will be applicable. Then set the condition for which this rule is applicable - !record {model: delivery.grid, id: delivery_grid_weight0}: diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index ef2331a3518..6a8d52ed201 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -1,6 +1,6 @@ - - In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. - I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO, @@ -109,10 +109,12 @@ !python {model: purchase.order}: | line_obj=self.pool.get('purchase.order.line') partner_obj=self.pool.get('res.partner') + requistion_obj=self.pool.get('purchase.requisition') + requistion_ids =requistion_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')]) partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] - partner_id2=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1)]) - purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2)]) + partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0] + purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)]) + purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)]) order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id line_obj.write(cr, uid, order_line1, {'product_qty':2}) @@ -147,6 +149,7 @@ !python {model: stock.picking }: | import time partner_obj=self.pool.get('res.partner') + order_obj=self.pool.get('purchase.order') partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0] picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')]) if picking_id: diff --git a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml index cc59649577e..030b80b2260 100644 --- a/addons/purchase_requisition/test/purchase_requisition_exclusive.yml +++ b/addons/purchase_requisition/test/purchase_requisition_exclusive.yml @@ -1,5 +1,5 @@ - - In order to test the purchase requicisition module, I will do a sale order -> purchase_requisition -> + In order to test the purchase requisition module, I will do a sale order -> purchase_requisition -> purchase flow and I will buy the required products at two different suppliers. - @@ -99,7 +99,9 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: @@ -110,6 +112,8 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id)])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') \ No newline at end of file