From bc92ebcf26a89f234e81899e80b5b8482639451b Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 18 Jan 2011 15:55:01 +0530 Subject: [PATCH 01/47] [FIX]: solve in procurement groupby "reason" bzr revid: ksa@tinyerp.co.in-20110118102501-xni9nk8x8bm2rlzx --- addons/procurement/procurement_view.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/procurement/procurement_view.xml b/addons/procurement/procurement_view.xml index 9c8ad70fe63..02cfae811eb 100644 --- a/addons/procurement/procurement_view.xml +++ b/addons/procurement/procurement_view.xml @@ -28,6 +28,7 @@ procurement.order.tree.board procurement.order tree + @@ -246,8 +247,8 @@ From 954b00ab6c8cac5052b9af0cbeb152997190039a Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 20 Jan 2011 15:36:59 +0530 Subject: [PATCH 02/47] [IMP]: Procurement yml bzr revid: ksa@tinyerp.co.in-20110120100659-pnjeuf2105l7768h --- addons/procurement/__openerp__.py | 1 + addons/procurement/test/procurement_test.yml | 60 ++++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 addons/procurement/test/procurement_test.yml diff --git a/addons/procurement/__openerp__.py b/addons/procurement/__openerp__.py index d30128041f3..bc17969efaa 100644 --- a/addons/procurement/__openerp__.py +++ b/addons/procurement/__openerp__.py @@ -46,6 +46,7 @@ 'board_mrp_procurement_view.xml', ], 'demo_xml': ['stock_orderpoint.xml'], + 'test': ['test/procurement_test.yml'], 'installable': True, 'active': False, 'certificate': '00954248826881074509', diff --git a/addons/procurement/test/procurement_test.yml b/addons/procurement/test/procurement_test.yml new file mode 100644 index 00000000000..50cb7276d69 --- /dev/null +++ b/addons/procurement/test/procurement_test.yml @@ -0,0 +1,60 @@ +- + In order to test the Procurement flow,I start by creating a new product 'Apple' +- + !record {model: product.product, id: product_product_apple0}: + categ_id: product.cat1 + name: Apple + procure_method: make_to_stock + seller_ids: + - delay: 1 + name: base.res_partner_asus + min_qty: 1.0 + product_uom: product.product_uom_kgm + supply_method: buy + type: product + uom_id: product.product_uom_kgm + uom_po_id: product.product_uom_kgm + property_stock_inventory: stock.location_inventory + property_stock_procurement: stock.location_procurement + property_stock_production: stock.location_production +- + I define Minimum stock rules for my stockable product "Apple". +- + !record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}: + company_id: base.main_company + location_id: stock.stock_location_stock + logic: max + name: OP/00002 + product_id: product_product_apple0 + product_max_qty: 10.0 + product_min_qty: 5.0 + product_uom: product.product_uom_kgm + qty_multiple: 1 + warehouse_id: stock.warehouse0 +- + The scheduler runs. +- + !function {model: procurement.order, name: run_scheduler}: + - model: procurement.order + search: "[]" +- + I also check that there are procurement order for Apple or not. +- + !python {model: procurement.order}: | + proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_apple0')])]) + assert proc_ids, 'No Procurements.' +- + Apply Request for Procurement clicking on "Procurement Request" From Product. +- + !record {model: make.procurement, id: procurement_order_apple0}: + product_id: product_product_apple0 + qty: 10.0 + date_planned: '2010-04-20' + uom_id: product.product_uom_kgm + warehouse_id: stock.warehouse0 +- + Create procurement order for selected product. +- + !python {model: make.procurement}: | + self.make_procurement(cr, uid, [ref('procurement_order_apple0')], context={'active_id': ref('product_product_apple0')}) + From 7f0ee9e69be351cae5996ff54663d790ad2e2940 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 20 Jan 2011 18:45:02 +0530 Subject: [PATCH 03/47] [FIX]: solve buildbot prolbem for stock bzr revid: ksa@tinyerp.co.in-20110120131502-tb0n02veboma0gg3 --- addons/stock/stock.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index b2fc42c298d..36dac0d0181 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1853,11 +1853,6 @@ class stock_move(osv.osv): """ moves = self.browse(cr, uid, ids, context=context) self.write(cr, uid, ids, {'state': 'confirmed'}) - res_obj = self.pool.get('res.company') - location_obj = self.pool.get('stock.location') - move_obj = self.pool.get('stock.move') - wf_service = netsvc.LocalService("workflow") - self.create_chained_picking(cr, uid, moves, context) return [] From 7418c760b017c35fba25728fabb015bac55b09d8 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Mon, 31 Jan 2011 15:40:31 +0530 Subject: [PATCH 04/47] [FIx]:purchase: Try to select partner address which has no partner on it lp bug: https://launchpad.net/bugs/710516 fixed bzr revid: ksa@tinyerp.co.in-20110131101031-1z1v15pg2f20hmxx --- addons/purchase/purchase.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 2d8eaac1d84..c6cf0470fc1 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -170,7 +170,7 @@ class purchase_order(osv.osv): 'partner_id':fields.many2one('res.partner', 'Supplier', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, change_default=True), 'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]},domain="[('partner_id', '=', partner_id)]"), - 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address', + 'dest_address_id':fields.many2one('res.partner.address', 'Destination Address',domain="[('partner_id', '<>', partner_id)]", states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)],'done':[('readonly',True)]}, help="Put an address if you want to deliver directly from the supplier to the customer." \ "In this case, it will remove the warehouse link and set the customer location." From f27ca382ffdef16816a156f24039ed572f6dd733 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Fri, 31 Dec 2010 17:37:39 +0530 Subject: [PATCH 05/47] [IMP]: improve yml for adding month and wrong month problem bzr revid: ksa@tinyerp.co.in-20101231120739-epsnsevk90rhey6a --- addons/membership/test/test_membership.yml | 20 +++- .../test/point_of_sale_report.yml | 5 +- .../point_of_sale/test/point_of_sale_test.yml | 99 ++++++++++--------- .../project_planning/test/planning_states.yml | 53 +++++----- 4 files changed, 98 insertions(+), 79 deletions(-) diff --git a/addons/membership/test/test_membership.yml b/addons/membership/test/test_membership.yml index 195fbd15b01..b58faaa43bb 100644 --- a/addons/membership/test/test_membership.yml +++ b/addons/membership/test/test_membership.yml @@ -6,12 +6,16 @@ !record {model: product.product, id: product_product_membershipproduct0}: categ_id: product.cat1 membership: 1 - membership_date_from: !eval datetime.today().strftime("%Y-%m-%d") - membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" + membership_date_from: !eval time.strftime('%Y-%m-%d') + membership_date_to: !eval time.strftime('%Y-%m-%d') name: Golden Membership type: service list_price: 80.00 - +- + !python {model: product.product}: | + from datetime import datetime + from dateutil.relativedelta import * + self.write(cr, uid, [ref("product_product_membershipproduct0")], {'membership_date_to': datetime.now() + relativedelta(months=3)}) - | "Mark Johnson" want to join "Golden Membership". - | @@ -102,13 +106,19 @@ !record {model: product.product, id: product_product_membershipproduct1}: categ_id: product.cat1 membership: 1 - membership_date_from: !eval datetime.today().strftime("%Y-%m-%d") - membership_date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" + membership_date_from: !eval time.strftime('%Y-%m-%d') + membership_date_to: !eval time.strftime('%Y-%m-%d') name: Silver Membership type: service list_price: 50.00 - | I'm making invoice of "Mark Johnson" member on joining new membership "Silver Membership". +- +- + !python {model: product.product}: | + from datetime import datetime + from dateutil.relativedelta import * + self.write(cr, uid, [ref("product_product_membershipproduct1")], {'membership_date_to': datetime.now() + relativedelta(months=3)}) - !python {model: res.partner}: | self.create_membership_invoice(cr, uid, [ref("res_partner_markjohnson0")], product_id=ref("product_product_membershipproduct1"), datas={"amount":50.00}) diff --git a/addons/point_of_sale/test/point_of_sale_report.yml b/addons/point_of_sale/test/point_of_sale_report.yml index 323d227f7d2..7ab44c8a98f 100644 --- a/addons/point_of_sale/test/point_of_sale_report.yml +++ b/addons/point_of_sale/test/point_of_sale_report.yml @@ -93,7 +93,7 @@ journal_id: account_journal_cash0 line_ids: - name: statement - date: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+5,datetime.now().day)" + date: !eval time.strftime('%Y-%m-%d') type: customer account_id: account_pos_account_sales amount: 100 @@ -105,9 +105,12 @@ - !python {model: account.bank.statement}: | import netsvc, tools, os, time + from datetime import datetime + from dateutil.relativedelta import * (data, format) = netsvc.LocalService('report.account.statement').create(cr, uid, [ref('point_of_sale.account_bank_statement_st0')], {}, {}) if tools.config['test_report_directory']: file(os.path.join(tools.config['test_report_directory'], 'point_of_sale-account_statement_report'+format), 'wb+').write(data) + self.write(cr, uid, [ref("account_bank_statement_st0")], {'date': datetime.now() + relativedelta(months=3)}) - In order to test the PDF reports defined on a Point Of Sale, we will print a POS User Product Report - diff --git a/addons/point_of_sale/test/point_of_sale_test.yml b/addons/point_of_sale/test/point_of_sale_test.yml index c8ed72e386f..140ac3c0a04 100644 --- a/addons/point_of_sale/test/point_of_sale_test.yml +++ b/addons/point_of_sale/test/point_of_sale_test.yml @@ -271,7 +271,7 @@ categ_id: product_category_computer0 cost_method: standard mes_type: fixed - list_price: 1000.0 + list_price: 1000.0 name: HP Pavilion Desktop PCs procure_method: make_to_stock seller_ids: @@ -290,7 +290,7 @@ !record {model: pos.order, id: pos_order_pos0}: company_id: base.main_company date_order: !eval time.strftime('%Y-%m-%d %H:%M:%S') - date_validity: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+6,datetime.now().day)" + date_validity: !eval time.strftime('%Y-%m-%d %H:%M:%S') lines: - company_id: base.main_company name: Order Line/01 @@ -305,27 +305,32 @@ sale_journal: account.sales_journal shop_id: sale.shop user_salesman_id: base.user_root -- - I add discount. -- +- + !python {model: pos.order}: | + from datetime import datetime + from dateutil.relativedelta import * + self.write(cr, uid, [ref("pos_order_pos0")], {'date_validity': datetime.now() + relativedelta(months=3)}) +- + I add discount. +- !record {model: pos.discount, id: pos_discount_0}: discount: 5.0 discount_notes: More then 5 product -- - I Apply the discount. -- +- + I Apply the discount. +- !python {model: pos.discount}: | self.apply_discount(cr, uid, [ref("pos_discount_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"), }) -- +- I open the register. -- +- !record {model: pos.open.statement, id: pos_open_statement_0}: {} -- +- I open the statement. -- +- !python {model: pos.open.statement}: | jou_obj = self.pool.get('account.journal') statement_obj = self.pool.get('account.bank.statement') @@ -339,8 +344,8 @@ "ir.ui.menu", "active_ids": [ref("point_of_sale.menu_open_statement")], "tz": False, "active_id": ref("point_of_sale.menu_open_statement"), }) - - I click on the "Make Payment" wizard. -- + I click on the "Make Payment" wizard. +- !record {model: pos.make.payment, id: pos_make_payment_0}: amount: 1615.0 journal: 7 @@ -349,9 +354,9 @@ product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 partner_id: base.res_partner_agrolait -- +- I make the payment. -- +- !python {model: pos.make.payment}: | self.check(cr, uid, [ref("pos_make_payment_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz": @@ -361,48 +366,48 @@ - !python {model: pos.order}: | order=self.browse(cr,uid,ref("pos_order_pos0")) - assert(order.statement_ids!=[]), "Statement lines not created" + assert(order.statement_ids!=[]), "Statement lines not created" - When I click on Return picking button , I get three option. - 1. Cancel 2.Return Goods and Exchange 3.Return without Refund - - When I click on Return Goods and Exchange. -- - Then it allows me to define the quantity of products, which will return to the stock. -- + When I click on Return Goods and Exchange. +- + Then it allows me to define the quantity of products, which will return to the stock. +- I click on Return Picking button. -- +- !record {model: pos.return, id: pos_return_0}: {} -- +- I Return the product. -- +- !python {model: pos.return}: | self.create_returns(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz": False, "active_id": ref("point_of_sale.pos_order_pos0"), }) -- +- Then it allows me to define the quantity of products, which will return to the stock. - - I select the HP Pavilion Desktop PCs for exchange. -- + I select the HP Pavilion Desktop PCs for exchange. +- !record {model: pos.add.product, id: pos_add_product_0}: product_id: product_product_hppaviliondesktoppcs0 quantity: 5.0 -- +- I click on close button. -- +- !python {model: pos.add.product}: | return_obj = self.pool.get('pos.return') - context['active_ids'] = [ref("pos_order_pos0")] + context['active_ids'] = [ref("pos_order_pos0")] return_obj.view_init(cr, uid, [],context=context) self.close_action(cr, uid, [ref("pos_add_product_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"), }) -- +- I create payment. -- +- !record {model: pos.make.payment, id: pos_make_payment_1}: amount: 680.0 journal: 7 @@ -411,40 +416,40 @@ product_id: product_product_hppaviliondesktoppcs0 pricelist_id: product.list0 partner_id: base.res_partner_agrolait -- - For payment, I click on Make Payment. -- +- + For payment, I click on Make Payment. +- !python {model: pos.make.payment}: | self.check(cr, uid, [ref("pos_make_payment_1")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": - False, "active_id": ref("pos_order_pos0"), }) -- + False, "active_id": ref("pos_order_pos0"), }) +- To check the Return without Refund . I click button "Return without Refund ". -- +- !record {model: pos.return, id: pos_return_0}: {} - The quantity which is selected in Return lines wizard is refunded. -- +- !python {model: pos.return}: | self.create_returns2(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"), }) -- +- To Close order, I use the wizard "Sale Confirm". -- +- !record {model: pos.confirm, id: pos_confirm_0}: {} -- +- I close this order. -- +- !python {model: pos.confirm}: | self.action_confirm(cr, uid, [ref("pos_confirm_0")], {"lang": "en_US", "active_model": "pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"), }) -- +- I check order state is done. -- +- !python {model: pos.order}: | - order=self.browse(cr,uid,ref("pos_order_pos0")) - assert(order.state=='done'), "Order is not done" + order=self.browse(cr,uid,ref("pos_order_pos0")) + assert(order.state=='done'), "Order is not done" diff --git a/addons/project_planning/test/planning_states.yml b/addons/project_planning/test/planning_states.yml index 5d40a199280..ddc8941c1f9 100644 --- a/addons/project_planning/test/planning_states.yml +++ b/addons/project_planning/test/planning_states.yml @@ -1,33 +1,34 @@ -- +- Create a analytic planning 'Project Planning' -- +- !record {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0}: business_days: 20 date_from: !eval time.strftime('%Y-%m-%d') - date_to: !eval "'%s-%s-%s' %(datetime.now().year,datetime.now().month+1,datetime.now().day)" + date_to: !eval time.strftime('%Y-%m-%d') name: Project Planning state: draft user_id: base.user_demo - - -- +- Open the planning -- +- !python {model: report_account_analytic.planning}: | + from datetime import datetime + from dateutil.relativedelta import * self.action_open(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {"lang": "en_US", "active_ids": [ref("project_planning.menu_report_account_analytic_planning")], "tz": False, "active_model": "ir.ui.menu", "section_id": False, "active_id": ref("project_planning.menu_report_account_analytic_planning"), "search_default_user_id": 1, "project_id": False, "department_id": False, }) + self.write(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {'date_to': datetime.now() + relativedelta(months=3)}) - Check if planning in open state - - !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in open state}: + !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in open state}: - state == "open" -- +- Cancel the planning -- +- !python {model: report_account_analytic.planning}: | self.action_cancel(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {"lang": "en_US", "active_ids": [ref("project_planning.menu_report_account_analytic_planning")], @@ -37,12 +38,12 @@ - Check if planning in cancel state - - !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in cancel state}: - - state == "cancel" - -- + !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in cancel state}: + - state == "cancel" + +- Reopen the planning -- +- !python {model: report_account_analytic.planning}: | self.action_draft(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {"lang": "en_US", "active_ids": [ref("project_planning.menu_report_account_analytic_planning")], @@ -52,12 +53,12 @@ - Check if planning in draft state - - !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in draft state}: - - state == "draft" - -- + !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in draft state}: + - state == "draft" + +- Open the planning -- +- !python {model: report_account_analytic.planning}: | self.action_open(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {"lang": "en_US", "active_ids": [ref("project_planning.menu_report_account_analytic_planning")], @@ -67,12 +68,12 @@ - Check if planning in open state - - !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in open state}: - - state == "open" - -- + !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in open state}: + - state == "open" + +- Close the planning -- +- !python {model: report_account_analytic.planning}: | self.action_done(cr, uid, [ref("report_account_analytic_planning_projectplanning0")], {"lang": "en_US", "active_ids": [ref("project_planning.menu_report_account_analytic_planning")], @@ -82,5 +83,5 @@ - Check if planning in done state - - !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in done state}: + !assert {model: report_account_analytic.planning, id: report_account_analytic_planning_projectplanning0, string: Planning in done state}: - state == "done" \ No newline at end of file From 39afa56669b137149939d7da7415a7078cf33450 Mon Sep 17 00:00:00 2001 From: "rha@tinyerp.com" <> Date: Fri, 28 Jan 2011 16:48:48 +0530 Subject: [PATCH 06/47] [Fix]: stock: Anglo-saxon Accounting does not use input stock account when purchase order invoicing control set to From picking lp bug: https://launchpad.net/bugs/708874 fixed bzr revid: rha@tinyerp.com-20110128111848-y3pqbmiu3l9sl0kh --- addons/stock/wizard/stock_invoice_onshipping.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index c7eab1eef4d..37b3d09810f 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -127,7 +127,7 @@ class stock_invoice_onshipping(osv.osv_memory): res = picking_pool.action_invoice_create(cr, uid, active_ids, journal_id = onshipdata_obj[0]['journal_id'], group = onshipdata_obj[0]['group'], - type = None, + type = context.get('inv_type'), context=context) return res From f76e0fc097531b414fd1d7dd5cf13c6ef29ebfa3 Mon Sep 17 00:00:00 2001 From: "rha@tinyerp.com" <> Date: Tue, 1 Feb 2011 18:57:50 +0530 Subject: [PATCH 07/47] [Fix]: product: Pricelist with base price set to 0 lp bug: https://launchpad.net/bugs/710521 fixed bzr revid: rha@tinyerp.com-20110201132750-lvp43mmvs0kxqwif --- addons/product/pricelist.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 6899b673c70..9413ceebbe2 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -264,7 +264,7 @@ class product_pricelist(osv.osv): product_obj.price_get(cr, uid, [product_id], price_type.field)[product_id], round=False, context=context) - if price: + if price or price == 0.0: price_limit = price price = price * (1.0+(res['price_discount'] or 0.0)) From 3f96ef97a7406df2b839c1e532234f316fc66086 Mon Sep 17 00:00:00 2001 From: Olivier Dony Date: Tue, 1 Feb 2011 22:08:39 +0100 Subject: [PATCH 08/47] [WIP] all: (work in progress) changing wizards to avoid using read() or at least take proper care of m2o fields This is in preparation of the fix for m2o.get() on osv_memory objects, to make it consistent with the regular read on osv objects. Previously on osv_memory objects it was only returned the id, instead of the pair (id, name) as is appropriate to avoid an additional name_get RPC call after each read. Unfortunately many wizards were using direct read() instead of browse() and relying on the fact that the returned dict contained a bare id value for many2one fields. bzr revid: odo@openerp.com-20110201210839-hwmk60ygksm805c4 --- .../wizard/account_automatic_reconcile.py | 5 ++++- .../account/wizard/account_change_currency.py | 6 +++--- addons/account/wizard/account_chart.py | 14 ++++++------- .../wizard/account_fiscalyear_close.py | 5 ++++- .../wizard/account_fiscalyear_close_state.py | 6 +++--- .../account/wizard/account_invoice_refund.py | 6 +++++- .../wizard/account_move_bank_reconcile.py | 8 ++++---- .../account_move_line_reconcile_select.py | 6 +++--- .../account_move_line_unreconcile_select.py | 6 +++--- addons/account/wizard/account_reconcile.py | 16 +++++++-------- addons/account/wizard/account_tax_chart.py | 18 ++++++++--------- .../wizard/account_crossovered_analytic.py | 4 +++- .../wizard/account_coda_import.py | 20 +++++++++---------- .../wizard/account_followup_print.py | 4 ++-- .../report/special_message_invoice.py | 5 ++++- .../wizard/hr_recruitment_phonecall.py | 10 +++++----- .../wizard/hr_timesheet_invoice_create.py | 18 ++++++++--------- addons/lunch/wizard/lunch_order_confirm.py | 4 ++-- addons/point_of_sale/wizard/pos_payment.py | 3 +++ addons/point_of_sale/wizard/pos_return.py | 4 ++-- addons/product/wizard/product_price.py | 2 ++ .../project/wizard/project_task_delegate.py | 2 ++ addons/project_gtd/wizard/project_gtd_fill.py | 6 +++--- .../wizard/project_compute_phases.py | 10 +++++----- .../wizard/project_compute_tasks.py | 4 ++-- addons/stock/wizard/stock_move.py | 8 ++++---- 26 files changed, 111 insertions(+), 89 deletions(-) diff --git a/addons/account/wizard/account_automatic_reconcile.py b/addons/account/wizard/account_automatic_reconcile.py index 432a430868c..13fef1fde0d 100644 --- a/addons/account/wizard/account_automatic_reconcile.py +++ b/addons/account/wizard/account_automatic_reconcile.py @@ -144,6 +144,9 @@ class account_automatic_reconcile(osv.osv_memory): if context is None: context = {} form = self.read(cr, uid, ids, [])[0] + for m2o_field in ['journal_id','period_id','writeoff_acc_id']: + if form[m2o_field] and isinstance(form[m2o_field], tuple): + form[m2o_field] = form[m2o_field][0] max_amount = form.get('max_amount', False) and form.get('max_amount') or 0.0 power = form['power'] allow_write_off = form['allow_write_off'] @@ -252,4 +255,4 @@ class account_automatic_reconcile(osv.osv_memory): account_automatic_reconcile() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_change_currency.py b/addons/account/wizard/account_change_currency.py index d915a1cd34b..223ba327343 100644 --- a/addons/account/wizard/account_change_currency.py +++ b/addons/account/wizard/account_change_currency.py @@ -45,8 +45,8 @@ class account_change_currency(osv.osv_memory): obj_currency = self.pool.get('res.currency') if context is None: context = {} - data = self.read(cr, uid, ids)[0] - new_currency = data['currency_id'] + data = self.browse(cr, uid, ids)[0] + new_currency = data.currency_id.id invoice = obj_inv.browse(cr, uid, context['active_id'], context=context) if invoice.currency_id.id == new_currency: @@ -76,4 +76,4 @@ class account_change_currency(osv.osv_memory): account_change_currency() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_chart.py b/addons/account/wizard/account_chart.py index e8f0e432d69..58526b30b0a 100644 --- a/addons/account/wizard/account_chart.py +++ b/addons/account/wizard/account_chart.py @@ -79,17 +79,17 @@ class account_chart(osv.osv_memory): fy_obj = self.pool.get('account.fiscalyear') if context is None: context = {} - data = self.read(cr, uid, ids, [], context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] result = mod_obj.get_object_reference(cr, uid, 'account', 'action_account_tree') id = result and result[1] or False result = act_obj.read(cr, uid, [id], context=context)[0] result['periods'] = [] - if data['period_from'] and data['period_to']: - result['periods'] = period_obj.build_ctx_periods(cr, uid, data['period_from'], data['period_to']) - result['context'] = str({'fiscalyear': data['fiscalyear'], 'periods': result['periods'], \ - 'state': data['target_move']}) - if data['fiscalyear']: - result['name'] += ':' + fy_obj.read(cr, uid, [data['fiscalyear']], context=context)[0]['code'] + if data.period_from and data.period_to: + result['periods'] = period_obj.build_ctx_periods(cr, uid, data.period_from.id, data.period_to.id) + result['context'] = str({'fiscalyear': data.fiscalyear.id, 'periods': result['periods'], \ + 'state': data.target_move}) + if data.fiscalyear: + result['name'] += ':' + fy_obj.read(cr, uid, [data.fiscalyear.id], context=context)[0]['code'] return result _defaults = { diff --git a/addons/account/wizard/account_fiscalyear_close.py b/addons/account/wizard/account_fiscalyear_close.py index 6190f792c7f..bd635839afb 100644 --- a/addons/account/wizard/account_fiscalyear_close.py +++ b/addons/account/wizard/account_fiscalyear_close.py @@ -56,7 +56,10 @@ class account_fiscalyear_close(osv.osv_memory): obj_acc_account = self.pool.get('account.account') obj_acc_journal_period = self.pool.get('account.journal.period') - data = self.read(cr, uid, ids, context=context) + data = self.read(cr, uid, ids, context=context) + for m2o_field in ['fy_id','fy2_id','journal_id','period_id']: + if isinstance(data[0][m2o_field], tuple): + data[0][m2o_field] = data[0][m2o_field][0] if context is None: context = {} diff --git a/addons/account/wizard/account_fiscalyear_close_state.py b/addons/account/wizard/account_fiscalyear_close_state.py index abf054746ce..30edce42077 100644 --- a/addons/account/wizard/account_fiscalyear_close_state.py +++ b/addons/account/wizard/account_fiscalyear_close_state.py @@ -40,8 +40,8 @@ class account_fiscalyear_close_state(osv.osv_memory): @param ids: List of Account fiscalyear close state’s IDs """ - for data in self.read(cr, uid, ids, context=context): - fy_id = data['fy_id'] + for data in self.browse(cr, uid, ids, context=context): + fy_id = data.fy_id.id cr.execute('UPDATE account_journal_period ' \ 'SET state = %s ' \ @@ -61,4 +61,4 @@ class account_fiscalyear_close_state(osv.osv_memory): account_fiscalyear_close_state() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 672e2a28fba..edc2b1d99c9 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -95,6 +95,8 @@ class account_invoice_refund(osv.osv_memory): description = False company = res_users_obj.browse(cr, uid, uid, context=context).company_id journal_id = form.get('journal_id', False) + if isinstance(journal_id, tuple): + journal_id = journal_id[0] for inv in inv_obj.browse(cr, uid, context.get('active_ids'), context=context): if inv.state in ['draft', 'proforma2', 'cancel']: raise osv.except_osv(_('Error !'), _('Can not %s draft/proforma/cancel invoice.') % (mode)) @@ -102,6 +104,8 @@ class account_invoice_refund(osv.osv_memory): raise osv.except_osv(_('Error !'), _('Can not %s invoice which is already reconciled, invoice should be unreconciled first. You can only Refund this invoice') % (mode)) if form['period']: period = form['period'] + if isinstance(period, tuple): + period = period[0] else: period = inv.period_id and inv.period_id.id or False @@ -217,4 +221,4 @@ class account_invoice_refund(osv.osv_memory): account_invoice_refund() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_move_bank_reconcile.py b/addons/account/wizard/account_move_bank_reconcile.py index 9be351ed440..266c6e764b4 100644 --- a/addons/account/wizard/account_move_bank_reconcile.py +++ b/addons/account/wizard/account_move_bank_reconcile.py @@ -41,15 +41,15 @@ class account_move_bank_reconcile(osv.osv_memory): """ if context is None: context = {} - data = self.read(cr, uid, ids, context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] cr.execute('select default_credit_account_id \ - from account_journal where id=%s', (data['journal_id'],)) + from account_journal where id=%s', (data.journal_id.id,)) account_id = cr.fetchone()[0] if not account_id: raise osv.except_osv(_('Error'), _('You have to define \ the bank account\nin the journal definition for reconciliation.')) return { - 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data['journal_id'], account_id), + 'domain': "[('journal_id','=',%d), ('account_id','=',%d), ('state','<>','draft')]" % (data.journal_id.id, account_id), 'name': _('Standard Encoding'), 'view_type': 'form', 'view_mode': 'tree,form', @@ -61,4 +61,4 @@ the bank account\nin the journal definition for reconciliation.')) account_move_bank_reconcile() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_move_line_reconcile_select.py b/addons/account/wizard/account_move_line_reconcile_select.py index 8e57c57884d..d0953bd83ba 100644 --- a/addons/account/wizard/account_move_line_reconcile_select.py +++ b/addons/account/wizard/account_move_line_reconcile_select.py @@ -39,9 +39,9 @@ class account_move_line_reconcile_select(osv.osv_memory): @return: dictionary of Open account move line window for reconcile on given account id """ - data = self.read(cr, uid, ids, context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] return { - 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data['account_id'], + 'domain': "[('account_id','=',%d),('reconcile_id','=',False),('state','<>','draft')]" % data.account_id.id, 'name': _('Reconciliation'), 'view_type': 'form', 'view_mode': 'tree,form', @@ -52,4 +52,4 @@ class account_move_line_reconcile_select(osv.osv_memory): account_move_line_reconcile_select() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_move_line_unreconcile_select.py b/addons/account/wizard/account_move_line_unreconcile_select.py index ad59493503d..084b93cdaa2 100644 --- a/addons/account/wizard/account_move_line_unreconcile_select.py +++ b/addons/account/wizard/account_move_line_unreconcile_select.py @@ -28,9 +28,9 @@ class account_move_line_unreconcile_select(osv.osv_memory): 'account_id': fields.many2one('account.account','Account',required=True), } def action_open_window(self, cr, uid, ids, context=None): - data = self.read(cr, uid, ids, context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] return { - 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data['account_id'], + 'domain': "[('account_id','=',%d),('reconcile_id','<>',False),('state','<>','draft')]" % data.account_id.id, 'name': 'Unreconciliation', 'view_type': 'form', 'view_mode': 'tree,form', @@ -41,4 +41,4 @@ class account_move_line_unreconcile_select(osv.osv_memory): account_move_line_unreconcile_select() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_reconcile.py b/addons/account/wizard/account_reconcile.py index 8131f6a9668..07da76733e4 100644 --- a/addons/account/wizard/account_reconcile.py +++ b/addons/account/wizard/account_reconcile.py @@ -152,13 +152,13 @@ class account_move_line_reconcile_writeoff(osv.osv_memory): period_obj = self.pool.get('account.period') if context is None: context = {} - data = self.read(cr, uid, ids,context=context)[0] - account_id = data['writeoff_acc_id'] - context['date_p'] = data['date_p'] - journal_id = data['journal_id'] - context['comment'] = data['comment'] - if data['analytic_id']: - context['analytic_id'] = data['analytic_id'] + data = self.browse(cr, uid, ids,context=context)[0] + account_id = data.writeoff_acc_id.id + context['date_p'] = data.date_p + journal_id = data.journal_id.id + context['comment'] = data.comment + if data.analytic_id: + context['analytic_id'] = data.analytic_id.id if context['date_p']: date = context['date_p'] @@ -173,4 +173,4 @@ class account_move_line_reconcile_writeoff(osv.osv_memory): account_move_line_reconcile_writeoff() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/wizard/account_tax_chart.py b/addons/account/wizard/account_tax_chart.py index 9e02931f34d..fd9b887ee2b 100644 --- a/addons/account/wizard/account_tax_chart.py +++ b/addons/account/wizard/account_tax_chart.py @@ -54,20 +54,20 @@ class account_tax_chart(osv.osv_memory): period_obj = self.pool.get('account.period') if context is None: context = {} - data = self.read(cr, uid, ids, [], context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] result = mod_obj.get_object_reference(cr, uid, 'account', 'action_tax_code_tree') id = result and result[1] or False result = act_obj.read(cr, uid, [id], context=context)[0] - if data['period_id']: - fiscalyear_id = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['fiscalyear_id'][0] - result['context'] = str({'period_id': data['period_id'], \ + if data.period_id: + fiscalyear_id = period_obj.read(cr, uid, [data.period_id.id], context=context)[0]['fiscalyear_id'][0] + result['context'] = str({'period_id': data.period_id.id, \ 'fiscalyear_id': fiscalyear_id, \ - 'state': data['target_move']}) + 'state': data.target_move}) else: - result['context'] = str({'state': data['target_move']}) + result['context'] = str({'state': data.target_move}) - if data['period_id']: - period_code = period_obj.read(cr, uid, [data['period_id']], context=context)[0]['code'] + if data.period_id: + period_code = period_obj.read(cr, uid, [data.period_id.id], context=context)[0]['code'] result['name'] += period_code and (':' + period_code) or '' return result @@ -78,4 +78,4 @@ class account_tax_chart(osv.osv_memory): account_tax_chart() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py index 4eaca49e2ca..2974c160501 100644 --- a/addons/account_analytic_plans/wizard/account_crossovered_analytic.py +++ b/addons/account_analytic_plans/wizard/account_crossovered_analytic.py @@ -45,6 +45,8 @@ class account_crossovered_analytic(osv.osv_memory): acc_ids = [x[0] for x in res] data = self.read(cr, uid, ids, [], context=context)[0] + if isinstance(data['ref'],tuple): + data['ref'] = data['ref'][0] obj_acc = self.pool.get('account.analytic.account').browse(cr, uid, data['ref'], context=context) name = obj_acc.name @@ -72,4 +74,4 @@ class account_crossovered_analytic(osv.osv_memory): account_crossovered_analytic() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_coda/wizard/account_coda_import.py b/addons/account_coda/wizard/account_coda_import.py index 6d3743116db..309a647ef47 100644 --- a/addons/account_coda/wizard/account_coda_import.py +++ b/addons/account_coda/wizard/account_coda_import.py @@ -69,14 +69,14 @@ class account_coda_import(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids)[0] + data = self.browse(cr, uid, ids)[0] - codafile = data['coda'] - journal_code = journal_obj.browse(cr, uid, data['journal_id'], context=context).code + codafile = data.coda + journal_code = journal_obj.browse(cr, uid, data.journal_id.id, context=context).code period = account_period_obj.find(cr, uid, context=context)[0] - def_pay_acc = data['def_payable'] - def_rec_acc = data['def_receivable'] + def_pay_acc = data.def_payable.id + def_rec_acc = data.def_receivable.id err_log = "Errors:\n------\n" nb_err=0 @@ -96,7 +96,7 @@ class account_coda_import(osv.osv_memory): bank_statement["bank_statement_line"]={} bank_statement_lines = {} bank_statement['date'] = str2date(line[5:11]) - bank_statement['journal_id']=data['journal_id'] + bank_statement['journal_id']=data.journal_id.id period_id = account_period_obj.search(cr, uid, [('date_start', '<=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d"))), ('date_stop', '>=', time.strftime('%Y-%m-%d', time.strptime(bank_statement['date'], "%y/%m/%d")))]) bank_statement['period_id'] = period_id and period_id[0] or False bank_statement['state']='draft' @@ -144,7 +144,7 @@ class account_coda_import(osv.osv_memory): bank_statement["bank_statement_line"]=bank_statement_lines elif line[1] == '2': st_line_name = line[2:6] - bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']}) + bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id}) elif line[1] == '3': # movement data record 3.1 @@ -165,7 +165,7 @@ class account_coda_import(osv.osv_memory): else: nb_err += 1 err_log += _('The bank account %s is not defined for the partner %s.\n')%(cntry_number, contry_name) - bank_statement_lines[st_line_name].update({'account_id': data['awaiting_account']}) + bank_statement_lines[st_line_name].update({'account_id': data.awaiting_account.id}) bank_statement["bank_statement_line"]=bank_statement_lines elif line[0]=='3': @@ -296,7 +296,7 @@ class account_coda_import(osv.osv_memory): 'name': codafile, 'statement_ids': [(6, 0, bkst_list,)], 'note': str_log1+str_not+std_log+err_log, - 'journal_id': data['journal_id'], + 'journal_id': data.journal_id.id, 'date': time.strftime("%Y-%m-%d"), 'user_id': uid, }) @@ -336,4 +336,4 @@ class account_coda_import(osv.osv_memory): account_coda_import() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account_followup/wizard/account_followup_print.py b/addons/account_followup/wizard/account_followup_print.py index 5d9c2da860f..e8f5e976389 100644 --- a/addons/account_followup/wizard/account_followup_print.py +++ b/addons/account_followup/wizard/account_followup_print.py @@ -48,10 +48,10 @@ class account_followup_print(osv.osv_memory): if context is None: context = {} - data = self.read(cr, uid, ids, [], context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] model_data_ids = mod_obj.search(cr, uid, [('model','=','ir.ui.view'),('name','=','view_account_followup_print_all')], context=context) resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id'] - context.update({'followup_id': data['followup_id'], 'date':data['date']}) + context.update({'followup_id': data.followup_id.id, 'date':data.date}) return { 'name': _('Select Partners'), 'view_type': 'form', diff --git a/addons/account_invoice_layout/report/special_message_invoice.py b/addons/account_invoice_layout/report/special_message_invoice.py index bac4a467ae1..81298bb6a06 100644 --- a/addons/account_invoice_layout/report/special_message_invoice.py +++ b/addons/account_invoice_layout/report/special_message_invoice.py @@ -37,7 +37,10 @@ class account_invoice_with_message(report_sxw.rml_parse): self.context = context def spcl_msg(self, form): - account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message']) + msg_id = form['message'] + if isinstance(msg_id, (tuple,list)): + msg_id = msg_id[0] + account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, msg_id) msg = account_msg_data.msg return msg diff --git a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py index ecb6a7cb3a4..becef387151 100644 --- a/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py +++ b/addons/hr_recruitment/wizard/hr_recruitment_phonecall.py @@ -69,7 +69,7 @@ class job2phonecall(osv.osv_memory): phonecall_case_obj = self.pool.get('crm.phonecall') if context is None: context = {} - form = self.read(cr, uid, ids, [], context=context)[0] + form = self.browse(cr, uid, ids, context=context)[0] result = mod_obj._get_id(cr, uid, 'crm', 'view_crm_case_phonecalls_filter') res = mod_obj.read(cr, uid, result, ['res_id'], context=context) # Select the view @@ -85,10 +85,10 @@ class job2phonecall(osv.osv_memory): #TODO: Take other info from job new_phonecall_id = phonecall_case_obj.create(cr, uid, { 'name': job.name, - 'user_id': form['user_id'], - 'categ_id': form['category_id'], - 'description': form['note'], - 'date': form['deadline'], + 'user_id': form.user_id.id, + 'categ_id': form.category_id.id, + 'description': form.note, + 'date': form.deadline, 'description': job.description, 'partner_id': job.partner_id.id, 'partner_address_id': job.partner_address_id.id, diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py index f3f720687cf..b2c0b814375 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py @@ -63,13 +63,13 @@ class hr_timesheet_invoice_create(osv.osv_memory): if context is None: context = {} result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter') - data = self.read(cr, uid, ids, [], context=context)[0] + data = self.browse(cr, uid, ids, context=context)[0] account_ids = {} for line in self.pool.get('account.analytic.line').browse(cr, uid, context['active_ids'], context=context): account_ids[line.account_id.id] = True - account_ids = account_ids.keys() #data['accounts'] + account_ids = account_ids.keys() #data.accounts for account in analytic_account_obj.browse(cr, uid, account_ids, context=context): partner = account.partner_id if (not partner) or not (account.pricelist_id): @@ -121,17 +121,17 @@ class hr_timesheet_invoice_create(osv.osv_memory): factor_name = '' factor = invoice_factor_obj.browse(cr, uid, factor_id, context2) - if not data['product']: + if not data.product: if factor.customer_name: factor_name = product.name+' - '+factor.customer_name else: factor_name = product.name else: - factor_name = product_obj.name_get(cr, uid, [data['product']], context=context)[0][1] + factor_name = product_obj.name_get(cr, uid, [data.product.id], context=context)[0][1] if account.pricelist_id: pl = account.pricelist_id.id - price = pro_price_obj.price_get(cr,uid,[pl], data['product'] or product_id, qty or 1.0, account.partner_id.id)[pl] + price = pro_price_obj.price_get(cr,uid,[pl], data.product.id or product_id, qty or 1.0, account.partner_id.id)[pl] else: price = 0.0 @@ -145,7 +145,7 @@ class hr_timesheet_invoice_create(osv.osv_memory): 'invoice_line_tax_id': [(6,0,tax )], 'invoice_id': last_invoice, 'name': factor_name, - 'product_id': data['product'] or product_id, + 'product_id': data.product.id or product_id, 'invoice_line_tax_id': [(6,0,tax)], 'uos_id': product.uom_id.id, 'account_id': account_id, @@ -162,14 +162,14 @@ class hr_timesheet_invoice_create(osv.osv_memory): for line in line_ids: # set invoice_line_note details = [] - if data['date']: + if data.date: details.append(line['date']) - if data['time']: + if data.time: if line['product_uom_id']: details.append("%s %s" % (line['unit_amount'], product_uom_obj.browse(cr, uid, [line['product_uom_id']],context2)[0].name)) else: details.append("%s" % (line['unit_amount'], )) - if data['name']: + if data.name: details.append(line['name']) note.append(u' - '.join(map(lambda x: unicode(x) or '',details))) diff --git a/addons/lunch/wizard/lunch_order_confirm.py b/addons/lunch/wizard/lunch_order_confirm.py index 6014f14f510..3dee0c3fd0d 100644 --- a/addons/lunch/wizard/lunch_order_confirm.py +++ b/addons/lunch/wizard/lunch_order_confirm.py @@ -46,8 +46,8 @@ class lunch_order_confirm(osv.osv_memory): data = context and context.get('active_ids', []) or [] order_ref = self.pool.get('lunch.order') - for confirm_obj in self.read(cr, uid, ids): - order_ref.confirm(cr, uid, data, confirm_obj['confirm_cashbox'], context) + for confirm_obj in self.browse(cr, uid, ids): + order_ref.confirm(cr, uid, data, confirm_obj.confirm_cashbox.id, context) return {'type': 'ir.actions.act_window_close'} lunch_order_confirm() diff --git a/addons/point_of_sale/wizard/pos_payment.py b/addons/point_of_sale/wizard/pos_payment.py index 8d8a6f8465a..6f9c2126a6d 100644 --- a/addons/point_of_sale/wizard/pos_payment.py +++ b/addons/point_of_sale/wizard/pos_payment.py @@ -148,6 +148,9 @@ class pos_make_payment(osv.osv_memory): order = order_obj.browse(cr, uid, active_id, context=context) amount = order.amount_total - order.amount_paid data = self.read(cr, uid, ids, context=context)[0] + for m2o_field in ['product_id','pricelist_id','partner_id']: + if data[m2o_field] and isinstance(data[m2o_field], (list,tuple)): + data[m2o_field] = data[m2o_field][0] if data['is_acc']: amount = self.pool.get('product.product').browse(cr, uid, data['product_id'], context=context).list_price diff --git a/addons/point_of_sale/wizard/pos_return.py b/addons/point_of_sale/wizard/pos_return.py index 810ef86ec7b..5db14e31358 100644 --- a/addons/point_of_sale/wizard/pos_return.py +++ b/addons/point_of_sale/wizard/pos_return.py @@ -353,8 +353,8 @@ class add_product(osv.osv_memory): data = return_boj.read(cr,uid,return_id,[])[0] wf_service = netsvc.LocalService("workflow") - self_data = self.read(cr, uid, ids)[0] - order_obj.add_product(cr, uid, active_ids[0], self_data['product_id'], self_data['quantity'], context=context) + self_data = self.browse(cr, uid, ids)[0] + order_obj.add_product(cr, uid, active_ids[0], self_data.product_id.id, self_data.quantity, context=context) for order_id in order_obj.browse(cr, uid, active_ids, context=context): prop_ids =property_obj.search(cr, uid, [('name', '=', 'property_stock_customer')]) diff --git a/addons/product/wizard/product_price.py b/addons/product/wizard/product_price.py index 5a5327a3f6d..c797efae937 100644 --- a/addons/product/wizard/product_price.py +++ b/addons/product/wizard/product_price.py @@ -53,6 +53,8 @@ class product_price_list(osv.osv_memory): datas = {'ids': context.get('active_ids', [])} res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context=context) res = res and res[0] or {} + if isinstance(res['price_list'], (tuple,list)): + res['price_list'] = res['price_list'][0] datas['form'] = res return { 'type': 'ir.actions.report.xml', diff --git a/addons/project/wizard/project_task_delegate.py b/addons/project/wizard/project_task_delegate.py index 72b32f7db68..16c3ec85653 100644 --- a/addons/project/wizard/project_task_delegate.py +++ b/addons/project/wizard/project_task_delegate.py @@ -105,6 +105,8 @@ class project_task_delegate(osv.osv_memory): task_id = context.get('active_id', False) task_pool = self.pool.get('project.task') delegate_data = self.read(cr, uid, ids, context=context)[0] + if isinstance(delegate_data['user_id'], tuple): + delegate_data['user_id'] = delegate_data['user_id'][0] delegate_data['name'] = tools.ustr(delegate_data['name']) task_pool.do_delegate(cr, uid, task_id, delegate_data, context=context) return {} diff --git a/addons/project_gtd/wizard/project_gtd_fill.py b/addons/project_gtd/wizard/project_gtd_fill.py index 7a36b3e6ead..8c607cd12f3 100644 --- a/addons/project_gtd/wizard/project_gtd_fill.py +++ b/addons/project_gtd/wizard/project_gtd_fill.py @@ -50,10 +50,10 @@ class project_timebox_fill(osv.osv_memory): def process(self, cr, uid, ids, context=None): if not ids: return {} - data = self.read(cr, uid, ids, [], context=context) - if not data[0]['task_ids']: + data = self.browse(cr, uid, ids, context=context) + if not data[0].task_ids: return {} - self.pool.get('project.task').write(cr, uid, data[0]['task_ids'], {'timebox_id':data[0]['timebox_to_id']}) + self.pool.get('project.task').write(cr, uid, [x.id for x in data[0].task_ids], {'timebox_id':data[0].timebox_to_id.id}) return {'type': 'ir.actions.act_window_close'} project_timebox_fill() diff --git a/addons/project_long_term/wizard/project_compute_phases.py b/addons/project_long_term/wizard/project_compute_phases.py index c07f1ae81be..b074f3c93e9 100644 --- a/addons/project_long_term/wizard/project_compute_phases.py +++ b/addons/project_long_term/wizard/project_compute_phases.py @@ -45,12 +45,12 @@ class project_compute_phases(osv.osv_memory): Compute the phases for scheduling. """ project_pool = self.pool.get('project.project') - data = self.read(cr, uid, ids, [], context=context)[0] - if not data['project_id'] and data['target_project'] == 'one': + data = self.browse(cr, uid, ids, context=context)[0] + if not data.project_id and data.target_project == 'one': raise osv.except_osv(_('Error!'), _('Please Specify Project to be schedule')) - if data['project_id']: # If project mentioned find its phases - project_ids = [data['project_id']] + if data.project_id: # If project mentioned find its phases + project_ids = [data.project_id.id] else: # Else take all the draft,open,pending states phases project_ids = project_pool.search(cr, uid, [], context=context) @@ -69,7 +69,7 @@ class project_compute_phases(osv.osv_memory): id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id'] result = act_obj.read(cr, uid, [id], context=context)[0] result['target'] = 'current' - result['context'] = {"search_default_project_id":data['project_id'], "default_project_id":data['project_id'], "search_default_responsible_id":uid, "search_default_current": 1} + result['context'] = {"search_default_project_id":data.project_id.id or False, "default_project_id":data.project_id.id or False, "search_default_responsible_id":uid, "search_default_current": 1} return result project_compute_phases() diff --git a/addons/project_long_term/wizard/project_compute_tasks.py b/addons/project_long_term/wizard/project_compute_tasks.py index 658350a27d2..d5cc4eb5991 100644 --- a/addons/project_long_term/wizard/project_compute_tasks.py +++ b/addons/project_long_term/wizard/project_compute_tasks.py @@ -37,8 +37,8 @@ class project_compute_tasks(osv.osv_memory): if context is None: context = {} context['compute_by'] = 'project' - data = self.read(cr, uid, ids, [])[0] - project_id = data['project_id'] + data = self.browse(cr, uid, ids)[0] + project_id = data.project_id.id project_pool.schedule_tasks(cr, uid, [project_id], context=context) return self._open_task_list(cr, uid, data, context=context) diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py index 8cfdc648349..d0bbc73863d 100644 --- a/addons/stock/wizard/stock_move.py +++ b/addons/stock/wizard/stock_move.py @@ -98,9 +98,9 @@ class stock_move_consume(osv.osv_memory): context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] - for data in self.read(cr, uid, ids): + for data in self.browse(cr, uid, ids): move_obj.action_consume(cr, uid, move_ids, - data['product_qty'], data['location_id'], + data.product_qty, data.location_id.id, context=context) return {'type': 'ir.actions.act_window_close'} @@ -159,9 +159,9 @@ class stock_move_scrap(osv.osv_memory): context = {} move_obj = self.pool.get('stock.move') move_ids = context['active_ids'] - for data in self.read(cr, uid, ids): + for data in self.browse(cr, uid, ids): move_obj.action_scrap(cr, uid, move_ids, - data['product_qty'], data['location_id'], + data.product_qty, data.location_id.id, context=context) return {'type': 'ir.actions.act_window_close'} From a54b002a98dc50c0c5f6036606f4cb6235055583 Mon Sep 17 00:00:00 2001 From: "rha@tinyerp.com" <> Date: Wed, 2 Feb 2011 17:47:37 +0530 Subject: [PATCH 09/47] [Fix]: stock: cancelling move availability doesn't change packing lp bug: https://launchpad.net/bugs/707031 fixed bzr revid: rha@tinyerp.com-20110202121737-y0mqh83pnetbwv9f --- addons/stock/stock.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c942818a3d4..f0d6ca83b32 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1886,6 +1886,14 @@ class stock_move(osv.osv): @return: True """ self.write(cr, uid, ids, {'state': 'confirmed'}) + + # fix for bug lp:707031 + # called write of related picking because changing move availability does + # not trigger workflow of picking in order to change the state of picking + wf_service = netsvc.LocalService('workflow') + for move in self.browse(cr, uid, ids, context): + if move.picking_id: + wf_service.trg_write(uid, 'stock.picking', move.picking_id.id, cr) return True # From e38be2c715539e56faeaf5714e2c075c7c046e73 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Wed, 2 Feb 2011 18:54:37 +0530 Subject: [PATCH 10/47] [FIX]project_mrp :Task summary is not interpretable when Tasks are created from Manufacturing Order lp bug: https://launchpad.net/bugs/711236 fixed bzr revid: ron@tinyerp.com-20110202132437-zeetkjbnoqsb896g --- addons/project_mrp/project_procurement.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/project_mrp/project_procurement.py b/addons/project_mrp/project_procurement.py index 7e7978eda59..0a7fa12ce6f 100644 --- a/addons/project_mrp/project_procurement.py +++ b/addons/project_mrp/project_procurement.py @@ -37,7 +37,7 @@ class procurement_order(osv.osv): self.write(cr, uid, [procurement.id], {'state': 'running'}) planned_hours = procurement.product_qty task_id = self.pool.get('project.task').create(cr, uid, { - 'name': '%s:%s' % (procurement.origin or '', procurement.name), + 'name': '%s:%s' % (procurement.origin or '', procurement.product_id.name), 'date_deadline': procurement.date_planned, 'planned_hours':planned_hours, 'remaining_hours': planned_hours, From e58d1c6266c3fd99348b7b93dc641b7141767d62 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Thu, 3 Feb 2011 11:26:40 +0530 Subject: [PATCH 11/47] [FIX]:Internal Stock move have problem if wearhouse input location = Input lp bug: https://launchpad.net/bugs/710717 fixed bzr revid: ksa@tinyerp.co.in-20110203055640-cg0uasduxxgafttp --- addons/stock/stock.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index ee4665ceff1..5f3f3474105 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -2130,7 +2130,7 @@ class stock_move(osv.osv): prodlot_id = partial_datas and partial_datas.get('move%s_prodlot_id' % (move.id), False) if prodlot_id: self.write(cr, uid, [move.id], {'prodlot_id': prodlot_id}, context=context) - if move.state not in ('confirmed','done'): + if move.state not in ('confirmed','done','assigned'): self.action_confirm(cr, uid, move_ids, context=context) self.write(cr, uid, move_ids, {'state': 'done', 'date_planned': time.strftime('%Y-%m-%d %H:%M:%S')}, context=context) From 9689293daf3698a5a79fd0755d7249b314ff2379 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Thu, 3 Feb 2011 12:41:44 +0530 Subject: [PATCH 12/47] [FIX] STOCK:Now Invoice Available Products in the Sale Order If It Has Not Available Products lp bug: https://launchpad.net/bugs/708434 fixed bzr revid: aag@tinyerp.co.in-20110203071144-0xbkqlf7h8ek9a7g --- addons/stock/stock.py | 3 +-- addons/stock/wizard/stock_partial_picking.py | 22 +++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index c942818a3d4..4fc43c54d45 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1166,8 +1166,7 @@ class stock_picking(osv.osv): for move in pick.move_lines: if move.state in ('done', 'cancel'): continue - partial_data = partial_datas.get('move%s'%(move.id), False) - assert partial_data, _('Missing partial picking data for move #%s') % (move.id) + partial_data = partial_datas.get('move%s'%(move.id), {}) product_qty = partial_data.get('product_qty',0.0) move_product_qty[move.id] = product_qty product_uom = partial_data.get('product_uom',False) diff --git a/addons/stock/wizard/stock_partial_picking.py b/addons/stock/wizard/stock_partial_picking.py index 9f644c981a8..cc858f0f726 100644 --- a/addons/stock/wizard/stock_partial_picking.py +++ b/addons/stock/wizard/stock_partial_picking.py @@ -67,8 +67,9 @@ class stock_partial_picking(osv.osv_memory): for m in pick.move_lines: if m.state in ('done', 'cancel'): continue - result.append(self.__create_partial_picking_memory(m, pick_type)) - + move_memory = self.__create_partial_picking_memory(m, pick_type) + if move_memory: + result.append(move_memory) if 'product_moves_in' in fields: res.update({'product_moves_in': result}) if 'product_moves_out' in fields: @@ -124,12 +125,27 @@ class stock_partial_picking(osv.osv_memory): 'prodlot_id' : picking.prodlot_id.id, 'move_id' : picking.id, } - + if pick_type == 'in': move_memory.update({ 'cost' : picking.product_id.standard_price, 'currency' : picking.product_id.company_id and picking.product_id.company_id.currency_id and picking.product_id.company_id.currency_id.id or False, }) + + if pick_type == 'out': + type = picking.picking_id.move_type + qty_avl = picking.product_id.qty_available + if type == 'direct' : + if qty_avl <= 0.0 and picking.state != 'assigned': + move_memory = {} + if picking.product_qty > qty_avl and qty_avl > 0.0: + move_memory.update({ + 'quantity' : qty_avl, + }) + if picking.state == 'assigned': + move_memory.update({ + 'quantity' : picking.product_qty, + }) return move_memory def do_partial(self, cr, uid, ids, context=None): From 7807995b5442538561cc5670d389812f83b835bb Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Thu, 3 Feb 2011 18:07:47 +0530 Subject: [PATCH 13/47] [IMP] stock: Add context and chech for Read method bzr revid: aag@tinyerp.co.in-20110203123747-0jcpq8xqlthstw2z --- addons/stock/wizard/stock_invoice_onshipping.py | 2 +- addons/stock/wizard/stock_location_product.py | 2 +- addons/stock/wizard/stock_return_picking.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index c7eab1eef4d..b58fec91930 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -115,7 +115,7 @@ class stock_invoice_onshipping(osv.osv_memory): if context is None: context = {} picking_pool = self.pool.get('stock.picking') - onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date']) + onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context) if context.get('new_picking', False): onshipdata_obj['id'] = onshipdata_obj.new_picking onshipdata_obj[ids] = onshipdata_obj.new_picking diff --git a/addons/stock/wizard/stock_location_product.py b/addons/stock/wizard/stock_location_product.py index 5ac4aa0f944..ba1f74ee0a1 100644 --- a/addons/stock/wizard/stock_location_product.py +++ b/addons/stock/wizard/stock_location_product.py @@ -39,7 +39,7 @@ class stock_location_product(osv.osv_memory): @return: Invoice type """ mod_obj = self.pool.get('ir.model.data') - for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']): + for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date'], context=context): return { 'name': False, 'view_type': 'form', diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 2dd9063fe7e..34d912ce786 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -151,7 +151,7 @@ class stock_return_picking(osv.osv_memory): wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id, context=context) - data = self.read(cr, uid, ids[0]) + data = self.read(cr, uid, ids[0], context=context) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') From 14dbf4d28e0fc0676a3d79f165dc18f80b736ade Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Thu, 3 Feb 2011 19:34:03 +0530 Subject: [PATCH 14/47] [IMP] stock: Add context and chech for Read method22 bzr revid: aag@tinyerp.co.in-20110203140403-bmtd0opgmq3iyq0n --- addons/stock/wizard/stock_invoice_onshipping.py | 2 +- addons/stock/wizard/stock_location_product.py | 2 +- addons/stock/wizard/stock_return_picking.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/wizard/stock_invoice_onshipping.py b/addons/stock/wizard/stock_invoice_onshipping.py index c7eab1eef4d..b58fec91930 100644 --- a/addons/stock/wizard/stock_invoice_onshipping.py +++ b/addons/stock/wizard/stock_invoice_onshipping.py @@ -115,7 +115,7 @@ class stock_invoice_onshipping(osv.osv_memory): if context is None: context = {} picking_pool = self.pool.get('stock.picking') - onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date']) + onshipdata_obj = self.read(cr, uid, ids, ['journal_id', 'group', 'invoice_date'], context=context) if context.get('new_picking', False): onshipdata_obj['id'] = onshipdata_obj.new_picking onshipdata_obj[ids] = onshipdata_obj.new_picking diff --git a/addons/stock/wizard/stock_location_product.py b/addons/stock/wizard/stock_location_product.py index 5ac4aa0f944..ba1f74ee0a1 100644 --- a/addons/stock/wizard/stock_location_product.py +++ b/addons/stock/wizard/stock_location_product.py @@ -39,7 +39,7 @@ class stock_location_product(osv.osv_memory): @return: Invoice type """ mod_obj = self.pool.get('ir.model.data') - for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date']): + for location_obj in self.read(cr, uid, ids, ['from_date', 'to_date'], context=context): return { 'name': False, 'view_type': 'form', diff --git a/addons/stock/wizard/stock_return_picking.py b/addons/stock/wizard/stock_return_picking.py index 2dd9063fe7e..34d912ce786 100644 --- a/addons/stock/wizard/stock_return_picking.py +++ b/addons/stock/wizard/stock_return_picking.py @@ -151,7 +151,7 @@ class stock_return_picking(osv.osv_memory): wf_service = netsvc.LocalService("workflow") pick = pick_obj.browse(cr, uid, record_id, context=context) - data = self.read(cr, uid, ids[0]) + data = self.read(cr, uid, ids[0], context=context) new_picking = None date_cur = time.strftime('%Y-%m-%d %H:%M:%S') From 6af654f7bf5ebb32788f8ec583d358b74a77bcd5 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Fri, 4 Feb 2011 13:13:05 +0530 Subject: [PATCH 15/47] [IMP] survey: Add context and chech for Read method is working bzr revid: aag@tinyerp.co.in-20110204074305-tscrng9ju5sha0zv --- addons/survey/wizard/survey_browse_answer.py | 3 ++- addons/survey/wizard/survey_print.py | 4 ++-- addons/survey/wizard/survey_print_answer.py | 2 +- addons/survey/wizard/survey_print_statistics.py | 2 +- addons/survey/wizard/survey_selection.py | 4 ++-- addons/survey/wizard/survey_send_invitation.py | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-) diff --git a/addons/survey/wizard/survey_browse_answer.py b/addons/survey/wizard/survey_browse_answer.py index 52664eb48cc..7b73c180cac 100644 --- a/addons/survey/wizard/survey_browse_answer.py +++ b/addons/survey/wizard/survey_browse_answer.py @@ -61,9 +61,10 @@ class survey_browse_answer(osv.osv_memory): @return : Dictionary value for Open the browse answer wizard. """ if context is None: context = {} - record = self.read(cr, uid, ids, []) + record = self.read(cr, uid, ids, [],context=context) record = record and record[0] or {} if record['response_id']: + record['response_id'] = record['response_id'][0] res_id = [(record['response_id'])] else: sur_response_obj = self.pool.get('survey.response') diff --git a/addons/survey/wizard/survey_print.py b/addons/survey/wizard/survey_print.py index ed6479885dc..ddaec0a4600 100644 --- a/addons/survey/wizard/survey_print.py +++ b/addons/survey/wizard/survey_print.py @@ -56,9 +56,9 @@ class survey_print(osv.osv_memory): @return : Dictionary value for print survey form. """ - datas = {'ids' : self.read(cr, uid, ids, [], context)[0]['survey_ids']} + datas = {'ids' : self.read(cr, uid, ids, [], context=context)[0]['survey_ids']} res = self.read(cr, uid, ids, ['survey_title', 'orientation', 'paper_size',\ - 'page_number', 'without_pagebreak'], context) + 'page_number', 'without_pagebreak'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print' diff --git a/addons/survey/wizard/survey_print_answer.py b/addons/survey/wizard/survey_print_answer.py index 8375868e9db..02db236d233 100644 --- a/addons/survey/wizard/survey_print_answer.py +++ b/addons/survey/wizard/survey_print_answer.py @@ -59,7 +59,7 @@ class survey_print_answer(osv.osv_memory): context = {} datas = {'ids': context.get('active_ids', [])} res = self.read(cr, uid, ids, ['response_ids', 'orientation', 'paper_size',\ - 'page_number', 'without_pagebreak'], context) + 'page_number', 'without_pagebreak'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print.answer' diff --git a/addons/survey/wizard/survey_print_statistics.py b/addons/survey/wizard/survey_print_statistics.py index 9c10d138e0e..10b321fcf45 100644 --- a/addons/survey/wizard/survey_print_statistics.py +++ b/addons/survey/wizard/survey_print_statistics.py @@ -44,7 +44,7 @@ class survey_print_statistics(osv.osv_memory): if context is None: context = {} datas = {'ids': context.get('active_ids', [])} - res = self.read(cr, uid, ids, ['survey_ids'], context) + res = self.read(cr, uid, ids, ['survey_ids'], context=context) res = res and res[0] or {} datas['form'] = res datas['model'] = 'survey.print.statistics' diff --git a/addons/survey/wizard/survey_selection.py b/addons/survey/wizard/survey_selection.py index 04b829077f3..4d246c2b0c3 100644 --- a/addons/survey/wizard/survey_selection.py +++ b/addons/survey/wizard/survey_selection.py @@ -122,7 +122,7 @@ class survey_name_wiz(osv.osv_memory): search_obj = self.pool.get('ir.ui.view') if context is None: context = {} - sur_id = self.read(cr, uid, ids, [])[0] + sur_id = self.read(cr, uid, ids, [], context=context)[0] survey_id = sur_id['survey_id'] context.update({'survey_id': survey_id, 'sur_name_id': sur_id['id']}) cr.execute('select count(id) from survey_history where user_id=%s\ @@ -133,7 +133,7 @@ class survey_name_wiz(osv.osv_memory): if user_limit and res >= user_limit: raise osv.except_osv(_('Warning !'),_("You can not give response for this survey more than %s times") % (user_limit)) - sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids)[0]['survey_id']) + sur_rec = survey_obj.read(cr,uid,self.read(cr,uid,ids, context=context)[0]['survey_id']) if sur_rec['max_response_limit'] and sur_rec['max_response_limit'] <= sur_rec['tot_start_survey']: raise osv.except_osv(_('Warning !'),_("You can not give more response. Please contact the author of this survey for further assistance.")) diff --git a/addons/survey/wizard/survey_send_invitation.py b/addons/survey/wizard/survey_send_invitation.py index 361f7388f6f..f091653c499 100644 --- a/addons/survey/wizard/survey_send_invitation.py +++ b/addons/survey/wizard/survey_send_invitation.py @@ -97,7 +97,7 @@ class survey_send_invitation(osv.osv_memory): if context is None: context = {} record = self.read(cr, uid, ids, []) - survey_ids = context.get('active_ids', []) + survey_ids = context.get('active_ids', [], context=context) record = record and record[0] partner_ids = record['partner_ids'] user_ref= self.pool.get('res.users') From d94b60c23fe8d1954ccfbd7d809262abad529c9e Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Fri, 4 Feb 2011 15:59:10 +0530 Subject: [PATCH 16/47] [IMP] Board: Add context and chech for Read method is working bzr revid: aag@tinyerp.co.in-20110204102910-y70hzv9cwweecknp --- addons/board/wizard/board_menu_create.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/board/wizard/board_menu_create.py b/addons/board/wizard/board_menu_create.py index 10d4d80a7f3..61f6a8f5ee4 100644 --- a/addons/board/wizard/board_menu_create.py +++ b/addons/board/wizard/board_menu_create.py @@ -70,7 +70,8 @@ class board_menu_create(osv.osv_memory): }) obj_menu = self.pool.get('ir.ui.menu') #start Loop - for data in self.read(cr, uid, ids): + for data in self.read(cr, uid, ids, context=context): + data['menu_parent_id'] = data['menu_parent_id'][0] obj_menu.create(cr, uid, { 'name': data.get('menu_name'), 'parent_id': data.get('menu_parent_id'), From 87ff4b3c97b2d363228e0495c6f1bab2058930d9 Mon Sep 17 00:00:00 2001 From: "rha@tinyerp.com" <> Date: Fri, 4 Feb 2011 18:28:09 +0530 Subject: [PATCH 17/47] [IMP] account: Improve osv memory wizards bzr revid: rha@tinyerp.com-20110204125809-yuiqwhpoy0j1cyfb --- addons/account/report/account_balance.py | 2 ++ addons/account/wizard/account_move_journal.py | 2 +- addons/account/wizard/account_open_closed_fiscalyear.py | 2 ++ addons/account/wizard/account_report_balance_sheet.py | 8 ++++++++ addons/account/wizard/account_report_common.py | 5 ++++- addons/account/wizard/account_report_common_account.py | 6 ++++++ addons/account/wizard/account_report_common_journal.py | 8 ++++++++ addons/account/wizard/account_report_common_partner.py | 6 ++++++ addons/account/wizard/account_report_general_ledger.py | 2 +- addons/account/wizard/account_report_partner_balance.py | 2 +- addons/account/wizard/account_report_partner_ledger.py | 2 +- addons/account/wizard/account_report_profit_loss.py | 2 +- addons/account/wizard/account_validate_account_move.py | 3 +++ addons/account/wizard/account_vat.py | 3 +++ addons/auction/wizard/auction_lots_invoice.py | 4 ++-- 15 files changed, 49 insertions(+), 8 deletions(-) diff --git a/addons/account/report/account_balance.py b/addons/account/report/account_balance.py index 8fe9af39e00..e30a6ca3a1f 100644 --- a/addons/account/report/account_balance.py +++ b/addons/account/report/account_balance.py @@ -71,6 +71,8 @@ class account_balance(report_sxw.rml_parse, common_report_header): def lines(self, form, ids=[], done=None):#, level=1): def _process_child(accounts, disp_acc, parent): account_rec = [acct for acct in accounts if acct['id']==parent][0] + if isinstance(account_rec['parent_id'], tuple): + account_rec['parent_id'] = account_rec['parent_id'][0] currency_obj = self.pool.get('res.currency') acc_id = self.pool.get('account.account').browse(self.cr, self.uid, account_rec['id']) currency = acc_id.currency_id and acc_id.currency_id or acc_id.company_id.currency_id diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 47b83bb23f1..db179ff00ff 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -148,7 +148,7 @@ class account_move_journal(osv.osv_memory): journal_id = self._get_journal(cr, uid, context) period_id = self._get_period(cr, uid, context) - target_move = self.read(cr, uid, ids, [])[0]['target_move'] + target_move = self.read(cr, uid, ids, [], context=context)[0]['target_move'] name = _("Journal Items") if journal_id: diff --git a/addons/account/wizard/account_open_closed_fiscalyear.py b/addons/account/wizard/account_open_closed_fiscalyear.py index 39c5be00f15..e4562d02ca9 100644 --- a/addons/account/wizard/account_open_closed_fiscalyear.py +++ b/addons/account/wizard/account_open_closed_fiscalyear.py @@ -35,6 +35,8 @@ class account_open_closed_fiscalyear(osv.osv_memory): move_obj = self.pool.get('account.move') data = self.read(cr, uid, ids, [], context=context)[0] + if isinstance(data['fyear_id'], tuple): + data['fyear_id'] = data['fyear_id'][0] data_fyear = fy_obj.browse(cr, uid, data['fyear_id'], context=context) if not data_fyear.end_journal_period_id: raise osv.except_osv(_('Error !'), _('No End of year journal defined for the fiscal year')) diff --git a/addons/account/wizard/account_report_balance_sheet.py b/addons/account/wizard/account_report_balance_sheet.py index b69c6d65d71..ef6e02c0d37 100644 --- a/addons/account/wizard/account_report_balance_sheet.py +++ b/addons/account/wizard/account_report_balance_sheet.py @@ -66,6 +66,14 @@ class account_bs_report(osv.osv_memory): if context is None: context = {} data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0]) + + for field in data['form'].keys(): + if isinstance(data['form'][field], tuple): + data['form'][field] = data['form'][field][0] + for ctx_field in data['form']['used_context'].keys(): + if isinstance(data['form']['used_context'][ctx_field], tuple): + data['form']['used_context'][ctx_field] = data['form']['used_context'][ctx_field][0] + if not data['form']['reserve_account_id']: raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !')) data = self.pre_print_report(cr, uid, ids, data, context=context) diff --git a/addons/account/wizard/account_report_common.py b/addons/account/wizard/account_report_common.py index a4f87f55da8..f7d7cac1c77 100644 --- a/addons/account/wizard/account_report_common.py +++ b/addons/account/wizard/account_report_common.py @@ -131,7 +131,10 @@ class account_common_report(osv.osv_memory): data = {} data['ids'] = context.get('active_ids', []) data['model'] = context.get('active_model', 'ir.ui.menu') - data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'])[0] + data['form'] = self.read(cr, uid, ids, ['date_from', 'date_to', 'fiscalyear_id', 'journal_ids', 'period_from', 'period_to', 'filter', 'chart_account_id', 'target_move'], context=context)[0] + for field in data['form'].keys(): + if isinstance(data['form'][field], tuple): + data['form'][field] = data['form'][field][0] used_context = self._build_contexts(cr, uid, ids, data, context=context) data['form']['periods'] = used_context.get('periods', False) and used_context['periods'] or [] data['form']['used_context'] = used_context diff --git a/addons/account/wizard/account_report_common_account.py b/addons/account/wizard/account_report_common_account.py index 7205a9e53bf..ac496e9d22e 100644 --- a/addons/account/wizard/account_report_common_account.py +++ b/addons/account/wizard/account_report_common_account.py @@ -39,6 +39,12 @@ class account_common_account_report(osv.osv_memory): if context is None: context = {} data['form'].update(self.read(cr, uid, ids, ['display_account'], context=context)[0]) + for field in data['form'].keys(): + if isinstance(data['form'][field], tuple): + data['form'][field] = data['form'][field][0] + for ctx_field in data['form']['used_context'].keys(): + if isinstance(data['form']['used_context'][ctx_field], tuple): + data['form']['used_context'][ctx_field] = data['form']['used_context'][ctx_field][0] return data account_common_account_report() diff --git a/addons/account/wizard/account_report_common_journal.py b/addons/account/wizard/account_report_common_journal.py index 8e9db058d31..741b171bfba 100644 --- a/addons/account/wizard/account_report_common_journal.py +++ b/addons/account/wizard/account_report_common_journal.py @@ -42,6 +42,14 @@ class account_common_journal_report(osv.osv_memory): if context is None: context = {} data['form'].update(self.read(cr, uid, ids, ['amount_currency'], context=context)[0]) + + for field in data['form'].keys(): + if isinstance(data['form'][field], tuple): + data['form'][field] = data['form'][field][0] + for ctx_field in data['form']['used_context'].keys(): + if isinstance(data['form']['used_context'][ctx_field], tuple): + data['form']['used_context'][ctx_field] = data['form']['used_context'][ctx_field][0] + fy_ids = data['form']['fiscalyear_id'] and [data['form']['fiscalyear_id']] or self.pool.get('account.fiscalyear').search(cr, uid, [('state', '=', 'draft')], context=context) period_list = data['form']['periods'] or self.pool.get('account.period').search(cr, uid, [('fiscalyear_id', 'in', fy_ids)], context=context) data['form']['active_ids'] = self.pool.get('account.journal.period').search(cr, uid, [('journal_id', 'in', data['form']['journal_ids']), ('period_id', 'in', period_list)], context=context) diff --git a/addons/account/wizard/account_report_common_partner.py b/addons/account/wizard/account_report_common_partner.py index 05003041eeb..1cf3dfa5a35 100644 --- a/addons/account/wizard/account_report_common_partner.py +++ b/addons/account/wizard/account_report_common_partner.py @@ -40,6 +40,12 @@ class account_common_partner_report(osv.osv_memory): if context is None: context = {} data['form'].update(self.read(cr, uid, ids, ['result_selection'], context=context)[0]) + for field in data['form'].keys(): + if isinstance(data['form'][field], tuple): + data['form'][field] = data['form'][field][0] + for ctx_field in data['form']['used_context'].keys(): + if isinstance(data['form']['used_context'][ctx_field], tuple): + data['form']['used_context'][ctx_field] = data['form']['used_context'][ctx_field][0] return data account_common_partner_report() diff --git a/addons/account/wizard/account_report_general_ledger.py b/addons/account/wizard/account_report_general_ledger.py index c08894bfadd..e3ad832e6fb 100644 --- a/addons/account/wizard/account_report_general_ledger.py +++ b/addons/account/wizard/account_report_general_ledger.py @@ -50,7 +50,7 @@ class account_report_general_ledger(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'])[0]) + data['form'].update(self.read(cr, uid, ids, ['landscape', 'initial_balance', 'amount_currency', 'sortby'], context=context)[0]) if not data['form']['fiscalyear_id']:# GTK client problem onchange does not consider in save record data['form'].update({'initial_balance': False}) if data['form']['landscape']: diff --git a/addons/account/wizard/account_report_partner_balance.py b/addons/account/wizard/account_report_partner_balance.py index eff9e71cb72..5853824e0ed 100644 --- a/addons/account/wizard/account_report_partner_balance.py +++ b/addons/account/wizard/account_report_partner_balance.py @@ -42,7 +42,7 @@ class account_partner_balance(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['display_partner'])[0]) + data['form'].update(self.read(cr, uid, ids, ['display_partner'], context=context)[0]) return { 'type': 'ir.actions.report.xml', 'report_name': 'account.partner.balance', diff --git a/addons/account/wizard/account_report_partner_ledger.py b/addons/account/wizard/account_report_partner_ledger.py index 1a09a6344f4..4211b1db866 100644 --- a/addons/account/wizard/account_report_partner_ledger.py +++ b/addons/account/wizard/account_report_partner_ledger.py @@ -47,7 +47,7 @@ class account_partner_ledger(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency'])[0]) + data['form'].update(self.read(cr, uid, ids, ['initial_balance', 'reconcil', 'page_split', 'amount_currency'], context=context)[0]) if data['form']['page_split']: return { 'type': 'ir.actions.report.xml', diff --git a/addons/account/wizard/account_report_profit_loss.py b/addons/account/wizard/account_report_profit_loss.py index c526550e789..f84b5db8f1d 100644 --- a/addons/account/wizard/account_report_profit_loss.py +++ b/addons/account/wizard/account_report_profit_loss.py @@ -42,7 +42,7 @@ class account_pl_report(osv.osv_memory): if context is None: context = {} data = self.pre_print_report(cr, uid, ids, data, context=context) - data['form'].update(self.read(cr, uid, ids, ['display_type'])[0]) + data['form'].update(self.read(cr, uid, ids, ['display_type'], context=context)[0]) if data['form']['display_type']: return { 'type': 'ir.actions.report.xml', diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index ddcfa2c5353..c2fcfbfd5ab 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -34,6 +34,9 @@ class validate_account_move(osv.osv_memory): if context is None: context = {} data = self.read(cr, uid, ids, context=context)[0] + for field in data.keys(): + if isinstance(data[field], tuple): + data[field] = data[field][0] ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','=',data['journal_id']),('period_id','=',data['period_id'])]) if not ids_move: raise osv.except_osv(_('Warning'), _('Specified Journal does not have any account move entries in draft state for this period')) diff --git a/addons/account/wizard/account_vat.py b/addons/account/wizard/account_vat.py index 863ae055428..3e77979cd3b 100644 --- a/addons/account/wizard/account_vat.py +++ b/addons/account/wizard/account_vat.py @@ -47,6 +47,9 @@ class account_vat_declaration(osv.osv_memory): datas = {'ids': context.get('active_ids', [])} datas['model'] = 'account.tax.code' datas['form'] = self.read(cr, uid, ids)[0] + for field in datas['form'].keys(): + if isinstance(datas['form'][field], tuple): + datas['form'][field] = datas['form'][field][0] datas['form']['company_id'] = self.pool.get('account.tax.code').browse(cr, uid, [datas['form']['chart_tax_id']], context=context)[0].company_id.id return { 'type': 'ir.actions.report.xml', diff --git a/addons/auction/wizard/auction_lots_invoice.py b/addons/auction/wizard/auction_lots_invoice.py index 66bb5e42f2b..d06dcf1db0b 100644 --- a/addons/auction/wizard/auction_lots_invoice.py +++ b/addons/auction/wizard/auction_lots_invoice.py @@ -46,7 +46,7 @@ class auction_lots_invoice(osv.osv_memory): @param context: A standard dictionary @return: A dictionary which of fields with values. """ - if context is None: + if context is None: context = {} res = super(auction_lots_invoice, self).default_get(cr, uid, fields, context=context) service = netsvc.LocalService("object_proxy") @@ -103,7 +103,7 @@ class auction_lots_invoice(osv.osv_memory): @param ids: List of Auction lots make invoice buyer’s IDs @return: dictionary of account invoice form. """ - if context is None: + if context is None: context = {} service = netsvc.LocalService("object_proxy") datas = {'ids' : context.get('active_ids',[])} From 5f49551eaf5465b8a6a03a77ffe9371223cb29e1 Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Mon, 7 Feb 2011 11:13:02 +0530 Subject: [PATCH 18/47] [IMP]: Task-2009 Improve osv memory wizard for one2many filed bzr revid: ksa@tinyerp.co.in-20110207054302-b9iajxd368wwzwng --- addons/hr_timesheet/wizard/hr_timesheet_print_employee.py | 4 +++- .../wizard/hr_timesheet_final_invoice_create.py | 3 +++ addons/mrp/wizard/mrp_product_produce.py | 4 ++-- .../wizard/project_scrum_backlog_create_task.py | 3 +++ addons/project_scrum/wizard/project_scrum_backlog_sprint.py | 3 +++ .../wizard/purchase_requisition_partner.py | 6 +++++- 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py index 9775a8518ff..51af2444661 100644 --- a/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py +++ b/addons/hr_timesheet/wizard/hr_timesheet_print_employee.py @@ -31,7 +31,7 @@ class analytical_timesheet_employee(osv.osv_memory): 'Month', required=True), 'year': fields.integer('Year', required=True), 'employee_id': fields.many2one('hr.employee', 'Employee', required=True) - + } def _get_user(self, cr, uid, context=None): @@ -50,6 +50,8 @@ class analytical_timesheet_employee(osv.osv_memory): def print_report(self, cr, uid, ids, context=None): data = self.read(cr, uid, ids, context=context)[0] + if isinstance(data['employee_id'], tuple): + data['employee_id'] = data['employee_id'][0] datas = { 'ids': [], 'model': 'hr.employee', diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py index 8f1ef4ef261..cebcf072794 100644 --- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py +++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_final_invoice_create.py @@ -59,6 +59,9 @@ class final_invoice_create(osv.osv_memory): res = mod_obj.read(cr, uid, result, ['res_id'], context=context) data = self.read(cr, uid, ids, [], context=context)[0] + if isinstance(data['balance_product'], tuple): + data['balance_product'] = data['balance_product'][0] + account_ids = 'active_ids' in context and context['active_ids'] or [] for account in analytic_account_obj.browse(cr, uid, account_ids, context=context): diff --git a/addons/mrp/wizard/mrp_product_produce.py b/addons/mrp/wizard/mrp_product_produce.py index 6052cdb56f7..811c707eb2a 100644 --- a/addons/mrp/wizard/mrp_product_produce.py +++ b/addons/mrp/wizard/mrp_product_produce.py @@ -70,10 +70,10 @@ class mrp_product_produce(osv.osv_memory): context = {} prod_obj = self.pool.get('mrp.production') move_ids = context.get('active_ids', []) - for data in self.read(cr, uid, ids, context=context): + for data in self.browse(cr, uid, ids, context=context): for move_id in move_ids: prod_obj.action_produce(cr, uid, move_id, - data['product_qty'], data['mode'], context=context) + data.product_qty, data.mode, context=context) return {} mrp_product_produce() diff --git a/addons/project_scrum/wizard/project_scrum_backlog_create_task.py b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py index afa4f40a5f8..3a13b43ae19 100644 --- a/addons/project_scrum/wizard/project_scrum_backlog_create_task.py +++ b/addons/project_scrum/wizard/project_scrum_backlog_create_task.py @@ -35,6 +35,9 @@ class backlog_create_task(osv.osv_memory): ids_task = [] data = self.read(cr, uid, ids, [], context=context)[0] + if isinstance(data['user_id'], tuple): + data['user_id'] = data['user_id'][0] + backlogs = backlog_id.browse(cr, uid, context['active_ids'], context=context) result = mod_obj._get_id(cr, uid, 'project', 'view_task_search_form') id = mod_obj.read(cr, uid, result, ['res_id']) diff --git a/addons/project_scrum/wizard/project_scrum_backlog_sprint.py b/addons/project_scrum/wizard/project_scrum_backlog_sprint.py index 591e1d5da62..f953f886e5c 100644 --- a/addons/project_scrum/wizard/project_scrum_backlog_sprint.py +++ b/addons/project_scrum/wizard/project_scrum_backlog_sprint.py @@ -42,6 +42,9 @@ class backlog_sprint_assign(osv.osv_memory): if context is None: context = {} data = self.read(cr, uid, ids, [], context=context)[0] + if isinstance(data['sprint_id'], tuple): + data['sprint_id'] = data['sprint_id'][0] + for backlog in backlog_obj.browse(cr, uid, context['active_ids'], context=context): backlog_ids.append(backlog.id) if data['convert_to_task']: diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py index 8dba2ab2eae..9ff7a769a72 100644 --- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py +++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py @@ -67,7 +67,11 @@ class purchase_requisition_partner(osv.osv_memory): context = {} record_ids = context and context.get('active_ids', False) if record_ids: - data = self.read(cr, uid, ids) + data = self.read(cr, uid, ids,context=context) + for m2o_field in ['partner_id','partner_address_id']: + if isinstance(data[0][m2o_field], tuple): + data[0][m2o_field] = data[0][m2o_field][0] + company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id order_obj = self.pool.get('purchase.order') order_line_obj = self.pool.get('purchase.order.line') From e1f5c71713b8bc6e708ee396b427a654855d4c59 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Mon, 7 Feb 2011 15:22:40 +0530 Subject: [PATCH 19/47] [IMP] stock: Add context and check for osv memory wiz for Read method bzr revid: aag@tinyerp.co.in-20110207095240-i04x6f4cvbjzeqmy --- addons/stock/wizard/stock_move.py | 2 +- addons/stock/wizard/stock_split_move.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/stock/wizard/stock_move.py b/addons/stock/wizard/stock_move.py index 8cfdc648349..a6afe93a1e3 100644 --- a/addons/stock/wizard/stock_move.py +++ b/addons/stock/wizard/stock_move.py @@ -43,7 +43,7 @@ class stock_move_track(osv.osv_memory): @param context: A standard dictionary @return: """ - datas = self.read(cr, uid, ids)[0] + datas = self.read(cr, uid, ids, context=context)[0] move_obj = self.pool.get('stock.move') move_obj._track_lines(cr, uid, context['active_id'], datas, context=context) return {'type': 'ir.actions.act_window_close'} diff --git a/addons/stock/wizard/stock_split_move.py b/addons/stock/wizard/stock_split_move.py index aa7e4c17e15..ce02a212179 100644 --- a/addons/stock/wizard/stock_split_move.py +++ b/addons/stock/wizard/stock_split_move.py @@ -107,7 +107,7 @@ class stock_split_move_line(osv.osv_memory): record_id = context and context.get('active_id', False) or False pick_obj = self.pool.get('stock.picking') pick = pick_obj.browse(cr, uid, record_id, context=context) - data = self.read(cr, uid, ids[0]) + data = self.read(cr, uid, ids[0], context=context) for move in pick.move_lines: quantity = data['move%s' % move.id] if 0 < quantity < move.product_qty: From a37471db1571f6d0f57ff4b08993774a59f35fb2 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Tue, 8 Feb 2011 12:24:26 +0530 Subject: [PATCH 20/47] [IMP] Survey,Board: use isinstance in osv wiz bzr revid: aag@tinyerp.co.in-20110208065426-75gwcq141k2ds9qk --- addons/board/wizard/board_menu_create.py | 3 ++- addons/survey/wizard/survey_browse_answer.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/board/wizard/board_menu_create.py b/addons/board/wizard/board_menu_create.py index 61f6a8f5ee4..73a8337bdb7 100644 --- a/addons/board/wizard/board_menu_create.py +++ b/addons/board/wizard/board_menu_create.py @@ -71,7 +71,8 @@ class board_menu_create(osv.osv_memory): obj_menu = self.pool.get('ir.ui.menu') #start Loop for data in self.read(cr, uid, ids, context=context): - data['menu_parent_id'] = data['menu_parent_id'][0] + if isinstance(data['menu_parent_id'], tuple): + data['menu_parent_id'] = data['menu_parent_id'][0] obj_menu.create(cr, uid, { 'name': data.get('menu_name'), 'parent_id': data.get('menu_parent_id'), diff --git a/addons/survey/wizard/survey_browse_answer.py b/addons/survey/wizard/survey_browse_answer.py index 7b73c180cac..13ff39cc6be 100644 --- a/addons/survey/wizard/survey_browse_answer.py +++ b/addons/survey/wizard/survey_browse_answer.py @@ -64,7 +64,8 @@ class survey_browse_answer(osv.osv_memory): record = self.read(cr, uid, ids, [],context=context) record = record and record[0] or {} if record['response_id']: - record['response_id'] = record['response_id'][0] + if isinstance(record['response_id'], tuple): + record['response_id'] = record['response_id'][0] res_id = [(record['response_id'])] else: sur_response_obj = self.pool.get('survey.response') From d92c83d632dfb50fc210f7e0495eaf51783070b0 Mon Sep 17 00:00:00 2001 From: "ron@tinyerp.com" <> Date: Tue, 8 Feb 2011 15:47:54 +0530 Subject: [PATCH 21/47] [FIX]stock:production lot and shipping direct from Sales Order lp bug: https://launchpad.net/bugs/713212 fixed bzr revid: ron@tinyerp.com-20110208101754-2i109txqx7tkiv2y --- addons/stock/stock.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 74577c13e97..51268eb8fc9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1247,9 +1247,9 @@ class stock_picking(osv.osv): if new_picking: move_obj.write(cr, uid, [c.id for c in complete], {'picking_id': new_picking}) - for move in complete: - if prodlot_ids.get(move.id): - move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]}) + for move in complete: + if prodlot_ids.get(move.id): + move_obj.write(cr, uid, move.id, {'prodlot_id': prodlot_ids[move.id]}) for move in too_many: product_qty = move_product_qty[move.id] defaults = { From 013cf332f33087694ca5be984daff3cb974c6386 Mon Sep 17 00:00:00 2001 From: "aag (OpenERP)" Date: Tue, 8 Feb 2011 16:34:12 +0530 Subject: [PATCH 22/47] [FIX] Product:Now context is transmitted in price_get function call lp bug: https://launchpad.net/bugs/709275 fixed bzr revid: aag@tinyerp.co.in-20110208110412-02ypx3gk0i1o2uxx --- addons/product/pricelist.py | 6 +++--- addons/product/product.py | 4 ++-- addons/product/report/pricelist.py | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index cf4d129b666..72525e4c583 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -262,7 +262,7 @@ class product_pricelist(osv.osv): price = currency_obj.compute(cr, uid, price_type.currency_id.id, res['currency_id'], product_obj.price_get(cr, uid, [product_id], - price_type.field)[product_id], round=False, context=context) + price_type.field, context=context)[product_id], round=False, context=context) if price >= 0.0: price_limit = price @@ -385,7 +385,7 @@ class product_pricelist(osv.osv): else: price_tmp = self.price_get(cr, uid, [res['base_pricelist_id']], prod_id, - qty)[res['base_pricelist_id']] + qty, context=context)[res['base_pricelist_id']] ptype_src = self.browse(cr, uid, res['base_pricelist_id']).currency_id.id price = currency_obj.compute(cr, uid, ptype_src, @@ -413,7 +413,7 @@ class product_pricelist(osv.osv): price = currency_obj.compute(cr, uid, price_type.currency_id.id, res['currency_id'], product_obj.price_get(cr, uid, [prod_id], - price_type.field)[prod_id], round=False, context=context) + price_type.field, context=context)[prod_id], round=False, context=context) if price: price_limit = price diff --git a/addons/product/product.py b/addons/product/product.py index 801e647e3f2..bbf3ea1b646 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -766,12 +766,12 @@ class product_supplierinfo(osv.osv): currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): # Compute price from standard price of product - price = product_pool.price_get(cr, uid, [product_id], 'standard_price')[product_id] + price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] # Compute price from Purchase pricelist of supplier pricelist_id = supplier.property_product_pricelist_purchase.id if pricelist_id: - price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty).setdefault(pricelist_id, 0) + price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty, context=context).setdefault(pricelist_id, 0) price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price) # Compute price from supplier pricelist which are in Supplier Information diff --git a/addons/product/report/pricelist.py b/addons/product/report/pricelist.py index 068aed7df1c..a6360c8ef19 100644 --- a/addons/product/report/pricelist.py +++ b/addons/product/report/pricelist.py @@ -90,7 +90,7 @@ class report_custom(report_rml): pro.append('' % (x['name'])) temp = [] for q in qty: - price_dict = pool.get('product.pricelist').price_get(cr, uid, [price_list_id], x['id'], q) + price_dict = pool.get('product.pricelist').price_get(cr, uid, [price_list_id], x['id'], q, context=context) if price_dict[price_list_id]: price = price_dict[price_list_id] else: From ca4c6c01a74fb435bd78b2da39d574a55d9eab7c Mon Sep 17 00:00:00 2001 From: "ksa (Open ERP)" Date: Tue, 8 Feb 2011 18:55:12 +0530 Subject: [PATCH 23/47] [IMP]: improvement hr related changes bzr revid: ksa@tinyerp.co.in-20110208132512-ts4frrrau5mbi4lh --- addons/hr/hr.py | 12 ++++++------ addons/hr/security/hr_security.xml | 2 +- addons/hr_holidays/hr_holidays_view.xml | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index e2b9a7089f3..5dc67e79d1b 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -204,15 +204,15 @@ class hr_employee(osv.osv): level -= 1 return True - def _check_department_id(self, cr, uid, ids, context=None): - for emp in self.browse(cr, uid, ids, context=context): - if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id: - return False - return True +# def _check_department_id(self, cr, uid, ids, context=None): +# for emp in self.browse(cr, uid, ids, context=context): +# if emp.department_id.manager_id and emp.id == emp.department_id.manager_id.id: +# return False +# return True _constraints = [ (_check_recursion, 'Error ! You cannot create recursive Hierarchy of Employees.', ['parent_id']), - (_check_department_id, 'Error ! You cannot select a department for which the employee is the manager.', ['department_id']), +# (_check_department_id, 'Error ! You cannot select a department for which the employee is the manager.', ['department_id']), ] hr_employee() diff --git a/addons/hr/security/hr_security.xml b/addons/hr/security/hr_security.xml index 61aa5a93b12..aba7d4b45e1 100644 --- a/addons/hr/security/hr_security.xml +++ b/addons/hr/security/hr_security.xml @@ -7,7 +7,7 @@ - Human Resources / User + Human Resources / Officer diff --git a/addons/hr_holidays/hr_holidays_view.xml b/addons/hr_holidays/hr_holidays_view.xml index e207c2caf7d..49c1d5d249e 100644 --- a/addons/hr_holidays/hr_holidays_view.xml +++ b/addons/hr_holidays/hr_holidays_view.xml @@ -94,7 +94,7 @@