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..f7e561c8e24 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([ @@ -672,25 +672,14 @@ class account_invoice(osv.osv): self.create_workflow(cr, uid, ids) return True - # ---------------------------------------- - # Mail related methods - # ---------------------------------------- - - def _get_formview_action(self, cr, uid, id, context=None): + def get_formview_id(self, cr, uid, id, context=None): """ Update form view id of action to open the invoice """ - action = super(account_invoice, self)._get_formview_action(cr, uid, id, context=context) obj = self.browse(cr, uid, id, context=context) if obj.type == 'in_invoice': model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_supplier_form') - action.update({ - 'views': [(view_id, 'form')], - }) else: model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account', 'invoice_form') - action.update({ - 'views': [(view_id, 'form')], - }) - return action + return view_id # Workflow stuff ################# 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 bf9b6533b4a..210b8c94225 100644 --- a/addons/crm/crm_lead.py +++ b/addons/crm/crm_lead.py @@ -79,6 +79,7 @@ class crm_lead(format_address, osv.osv): 'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.fold and obj.stage_id.sequence > 1, }, } + _mail_mass_mailing = _('Leads / Opportunities') def get_empty_list_help(self, cr, uid, help, context=None): if context.get('default_type') == 'lead': @@ -971,15 +972,13 @@ class crm_lead(format_address, osv.osv): return [lead.section_id.message_get_reply_to()[0] if lead.section_id else False for lead in self.browse(cr, SUPERUSER_ID, ids, context=context)] - def _get_formview_action(self, cr, uid, id, context=None): - action = super(crm_lead, self)._get_formview_action(cr, uid, id, context=context) + def get_formview_id(self, cr, uid, id, context=None): obj = self.browse(cr, uid, id, context=context) if obj.type == 'opportunity': model, view_id = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'crm', 'crm_case_form_view_oppor') - action.update({ - 'views': [(view_id, 'form')], - }) - return action + else: + view_id = super(crm_lead, self).get_formview_id(cr, uid, id, model=model, context=context) + return view_id def message_get_suggested_recipients(self, cr, uid, ids, context=None): recipients = super(crm_lead, self).message_get_suggested_recipients(cr, uid, ids, context=context) 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 - - - - - - - - - - - - + +
+
+ + +
+
+ + + Contact Lists + mail.mass_mailing.list + form + tree,form + +

+ Click here to create a new mailing list. +

+ Mailing lists allows you to to manage customers and + contacts easily and to send to mailings in a single click. +

+
+ + + + + + mail.mass_mailing.search + mail.mass_mailing + + + + + + + + + + + + + + mail.mass_mailing.tree + mail.mass_mailing + 10 + + + + + + + + + + + + + + mail.mass_mailing.form + mail.mass_mailing + +
+
+
+
+

+ + emails are in queue and will be sent soon. +

+
+ +
+ + + + + +
+
+ +
+ + + + + + + + + + + + + + Related Mailing(s) + + + + + + + + + +