From 614477f6e92ed35b379b46a74395737b46cd7236 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Mon, 18 Jul 2011 19:11:25 +0530 Subject: [PATCH 001/129] [AAD]purchase_double_validation: add yml for purchase_double_validation_installer.py bzr revid: aag@tinyerp.com-20110718134125-cimkcz05krvlxrfy --- .../purchase_double_validation/__openerp__.py | 1 + .../test/purchase_double_validation_test.yml | 117 ++++++++++++++++++ 2 files changed, 118 insertions(+) create mode 100755 addons/purchase_double_validation/test/purchase_double_validation_test.yml diff --git a/addons/purchase_double_validation/__openerp__.py b/addons/purchase_double_validation/__openerp__.py index 1a10fb5c0ce..803b48a59c0 100644 --- a/addons/purchase_double_validation/__openerp__.py +++ b/addons/purchase_double_validation/__openerp__.py @@ -39,6 +39,7 @@ that exceeds minimum amount set by configuration wizard. 'purchase_double_validation_workflow.xml', 'purchase_double_validation_installer.xml' ], + 'test': ['test/purchase_double_validation_test.yml'], 'demo_xml': [], 'installable': True, 'active': False, diff --git a/addons/purchase_double_validation/test/purchase_double_validation_test.yml b/addons/purchase_double_validation/test/purchase_double_validation_test.yml new file mode 100755 index 00000000000..ecc8d08a493 --- /dev/null +++ b/addons/purchase_double_validation/test/purchase_double_validation_test.yml @@ -0,0 +1,117 @@ +- + I Create new limit amount from Configure Limit Amount for Purchase wizard. +- + !record {model: purchase.double.validation.installer, id: purchase_double_validation_installer_1}: + limit_amount: 3000 +- + Then I set the Limit Amount +- + !python {model: purchase.double.validation.installer}: | + self.execute(cr, uid, [ref("purchase_double_validation_installer_1")]) +- + In order to test the purchase double validation flow,I start by creating a new product 'MOB1' +- + !record {model: product.product, id: product_product_mob1}: + categ_id: 'product.product_category_3' + cost_method: standard + mes_type: fixed + name: MOB1 + price_margin: 2.0 + procure_method: make_to_stock + property_stock_inventory: stock.location_inventory + property_stock_procurement: stock.location_procurement + property_stock_production: stock.location_production + seller_delay: '1' + standard_price: 2000.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 double validation flow,I create a new record where "invoice_method" is From Order. +- + Test for purchase double validation in which Total > = Limit Amount. +- + I create purchase order for MOB1 for 3 quantity. +- + !record {model: purchase.order, id: purchase_order_po11}: + company_id: base.main_company + date_order: '2011-01-1' + invoice_method: order + location_id: stock.stock_location_stock + order_line: + - date_planned: '2011-01-11' + name: MOB1 + price_unit: 2000.0 + product_id: 'product_product_mob1' + product_qty: 3.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_po11}: + - state == 'draft' +- + I confirm the purchase order for MOB1. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po11} +- + I check that the order which was initially in the draft state has transmit to confirm state for double validation. +- + !assert {model: purchase.order, id: purchase_order_po11}: + - state == 'confirmed' +- + I Approved purchase order by Supplier for MOB1. +- + !workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po11} +- + I check that the order which was initially in the confirmed state has transmit to approved state. +- + !assert {model: purchase.order, id: purchase_order_po11}: + - state == 'approved' +- + Test for purchase double validation in which Total < Limit Amount. +- + I create purchase order for MOB1 for 1 quantity. +- + !record {model: purchase.order, id: purchase_order_po12}: + company_id: base.main_company + date_order: '2011-01-02' + invoice_method: order + location_id: stock.stock_location_stock + order_line: + - date_planned: '2011-01-12' + name: MOB1 + price_unit: 2000.0 + product_id: 'product_product_mob1' + product_qty: 1.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_po12}: + - state == 'draft' +- + I confirm the purchase order for MOB1. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po12} +- + I check that the order which was initially in the draft state has transmit to approved state. +- + !assert {model: purchase.order, id: purchase_order_po12}: + - state == 'approved' + + + \ No newline at end of file From 3e29dbf440d5d70a00391f441683a532122e370e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Tue, 19 Jul 2011 11:15:33 +0530 Subject: [PATCH 002/129] [AAD]purchase_requisition: add yml purchase_requisition_test.yml for cover more functionality of module bzr revid: aag@tinyerp.com-20110719054533-64qd1znwp3opsqc2 --- addons/purchase_requisition/__openerp__.py | 4 +- .../test/purchase_requisition_test.yml | 174 ++++++++++++++++++ 2 files changed, 177 insertions(+), 1 deletion(-) create mode 100755 addons/purchase_requisition/test/purchase_requisition_test.yml diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index 5fd224b14f9..7e15c585803 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -42,7 +42,9 @@ This new object will regroup and will allow you to easily keep track and order a "security/ir.model.access.csv","purchase_requisition_sequence.xml" ], "active": False, - "test":['test/purchase_requisition_report.yml'], + "test":['test/purchase_requisition_report.yml', + 'test/purchase_requisition_test.yml', + ], "installable": True, "certificate" : "001023264099823179629", } diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml new file mode 100755 index 00000000000..3cc0a4bb065 --- /dev/null +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -0,0 +1,174 @@ +- + In order to test the purchase requisition flow,I start by creating a new product 'MOB1' +- + !record {model: product.product, id: product_product_mob1}: + name: MOB1 + categ_id: product.product_category_3 + cost_method: standard + mes_type: fixed + price_margin: 2.0 + procure_method: make_to_stock + property_stock_inventory: stock.location_inventory + property_stock_procurement: stock.location_procurement + property_stock_production: stock.location_production + seller_delay: '1' + standard_price: 2000.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 +- + I create purchase requisition for MOB1 for 1 quantity. +- + !record {model: purchase.requisition, id: purchase_requisition_te0}: + company_id: base.main_company + exclusive: multiple + line_ids: + - company_id: base.main_company + product_id: product_product_mob1 + product_qty: 10.0 + product_uom_id: product.product_uom_unit + name: TE00009 +- + Initially purchase requisition is in draft state. +- + !assert {model: purchase.requisition, id: purchase_requisition_te0}: + - state == 'draft' +- + I confirm the purchase requisition for MOB1. +- + !python {model: purchase.requisition}: | + self.tender_in_progress(cr, uid, [ref("purchase_requisition_te0")]) +- + I check that the purchase requisition which was initially in the draft state has transmit to In Progress after confirm it. +- + !assert {model: purchase.requisition, id: purchase_requisition_te0}: + - state == 'in_progress' +- + I Create a Purchase Order for the supplier 'Axelor'. +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}: + partner_address_id: base.res_partner_address_7 + partner_id: base.res_partner_desertic_hispafuentes +- + I create Quotations For supplier 'Axelor'. +- + !python {model: purchase.requisition.partner}: | + self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"active_model": "purchase.requisition", + "active_ids": [ref("purchase_requisition_te0")],"active_id": ref("purchase_requisition_te0"), }) +- + I confirm the purchase order of Axelor. +- + !python {model: purchase.order}: | + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('name','=','TE00009')]) + purchase_id= self.search(cr, uid, [('requisition_id','in',ids)]) + import netsvc + wf_service = netsvc.LocalService("workflow") + if purchase_id: + wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_approve', cr) +- + I check that Quotation of Axelor is Approved. +- + !python {model: purchase.order}: | + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid,[('name','=','TE00009')]) + purchase_id= self.search(cr, uid, [('requisition_id','in',ids)])[0] + state=self.browse(cr,uid,purchase_id).state + assert (state=='approved') +- + I click on Done button +- + !python {model: purchase.requisition}: | + self.tender_done(cr, uid, [ref("purchase_requisition_te0")],) +- + I check that after click on Done button state is in done. +- + !assert {model: purchase.requisition, id: purchase_requisition_te0}: + - state == 'done' +- + In order to test the purchase requisition flow for Requisition Type is exclusive +- + I create purchase requisition for Requisition Type is exclusive +- + !record {model: purchase.requisition, id: purchase_requisition_ex1}: + company_id: base.main_company + exclusive: exclusive + line_ids: + - company_id: base.main_company + product_id: product_product_mob1 + product_qty: 10.0 + product_uom_id: product.product_uom_unit + name: TE000010 +- + I Create a First Purchase Order for the supplier 'DistriPC'. +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_1}: + partner_address_id: base.res_partner_address_7 + partner_id: base.res_partner_4 +- + I create Quotations For supplier 'DistriPC'. +- + !python {model: purchase.requisition.partner}: | + self.create_order(cr, uid, [ref("purchase_requisition_partner_1")], {"active_model": "purchase.requisition", + "active_ids": [ref("purchase_requisition_ex1")],"active_id": ref("purchase_requisition_ex1"), }) +- + I Create a Second Purchase Order for the supplier ASUStek. +- + !record {model: purchase.requisition.partner, id: purchase_requisition_partner_2}: + partner_address_id: base.res_partner_address_7 + partner_id: base.res_partner_asus +- + I create Quotations For supplier 'ASUStek'. +- + !python {model: purchase.requisition.partner}: | + self.create_order(cr, uid, [ref("purchase_requisition_partner_2")], {"active_model": "purchase.requisition", + "active_ids": [ref("purchase_requisition_ex1")],"active_id": ref("purchase_requisition_ex1"), }) +- + I check that Initially purchase requisition is draft state. +- + !assert {model: purchase.requisition, id: purchase_requisition_ex1}: + - state == 'draft' +- + I confirm the Second purchase order of ASUStek. +- + !python {model: purchase.order}: | + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid, [('name','=','TE000010')]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)]) + import netsvc + wf_service = netsvc.LocalService("workflow") + if purchase_id: + wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_confirm', cr) + wf_service.trg_validate(uid, 'purchase.order',purchase_id[0],'purchase_approve', cr) +- + I check that Quotation of ASUStek is Approved. +- + !python {model: purchase.order}: | + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid,[('name','=','TE000010')]) + 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=='approved') +- + I check that Quotation of DistriPC is cancelled. +- + !python {model: purchase.order}: | + partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] + req_obj = self.pool.get('purchase.requisition') + ids =req_obj.search(cr, uid,[('name','=','TE000010')]) + 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') +- + I check that Purchase Requisition is Done. +- + !assert {model: purchase.requisition, id: purchase_requisition_ex1}: + - state == 'done' \ No newline at end of file From 6dc6b8dddc246c05afc4254bfcdde8a68bc0415e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 21 Jul 2011 17:28:17 +0530 Subject: [PATCH 003/129] [AAD]purchase: add yml purchase_order_merge.yml for cover more functionality of merging PO bzr revid: aag@tinyerp.com-20110721115817-io4fomevc9v8egwk --- addons/purchase/__openerp__.py | 1 + addons/purchase/test/purchase_order_merge.yml | 85 +++++++++++++++++++ 2 files changed, 86 insertions(+) create mode 100644 addons/purchase/test/purchase_order_merge.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index 1fb49198404..d52c84ceedf 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -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, diff --git a/addons/purchase/test/purchase_order_merge.yml b/addons/purchase/test/purchase_order_merge.yml new file mode 100644 index 00000000000..fab75f63037 --- /dev/null +++ b/addons/purchase/test/purchase_order_merge.yml @@ -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}) From 5b9d4e1c76cd7f48ca29c80563f883490c422191 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 28 Jul 2011 15:10:42 +0530 Subject: [PATCH 004/129] [IMP]purchase: Change Expected Date in Purchase order . bzr revid: aag@tinyerp.com-20110728094042-8k06xmajr9xp1w5x --- addons/purchase/test/purchase_from_order.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/addons/purchase/test/purchase_from_order.yml b/addons/purchase/test/purchase_from_order.yml index 3acc68cb51b..cb2fe88f841 100644 --- a/addons/purchase/test/purchase_from_order.yml +++ b/addons/purchase/test/purchase_from_order.yml @@ -51,6 +51,17 @@ I confirm the purchase order for iPod. - !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0} +- + I changed Expected Date to Next Day. +- + !python {model: purchase.order}: | + from tools.translate import _ + import time + from datetime import datetime + from dateutil.relativedelta import relativedelta + next_day = datetime.today() + relativedelta(days=1) + purod_id=self.browse(cr, uid, ref("purchase_order_po0")) + self._set_minimum_planned_date(cr, uid, purod_id.id, 'minimum_planned_date', next_day.strftime('%Y-%m-%d'),None ) - I check that the order which was initially in the draft state has transit to confirm state. - From 9f104b52e3dc16400b2f0ec7d25a1ec9e03e0d30 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 28 Jul 2011 18:38:00 +0530 Subject: [PATCH 005/129] [ADD]purchase: Add yml for Purchase Order cancel from Aproved state. bzr revid: aag@tinyerp.com-20110728130800-ti3360jmmncbg8jh --- addons/purchase/__openerp__.py | 5 +- .../test/purchase_order_cancel_draft.yml | 94 +++++++++++++++++++ 2 files changed, 97 insertions(+), 2 deletions(-) create mode 100644 addons/purchase/test/purchase_order_cancel_draft.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index d52c84ceedf..827d2a4971e 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -65,8 +65,9 @@ Dashboard for purchase management that includes: 'purchase_unit_test.xml', 'test/procurement_buy.yml', 'test/purchase_report.yml', - 'test/purchase_order_merge.yml' - ], + 'test/purchase_order_merge.yml', + 'test/purchase_order_cancel_draft.yml' + ], 'demo': ['purchase_demo.xml'], 'installable': True, 'active': False, diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml new file mode 100644 index 00000000000..b1c8b6ef938 --- /dev/null +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -0,0 +1,94 @@ +- + In order to test to Cancel purchase order from Approved State,I start by creating a new product 'Pen Drive1' +- + !record {model: product.product, id: product_product_pendrive1}: + categ_id: 'product.product_category_3' + cost_method: standard + mes_type: fixed + name: Pen Drive + 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. +- + I create first purchase order for Pen Drive1. +- + !record {model: purchase.order, id: purchase_order_pendrive1}: + 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: Pen Drive + price_unit: 100.0 + product_id: 'product_product_pendrive1' + 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_pendrive1}: + - state == 'draft' +- + I confirm the purchase order for Pen Drive1. +- + !workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_pendrive1} +- + I check that the order which was initially in the draft state has transmit to confirm state. +- + !assert {model: purchase.order, id: purchase_order_pendrive1}: + - state == 'approved' +- + I have to first cancel Picking of Approved Perchase order . +- + !python {model: stock.picking}: | + from tools.translate import _ + pur_ord=self.pool.get( 'purchase.order') + name = pur_ord.browse(cr, uid, ref("purchase_order_pendrive1")).name + search_ids=self.search(cr, uid, [('origin', '=', name) ]) + self.action_cancel(cr, uid, search_ids) +- + Now I have to cancel confirm purchase order for Pen Drive1. +- + !python {model: purchase.order}: | + from tools.translate import _ + ids = [] + ids.append(ref("purchase_order_pendrive1")) + self.action_cancel(cr, uid, ids) +- + I check that the order which was in approved state has transmit to cancel state. +- + !assert {model: purchase.order, id: purchase_order_pendrive1}: + - state == 'cancel' +- + Now again set purchase order for Pen Drive1 to draft state. +- + !python {model: purchase.order}: | + from tools.translate import _ + ids = [] + ids.append(ref("purchase_order_pendrive1")) + self.action_cancel_draft(cr, uid, ids) +- + I check that the order which was in cancel state has transmit to draft state. +- + !assert {model: purchase.order, id: purchase_order_pendrive1}: + - state == 'draft' + \ No newline at end of file From 30c2c2e997f4f716b7e154adcc420b31eb9d8e1c Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 29 Jul 2011 16:15:40 +0530 Subject: [PATCH 006/129] [IMP]purchase: Add Functionality to test onchange Warehouse id , product_id, uom_id bzr revid: aag@tinyerp.com-20110729104540-9a2pvv34rw1rm8yk --- .../test/purchase_order_cancel_draft.yml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index b1c8b6ef938..ad8eb1d3508 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -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. - From e34cb5bc84d3cef25a1544e93ff1a1a59caebea4 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 29 Jul 2011 16:36:41 +0530 Subject: [PATCH 007/129] [IMP]purchase: Add Functionality to test onchange Destination Address and Unlink PO bzr revid: aag@tinyerp.com-20110729110641-g37tzvesaidhy2uq --- addons/purchase/test/purchase_order_cancel_draft.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index ad8eb1d3508..0bae780348c 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -71,7 +71,7 @@ !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' - - I test onchanged on Wharehouse ,Product , Uom . + I test onchanged on Wharehouse ,Product, Uom, Destination Address . - !python {model: purchase.order}: | from tools.translate import _ @@ -91,6 +91,8 @@ 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]) + address_id = addrss_obj.search(cr, uid, [('partner_id','=',part_ids)]) + self.onchange_dest_address_id(cr, uid, ids, address_id[0]) - I confirm the purchase order for Pen Drive1. - @@ -135,4 +137,12 @@ - !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' +- + I test for Delete Perchase order in Draft state. +- + !python {model: purchase.order}: | + from tools.translate import _ + ids = [] + ids.append(ref("purchase_order_pendrive1")) + self.unlink(cr, uid, ids) \ No newline at end of file From 4564c11b9948439ec4ce502c6378aaa07bfb6160 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 29 Jul 2011 17:00:46 +0530 Subject: [PATCH 008/129] [IMP]purchase: Add Functionality to test copy Purchase order bzr revid: aag@tinyerp.com-20110729113046-s9gcm17noc4snu9y --- addons/purchase/test/purchase_order_cancel_draft.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 0bae780348c..662467b8bfb 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -138,11 +138,12 @@ !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' - - I test for Delete Perchase order in Draft state. + I test for Copy and Delete Perchase order in Draft state. - !python {model: purchase.order}: | from tools.translate import _ ids = [] ids.append(ref("purchase_order_pendrive1")) + self.copy(cr, uid, ids[0]) self.unlink(cr, uid, ids) \ No newline at end of file From a7a52fe5f4793c8ea999cfefad2ce906cf40fc39 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 12 Aug 2011 15:39:14 +0530 Subject: [PATCH 009/129] [ADD] Product: Add product_test yml bzr revid: aag@tinyerp.com-20110812100914-sumunc1837xqp9zf --- addons/product/__openerp__.py | 2 +- addons/product/test/product_test.yml | 51 ++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 addons/product/test/product_test.yml diff --git a/addons/product/__openerp__.py b/addons/product/__openerp__.py index bcddcc93bdf..b05ba4d3a25 100644 --- a/addons/product/__openerp__.py +++ b/addons/product/__openerp__.py @@ -61,7 +61,7 @@ Print product labels with barcode. 'partner_view.xml', 'process/product_process.xml' ], - 'test':['test/product_report.yml'], + 'test':['test/product_report.yml','test/product_test.yml'], 'installable': True, 'active': False, 'certificate': '0068861431437', diff --git a/addons/product/test/product_test.yml b/addons/product/test/product_test.yml new file mode 100644 index 00000000000..dcf83cb9740 --- /dev/null +++ b/addons/product/test/product_test.yml @@ -0,0 +1,51 @@ +- + In order to test product,I start by creating a Category +- + !record {model: product.category, id: product_category_suger}: + name: vehicle + type: normal +- + I create a 20KG UOM for 'Suger' +- + !record {model: product.uom, id: product_20k_uom_suger}: + name: 20KG + uom_type: bigger + category_id: 2 + rounding: 0.010 + factor_inv: 20 +- + I create a 10KG UOM for 'Suger' +- + !record {model: product.uom, id: product_10k_uom_suger}: + name: 10KG + uom_type: bigger + category_id: 2 + rounding: 0.010 + factor_inv: 10 +- + I create a new product 'Suger' +- + !record {model: product.product, id: product_suger_id1}: + categ_id: 'product.product_category_suger' + cost_method: standard + name: Cycle + procure_method: make_to_order + seller_delay: '1' + standard_price: 400.0 + uom_id: product.product_20k_uom_suger + uom_po_id: product.product_20k_uom_suger + volume: 0.0 + warranty: 0.0 + weight: 0.0 + weight_net: 0.0 +- + I test onchanged on Uom, Create Dublicate Product and Delete original Product. +- + !python {model: product.product}: | + from tools.translate import _ + ids = [] + ids.append(ref("product_suger_id1")) + self.onchange_uom(cr ,uid, ids, ref("product.product_20k_uom_suger"), ref("product_10k_uom_suger")) + self.copy(cr, uid, ids[0]) + self.unlink(cr, uid, ids) +- \ No newline at end of file From abb387c4cf74991ec79ff3b565b5369e8fac9503 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 12 Aug 2011 16:39:12 +0530 Subject: [PATCH 010/129] [IMP] Purchase: Optimize Purcase Code for merging PO bzr revid: aag@tinyerp.com-20110812110912-7iqg5lu5s3xw183f --- addons/purchase/test/purchase_order_merge.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/addons/purchase/test/purchase_order_merge.yml b/addons/purchase/test/purchase_order_merge.yml index fab75f63037..61555806d88 100644 --- a/addons/purchase/test/purchase_order_merge.yml +++ b/addons/purchase/test/purchase_order_merge.yml @@ -75,11 +75,6 @@ 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] + ids = [ref("purchase_order_po_nokia1"),ref("purchase_order_po_nokia2")] self.fields_view_get(cr, uid, context={'active_ids': ids}) self.merge_orders(cr, uid, [1], context={'active_ids': ids}) From cbb1d53ac8178f5211da46e6b91fcc2adbcf8083 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 12 Aug 2011 16:44:24 +0530 Subject: [PATCH 011/129] [IMP] Purchase: Optimize Purcase Code for From Order yml bzr revid: aag@tinyerp.com-20110812111424-37eumzycikt8jdk8 --- addons/purchase/test/purchase_from_order.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/purchase/test/purchase_from_order.yml b/addons/purchase/test/purchase_from_order.yml index cb2fe88f841..4e72079b3be 100644 --- a/addons/purchase/test/purchase_from_order.yml +++ b/addons/purchase/test/purchase_from_order.yml @@ -60,8 +60,7 @@ from datetime import datetime from dateutil.relativedelta import relativedelta next_day = datetime.today() + relativedelta(days=1) - purod_id=self.browse(cr, uid, ref("purchase_order_po0")) - self._set_minimum_planned_date(cr, uid, purod_id.id, 'minimum_planned_date', next_day.strftime('%Y-%m-%d'),None ) + self._set_minimum_planned_date(cr, uid, ref("purchase_order_po0"), 'minimum_planned_date', next_day.strftime('%Y-%m-%d'),None ) - I check that the order which was initially in the draft state has transit to confirm state. - From 9013acbe9033d3ae2c86caa43c20f494431a68a4 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 12 Aug 2011 17:00:22 +0530 Subject: [PATCH 012/129] [IMP] Purchase: Optimize purchase_order_cancel_draft yml bzr revid: aag@tinyerp.com-20110812113022-9bvodza62zjt1j6d --- .../purchase/test/purchase_order_cancel_draft.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 662467b8bfb..6065e34994f 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -116,9 +116,7 @@ - !python {model: purchase.order}: | from tools.translate import _ - ids = [] - ids.append(ref("purchase_order_pendrive1")) - self.action_cancel(cr, uid, ids) + self.action_cancel(cr, uid, [ref("purchase_order_pendrive1")]) - I check that the order which was in approved state has transmit to cancel state. - @@ -129,9 +127,7 @@ - !python {model: purchase.order}: | from tools.translate import _ - ids = [] - ids.append(ref("purchase_order_pendrive1")) - self.action_cancel_draft(cr, uid, ids) + self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")]) - I check that the order which was in cancel state has transmit to draft state. - @@ -142,8 +138,6 @@ - !python {model: purchase.order}: | from tools.translate import _ - ids = [] - ids.append(ref("purchase_order_pendrive1")) - self.copy(cr, uid, ids[0]) - self.unlink(cr, uid, ids) + self.copy(cr, uid, ref("purchase_order_pendrive1")) + self.unlink(cr, uid, [ref("purchase_order_pendrive1")]) \ No newline at end of file From 9e5c84fd2ae393a5d68d7e9bf74c1bcd8c649fbc Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Fri, 12 Aug 2011 17:14:12 +0530 Subject: [PATCH 013/129] [IMP] Purchase: Optimize purchase_order_cancel_draft yml Again bzr revid: aag@tinyerp.com-20110812114412-1zi5v8ueg4jxx0d6 --- addons/purchase/test/purchase_order_cancel_draft.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 6065e34994f..c31ba7ce68c 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -75,9 +75,7 @@ - !python {model: purchase.order}: | from tools.translate import _ - ids = [] - ids.append(ref("purchase_order_pendrive1")) - self.onchange_warehouse_id(cr, uid, ids , 1) + self.onchange_warehouse_id(cr, uid, [ref("purchase_order_pendrive1")], 1) part_obj = self.pool.get('res.partner') price_obj = self.pool.get('product.pricelist') product_obj = self.pool.get('product.product') @@ -88,11 +86,11 @@ 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])]) + line_id = po_line_obj.search(cr, uid, [('order_id','=',ref("purchase_order_pendrive1"))]) 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]) address_id = addrss_obj.search(cr, uid, [('partner_id','=',part_ids)]) - self.onchange_dest_address_id(cr, uid, ids, address_id[0]) + self.onchange_dest_address_id(cr, uid, [ref("purchase_order_pendrive1")], address_id[0]) - I confirm the purchase order for Pen Drive1. - From c95fc748a33a560b88556cbc74b8b8c56592a77e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 11:51:29 +0530 Subject: [PATCH 014/129] [IMP] Purchase: Optimize purchase_order_cancel_draft.yml bzr revid: aag@tinyerp.com-20110825062129-g0kr3dmpkto5960s --- addons/purchase/test/purchase_order_cancel_draft.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index c31ba7ce68c..8b15b285948 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -101,13 +101,11 @@ !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'approved' - - I have to first cancel Picking of Approved Perchase order . + I have to first cancel Picking of Approved Purchase order . - !python {model: stock.picking}: | from tools.translate import _ - pur_ord=self.pool.get( 'purchase.order') - name = pur_ord.browse(cr, uid, ref("purchase_order_pendrive1")).name - search_ids=self.search(cr, uid, [('origin', '=', name) ]) + search_ids=self.search(cr, uid, [('purchase_id', '=', ref("purchase_order_pendrive1"))]) self.action_cancel(cr, uid, search_ids) - Now I have to cancel confirm purchase order for Pen Drive1. From 9c939e3024786b276b07a59a8651da4c5d202192 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 13:51:16 +0530 Subject: [PATCH 015/129] [IMP] Purchase: write on purchase order instead of manually calling _set_minimum_planned_date bzr revid: aag@tinyerp.com-20110825082116-iwo2zlhox65bsk8q --- addons/purchase/test/purchase_from_order.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/purchase/test/purchase_from_order.yml b/addons/purchase/test/purchase_from_order.yml index 4e72079b3be..5863483f2dc 100644 --- a/addons/purchase/test/purchase_from_order.yml +++ b/addons/purchase/test/purchase_from_order.yml @@ -56,11 +56,10 @@ - !python {model: purchase.order}: | from tools.translate import _ - import time from datetime import datetime from dateutil.relativedelta import relativedelta next_day = datetime.today() + relativedelta(days=1) - self._set_minimum_planned_date(cr, uid, ref("purchase_order_po0"), 'minimum_planned_date', next_day.strftime('%Y-%m-%d'),None ) + self.write(cr, uid, [ref("purchase_order_po0")], {'minimum_planned_date': next_day}) - I check that the order which was initially in the draft state has transit to confirm state. - From 5a382e6167823157c329e46ac0421bffa00fb354 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:00:50 +0530 Subject: [PATCH 016/129] [IMP] Purchase: Remove statement from yml bzr revid: aag@tinyerp.com-20110825083050-js34gvqlaijoku37 --- addons/purchase/test/purchase_order_cancel_draft.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 8b15b285948..14ab437110e 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -45,9 +45,7 @@ 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. -- - I create first purchase order for Pen Drive1. + I create first purchase order for Pen Drive1 where "invoice_method" is From Order. - !record {model: purchase.order, id: purchase_order_pendrive1}: company_id: base.main_company From 293b63f4d8888abbee0d4940774d9341f1e13d44 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:04:49 +0530 Subject: [PATCH 017/129] [IMP] Purchase: Remove from tools.translate import _ bzr revid: aag@tinyerp.com-20110825083449-sx2xqf4rwimee0nh --- addons/purchase/test/purchase_order_cancel_draft.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 14ab437110e..1bdb5aaa578 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -109,7 +109,6 @@ Now I have to cancel confirm purchase order for Pen Drive1. - !python {model: purchase.order}: | - from tools.translate import _ self.action_cancel(cr, uid, [ref("purchase_order_pendrive1")]) - I check that the order which was in approved state has transmit to cancel state. From 03d68cc44b4d2b2e0745b033fdbdd102a9089dff Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:05:53 +0530 Subject: [PATCH 018/129] [IMP] Purchase: Remove from tools.translate import _ bzr revid: aag@tinyerp.com-20110825083553-3a6xrnpsbpp6wzgy --- addons/purchase/test/purchase_order_cancel_draft.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 1bdb5aaa578..2ce246bb7e4 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -119,7 +119,6 @@ Now again set purchase order for Pen Drive1 to draft state. - !python {model: purchase.order}: | - from tools.translate import _ self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")]) - I check that the order which was in cancel state has transmit to draft state. From bb6508040dfa8e70a1d4a74d17333e807aa8c638 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:20:38 +0530 Subject: [PATCH 019/129] [IMP] Purchase: change the tag bzr revid: aag@tinyerp.com-20110825085038-reiitbn3rjxz4y22 --- addons/purchase/test/purchase_order_cancel_draft.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 2ce246bb7e4..78208166e41 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -121,7 +121,7 @@ !python {model: purchase.order}: | self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")]) - - I check that the order which was in cancel state has transmit to draft state. + I check that the order is in draft state. - !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' From b6534076a3af746f2ca87013dae96288c7be33ca Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:33:19 +0530 Subject: [PATCH 020/129] [IMP] Purchase: Remove Duplicate Record bzr revid: aag@tinyerp.com-20110825090319-0scigeqn4beeehrk --- addons/purchase/test/purchase_order_cancel_draft.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 78208166e41..da4961d7ae7 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -130,6 +130,6 @@ - !python {model: purchase.order}: | from tools.translate import _ - self.copy(cr, uid, ref("purchase_order_pendrive1")) - self.unlink(cr, uid, [ref("purchase_order_pendrive1")]) + copy_id = self.copy(cr, uid, ref("purchase_order_pendrive1")) + self.unlink(cr, uid, [copy_id]) \ No newline at end of file From e4244b640518384443d6b6414dc48524ccb4774a Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:50:26 +0530 Subject: [PATCH 021/129] [IMP] Purchase: Add new optimize code for Merging PO bzr revid: aag@tinyerp.com-20110825092026-3vuc4x2x78s8ont2 --- .../test/purchase_order_cancel_draft.yml | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index da4961d7ae7..35872418f84 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -121,7 +121,7 @@ !python {model: purchase.order}: | self.action_cancel_draft(cr, uid, [ref("purchase_order_pendrive1")]) - - I check that the order is in draft state. + I check that the First purchase order is in draft state. - !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' @@ -132,4 +132,36 @@ from tools.translate import _ copy_id = self.copy(cr, uid, ref("purchase_order_pendrive1")) self.unlink(cr, uid, [copy_id]) +- + I create Second purchase order for Pen Drive1 where "invoice_method" is From Order. +- + !record {model: purchase.order, id: purchase_order_pendrive2}: + 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: Pen Drive + price_unit: 100.0 + product_id: 'product_product_pendrive1' + 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 Second purchase order is in the draft state. +- + !assert {model: purchase.order, id: purchase_order_pendrive2}: + - 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}: | + ids = [ref("purchase_order_pendrive1"),ref("purchase_order_pendrive2")] + self.fields_view_get(cr, uid, context={'active_ids': ids}) + self.merge_orders(cr, uid, [1], context={'active_ids': ids}) + \ No newline at end of file From c0f3cc7a71b1e7e9ee06e7b499aeb3e0e571ef34 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 14:55:45 +0530 Subject: [PATCH 022/129] [REM] Purchase: Remove purchase/test/purchase_order_merge.yml file bzr revid: aag@tinyerp.com-20110825092545-on6o4ujyyn8g2cmc --- addons/purchase/__openerp__.py | 1 - addons/purchase/test/purchase_order_merge.yml | 80 ------------------- 2 files changed, 81 deletions(-) delete mode 100644 addons/purchase/test/purchase_order_merge.yml diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index 20efb26d3d2..cc009386f67 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -66,7 +66,6 @@ Dashboard for purchase management that includes: 'purchase_unit_test.xml', 'test/procurement_buy.yml', 'test/purchase_report.yml', - 'test/purchase_order_merge.yml', 'test/purchase_order_cancel_draft.yml' ], 'demo': ['purchase_demo.xml'], diff --git a/addons/purchase/test/purchase_order_merge.yml b/addons/purchase/test/purchase_order_merge.yml deleted file mode 100644 index 61555806d88..00000000000 --- a/addons/purchase/test/purchase_order_merge.yml +++ /dev/null @@ -1,80 +0,0 @@ -- - 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}: | - ids = [ref("purchase_order_po_nokia1"),ref("purchase_order_po_nokia2")] - self.fields_view_get(cr, uid, context={'active_ids': ids}) - self.merge_orders(cr, uid, [1], context={'active_ids': ids}) From 3d4e04d904a86d5f5294c60780ddadab4c4eb826 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 15:08:05 +0530 Subject: [PATCH 023/129] [REM] Purchase: Remove Onchange function call bzr revid: aag@tinyerp.com-20110825093805-5wptnyuya7n7qfzq --- .../test/purchase_order_cancel_draft.yml | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/addons/purchase/test/purchase_order_cancel_draft.yml b/addons/purchase/test/purchase_order_cancel_draft.yml index 35872418f84..1cd37b8d87f 100644 --- a/addons/purchase/test/purchase_order_cancel_draft.yml +++ b/addons/purchase/test/purchase_order_cancel_draft.yml @@ -68,27 +68,6 @@ - !assert {model: purchase.order, id: purchase_order_pendrive1}: - state == 'draft' -- - I test onchanged on Wharehouse ,Product, Uom, Destination Address . -- - !python {model: purchase.order}: | - from tools.translate import _ - self.onchange_warehouse_id(cr, uid, [ref("purchase_order_pendrive1")], 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','=',ref("purchase_order_pendrive1"))]) - 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]) - address_id = addrss_obj.search(cr, uid, [('partner_id','=',part_ids)]) - self.onchange_dest_address_id(cr, uid, [ref("purchase_order_pendrive1")], address_id[0]) - I confirm the purchase order for Pen Drive1. - From d8f1410505b154e7a99a40e77c9fefb35158fd7e Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 15:44:48 +0530 Subject: [PATCH 024/129] [IMP]: use datetime.timedelta instead of relativedelta bzr revid: aag@tinyerp.com-20110825101448-o3ndugu3zfduv0zf --- addons/purchase/test/purchase_from_order.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/addons/purchase/test/purchase_from_order.yml b/addons/purchase/test/purchase_from_order.yml index 5863483f2dc..8e46899f8a0 100644 --- a/addons/purchase/test/purchase_from_order.yml +++ b/addons/purchase/test/purchase_from_order.yml @@ -55,10 +55,8 @@ I changed Expected Date to Next Day. - !python {model: purchase.order}: | - from tools.translate import _ - from datetime import datetime - from dateutil.relativedelta import relativedelta - next_day = datetime.today() + relativedelta(days=1) + import datetime + next_day = (datetime.date.today()+datetime.timedelta(days=1)) self.write(cr, uid, [ref("purchase_order_po0")], {'minimum_planned_date': next_day}) - I check that the order which was initially in the draft state has transit to confirm state. From a7c80240cb0d4380b56dd609dbf0db54fa4900e2 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 16:29:14 +0530 Subject: [PATCH 025/129] [REM] purchase_requisition: Remove Static code from yml bzr revid: aag@tinyerp.com-20110825105914-3aq90dc5h72g4z03 --- .../test/purchase_requisition_test.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml index 3cc0a4bb065..82bb3d86f89 100755 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -64,9 +64,7 @@ I confirm the purchase order of Axelor. - !python {model: purchase.order}: | - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('name','=','TE00009')]) - purchase_id= self.search(cr, uid, [('requisition_id','in',ids)]) + purchase_id= self.search(cr, uid, [('requisition_id','=',ref("purchase_requisition_te0"))]) import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: @@ -76,9 +74,7 @@ I check that Quotation of Axelor is Approved. - !python {model: purchase.order}: | - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid,[('name','=','TE00009')]) - purchase_id= self.search(cr, uid, [('requisition_id','in',ids)])[0] + purchase_id= self.search(cr, uid, [('requisition_id','=',ref("purchase_requisition_te0"))])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='approved') - From d62df3ae923e090f8faeb104a68aecc0e8ef6e4c Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 16:35:35 +0530 Subject: [PATCH 026/129] [REM] purchase_requisition: Remove Static code from yml bzr revid: aag@tinyerp.com-20110825110535-rclb0ldd9dcj8l2r --- .../purchase_requisition/test/purchase_requisition_test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml index 82bb3d86f89..385f93ae33d 100755 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -135,9 +135,7 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid, [('name','=','TE000010')]) - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)]) + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','=',ref("purchase_requisition_ex1"))]) import netsvc wf_service = netsvc.LocalService("workflow") if purchase_id: From ca82be04a99d2b0d98e9944c1199ea34fe056cb0 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 16:40:04 +0530 Subject: [PATCH 027/129] [REM] purchase_requisition: Remove Static code from yml bzr revid: aag@tinyerp.com-20110825111004-qqw4akeen0caiibz --- .../purchase_requisition/test/purchase_requisition_test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml index 385f93ae33d..1ffd11a5ec1 100755 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -146,9 +146,7 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0] - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid,[('name','=','TE000010')]) - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','=',ref("purchase_requisition_ex1"))])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='approved') - From 53b441bb845e97d2836582149e206d02b7170c61 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 16:43:44 +0530 Subject: [PATCH 028/129] [REM] purchase_requisition: Remove Static code from yml bzr revid: aag@tinyerp.com-20110825111344-on8euk2slev36pmt --- .../purchase_requisition/test/purchase_requisition_test.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml index 1ffd11a5ec1..5aaa8e22123 100755 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -154,9 +154,7 @@ - !python {model: purchase.order}: | partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0] - req_obj = self.pool.get('purchase.requisition') - ids =req_obj.search(cr, uid,[('name','=','TE000010')]) - purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0] + purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','=',ref("purchase_requisition_ex1"))])[0] state=self.browse(cr,uid,purchase_id).state assert (state=='cancel') - From 4923de9a822c540647dcef62f1a732cedda778d7 Mon Sep 17 00:00:00 2001 From: "Atik Agewan (OpenERP)" Date: Thu, 25 Aug 2011 17:25:19 +0530 Subject: [PATCH 029/129] [IMP]: purchase_requisition:Add code for copy ,confirm, Done requsitions bzr revid: aag@tinyerp.com-20110825115519-06mn72wvm30bg80s --- .../test/purchase_requisition_test.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/addons/purchase_requisition/test/purchase_requisition_test.yml b/addons/purchase_requisition/test/purchase_requisition_test.yml index 5aaa8e22123..1cab8ff8f2d 100755 --- a/addons/purchase_requisition/test/purchase_requisition_test.yml +++ b/addons/purchase_requisition/test/purchase_requisition_test.yml @@ -38,6 +38,15 @@ - !assert {model: purchase.requisition, id: purchase_requisition_te0}: - state == 'draft' +- + Copy purchase requisition which is in draft state than confirm and Done it. +- + !python {model: purchase.requisition}: | + copy_id = self.copy(cr, uid, ref("purchase_requisition_te0")) + self.tender_cancel(cr, uid, [copy_id], context=None) + self.tender_reset(cr, uid, [copy_id], context=None) + self.tender_in_progress(cr, uid, [copy_id], context=None) + self.tender_done(cr, uid, [copy_id], context=None) - I confirm the purchase requisition for MOB1. - From 72b6ac7daf626f4a2f00ce0c0b54bff82cd673fe Mon Sep 17 00:00:00 2001 From: "Purnendu Singh (OpenERP)" Date: Thu, 8 Sep 2011 16:19:21 +0530 Subject: [PATCH 030/129] [FIX] account_payment: account_payment not allowing selection of invoices for payment lp bug: https://launchpad.net/bugs/834091 fixed bzr revid: psi@tinyerp.com-20110908104921-70a4v56zxfyeh5al --- .../account_payment_create_order_view.xml | 3 +- .../wizard/account_payment_order.py | 29 +++++++++---------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/addons/account_payment/wizard/account_payment_create_order_view.xml b/addons/account_payment/wizard/account_payment_create_order_view.xml index 905baf7e118..10d437533f4 100644 --- a/addons/account_payment/wizard/account_payment_create_order_view.xml +++ b/addons/account_payment/wizard/account_payment_create_order_view.xml @@ -26,7 +26,8 @@ form
- + + diff --git a/addons/account_payment/wizard/account_payment_order.py b/addons/account_payment/wizard/account_payment_order.py index d1137078c32..613b049a412 100644 --- a/addons/account_payment/wizard/account_payment_order.py +++ b/addons/account_payment/wizard/account_payment_order.py @@ -29,7 +29,7 @@ class payment_order_create(osv.osv_memory): Create a payment object with lines corresponding to the account move line to pay according to the date and the mode provided by the user. Hypothesis: - - Small number of non-reconcilied move line, payment mode and bank account type, + - Small number of non-reconciled move line, payment mode and bank account type, - Big number of partner and bank account. If a type is given, unsuitable account Entry lines are ignored. @@ -48,12 +48,11 @@ class payment_order_create(osv.osv_memory): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(payment_order_create, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False) if context and 'line_ids' in context: - view_obj = etree.XML(res['arch']) - child = view_obj.getchildren()[0] - domain = '[("id", "in", '+ str(context['line_ids'])+')]' - field = etree.Element('field', attrib={'domain': domain, 'name':'entries', 'colspan':'4', 'height':'300', 'width':'800', 'nolabel':"1"}) - child.addprevious(field) - res['arch'] = etree.tostring(view_obj) + doc = etree.XML(res['arch']) + nodes = doc.xpath("//field[@name='entries']") + for node in nodes: + node.set('domain', '[("id", "in", '+ str(context['line_ids'])+')]') + res['arch'] = etree.tostring(doc) return res def create_payment(self, cr, uid, ids, context=None): @@ -81,14 +80,14 @@ class payment_order_create(osv.osv_memory): elif payment.date_prefered == 'fixed': date_to_pay = payment.date_scheduled payment_obj.create(cr, uid,{ - 'move_line_id': line.id, - 'amount_currency': line.amount_to_pay, - 'bank_id': line2bank.get(line.id), - 'order_id': payment.id, - 'partner_id': line.partner_id and line.partner_id.id or False, - 'communication': line.ref or '/', - 'date': date_to_pay, - 'currency': line.invoice and line.invoice.currency_id.id or False, + 'move_line_id': line.id, + 'amount_currency': line.amount_to_pay, + 'bank_id': line2bank.get(line.id), + 'order_id': payment.id, + 'partner_id': line.partner_id and line.partner_id.id or False, + 'communication': line.ref or '/', + 'date': date_to_pay, + 'currency': line.invoice and line.invoice.currency_id.id or False, }, context=context) return {'type': 'ir.actions.act_window_close'} From 7627d736189d17f08d848c969e47b2dd29bcf09c Mon Sep 17 00:00:00 2001 From: "Mustufa Rangwala (OpenERP)" Date: Mon, 12 Sep 2011 12:34:17 +0530 Subject: [PATCH 031/129] [FIX] Account_payment: onchange partner for voucher creation argument mismatch due to change of name bzr revid: mra@tinyerp.com-20110912070417-sreyrs9ezxh51v51 --- .../wizard/account_payment_populate_statement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/account_payment/wizard/account_payment_populate_statement.py b/addons/account_payment/wizard/account_payment_populate_statement.py index 16d8dc5a7e4..1ef6339d2f3 100644 --- a/addons/account_payment/wizard/account_payment_populate_statement.py +++ b/addons/account_payment/wizard/account_payment_populate_statement.py @@ -76,7 +76,7 @@ class account_payment_populate_statement(osv.osv_memory): statement.currency.id, line.amount_currency, context=ctx) context.update({'move_line_ids': [line.move_line_id.id]}) - result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) + result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), voucher_currency_id= statement.currency.id, ttype='payment', date=line.ml_maturity_date, context=context) if line.move_line_id: voucher_res = { From 2d5e043413945657e2c09f74d9c1142f30bbfe42 Mon Sep 17 00:00:00 2001 From: "Mustufa Rangwala (OpenERP)" Date: Mon, 12 Sep 2011 12:42:37 +0530 Subject: [PATCH 032/129] [FIX] Account_payment: fixed indentation bzr revid: mra@tinyerp.com-20110912071237-8ghzf91g6drp950t --- .../account_payment_create_order_view.xml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/account_payment/wizard/account_payment_create_order_view.xml b/addons/account_payment/wizard/account_payment_create_order_view.xml index 10d437533f4..0a0997176aa 100644 --- a/addons/account_payment/wizard/account_payment_create_order_view.xml +++ b/addons/account_payment/wizard/account_payment_create_order_view.xml @@ -8,15 +8,15 @@ form - - - - - - From 9857cb60fa71bb09f646b2d48df9ae2c1fc04939 Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 10 Oct 2011 16:18:04 +0200 Subject: [PATCH 122/129] [imp] removed asynchronous operations in buffered dataset, "l'amour du risque, papapalapapapa" bzr revid: nicolas.vanhoren@openerp.com-20111010141804-zc6t2sr60twz6r4s --- addons/web/static/src/js/data.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index f72c1b50fcd..459fe2be3af 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -617,7 +617,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({ this.cache.push(cached); this.on_change(); var prom = $.Deferred().then(callback); - setTimeout(function() {prom.resolve({result: cached.id});}, 0); + prom.resolve({result: cached.id}); return prom.promise(); }, write: function (id, data, options, callback) { @@ -695,7 +695,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({ throw "Record not correctly loaded"; } } - setTimeout(function () {completion.resolve(records);}, 0); + completion.resolve(records); }; if(to_get.length > 0) { var rpc_promise = this._super(to_get, fields, function(records) { From 0c9e9a7643ea93e8e67371763d788421a0510b23 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Mon, 10 Oct 2011 16:22:26 +0200 Subject: [PATCH 123/129] [IMP] rng,convert: add support for report `usage` attribute The `usage` attribute may indicate a special purpose of this report. For instance, the "default" usage is used to identify the report to include along with a record for EDI exports. bzr revid: odo@openerp.com-20111010142226-ceradf4acsbr3r5l --- openerp/import_xml.rng | 4 ++++ openerp/tools/convert.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/openerp/import_xml.rng b/openerp/import_xml.rng index d301ae47ed3..97165f24203 100644 --- a/openerp/import_xml.rng +++ b/openerp/import_xml.rng @@ -114,6 +114,10 @@ + + diff --git a/openerp/tools/convert.py b/openerp/tools/convert.py index e0b7cdeeb5f..7d6a982986b 100644 --- a/openerp/tools/convert.py +++ b/openerp/tools/convert.py @@ -314,7 +314,8 @@ form: module.record_id""" % (xml_id,) for dest,f in (('name','string'),('model','model'),('report_name','name')): res[dest] = rec.get(f,'').encode('utf8') assert res[dest], "Attribute %s of report is empty !" % (f,) - for field,dest in (('rml','report_rml'),('file','report_rml'),('xml','report_xml'),('xsl','report_xsl'),('attachment','attachment'),('attachment_use','attachment_use')): + for field,dest in (('rml','report_rml'),('file','report_rml'),('xml','report_xml'),('xsl','report_xsl'), + ('attachment','attachment'),('attachment_use','attachment_use'), ('usage','usage')): if rec.get(field): res[dest] = rec.get(field).encode('utf8') if rec.get('auto'): From 153f5f5890acb65f191b5e19efec491852285b6b Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 10 Oct 2011 16:28:06 +0200 Subject: [PATCH 124/129] [IMP] Improved dashboard action titles bzr revid: fme@openerp.com-20111010142806-63dtrwjb22uppo4z --- addons/web_dashboard/static/src/css/dashboard.css | 3 --- addons/web_dashboard/static/src/js/dashboard.js | 6 ++---- addons/web_dashboard/static/src/xml/web_dashboard.xml | 2 +- 3 files changed, 3 insertions(+), 8 deletions(-) diff --git a/addons/web_dashboard/static/src/css/dashboard.css b/addons/web_dashboard/static/src/css/dashboard.css index f317cb45e8e..174066e1b72 100644 --- a/addons/web_dashboard/static/src/css/dashboard.css +++ b/addons/web_dashboard/static/src/css/dashboard.css @@ -234,6 +234,3 @@ .openerp .oe-dashboard-action .view-manager-main-content { padding: 2px; } -.openerp .oe-dashboard-action-header .ui-icon, .openerp .oe-dashboard-action-header .oe-dashboard-action-rename { - display: none; -} diff --git a/addons/web_dashboard/static/src/js/dashboard.js b/addons/web_dashboard/static/src/js/dashboard.js index cbf03e7044e..f8eeef78e1e 100644 --- a/addons/web_dashboard/static/src/js/dashboard.js +++ b/addons/web_dashboard/static/src/js/dashboard.js @@ -43,9 +43,6 @@ openerp.web.form.DashBoard = openerp.web.form.Widget.extend({ }); //this.$element.find('a.oe-dashboard-action-rename').live('click', this.on_rename); - this.$element.find('.oe-dashboard-action').live('mouseover mouseout', function(event) { - $(this).find('.oe-dashboard-action-header .ui-icon, .oe-dashboard-action-header .oe-dashboard-action-rename').toggle(event.type == 'mouseover'); - }); }, on_undo: function() { this.rpc('/web/view/undo_custom', { @@ -224,7 +221,8 @@ openerp.web.form.DashBoard = openerp.web.form.Widget.extend({ views_switcher : false, action_buttons : false, pager: false, - low_profile: true + low_profile: true, + display_title: false }; var view_manager = new openerp.web.ViewManagerAction(this, action); view_manager.appendTo($("#"+this.view.element_id + '_action_' + action.id)); diff --git a/addons/web_dashboard/static/src/xml/web_dashboard.xml b/addons/web_dashboard/static/src/xml/web_dashboard.xml index c78583e709c..505cc45e027 100644 --- a/addons/web_dashboard/static/src/xml/web_dashboard.xml +++ b/addons/web_dashboard/static/src/xml/web_dashboard.xml @@ -32,7 +32,7 @@

- ActionTitle + From aaf01c6395e40fbbeb7c889dc930f0edb2b89e9c Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 10 Oct 2011 16:36:34 +0200 Subject: [PATCH 125/129] [fix] dirty fix of the problem with list views in o2m bzr revid: nicolas.vanhoren@openerp.com-20111010143634-sjld7z726l6ebg53 --- addons/web/static/src/js/view_list.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/web/static/src/js/view_list.js b/addons/web/static/src/js/view_list.js index f169e641ab4..0ea1f7ec944 100644 --- a/addons/web/static/src/js/view_list.js +++ b/addons/web/static/src/js/view_list.js @@ -1151,7 +1151,8 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L var fields = _.pluck(_.select(this.columns, function(x) {return x.tag == "field"}), 'name'); var options = { offset: page * limit, limit: limit }; - dataset.read_slice(fields, options , function (records) { + //TODO xmo: investigate why we need to put the setTimeout + setTimeout(function() {dataset.read_slice(fields, options , function (records) { if (!self.datagroup.openable) { view.configure_pager(dataset); } else { @@ -1170,7 +1171,7 @@ openerp.web.ListView.Groups = openerp.web.Class.extend( /** @lends openerp.web.L self.records.add(records, {silent: true}); list.render(); d.resolve(list); - }); + });}, 0); return d.promise(); }, setup_resequence_rows: function (list, dataset) { From 5cdf82dd0aeeb5ef8ec5b8887adf565a9c2f88fa Mon Sep 17 00:00:00 2001 From: niv-openerp Date: Mon, 10 Oct 2011 17:00:12 +0200 Subject: [PATCH 126/129] [fix] problem in idea view bzr revid: nicolas.vanhoren@openerp.com-20111010150012-pty14q4z54zdtgvu --- addons/web/static/src/js/data.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/web/static/src/js/data.js b/addons/web/static/src/js/data.js index 459fe2be3af..76e430dc34a 100644 --- a/addons/web/static/src/js/data.js +++ b/addons/web/static/src/js/data.js @@ -613,7 +613,7 @@ openerp.web.BufferedDataSet = openerp.web.DataSetStatic.extend({ create: function(data, callback, error_callback) { var cached = {id:_.uniqueId(this.virtual_id_prefix), values: data, defaults: this.last_default_get}; - this.to_create.push(cached); + this.to_create.push(_.extend(_.clone(cached), {values: _.clone(cached.values)})); this.cache.push(cached); this.on_change(); var prom = $.Deferred().then(callback); From 5a08fd1078a23273b6d797cf41945bdf898f1109 Mon Sep 17 00:00:00 2001 From: Fabien Meghazi Date: Mon, 10 Oct 2011 17:08:11 +0200 Subject: [PATCH 127/129] [IMP] Bring dashboard styling from trunk-style branch bzr revid: fme@openerp.com-20111010150811-4vdff1jcr6eqz2xq --- addons/web/static/src/img/box-a-header-a.gif | Bin 0 -> 91 bytes .../static/src/css/dashboard.css | 35 +++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 addons/web/static/src/img/box-a-header-a.gif diff --git a/addons/web/static/src/img/box-a-header-a.gif b/addons/web/static/src/img/box-a-header-a.gif new file mode 100644 index 0000000000000000000000000000000000000000..6b461b42bfeebf6d11a19b88d1dcb45c55e42a4a GIT binary patch literal 91 zcmZ?wbhEHbWMoiec+Ac4 Date: Mon, 10 Oct 2011 17:16:11 +0200 Subject: [PATCH 128/129] [fix] problem with the web client in the idea module bzr revid: nicolas.vanhoren@openerp.com-20111010151611-efmcqnm14n0s2r8t --- addons/idea/wizard/idea_post_vote.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/idea/wizard/idea_post_vote.py b/addons/idea/wizard/idea_post_vote.py index df35f42cc33..420955b992b 100644 --- a/addons/idea/wizard/idea_post_vote.py +++ b/addons/idea/wizard/idea_post_vote.py @@ -103,9 +103,10 @@ class idea_post_vote(osv.osv_memory): @param ids: List of Idea Post vote’s IDs. @return: Dictionary {} """ + + ctx_key = 'idea_ids' if context.get('idea_ids') is not None else 'active_ids' - vote_ids = context and context.get('active_ids', []) or [] - vote_id = context['active_ids'][0] + idea_id = context[ctx_key][0] vote_pool = self.pool.get('idea.vote') idea_pool = self.pool.get('idea.idea') comment_pool = self.pool.get('idea.comment') @@ -114,19 +115,19 @@ class idea_post_vote(osv.osv_memory): score = str(do_vote_obj['vote']) comment = do_vote_obj.get('note', False) vote = { - 'idea_id': vote_id, + 'idea_id': idea_id, 'user_id': uid, 'score': score } if comment: comment = { 'user_id':uid, - 'idea_id':vote_id, + 'idea_id':idea_id, 'content': comment, } comment = comment_pool.create(cr, uid, comment) - idea_pool._vote_save(cr, uid, vote_id, None, score, context) + idea_pool._vote_save(cr, uid, idea_id, None, score, context) #vote = vote_pool.create(cr, uid, vote) return {'type': 'ir.actions.act_window_close'} From 5ca1ee4fff8a0b24a6d5835d5016e924b7932be1 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Mon, 10 Oct 2011 17:42:41 +0200 Subject: [PATCH 129/129] [FIX] stock: fill inventory wizard now propose the right quantity of products regarding what has been consumed lp bug: https://launchpad.net/bugs/797772 fixed lp bug: https://launchpad.net/bugs/837123 fixed bzr revid: qdp-launchpad@openerp.com-20111010154241-penanv8aggxdcgj3 --- addons/stock/wizard/stock_fill_inventory.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/addons/stock/wizard/stock_fill_inventory.py b/addons/stock/wizard/stock_fill_inventory.py index 03ddb1d7a7f..5c5e8964e9a 100644 --- a/addons/stock/wizard/stock_fill_inventory.py +++ b/addons/stock/wizard/stock_fill_inventory.py @@ -92,12 +92,16 @@ class stock_fill_inventory(osv.osv_memory): for location in location_ids: datas = {} res[location] = {} - move_ids = move_obj.search(cr, uid, [('location_dest_id','=',location),('state','=','done')], context=context) + move_ids = move_obj.search(cr, uid, ['|',('location_dest_id','=',location),('location_id','=',location),('state','=','done')], context=context) for move in move_obj.browse(cr, uid, move_ids, context=context): lot_id = move.prodlot_id.id prod_id = move.product_id.id - qty = uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id) + if move.location_dest_id.id == location: + qty = uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id) + else: + qty = -uom_obj._compute_qty(cr, uid, move.product_uom.id,move.product_qty, move.product_id.uom_id.id) + if datas.get((prod_id, lot_id)): qty += datas[(prod_id, lot_id)]['product_qty']