From f78cd4310170a4816d373a76333c4a8c71f54164 Mon Sep 17 00:00:00 2001 From: "sbh (Open ERP)" Date: Wed, 11 Aug 2010 17:04:24 +0530 Subject: [PATCH 01/17] [Fix] stock_location: Fix the security rule bzr revid: sbh@tinyerp.com-20100811113424-d3vwqs2ex532c42y --- addons/stock/wizard/stock_ups.py | 2 ++ addons/stock_location/security/ir.model.access.csv | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/stock/wizard/stock_ups.py b/addons/stock/wizard/stock_ups.py index d59820b2e05..03156dfe7fc 100644 --- a/addons/stock/wizard/stock_ups.py +++ b/addons/stock/wizard/stock_ups.py @@ -64,6 +64,7 @@ class stock_ups_final(osv.osv_memory): """ Creates xml report file. @return: xml file """ + data={} report = netsvc._group['report']['report.stock.move.lot.ups_xml'] data['report_type'] = 'raw' return {'xmlfile' : report.create(uid, context['active_id'], ids, {})} @@ -82,6 +83,7 @@ class stock_ups_upload(osv.osv_memory): """ Uploads xml report file. @return: """ + data={} report = netsvc._group['report']['report.stock.move.lot.ups_xml'] data['report_type'] = 'raw' fp = file('/tmp/test.xml', 'w').write(report.create(uid, context['active_id'], ids, {})) diff --git a/addons/stock_location/security/ir.model.access.csv b/addons/stock_location/security/ir.model.access.csv index 9bfee8edb8b..d3815736408 100644 --- a/addons/stock_location/security/ir.model.access.csv +++ b/addons/stock_location/security/ir.model.access.csv @@ -5,4 +5,4 @@ "access_stock_location_path_user","stock location path user","model_stock_location_path","stock.group_stock_user",1,0,0,0 "access_stock_location_path_manager","stock location path manager","model_stock_location_path","stock.group_stock_manager",1,1,1,1 "access_stock_location_path_partner_manager","stock.location.path partner manager","model_stock_location_path","product.group_product_manager",1,1,1,1 -"access_stock_location_path_purchase_user","stock.location.path purchase user","model_stock_location_path","purchase.group_purchase_user",1,1,1,1 +"access_stock_location_path_stock_user","stock.location.path stock user","model_stock_location_path","stock.group_stock_user",1,1,1,1 From bfdb1a006a6d3af0b2ea5af312caf7e12a8d2000 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Wed, 11 Aug 2010 17:26:06 +0530 Subject: [PATCH 02/17] [FIX]:bad commit bzr revid: nch@tinyerp.com-20100811115606-nrey9i3969bz5xgx --- addons/crm/res_partner_view.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/crm/res_partner_view.xml b/addons/crm/res_partner_view.xml index 4fa91b0ac39..375d09d6888 100644 --- a/addons/crm/res_partner_view.xml +++ b/addons/crm/res_partner_view.xml @@ -12,7 +12,7 @@ - + @@ -45,7 +45,7 @@ - + From 096ec13381cfb6869abdf9d9e6d69469c89d8678 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 11 Aug 2010 17:33:24 +0530 Subject: [PATCH 03/17] [FIX] hr: Managers and subordinates field calculation on user bzr revid: mra@mra-laptop-20100811120324-m15frv6513yuqjg2 --- addons/hr/hr_department.py | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/addons/hr/hr_department.py b/addons/hr/hr_department.py index f304e994a1f..38dedffbbfb 100644 --- a/addons/hr/hr_department.py +++ b/addons/hr/hr_department.py @@ -123,11 +123,18 @@ class res_users(osv.osv): result = {} obj_dept = self.pool.get('hr.department') for user_id in ids: - ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])], context=context) + emp_ids = self.pool.get('hr.employee').search(cr, uid, [('user_id', '=', user_id)]) + cr.execute('SELECT emp.department_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id = emp.resource_id \ + WHERE res.user_id = %s AND emp.department_id IS NOT NULL', (user_id,)) + ids_dept = [x[0] for x in cr.fetchall()] +# ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])], context=context) parent_ids = [] if ids_dept: data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id'], context=context) parent_ids = map(lambda x: x['manager_id'][0], data_dept) + cr.execute('SELECT res.user_id FROM hr_employee AS emp JOIN resource_resource AS res ON res.id=emp.resource_id \ + WHERE emp.id IN %s', (tuple(parent_ids),)) + parent_ids = [x[0] for x in cr.fetchall()] result[user_id] = parent_ids return result @@ -141,7 +148,7 @@ class res_users(osv.osv): child_ids = self._child_compute(cr, uid, parent, name, args, context=context) if not child_ids: return [('id', 'in', [0])] - return [('id', 'in', child_ids.get(uid,[]))] + return [('id', 'in', child_ids.get(uid, []))] def _child_compute(self, cr, uid, ids, name, args, context=None): if context is None: @@ -149,24 +156,28 @@ class res_users(osv.osv): obj_dept = self.pool.get('hr.department') obj_user = self.pool.get('res.users') result = {} - for manager_id in ids: + for user_id in ids: child_ids = [] - mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)], context=context) + cr.execute('SELECT dept.id FROM hr_department AS dept \ + LEFT JOIN hr_employee AS emp ON dept.manager_id = emp.id \ + WHERE emp.id IN \ + (SELECT emp.id FROM hr_employee \ + JOIN resource_resource r ON r.id = emp.resource_id WHERE r.user_id=' + str(user_id) + ') ') + mgnt_dept_ids = [x[0] for x in cr.fetchall()] +# mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', user_id)], context=context) ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)], context=context) if ids_dept: data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids'], context=context) childs = map(lambda x: x['member_ids'], data_dept) childs = tools.flatten(childs) childs = obj_user.search(cr, uid, [('id', 'in', childs),('active', '=', True)], context=context) - if manager_id in childs: - childs.remove(manager_id) + if user_id in childs: + childs.remove(user_id) child_ids.extend(tools.flatten(childs)) set = {} map(set.__setitem__, child_ids, []) - child_ids = set.keys() - else: - child_ids = [] - result[manager_id] = child_ids + child_ids = set.keys() + result[user_id] = child_ids return result def _child_search(self, cr, uid, obj, name, args, context=None): @@ -179,7 +190,7 @@ class res_users(osv.osv): child_ids = self._child_compute(cr, uid, parent, name, args, context=context) if not child_ids: return [('id', 'in', [0])] - return [('id', 'in', child_ids.get(uid,[]))] + return [('id', 'in', child_ids.get(uid, []))] _columns = { 'parent_id': fields.function(_parent_compute, relation='res.users', fnct_search=_parent_search, method=True, string="Managers", type='many2many'), @@ -189,4 +200,4 @@ class res_users(osv.osv): res_users() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file From 54367603a0c46c301a7ea8cb2aba26542715e27c Mon Sep 17 00:00:00 2001 From: "MTR(OpenERP)" <> Date: Wed, 11 Aug 2010 17:35:54 +0530 Subject: [PATCH 04/17] [IMP] Sale_crm: Warning moved to view init of osv memory wizard for make sale from crm bzr revid: mra@mra-laptop-20100811120554-xki60bm01pi003kt --- addons/sale_crm/wizard/crm_make_sale.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/addons/sale_crm/wizard/crm_make_sale.py b/addons/sale_crm/wizard/crm_make_sale.py index b528681b6a3..f6a99e56578 100644 --- a/addons/sale_crm/wizard/crm_make_sale.py +++ b/addons/sale_crm/wizard/crm_make_sale.py @@ -48,6 +48,18 @@ class crm_make_sale(osv.osv_memory): return False lead = lead_obj.read(cr, uid, active_id, ['partner_id']) return lead['partner_id'] + + def view_init(self, cr, uid, fields_list, context=None): + if context is None: + context = {} + if context.get('active_ids', False) and context['active_ids']: + oppr = self.pool.get('crm.lead').browse(cr, uid, context['active_ids']) + for line in oppr: + if not line.section_id: + raise osv.except_osv(_('Warning !'), _(' Sales Team is not specified.')) + return super(crm_make_sale, self).view_init(cr, uid, fields_list, context=context) + + def makeOrder(self, cr, uid, ids, context=None): """ From 91e975bb29c5d5dfb286f3d6bc5c3af1b167b246 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 11 Aug 2010 18:45:24 +0530 Subject: [PATCH 05/17] [IMP]: crm: Added proper domain for Categories of lead/opportunity, and moved its action and menu in proper file bzr revid: rpa@tinyerp.com-20100811131524-es7794npltvlbk7d --- addons/crm/crm_lead_view.xml | 14 ++++++++++++++ addons/crm/crm_view.xml | 13 ------------- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index c0fe81db5c8..b31e7b0df9d 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -18,6 +18,20 @@ parent="base.menu_crm_config_lead" /> + + + + Categories + crm.case.categ + form + + [('object_id.model', '=', 'crm.lead')] + + + + Lead Sources diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 2e859d68dfa..12a2f069cdc 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -170,19 +170,6 @@ - - - - Categories - crm.case.categ - form - - - - - From a5c3f8a8de2488250c7b81b12226db43f0b67ccc Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 11 Aug 2010 18:48:20 +0530 Subject: [PATCH 06/17] [FIX]: crm: Minor fix in phonecall to opportunity bzr revid: rpa@tinyerp.com-20100811131820-d4r41mg778nzy363 --- addons/crm/wizard/crm_phonecall_to_opportunity.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/crm/wizard/crm_phonecall_to_opportunity.py b/addons/crm/wizard/crm_phonecall_to_opportunity.py index f24d5379997..98e3c978eb0 100644 --- a/addons/crm/wizard/crm_phonecall_to_opportunity.py +++ b/addons/crm/wizard/crm_phonecall_to_opportunity.py @@ -88,7 +88,7 @@ Call Could not convert into Opportunity")) address = None if this.partner_id: address_id = self.pool.get('res.partner').address_get(cr, uid, [this.partner_id.id]) - if address_id: + if address_id['default']: address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default'], context=context) new_opportunity_id = opp_obj.create(cr, uid, { 'name': this.name, From 17aaa0b7465395891d4ac2f46f3d025d7053fe3f Mon Sep 17 00:00:00 2001 From: Mantavya Gajjar Date: Wed, 11 Aug 2010 19:20:57 +0530 Subject: [PATCH 07/17] [IMP]: improve bank statement import invoice wizard bzr revid: mga@tinyerp.com-20100811135057-w9kocaaawfpo2fle --- addons/account/account_bank_statement.py | 3 +-- addons/account/account_cash_statement.py | 2 +- addons/account/wizard/account_statement_from_invoice_view.xml | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 45736c2948f..781d9871dba 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -132,8 +132,7 @@ class account_bank_statement(osv.osv): _description = "Bank Statement" _columns = { 'name': fields.char('Name', size=64, required=True, states={'confirm': [('readonly', True)]}), - 'date': fields.date('Date', required=True, - states={'confirm': [('readonly', True)]}), + 'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'confirm': [('readonly', True)]}, domain=[('type', '=', 'bank')]), 'period_id': fields.many2one('account.period', 'Period', required=True, diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 815f3531c57..e5298fa2f9d 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -198,7 +198,7 @@ class account_cash_statement(osv.osv): _columns = { 'company_id':fields.many2one('res.company', 'Company', required=False), - 'journal_id': fields.many2one('account.journal', 'Journal', required=True, domain=[('type', '=', 'cash')]), + 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'confirm': [('readonly', True)]}, domain=[('type', '=', 'cash')]), 'balance_end_real': fields.float('Closing Balance', digits_compute=dp.get_precision('Account'), states={'confirm':[('readonly', True)]}, help="closing balance entered by the cashbox verifier"), 'state': fields.selection( [('draft', 'Draft'), diff --git a/addons/account/wizard/account_statement_from_invoice_view.xml b/addons/account/wizard/account_statement_from_invoice_view.xml index c5f42851e69..7c7986b04d0 100644 --- a/addons/account/wizard/account_statement_from_invoice_view.xml +++ b/addons/account/wizard/account_statement_from_invoice_view.xml @@ -38,7 +38,7 @@
- +