Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-server/trunk-social-tde into lp:openobject-server.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-social-tde/+merge/100668
-- 
https://code.launchpad.net/~openerp-dev/openobject-server/trunk-social-tde/+merge/100668
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-server/trunk-social-tde.
=== modified file 'openerp/addons/base/__openerp__.py'
--- openerp/addons/base/__openerp__.py	2012-04-05 14:44:58 +0000
+++ openerp/addons/base/__openerp__.py	2012-04-05 17:02:22 +0000
@@ -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',

=== modified file 'openerp/addons/base/base_update.xml'
--- openerp/addons/base/base_update.xml	2012-03-30 13:32:50 +0000
+++ openerp/addons/base/base_update.xml	2012-04-05 17:02:22 +0000
@@ -85,7 +85,7 @@
                     <field name="name" readonly="1"/>
                     <newline/>
                     <group colspan="2" col="3">
-                        <group col="2" colspan="2">
+                        <group col="2" colspan="2" name="preferences">
                             <separator string="Preferences" colspan="2"/>
                             <field name="view" readonly="0"/>
                             <field name="context_lang" readonly="0"/>
@@ -128,11 +128,11 @@
                                 <!-- Second nested group to avoid misalignment with email prefs groups
                                     in simplified view -->
                                 <group colspan="7" col="7">
-                                    <group col="2" colspan="1">
+                                    <group col="2" colspan="1" name="avatar">
                                         <separator string="Avatar" colspan="2"/>
                                         <field name="avatar" widget='image' nolabel="1" colspan="2" on_change="onchange_avatar(avatar)"/>
                                     </group>
-                                    <group col="3" colspan="2">
+                                    <group col="3" colspan="2" name="preferences">
                                         <separator string="Preferences" colspan="3"/>
                                         <field name="context_lang"/>
                                         <field name="context_tz"/>

=== modified file 'openerp/addons/base/ir/ir_model.py'
--- openerp/addons/base/ir/ir_model.py	2012-03-31 21:25:15 +0000
+++ openerp/addons/base/ir/ir_model.py	2012-04-05 17:02:22 +0000
@@ -717,8 +717,8 @@
         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, 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('.')

=== modified file 'openerp/addons/base/ir/ir_ui_menu.py'
--- openerp/addons/base/ir/ir_ui_menu.py	2012-04-03 14:54:26 +0000
+++ openerp/addons/base/ir/ir_ui_menu.py	2012-04-05 17:02:22 +0000
@@ -263,11 +263,12 @@
             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'] = menu_needaction_res[1]
-            res[menu.id]['needaction_record_ids'] = menu_needaction_res[2]
+            res[menu.id]['needaction_record_ids'] = []
         return res
         
     _columns = {

=== modified file 'openerp/addons/base/publisher_warranty/publisher_warranty.py'
--- openerp/addons/base/publisher_warranty/publisher_warranty.py	2012-01-27 11:42:36 +0000
+++ openerp/addons/base/publisher_warranty/publisher_warranty.py	2012-04-05 17:02:22 +0000
@@ -187,21 +187,21 @@
 
 
             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 @@
         @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),

=== modified file 'openerp/addons/base/res/__init__.py'
--- openerp/addons/base/res/__init__.py	2012-03-01 11:07:25 +0000
+++ openerp/addons/base/res/__init__.py	2012-04-05 17:02:22 +0000
@@ -32,7 +32,6 @@
 import res_users
 import res_request
 import res_lang
-import res_log
 import res_widget
 import ir_property
 

=== removed file 'openerp/addons/base/res/res_log.py'
--- openerp/addons/base/res/res_log.py	2011-11-22 08:58:48 +0000
+++ openerp/addons/base/res/res_log.py	1970-01-01 00:00:00 +0000
@@ -1,80 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-#    OpenERP, Open Source Management Solution
-#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
-#
-#    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 <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-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:

