diff --git a/openerp/addons/base/__openerp__.py b/openerp/addons/base/__openerp__.py index a353344190f..393e7651bda 100644 --- a/openerp/addons/base/__openerp__.py +++ b/openerp/addons/base/__openerp__.py @@ -58,7 +58,6 @@ 'module/wizard/base_update_translations_view.xml', 'res/res_request_view.xml', 'res/res_lang_view.xml', - 'res/res_log_view.xml', 'res/res_partner_report.xml', 'res/res_partner_view.xml', 'res/res_partner_shortcut_data.xml', diff --git a/openerp/addons/base/base_update.xml b/openerp/addons/base/base_update.xml index 85d92106fc8..8a46c985dad 100644 --- a/openerp/addons/base/base_update.xml +++ b/openerp/addons/base/base_update.xml @@ -85,7 +85,7 @@ - + @@ -94,7 +94,7 @@ - + @@ -128,11 +128,11 @@ - + - + diff --git a/openerp/addons/base/ir/ir.xml b/openerp/addons/base/ir/ir.xml index 7e8a6c481b0..ccec381f1d1 100644 --- a/openerp/addons/base/ir/ir.xml +++ b/openerp/addons/base/ir/ir.xml @@ -683,7 +683,7 @@ tree,form - + - - + + diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 1af5818438a..739c5679798 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -717,8 +717,8 @@ class ir_model_data(osv.osv): model_obj = self.pool.get(model) if not context: context = {} - # records created during module install should result in res.log entries that are already read! - context = dict(context, res_log_read=True) + # records created during module install should not display the messages of OpenChatter + context = dict(context, install_mode=True) if xml_id and ('.' in xml_id): assert len(xml_id.split('.'))==2, _("'%s' contains too many dots. XML ids should not contain dots ! These are used to refer to other modules data, as in module.reference_id") % (xml_id) module, xml_id = xml_id.split('.') diff --git a/openerp/addons/base/ir/ir_ui_menu.py b/openerp/addons/base/ir/ir_ui_menu.py index f992e06b37f..1f3f2e0f181 100644 --- a/openerp/addons/base/ir/ir_ui_menu.py +++ b/openerp/addons/base/ir/ir_ui_menu.py @@ -263,11 +263,14 @@ class ir_ui_menu(osv.osv): res[menu.id] = {} if menu.action and menu.action.type == 'ir.actions.act_window' and menu.action.res_model: menu_needaction_res = self.pool.get(menu.action.res_model).get_needaction_info(cr, uid, uid, domain=menu.action.domain, context=context) + # TODO: find the addon that causes a bug on runbot, not on local + if not isinstance(menu_needaction_res[1], (int, long)): menu_needaction_res[1] = 0 else: menu_needaction_res = [False, 0, ()] res[menu.id]['needaction_enabled'] = menu_needaction_res[0] res[menu.id]['needaction_counter'] = menu_needaction_res[1] - res[menu.id]['needaction_record_ids'] = menu_needaction_res[2] + # not used currently, therefore set to a void list + res[menu.id]['needaction_record_ids'] = [] return res _columns = { diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index 0669dadb228..2fa47f150f3 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -187,21 +187,21 @@ class publisher_warranty_contract(osv.osv): limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT) - for message in result["messages"]: - ids = self.pool.get("res.log").search(cr, uid, [("res_model", "=", "publisher_warranty.contract"), - ("create_date", ">=", limit_date), - ("name", "=", message)]) - if ids: - continue - self.pool.get('res.log').create(cr, uid, - { - 'name': message, - 'res_model': "publisher_warranty.contract", - "read": True, - "user_id": False, - }, - context=context - ) + + # old behavior based on res.log; now on mail.message, that is not necessarily installed + mail_message_obj = self.pool.get('mail.message') + if mail_message_obj: + for message in result["messages"]: + ids = mail_message_obj.search(cr, uid, [("model", "=", "publisher_warranty.contract"), + ("create_date", ">=", limit_date), + ("body_text", "=", message)]) + if ids: + continue + mail_message_obj.create(cr, uid, { + 'name': message, + 'model': "publisher_warranty.contract", + 'user_id': False, + }, context=context) except Exception: if cron_mode: return False # we don't want to see any stack trace in cron @@ -215,22 +215,15 @@ class publisher_warranty_contract(osv.osv): @return: A list of html messages with ids, can be False or empty. @rtype: list of tuples(int,string) """ - ids = self.pool.get('res.log').search(cr, uid, [("res_model", "=", "publisher_warranty.contract")] - , order="create_date desc", limit=limit) + if not self.pool.get('mail.message'): + return [] + ids = self.pool.get('mail.message').search(cr, uid, [("model", "=", "publisher_warranty.contract")] + , order="create_date desc", limit=limit, context=context) if not ids: return [] - messages = [(x.id, x.name) for x in self.pool.get('res.log').browse(cr, uid, ids)] - + messages = [(x.id, x.name) for x in self.pool.get('mail.message').browse(cr, uid, ids, context=context)] return messages - def del_user_message(self, cr, uid, id, context=None): - """ - Delete a message. - """ - self.pool.get('res.log').unlink(cr, uid, [id]) - - return True - _columns = { 'name' : fields.char('Serial Key', size=384, required=True, help="Your OpenERP Publisher's Warranty Contract unique key, also called serial number."), 'date_start' : fields.date('Starting Date', readonly=True), diff --git a/openerp/addons/base/res/__init__.py b/openerp/addons/base/res/__init__.py index 2b4da739f54..1131564a812 100644 --- a/openerp/addons/base/res/__init__.py +++ b/openerp/addons/base/res/__init__.py @@ -32,7 +32,6 @@ import res_company import res_users import res_request import res_lang -import res_log import res_widget import ir_property diff --git a/openerp/addons/base/res/res_log.py b/openerp/addons/base/res/res_log.py deleted file mode 100644 index ef49b52ee52..00000000000 --- a/openerp/addons/base/res/res_log.py +++ /dev/null @@ -1,80 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Management Solution -# Copyright (C) 2004-2009 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 osv import fields, osv - -class res_log(osv.osv): - _name = 'res.log' - _columns = { - 'name': fields.char('Message', size=250, help='The logging message.', required=True, select=1), - 'user_id': fields.many2one('res.users','User'), - 'res_model': fields.char('Object', size=128, select=1), - 'context': fields.char('Context', size=250), - 'res_id': fields.integer('Object ID'), - 'secondary': fields.boolean('Secondary Log', help='Do not display this log if it belongs to the same object the user is working on'), - 'create_date': fields.datetime('Creation Date', readonly=True, select=1), - 'read': fields.boolean('Read', help="If this log item has been read, get() should not send it to the client"), - } - _defaults = { - 'user_id': lambda self,cr,uid,ctx: uid, - 'context': "{}", - 'read': False, - } - _order='create_date desc' - - _index_name = 'res_log_uid_read' - def _auto_init(self, cr, context=None): - super(res_log, self)._auto_init(cr, context) - cr.execute('SELECT 1 FROM pg_indexes WHERE indexname=%s', - (self._index_name,)) - if not cr.fetchone(): - cr.execute('CREATE INDEX %s ON res_log (user_id, read)' % - self._index_name) - - def create(self, cr, uid, vals, context=None): - create_context = context and dict(context) or {} - if 'res_log_read' in create_context: - vals['read'] = create_context.pop('res_log_read') - if create_context and not vals.get('context'): - vals['context'] = create_context - return super(res_log, self).create(cr, uid, vals, context=context) - - # TODO: do not return secondary log if same object than in the model (but unlink it) - def get(self, cr, uid, context=None): - unread_log_ids = self.search(cr, uid, - [('user_id','=',uid), ('read', '=', False)], context=context) - res = self.read(cr, uid, unread_log_ids, - ['name','res_model','res_id','context'], - context=context) - res.reverse() - result = [] - res_dict = {} - for r in res: - t = (r['res_model'], r['res_id']) - if t not in res_dict: - res_dict[t] = True - result.insert(0,r) - self.write(cr, uid, unread_log_ids, {'read': True}, context=context) - return result - -res_log() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/openerp/addons/base/res/res_log_view.xml b/openerp/addons/base/res/res_log_view.xml deleted file mode 100644 index e8cb912e227..00000000000 --- a/openerp/addons/base/res/res_log_view.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - res.log.search - res.log - search - - - - - - - - - - - - - - - - - res.log.tree - res.log - tree - - - - - - - - - - res.log.form - res.log - form - -
- - - - - - - - -
-
-
- - - Client Logs - res.log - form - {'search_default_my': 1} - - -
-
diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index 4b8fb330a78..6ed6e7cc74c 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -40,7 +40,6 @@ from service import security import tools from tools.translate import _ - _logger = logging.getLogger(__name__) class groups(osv.osv): @@ -205,7 +204,7 @@ class users(osv.osv): img_stream = StringIO.StringIO() img.save(img_stream, "PNG") return img_stream.getvalue().encode('base64') - + def _get_avatar(self, cr, uid, ids, name, args, context=None): result = dict.fromkeys(ids, False) for user in self.browse(cr, uid, ids, context=context): @@ -376,7 +375,7 @@ class users(osv.osv): } # User can write to a few of her own fields (but not her groups for example) - SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email', 'name'] + SELF_WRITEABLE_FIELDS = ['menu_tips','view', 'password', 'signature', 'action_id', 'company_id', 'user_email', 'name', 'avatar', 'avatar_big'] def write(self, cr, uid, ids, values, context=None): if not hasattr(ids, '__iter__'): diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 08410cc6357..ac05b726341 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -117,9 +117,10 @@ "access_ir_filters","ir_filters_all","model_ir_filters",,1,1,1,1 "access_res_widget","res.widget","model_res_widget","group_erp_manager",1,1,1,1 "access_res_widget_user","res.widget.user","model_res_widget",,1,0,0,0 -"access_res_log_all","res.log","model_res_log",,1,1,1,1 "access_ir_config_parameter","ir_config_parameter","model_ir_config_parameter",,1,0,0,0 "access_ir_mail_server_all","ir_mail_server","model_ir_mail_server",,1,0,0,0 "access_ir_actions_todo_category","ir_actions_todo_category","model_ir_actions_todo_category","group_system",1,1,1,1 "access_ir_actions_client","ir_actions_client all","model_ir_actions_client",,1,0,0,0 "access_ir_needaction_users","ir_needaction_users","model_ir_needaction_users",,1,1,1,1 +"access_ir_needaction_mixin","ir_needaction_mixin","model_ir_needaction_mixin",,1,1,1,1 + diff --git a/openerp/modules/loading.py b/openerp/modules/loading.py index efc73d44a58..8ed79a4d615 100644 --- a/openerp/modules/loading.py +++ b/openerp/modules/loading.py @@ -212,10 +212,7 @@ def load_module_graph(cr, graph, status=None, perform_checks=True, skip_modules= delattr(package, kind) cr.commit() - - # mark new res_log records as read - cr.execute("update res_log set read=True where create_date >= %s", (dt_before_load,)) - + cr.commit() return loaded_modules, processed_modules diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 81fc9b81976..c94a8a51e26 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -709,17 +709,7 @@ class BaseModel(object): CONCURRENCY_CHECK_FIELD = '__last_update' def log(self, cr, uid, id, message, secondary=False, context=None): - if context and context.get('disable_log'): - return True - return self.pool.get('res.log').create(cr, uid, - { - 'name': message, - 'res_model': self._name, - 'secondary': secondary, - 'res_id': id, - }, - context=context - ) + return _logger.warning("log() is deprecated. Please use OpenChatter notification system instead of the res.log mechanism.") def view_init(self, cr, uid, fields_list, context=None): """Override this method to do specific things when a view on the object is opened.""" @@ -4895,14 +4885,14 @@ class BaseModel(object): if hasattr(self, 'needaction_get_record_ids'): ids = self.needaction_get_record_ids(cr, uid, user_id, limit=8192, context=context) if not ids: - return (True, 0, []) + return [True, 0, []] if domain: - new_domain = eval(domain) + [('id', 'in', ids)] + new_domain = eval(domain, locals_dict={'uid': user_id}) + [('id', 'in', ids)] else: new_domain = [('id', 'in', ids)] - return (True, self.search(cr, uid, new_domain, limit=limit, order=order, count=True, context=context), ids) + return [True, self.search(cr, uid, new_domain, limit=limit, order=order, count=True, context=context), ids] else: - return (False, 0, []) + return [False, 0, []] # Transience def is_transient(self):