Thibault Delavallée (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-fix-user_id-warning-tde2 into 
lp:openobject-addons.

Requested reviews:
  OpenERP Core Team (openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fix-user_id-warning-tde2/+merge/119426

Fix some warnings :
- mail_thread warnings (hasattr user_id -> check if user_id in columns)
- this has trigerred a bug about needaction_user_ids -> called in mail_thread 
only if defined, all mail_thread objects are not inheriting from need action
- base_calendar: xml files holding values for fields that does not exist
- crm: fixed some warning due to categ_id that became categ_ids; it could have 
been interesting to check the categ_id(s) behavior before merging
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-fix-user_id-warning-tde2/+merge/119426
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-fix-user_id-warning-tde2.
=== modified file 'base_calendar/crm_meeting_demo.xml'
--- base_calendar/crm_meeting_demo.xml	2012-08-07 07:07:58 +0000
+++ base_calendar/crm_meeting_demo.xml	2012-08-13 20:21:23 +0000
@@ -24,7 +24,6 @@
             <field name="name">Initial discussion</field>
             <field name="description">Discussion with partner for product.</field>
             <field name="categ_ids" eval="[(6,0,[ref('categ_meet3')])]"/>
-            <field eval="&quot;[email protected]&quot;" name="email_from"/>
             <field eval="time.strftime('%Y-%m-05 12:00:00')" name="date"/>
             <field eval="time.strftime('%Y-%m-05 19:00:00')" name="date_deadline"/>
             <field eval="7.0" name="duration"/>
@@ -36,7 +35,7 @@
             <field name="user_id" ref="base.user_root"/>
             <field name="name">Pricing Discussion</field>
             <field name="description">Internal meeting for discussion for new pricing for product and services.</field>
-            <field name="categ_ids" eval="[(6,0,[ref('categ_meet2'), ref('categ_meet4')])]"/>
+            <field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
             <field eval="time.strftime('%Y-%m-12 15:55:05')" name="date"/>
             <field eval="time.strftime('%Y-%m-12 18:55:05')" name="date_deadline"/>
             <field eval="3.0" name="duration"/>
@@ -58,8 +57,7 @@
             <field eval="1" name="active"/>
             <field name="user_id" ref="base.user_demo"/>
             <field name="name">Changes in Designing</field>
-            <field name="email_from">[email protected]</field>
-            <field name="categ_ids" eval="[(6,0,[ref('categ_meet5')])]"/>
+            <field name="categ_ids" eval="[(6,0,[ref('categ_meet1')])]"/>
             <field eval="time.strftime('%Y-%m-22 11:05:00')" name="date"/>
             <field eval="time.strftime('%Y-%m-22 16:05:00')" name="date_deadline"/>
             <field eval="5" name="duration"/>
@@ -70,7 +68,7 @@
             <field eval="1" name="active"/>
             <field name="user_id" ref="base.user_root"/>
             <field name="name">Presentation for new Services</field>
-            <field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet4')])]"/>
+            <field name="categ_ids" eval="[(6,0,[ref('categ_meet1'), ref('categ_meet2')])]"/>
             <field eval="time.strftime('%Y-%m-18 2:00:00')" name="date"/>
             <field eval="time.strftime('%Y-%m-18 10:30:00')" name="date_deadline"/>
             <field eval="8.5" name="duration"/>

=== modified file 'base_calendar/test/base_calendar_test.yml'
--- base_calendar/test/base_calendar_test.yml	2011-10-27 21:11:24 +0000
+++ base_calendar/test/base_calendar_test.yml	2012-08-13 20:21:23 +0000
@@ -1,5 +1,5 @@
--   |
-    In Order to test base_calendar, I will first create One Simple Event with real data
+-
+  In Order to test base_calendar, I will first create One Simple Event with real data
 -
     !record {model: calendar.event, id: calendar_event_technicalpresentation0}:
         class: private
@@ -11,27 +11,25 @@
         location: OpenERP S.A.
         name: Technical Presentation
         rrule_type: none
--   |
-    Now I will set recurrence for this event to occur monday and friday of week
+-   
+  Now I will set recurrence for this event to occur monday and friday of week
 -
     !python {model: calendar.event}: |
      data = {'fr': 1, 'mo': 1, 'interval': 1, 'rrule_type': 'weekly', 'end_type': 'end_date', 'end_date': '2011-05-31 00:00:00', 'recurrency' : True}
      self.write(cr, uid, [ref("calendar_event_technicalpresentation0")], data)
--   |
-    In order to check that recurrent events are views successfully in calendar view,
-    I will open calendar view of events
+-
+  In order to check that recurrent events are views successfully in calendar view, I will open calendar view of events
 -
     !python {model: calendar.event}: |
      self.fields_view_get(cr, uid, False, 'calendar', context)
--   |
-    In order to check that recurrent events are views successfully in calendar view,
-    I will search for one of the recurrent event and count the number of events
+-
+  In order to check that recurrent events are views successfully in calendar view, I will search for one of the recurrent event and count the number of events
 -
     !python {model: calendar.event}: |
      ids = self.search(cr, uid, [('date', '>=', '2011-04-30 16:00:00'), ('date', '<=', '2011-05-31 00:00:00')], context={'virtual_id': True} )
      assert len(ids) == 9
--   |
-    Now I will make All day event and test it
+-
+  Now I will make All day event and test it
 -
     !record {model: calendar.event, id: calendar_event_alldaytestevent0}:
         allday: 1
@@ -42,8 +40,8 @@
         location: School
         name: All day test event
         rrule_type: none
--   |
-    In order to check reminder I will first create reminder 
+-
+  In order to check reminder I will first create reminder
 - 
   !record {model: res.alarm, id: res_alarm_daybeforeeventstarts0}:
     name: 1 Day before event starts
@@ -51,13 +49,13 @@
     trigger_interval: days
     trigger_occurs: before
     trigger_related: start
--   |
-    Now I will assign this reminder to all day event
+-
+  Now I will assign this reminder to all day event
 -
     !python {model: calendar.event}: |
      self.write(cr, uid, [ref("calendar_event_alldaytestevent0")], {'alarm_id': ref("res_alarm_daybeforeeventstarts0")})
--   |
-    In order to assign attendee I will invite Demo user
+-
+  In order to assign attendee I will invite Demo user
 - 
   !record {model: base_calendar.invite.attendee, id: base_calendar_invite_attendee_0}:
     type: internal
@@ -65,13 +63,13 @@
     partner_id: base.res_partner_9 # Put bcz of problem in read
     user_ids:
       - base.user_demo
--   |
-    Then I click on Invite Button
+-
+  Then I click on Invite Button
 -
     !python {model: base_calendar.invite.attendee}: |
      self.do_invite(cr, uid, [ref("base_calendar_invite_attendee_0")], {'active_id': ref("calendar_event_alldaytestevent0"), 'model' : 'calendar.event', 'attendee_field':'attendee_ids'})
--   |
-    Now I will Accept this invitation
+-
+  Now I will Accept this invitation
 -
     !python {model: calendar.attendee}: |
         ids = self.search(cr, uid, [('ref', '=', 'calendar.event' + ',' + str(ref("calendar_event_alldaytestevent0")))])

=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py	2012-08-08 17:02:15 +0000
+++ crm/crm_lead.py	2012-08-13 20:21:23 +0000
@@ -479,7 +479,7 @@
         details = []
         merge_message = _('Merged opportunities')
         subject = [merge_message]
-        fields = ['name', 'partner_id', 'stage_id', 'section_id', 'user_id', 'categ_id', 'channel_id', 'company_id', 'contact_name',
+        fields = ['name', 'partner_id', 'stage_id', 'section_id', 'user_id', 'categ_ids', 'channel_id', 'company_id', 'contact_name',
                   'email_from', 'phone', 'fax', 'mobile', 'state_id', 'description', 'probability', 'planned_revenue',
                   'country_id', 'city', 'street', 'street2', 'zip']
         for opportunity in opportunities:
@@ -550,7 +550,7 @@
             first_opportunity = opportunities_list[0]
             tail_opportunities = opportunities_list[1:]
 
-        fields = ['partner_id', 'title', 'name', 'categ_id', 'channel_id', 'city', 'company_id', 'contact_name', 'country_id', 'type_id', 'user_id', 'section_id', 'state_id', 'description', 'email', 'fax', 'mobile',
+        fields = ['partner_id', 'title', 'name', 'categ_ids', 'channel_id', 'city', 'company_id', 'contact_name', 'country_id', 'type_id', 'user_id', 'section_id', 'state_id', 'description', 'email', 'fax', 'mobile',
             'partner_name', 'phone', 'probability', 'planned_revenue', 'street', 'street2', 'zip', 'create_date', 'date_action_last',
             'date_action_next', 'email_from', 'email_cc', 'partner_name']
 

=== modified file 'crm/crm_lead_demo.xml'
--- crm/crm_lead_demo.xml	2012-08-07 06:34:46 +0000
+++ crm/crm_lead_demo.xml	2012-08-13 20:21:23 +0000
@@ -553,7 +553,7 @@
             <field name="subject">Kitchen design</field>
             <field name="model">crm.lead</field>
             <field name="res_id" ref="crm_case_15"/>
-            <field name="subtype">html</field>
+            <field name="content_subtype">html</field>
             <field name="body_html"><![CDATA[Email0 inquiry]]></field>
             <field name="type">email</field>
             <field name="state">sent</field>
@@ -563,7 +563,7 @@
             <field name="subject">Reply</field>
             <field name="model">crm.lead</field>
             <field name="res_id" ref="crm_case_15"/>
-            <field name="subtype">html</field>
+            <field name="content_subtype">html</field>
             <field name="body_html"><![CDATA[Internal note0]]></field>
             <field name="type">comment</field>
             <field name="user_id" ref="base.user_root"></field>
@@ -572,7 +572,7 @@
             <field name="subject">Reply</field>
             <field name="model">crm.lead</field>
             <field name="res_id" ref="crm_case_15"/>
-            <field name="subtype">html</field>
+            <field name="content_subtype">html</field>
             <field name="body_html"><![CDATA[comment on note0]]></field>
             <field name="parent_id" ref="message_note0"/>
             <field name="type">comment</field>
@@ -582,7 +582,7 @@
             <field name="subject">Reply</field>
             <field name="model">crm.lead</field>
             <field name="res_id" ref="crm_case_15"/>
-            <field name="subtype">html</field>
+            <field name="content_subtype">html</field>
             <field name="body_html"><![CDATA[comment1 on note0]]></field>
             <field name="parent_id" ref="message_note0"/>
             <field name="type">comment</field>
@@ -592,7 +592,7 @@
             <field name="subject">Your inquiry</field>
             <field name="model">crm.lead</field>
             <field name="res_id" ref="crm_case_15"/>
-            <field name="subtype">html</field>
+            <field name="content_subtype">html</field>
             <field name="body_html"><![CDATA[hello, outgoing email]]></field>
             <field name="type">email</field>
             <field name="state">received</field>

=== modified file 'crm/res_partner.py'
--- crm/res_partner.py	2012-08-02 14:04:05 +0000
+++ crm/res_partner.py	2012-08-13 20:21:23 +0000
@@ -82,7 +82,7 @@
                 'planned_revenue' : planned_revenue,
                 'probability' : probability,
                 'partner_id' : partner_id,
-                'categ_id' : categ_ids and categ_ids[0] or '',
+                'categ_ids' : categ_ids and categ_ids[0:1] or [],
                 'state' :'draft',
                 'type': 'opportunity'
             }, context=context)

=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py	2012-08-07 12:03:35 +0000
+++ mail/mail_thread.py	2012-08-13 20:21:23 +0000
@@ -189,7 +189,7 @@
         notif_user_ids += self.message_parse_users(cr, uid, body, context=context)
         
         # add users requested to perform an action (need_action mechanism)
-        if hasattr(self, 'get_needaction_user_ids'):
+        if hasattr(self, get_needaction_user_ids) and self._columns.get('user_id'):
             user_ids_dict = self.get_needaction_user_ids(cr, uid, thread_ids, context=context)
             for id, user_ids in user_ids_dict.iteritems():
                 notif_user_ids += user_ids
@@ -330,7 +330,7 @@
 
             data = {
                 'subject': subject,
-                'body_text': body_text or (hasattr(thread, 'description') and thread.description or ''),
+                'body_text': body_text or thread._model._columns.get('description') and thread.description or '',
                 'body_html': body_html or '',
                 'parent_id': parent_id,
                 'date': email_date or fields.datetime.now(),
@@ -353,7 +353,7 @@
                 data.update({
                     'email_to': email_to,
                     'email_from': email_from or \
-                        (hasattr(thread, 'user_id') and thread.user_id and thread.user_id.user_email),
+                        thread._model._columns.get('user_id') and thread.user_id and thread.user_id.user_email,
                     'email_cc': email_cc,
                     'email_bcc': email_bcc,
                     'references': references,
@@ -805,7 +805,7 @@
             forward_to = [i for i in message_followers_emails if (i and (i not in message_recipients))]
             if forward_to:
                 # TODO: we need an interface for this for all types of objects, not just leads
-                if hasattr(res, 'section_id'):
+                if model_pool._columns.get('section_id'):
                     del msg['reply-to']
                     msg['reply-to'] = res.section_id.reply_to
 
@@ -1047,14 +1047,14 @@
         """ When creating a new message, set as unread if uid is not the
             object responsible. """
         for obj in self.browse(cr, uid, ids, context=context):
-            if obj.message_state and hasattr(obj, 'user_id') and (not obj.user_id or obj.user_id.id != uid):
+            if obj.message_state and self._columns.get('user_id') and (not obj.user_id or obj.user_id.id != uid):
                 self.message_mark_as_unread(cr, uid, [obj.id], context=context)
 
     def message_check_and_set_unread(self, cr, uid, ids, context=None):
         """ Set unread if uid is the object responsible or if the object has
             no responsible. """
         for obj in self.browse(cr, uid, ids, context=context):
-            if obj.message_state and hasattr(obj, 'user_id') and (not obj.user_id or obj.user_id.id == uid):
+            if obj.message_state and self._columns.get('user_id') and (not obj.user_id or obj.user_id.id == uid):
                 self.message_mark_as_unread(cr, uid, [obj.id], context=context)
 
     def message_mark_as_unread(self, cr, uid, ids, context=None):
@@ -1064,7 +1064,7 @@
     def message_check_and_set_read(self, cr, uid, ids, context=None):
         """ Set read if uid is the object responsible. """
         for obj in self.browse(cr, uid, ids, context=context):
-            if not obj.message_state and hasattr(obj, 'user_id') and obj.user_id and obj.user_id.id == uid:
+            if not obj.message_state and self._columns.get('user_id') and obj.user_id and obj.user_id.id == uid:
                 self.message_mark_as_read(cr, uid, [obj.id], context=context)
     
     def message_mark_as_read(self, cr, uid, ids, context=None):

_______________________________________________
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