=== removed file 'openerp/addons/base/res/res_log_view.xml'
--- openerp/addons/base/res/res_log_view.xml	2010-12-29 18:30:07 +0000
+++ openerp/addons/base/res/res_log_view.xml	1970-01-01 00:00:00 +0000
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<openerp>
-    <data>
-        <record id="res_log_search" model="ir.ui.view">
-            <field name="name">res.log.search</field>
-            <field name="model">res.log</field>
-            <field name="type">search</field>
-            <field name="arch" type="xml">
-                <search string="Logs">
-                    <filter icon="terp-camera_test" string="Read" domain="[('read','=',True)]" name="read"/>
-                    <filter icon="terp-gtk-jump-to-ltr" string="Unread" domain="[('read','&lt;&gt;',True)]" name="unread"/>
-                    <separator orientation="vertical"/>
-                    <filter icon="terp-personal" string="My Logs" domain="[('user_id','=',uid)]" name="my"/>
-                    <filter icon="terp-stock_align_left_24" string="System Logs"
-                        domain="[('res_model','=','publisher_warranty.contract')]" name="sys"/>
-                    <separator orientation="vertical"/>
-                    <field name="name"/>
-                    <field name="user_id"/>
-                    <field name="res_model"/>
-                    <field name="create_date"/>
-                </search>
-            </field>
-        </record>
-        <record id="res_log_tree" model="ir.ui.view">
-            <field name="name">res.log.tree</field>
-            <field name="model">res.log</field>
-            <field name="type">tree</field>
-            <field name="arch" type="xml">
-                <tree string="Logs">
-                    <field name="create_date"/>
-                    <field name="user_id"/>
-                    <field name="name"/>
-                </tree>
-            </field>
-        </record>
-        <record id="res_log_form" model="ir.ui.view">
-            <field name="name">res.log.form</field>
-            <field name="model">res.log</field>
-            <field name="type">form</field>
-            <field name="arch" type="xml">
-                <form string="Logs">
-                  <group colspan="4" col="6">
-                      <field name="name"/>
-                      <field name="create_date"/>
-                      <field name="read"/>
-                      <field name="user_id" />
-                      <field name="res_model"/>
-                      <field name="res_id"/>
-                  </group>
-                </form>
-            </field>
-        </record>
-
-        <record id="res_log_act_window" model="ir.actions.act_window">
-            <field name="name">Client Logs</field>
-            <field name="res_model">res.log</field>
-            <field name="view_type">form</field>
-            <field name="context">{'search_default_my': 1}</field>
-        </record>
-        <menuitem
-            action="res_log_act_window"
-            id="menu_res_log_act_window"
-            parent="base.menu_audit"/>
-    </data>
-</openerp>

=== modified file 'openerp/addons/base/res/res_users.py'
--- openerp/addons/base/res/res_users.py	2012-04-04 09:08:18 +0000
+++ openerp/addons/base/res/res_users.py	2012-04-05 17:02:22 +0000
@@ -40,7 +40,6 @@
 import tools
 from tools.translate import _
 
-
 _logger = logging.getLogger(__name__)
 
 class groups(osv.osv):
@@ -205,7 +204,7 @@
         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):

=== modified file 'openerp/addons/base/security/ir.model.access.csv'
--- openerp/addons/base/security/ir.model.access.csv	2012-04-03 14:54:26 +0000
+++ openerp/addons/base/security/ir.model.access.csv	2012-04-05 17:02:22 +0000
@@ -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
+

=== modified file 'openerp/modules/loading.py'
--- openerp/modules/loading.py	2012-03-30 16:34:22 +0000
+++ openerp/modules/loading.py	2012-04-05 17:02:22 +0000
@@ -212,10 +212,7 @@
                     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

=== modified file 'openerp/osv/orm.py'
--- openerp/osv/orm.py	2012-04-05 14:44:58 +0000
+++ openerp/osv/orm.py	2012-04-05 17:02:22 +0000
@@ -709,17 +709,7 @@
     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 @@
         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):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to