From e8f9427c284275a68bec0ab057625b855bd14140 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 7 Mar 2012 10:09:28 +0100 Subject: [PATCH 01/17] [ADD] Moved base_need_action file from addons/mail to server, in res/res.need_action file, holding the need_action mechanism. Also cleaned code. bzr revid: tde@openerp.com-20120307090928-0wxjmukqj9n0kkay --- openerp/addons/base/res/__init__.py | 1 + openerp/addons/base/res/res_needaction.py | 67 +++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 openerp/addons/base/res/res_needaction.py diff --git a/openerp/addons/base/res/__init__.py b/openerp/addons/base/res/__init__.py index 2b4da739f54..8bfaba2fe24 100644 --- a/openerp/addons/base/res/__init__.py +++ b/openerp/addons/base/res/__init__.py @@ -34,6 +34,7 @@ import res_request import res_lang import res_log import res_widget +import res_needaction import ir_property import wizard diff --git a/openerp/addons/base/res/res_needaction.py b/openerp/addons/base/res/res_needaction.py new file mode 100644 index 00000000000..529444b6e4e --- /dev/null +++ b/openerp/addons/base/res/res_needaction.py @@ -0,0 +1,67 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2009-Today OpenERP SA () +# +# 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 time +from osv import osv, fields +from tools.translate import _ + +class res_needaction(osv.osv): + '''Mixin class for object implementing a need_action mechanism + + Need action mechanism can be used by objects wanting to be able to + signal that an action is required on a particular record. If in the + business logic an action must be performed by somebody, for instance + validation by a manager, this mechanism allows to add have a field + linking to the user requested to perform the action. + + Technically, this class adds a need_action_user_id field; when + set to false, no action is required; when an user_id is set, + this user has an action to perform. Setting an user_id is done + through redefining the get_needaction_user_id method, that + stores the need_action_user_id function fields. + + This mechanism is used for instance to display the number of pending action + in menus. + ''' + _name = 'res.needaction' + _description = 'Need action Engine' + + def get_needaction_user_id(self, cr, uid, ids, name, arg, context=None): + if context is None: + context = {} + result = {} + for obj in self.browse(cr, uid, ids, context=context): + result[obj.id] = False + return result + + ''' Wrapper: in 6.1 the reference to a method is given to a function + field, not the function name. Inheritance is therefore not directly + possible.''' + def get_needaction_user_id_wrapper(self, cr, uid, ids, name, arg, context=None): + return self.get_needaction_user_id(cr, uid, ids, name, arg, context=context) + + _columns = { + 'need_action_user_id': fields.function(get_needaction_user_id_wrapper, + type='many2one', relation='res.users', store=True, + select=1, string='User'), + } + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: From 2781e5c06d2d188f4236bf02f997204f5a66aa3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 21 Mar 2012 10:10:02 +0100 Subject: [PATCH 02/17] [FIX] Added a type checking in write method, because sometimes an id is given instead of ids. bzr revid: tde@openerp.com-20120321091002-40yogha4vho3d6vi --- openerp/addons/base/base_needaction.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/addons/base/base_needaction.py b/openerp/addons/base/base_needaction.py index 62a36162e89..e7ef518e14e 100644 --- a/openerp/addons/base/base_needaction.py +++ b/openerp/addons/base/base_needaction.py @@ -131,6 +131,8 @@ class base_needaction(osv.osv): def write(self, cr, uid, ids, values, context=None): if context is None: context = {} + if isinstance(ids, (int, long)): + ids = [ids] # perform write write_res = super(base_needaction, self).write(cr, uid, ids, values, context=context) # get and update user_ids From c1737b12b758c1a10e619a51663876410094df13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 26 Mar 2012 16:00:03 +0200 Subject: [PATCH 03/17] [IMP] res.users: form and preference views: added name to some fields, for view inheritance purpose. bzr revid: tde@openerp.com-20120326140003-g9ghmx40st6rlhcf --- openerp/addons/base/base_update.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/addons/base/base_update.xml b/openerp/addons/base/base_update.xml index 5d6f214c0a9..2e595864691 100644 --- a/openerp/addons/base/base_update.xml +++ b/openerp/addons/base/base_update.xml @@ -85,7 +85,7 @@ - + @@ -128,11 +128,11 @@ - + - + From 5959157cc55ad80dd93347ca698a88c8d2ba6342 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Mon, 2 Apr 2012 13:47:46 +0200 Subject: [PATCH 04/17] [REM] Removed res.log feature in ORM. However, the res.log table stays, because it is still used notably in publisher_warranty, that must be checked to see how it should be updated with OpenChatter. bzr revid: tde@openerp.com-20120402114746-unxkhxutivx2hp7f --- openerp/addons/base/ir/ir_model.py | 4 ++-- .../base/publisher_warranty/publisher_warranty.py | 1 + openerp/modules/loading.py | 5 +---- openerp/osv/orm.py | 12 +----------- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 1af5818438a..bfbe734adbf 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) + # TODO: records created during module install should not display the messages of OpenChatter + context = dict(context) 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/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index 0669dadb228..2f885f318a4 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -187,6 +187,7 @@ class publisher_warranty_contract(osv.osv): limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT) + # TODO: must be updated with OpenChatter ? for message in result["messages"]: ids = self.pool.get("res.log").search(cr, uid, [("res_model", "=", "publisher_warranty.contract"), ("create_date", ">=", limit_date), 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 6d65edfbb5c..776d639bf43 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -710,17 +710,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.") @staticmethod def get_needaction_info(cr, uid, model_name, user_id, limit=None, order=None, domain=False, context=None): From ecad81b8814802bd3c57bc2752339a8b35eaaebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 3 Apr 2012 09:47:35 +0200 Subject: [PATCH 05/17] [IMP] Added a variable in context for install mode bzr revid: tde@openerp.com-20120403074735-6gv0d64xb6dq7fzu --- openerp/addons/base/ir/ir_model.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index bfbe734adbf..50f9872d522 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -718,7 +718,7 @@ class ir_model_data(osv.osv): if not context: context = {} # TODO: records created during module install should not display the messages of OpenChatter - context = dict(context) + 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('.') From 741381eb21a3f4d335b79438c3d442910ba73511 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 3 Apr 2012 17:29:49 +0200 Subject: [PATCH 06/17] [REF] Removed res.log. bzr revid: tde@openerp.com-20120403152949-tw1mphjf2tia4q9a --- openerp/addons/base/__openerp__.py | 1 - .../publisher_warranty/publisher_warranty.py | 30 +++---- openerp/addons/base/res/__init__.py | 1 - openerp/addons/base/res/res_log.py | 80 ------------------- openerp/addons/base/res/res_log_view.xml | 65 --------------- .../addons/base/security/ir.model.access.csv | 1 - 6 files changed, 15 insertions(+), 163 deletions(-) delete mode 100644 openerp/addons/base/res/res_log.py delete mode 100644 openerp/addons/base/res/res_log_view.xml 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/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index 2f885f318a4..55e26d9623e 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -188,21 +188,21 @@ class publisher_warranty_contract(osv.osv): limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT) # TODO: must be updated with OpenChatter ? - 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 - ) + #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 + #) except Exception: if cron_mode: return False # we don't want to see any stack trace in cron 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/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 1ed4d96c223..dbd263137dc 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -117,7 +117,6 @@ "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 From 51024e1dcb06d0c376d37fcc7815254d805fe3bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 3 Apr 2012 22:48:48 +0200 Subject: [PATCH 07/17] [REM] Removed res.log references in publisher_warranty. TODO: solve this. bzr revid: tde@openerp.com-20120403204848-knh44gjnenbmcp6p --- .../publisher_warranty/publisher_warranty.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index 55e26d9623e..8dc46870642 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -216,22 +216,14 @@ 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) + ids = [] + #ids = self.pool.get('res.log').search(cr, uid, [("res_model", "=", "publisher_warranty.contract")] + #, order="create_date desc", limit=limit) 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('res.log').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), From 65846e77ebdda81d6fc73818f7e4a2afa5e856ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Tue, 3 Apr 2012 23:07:31 +0200 Subject: [PATCH 08/17] [FIX] Fixed last commit. Biesserie aussi, peut pas se mettre au bon endroit, didjou. bzr revid: tde@openerp.com-20120403210731-r43z46uzqz9ejs72 --- openerp/addons/base/publisher_warranty/publisher_warranty.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index 8dc46870642..d6c1304a9ca 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -221,7 +221,7 @@ class publisher_warranty_contract(osv.osv): #, order="create_date desc", limit=limit) if not ids: return [] - messages = [(x.id, x.name) for x in self.pool.get('res.log').browse(cr, uid, ids), context=context] + messages = [(x.id, x.name) for x in self.pool.get('res.log').browse(cr, uid, ids, context=context)] return messages _columns = { From 49e4f187cf54459dd07cec0642767aeb70ff297c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 4 Apr 2012 14:33:40 +0200 Subject: [PATCH 09/17] [IMP] publisher_warranty: updated code based on res.log, now using mail.message if exists. bzr revid: tde@openerp.com-20120404123340-b12w4jwf7nclo38u --- .../publisher_warranty/publisher_warranty.py | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/openerp/addons/base/publisher_warranty/publisher_warranty.py b/openerp/addons/base/publisher_warranty/publisher_warranty.py index d6c1304a9ca..2fa47f150f3 100644 --- a/openerp/addons/base/publisher_warranty/publisher_warranty.py +++ b/openerp/addons/base/publisher_warranty/publisher_warranty.py @@ -187,22 +187,21 @@ class publisher_warranty_contract(osv.osv): limit_date = (datetime.datetime.now() - _PREVIOUS_LOG_CHECK).strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT) - # TODO: must be updated with OpenChatter ? - #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 @@ -216,12 +215,13 @@ 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 = [] - #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, context=context)] + messages = [(x.id, x.name) for x in self.pool.get('mail.message').browse(cr, uid, ids, context=context)] return messages _columns = { From a43b3de1da68f5f0888e7b5c81e7b69bc11b9eb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 4 Apr 2012 15:33:28 +0200 Subject: [PATCH 10/17] [IMP] Added missing access rights. bzr revid: tde@openerp.com-20120404133328-4ja02osilci6w939 --- openerp/addons/base/security/ir.model.access.csv | 2 ++ 1 file changed, 2 insertions(+) diff --git a/openerp/addons/base/security/ir.model.access.csv b/openerp/addons/base/security/ir.model.access.csv index 69f833f591c..ac05b726341 100644 --- a/openerp/addons/base/security/ir.model.access.csv +++ b/openerp/addons/base/security/ir.model.access.csv @@ -122,3 +122,5 @@ "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 + From d3f9e332224eddd3a2e5d262ff4126f5cd3e566f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 5 Apr 2012 13:08:15 +0200 Subject: [PATCH 11/17] [FIX] orm: needaction: Added missing local dict with some values in domain evaluation bzr revid: tde@openerp.com-20120405110815-g9u7yr7gs5o8s28k --- openerp/osv/orm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 759e0d2cd0c..1ee0f69ff52 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4887,7 +4887,7 @@ class BaseModel(object): if not ids: 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) From 2740f7e47486a0d018db1e56e6f3284dc4989614 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 5 Apr 2012 14:35:03 +0200 Subject: [PATCH 12/17] [FIX] Fixed error in needaction mechanism when calculatin menu functional fields. bzr revid: tde@openerp.com-20120405123503-4ic48pi7tz943lrq --- openerp/addons/base/ir/ir_ui_menu.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/ir/ir_ui_menu.py b/openerp/addons/base/ir/ir_ui_menu.py index f992e06b37f..663465d7365 100644 --- a/openerp/addons/base/ir/ir_ui_menu.py +++ b/openerp/addons/base/ir/ir_ui_menu.py @@ -266,8 +266,8 @@ class ir_ui_menu(osv.osv): 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] + res[menu.id]['needaction_counter'] = int(menu_needaction_res[1]) + res[menu.id]['needaction_record_ids'] = [] return res _columns = { From 920c7b4af4d7f0ed1c264b6e661c286393e17c93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 5 Apr 2012 15:04:01 +0200 Subject: [PATCH 13/17] [FIX] Fixed weird bug with search and count=True. bzr revid: tde@openerp.com-20120405130401-1nebka17459h71cj --- openerp/addons/base/ir/ir_ui_menu.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_ui_menu.py b/openerp/addons/base/ir/ir_ui_menu.py index 663465d7365..bae701c19ae 100644 --- a/openerp/addons/base/ir/ir_ui_menu.py +++ b/openerp/addons/base/ir/ir_ui_menu.py @@ -263,10 +263,11 @@ 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) + 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'] = int(menu_needaction_res[1]) + res[menu.id]['needaction_counter'] = menu_needaction_res[1] res[menu.id]['needaction_record_ids'] = [] return res From dc698712ff008c1757ed1a4904e5ce3fe1c40510 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 5 Apr 2012 15:36:14 +0200 Subject: [PATCH 14/17] [FIX] Fixed last fix. bzr revid: tde@openerp.com-20120405133614-6ol9zrqc1t4g3air --- openerp/osv/orm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openerp/osv/orm.py b/openerp/osv/orm.py index 1ee0f69ff52..c94a8a51e26 100644 --- a/openerp/osv/orm.py +++ b/openerp/osv/orm.py @@ -4885,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, 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): From 4a1ad426a495af6a617fb19d7412c1095d7d52bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 6 Apr 2012 09:39:40 +0200 Subject: [PATCH 15/17] [FIX] res.users: avatar: added right to modify avatar and avatar_big for users. bzr revid: tde@openerp.com-20120406073940-5nccdpf7nu78kx59 --- openerp/addons/base/base_update.xml | 2 +- openerp/addons/base/res/res_users.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/openerp/addons/base/base_update.xml b/openerp/addons/base/base_update.xml index 7440984fc10..8a46c985dad 100644 --- a/openerp/addons/base/base_update.xml +++ b/openerp/addons/base/base_update.xml @@ -94,7 +94,7 @@
- +
diff --git a/openerp/addons/base/res/res_users.py b/openerp/addons/base/res/res_users.py index da5470635a8..6ed6e7cc74c 100644 --- a/openerp/addons/base/res/res_users.py +++ b/openerp/addons/base/res/res_users.py @@ -375,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__'): From 77a569df6985a1b4d6c94af5df74cdde7e37e455 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 6 Apr 2012 10:17:26 +0200 Subject: [PATCH 16/17] [DOC] Added some comments. bzr revid: tde@openerp.com-20120406081726-uusbqse1ty7o2yet --- openerp/addons/base/ir/ir_model.py | 2 +- openerp/addons/base/ir/ir_ui_menu.py | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/openerp/addons/base/ir/ir_model.py b/openerp/addons/base/ir/ir_model.py index 50f9872d522..739c5679798 100644 --- a/openerp/addons/base/ir/ir_model.py +++ b/openerp/addons/base/ir/ir_model.py @@ -717,7 +717,7 @@ class ir_model_data(osv.osv): model_obj = self.pool.get(model) if not context: context = {} - # TODO: records created during module install should not display the messages of OpenChatter + # 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) diff --git a/openerp/addons/base/ir/ir_ui_menu.py b/openerp/addons/base/ir/ir_ui_menu.py index bae701c19ae..1f3f2e0f181 100644 --- a/openerp/addons/base/ir/ir_ui_menu.py +++ b/openerp/addons/base/ir/ir_ui_menu.py @@ -263,11 +263,13 @@ 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] + # not used currently, therefore set to a void list res[menu.id]['needaction_record_ids'] = [] return res From 8a5d24df8846c535f0e7c808fe943116d7b01437 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Fri, 6 Apr 2012 10:19:37 +0200 Subject: [PATCH 17/17] [IMP] Email menus: email has no restriction anymore: mail_servers is moved to technical group. bzr revid: tde@openerp.com-20120406081937-5hnau38k1ru28yhw --- openerp/addons/base/ir/ir.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 - + - - + +