diff --git a/addons/account/account.py b/addons/account/account.py index 3537c4f4c55..b87caf547ab 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -840,16 +840,11 @@ class account_journal(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if not args: args = [] - if context is None: - context = {} - ids = [] - if context.get('journal_type', False): - args += [('type','=',context.get('journal_type'))] - if name: - ids = self.search(cr, user, [('code', 'ilike', name)]+ args, limit=limit, context=context) - if not ids: - ids = self.search(cr, user, [('name', 'ilike', name)]+ args, limit=limit, context=context)#fix it ilike should be replace with operator - + if operator in expression.NEGATIVE_TERM_OPERATORS: + domain = [('code', operator, name), ('name', operator, name)] + else: + domain = ['|', ('code', operator, name), ('name', operator, name)] + ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context) return self.name_get(cr, user, ids, context=context) @@ -938,13 +933,11 @@ class account_fiscalyear(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): if args is None: args = [] - if context is None: - context = {} - ids = [] - if name: - ids = self.search(cr, user, [('code', 'ilike', name)]+ args, limit=limit) - if not ids: - ids = self.search(cr, user, [('name', operator, name)]+ args, limit=limit) + if operator in expression.NEGATIVE_TERM_OPERATORS: + domain = [('code', operator, name), ('name', operator, name)] + else: + domain = ['|', ('code', operator, name), ('name', operator, name)] + ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context) return self.name_get(cr, user, ids, context=context) @@ -1040,19 +1033,11 @@ class account_period(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if args is None: args = [] - if context is None: - context = {} - ids = [] - if name: - ids = self.search(cr, user, - [('code', 'ilike', name)] + args, - limit=limit, - context=context) - if not ids: - ids = self.search(cr, user, - [('name', operator, name)] + args, - limit=limit, - context=context) + if operator in expression.NEGATIVE_TERM_OPERATORS: + domain = [('code', operator, name), ('name', operator, name)] + else: + domain = ['|', ('code', operator, name), ('name', operator, name)] + ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context) return self.name_get(cr, user, ids, context=context) def write(self, cr, uid, ids, vals, context=None): @@ -1187,36 +1172,6 @@ class account_move(osv.osv): 'company_id': company_id, } - def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): - """ - Returns a list of tupples containing id, name, as internally it is called {def name_get} - result format: {[(id, name), (id, name), ...]} - - @param cr: A database cursor - @param user: ID of the user currently logged in - @param name: name to search - @param args: other arguments - @param operator: default operator is 'ilike', it can be changed - @param context: context arguments, like lang, time zone - @param limit: Returns first 'n' ids of complete result, default is 80. - - @return: Returns a list of tuples containing id and name - """ - - if not args: - args = [] - ids = [] - if name: - ids += self.search(cr, user, [('name','ilike',name)]+args, limit=limit, context=context) - - if not ids and name and type(name) == int: - ids += self.search(cr, user, [('id','=',name)]+args, limit=limit, context=context) - - if not ids: - ids += self.search(cr, user, args, limit=limit, context=context) - - return self.name_get(cr, user, ids, context=context) - def name_get(self, cursor, user, ids, context=None): if isinstance(ids, (int, long)): ids = [ids] @@ -1842,10 +1797,12 @@ class account_tax_code(osv.osv): def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): if not args: args = [] - if context is None: - context = {} - ids = self.search(cr, user, ['|',('name',operator,name),('code',operator,name)] + args, limit=limit, context=context) - return self.name_get(cr, user, ids, context) + if operator in expression.NEGATIVE_TERM_OPERATORS: + domain = [('code', operator, name), ('name', operator, name)] + else: + domain = ['|', ('code', operator, name), ('name', operator, name)] + ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context) + return self.name_get(cr, user, ids, context=context) def name_get(self, cr, uid, ids, context=None): if isinstance(ids, (int, long)): @@ -1974,15 +1931,11 @@ class account_tax(osv.osv): """ if not args: args = [] - if context is None: - context = {} - ids = [] - if name: - ids = self.search(cr, user, [('description', '=', name)] + args, limit=limit, context=context) - if not ids: - ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context) + if operator in expression.NEGATIVE_TERM_OPERATORS: + domain = [('description', operator, name), ('name', operator, name)] else: - ids = self.search(cr, user, args, limit=limit, context=context or {}) + domain = ['|', ('description', operator, name), ('name', operator, name)] + ids = self.search(cr, user, expression.AND([domain, args]), limit=limit, context=context) return self.name_get(cr, user, ids, context=context) def write(self, cr, uid, ids, vals, context=None): diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index effc2b03f61..eb7d9926bbf 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -226,7 +226,7 @@ class account_invoice(osv.osv): }, } _columns = { - 'name': fields.char('Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}), + 'name': fields.char('Reference/Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}), 'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}), 'supplier_invoice_number': fields.char('Supplier Invoice Number', size=64, help="The reference of this invoice as provided by the supplier.", readonly=True, states={'draft':[('readonly',False)]}), 'type': fields.selection([ diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index e58cf7721c7..b521f3ff48c 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -404,7 +404,7 @@ - + diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py index 8a583b79383..02b046edfcf 100644 --- a/addons/account/wizard/account_invoice_refund.py +++ b/addons/account/wizard/account_invoice_refund.py @@ -165,7 +165,7 @@ class account_invoice_refund(osv.osv_memory): to_reconcile_ids = {} for line in movelines: if line.account_id.id == inv.account_id.id: - to_reconcile_ids[line.account_id.id] = [line.id] + to_reconcile_ids.setdefault(line.account_id.id, []).append(line.id) if line.reconcile_id: line.reconcile_id.unlink() inv_obj.signal_invoice_open(cr, uid, [refund.id]) diff --git a/addons/account_budget/account_budget.py b/addons/account_budget/account_budget.py index e6fc3a29668..753a5df79f4 100644 --- a/addons/account_budget/account_budget.py +++ b/addons/account_budget/account_budget.py @@ -162,7 +162,7 @@ class crossovered_budget_lines(osv.osv): elapsed = strToDate(date_to) - strToDate(date_to) if total.days: - theo_amt = float(elapsed.days / float(total.days)) * line.planned_amount + theo_amt = float((elapsed.days + 1) / float(total.days + 1)) * line.planned_amount else: theo_amt = line.planned_amount diff --git a/addons/analytic_user_function/analytic_user_function_view.xml b/addons/analytic_user_function/analytic_user_function_view.xml index ca148175c5a..147e96f0be0 100644 --- a/addons/analytic_user_function/analytic_user_function_view.xml +++ b/addons/analytic_user_function/analytic_user_function_view.xml @@ -66,7 +66,7 @@ - + @@ -79,7 +79,7 @@ - + diff --git a/addons/calendar/calendar.py b/addons/calendar/calendar.py index add0030d76c..6dff8ee2e8b 100644 --- a/addons/calendar/calendar.py +++ b/addons/calendar/calendar.py @@ -197,6 +197,10 @@ class calendar_attendee(osv.Model): @param email_from: email address for user sending the mail """ res = False + + if self.pool['ir.config_parameter'].get_param(cr, uid, 'calendar.block_mail', default=False): + return res + mail_ids = [] data_pool = self.pool['ir.model.data'] mailmess_pool = self.pool['mail.message'] @@ -431,7 +435,7 @@ class calendar_alarm_manager(osv.AbstractModel): if cron and len(cron) == 1: cron = self.pool.get('ir.cron').browse(cr, uid, cron[0], context=context) else: - raise ("Cron for " + self._name + " not identified :( !") + _logger.exception("Cron for " + self._name + " can not be identified !") if cron.interval_type == "weeks": cron_interval = cron.interval_number * 7 * 24 * 60 * 60 @@ -445,7 +449,7 @@ class calendar_alarm_manager(osv.AbstractModel): cron_interval = cron.interval_number if not cron_interval: - raise ("Cron delay for " + self._name + " can not be calculated :( !") + _logger.exception("Cron delay can not be computed !") all_events = self.get_next_potential_limit_alarm(cr, uid, cron_interval, notif=False, context=context) @@ -649,7 +653,7 @@ class calendar_event(osv.Model): _inherit = ["mail.thread", "ir.needaction_mixin"] def do_run_scheduler(self, cr, uid, id, context=None): - self.pool['calendar.alarm_manager'].do_run_scheduler(cr, uid, context=context) + self.pool['calendar.alarm_manager'].get_next_mail(cr, uid, context=context) def get_recurrent_date_by_event(self, cr, uid, event, context=None): """Get recurrent dates based on Rule string and all event where recurrent_id is child diff --git a/addons/calendar/calendar_data.xml b/addons/calendar/calendar_data.xml index ef413ee3bb5..7179566989c 100644 --- a/addons/calendar/calendar_data.xml +++ b/addons/calendar/calendar_data.xml @@ -212,7 +212,7 @@ : % for attendee in object.event_id.attendee_ids: -
+
% if attendee.cn != object.cn: ${attendee.cn} % else: @@ -345,7 +345,7 @@ : % for attendee in object.event_id.attendee_ids: -
+
% if attendee.cn != object.cn: ${attendee.cn} % else: @@ -477,7 +477,7 @@ : % for attendee in object.event_id.attendee_ids: -
+
% if attendee.cn != object.cn: ${attendee.cn} % else: diff --git a/addons/crm/crm_lead.py b/addons/crm/crm_lead.py index 9dfe22202ec..bf9b6533b4a 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -231,8 +231,8 @@ class crm_lead(format_address, osv.osv): 'email_cc': fields.text('Global CC', help="These email addresses will be added to the CC field of all inbound and outbound emails for this record before being sent. Separate multiple email addresses with a comma"), 'description': fields.text('Notes'), 'write_date': fields.datetime('Update Date', readonly=True), - 'categ_ids': fields.many2many('crm.case.categ', 'crm_lead_category_rel', 'lead_id', 'category_id', 'Categories', \ - domain="['|',('section_id','=',section_id),('section_id','=',False), ('object_id.model', '=', 'crm.lead')]"), + 'categ_ids': fields.many2many('crm.case.categ', 'crm_lead_category_rel', 'lead_id', 'category_id', 'Tags', \ + domain="['|', ('section_id', '=', section_id), ('section_id', '=', False), ('object_id.model', '=', 'crm.lead')]", help="Classify and analyze your lead/opportunity categories like: Training, Service"), 'type_id': fields.many2one('crm.case.resource.type', 'Campaign', \ domain="['|',('section_id','=',section_id),('section_id','=',False)]", help="From which campaign (seminar, marketing campaign, mass mailing, ...) did this contact come from?"), 'channel_id': fields.many2one('crm.case.channel', 'Channel', help="Communication channel (mail, direct, phone, ...)"), diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index a33b215fb8f..cfa0c352253 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -324,7 +324,7 @@ - + @@ -437,7 +437,7 @@ @@ -544,7 +544,7 @@ - + diff --git a/addons/crm_todo/__init__.py b/addons/crm_todo/__init__.py deleted file mode 100644 index 528f4b2d439..00000000000 --- a/addons/crm_todo/__init__.py +++ /dev/null @@ -1,24 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import crm_todo - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_todo/__openerp__.py b/addons/crm_todo/__openerp__.py deleted file mode 100644 index 255f7dce1c3..00000000000 --- a/addons/crm_todo/__openerp__.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - - -{ - 'name': 'Tasks on CRM', - 'version': '1.0', - 'category': 'Customer Relationship Management', - 'description': """ -Todo list for CRM leads and opportunities. -========================================== - """, - 'author': 'OpenERP SA', - 'depends': ['crm','project_gtd'], - 'data': ['crm_todo_view.xml'], - 'demo': ['crm_todo_demo.xml'], - 'installable': True, - 'auto_install': False, -} - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_todo/crm_todo.py b/addons/crm_todo/crm_todo.py deleted file mode 100644 index e11fa03193f..00000000000 --- a/addons/crm_todo/crm_todo.py +++ /dev/null @@ -1,39 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2010 Tiny SPRL (). -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -from openerp.osv import fields, osv - -class project_task(osv.osv): - _inherit = 'project.task' - _columns = { - 'lead_id': fields.many2one('crm.lead', 'Lead / Opportunity') - } - -class crm_todo(osv.osv): - _inherit = 'crm.lead' - _columns = { - 'task_ids': fields.one2many('project.task', 'lead_id', 'Tasks'), - } - - - - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm_todo/crm_todo_demo.xml b/addons/crm_todo/crm_todo_demo.xml deleted file mode 100644 index 9c016f5d0c9..00000000000 --- a/addons/crm_todo/crm_todo_demo.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/addons/crm_todo/crm_todo_view.xml b/addons/crm_todo/crm_todo_view.xml deleted file mode 100644 index b9cbb42a0fa..00000000000 --- a/addons/crm_todo/crm_todo_view.xml +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - Opportunities - Tasks - crm.lead - - - - - - - - - - - -