diff --git a/addons/base_calendar/crm_meeting_view.xml b/addons/base_calendar/crm_meeting_view.xml index 9776d66b839..3dffcd61520 100644 --- a/addons/base_calendar/crm_meeting_view.xml +++ b/addons/base_calendar/crm_meeting_view.xml @@ -244,14 +244,14 @@ CRM - Meetings Tree crm.meeting - - + @@ -288,7 +288,7 @@ - + diff --git a/addons/crm/crm_lead_view.xml b/addons/crm/crm_lead_view.xml index e47e0cafcad..4109bca5b17 100644 --- a/addons/crm/crm_lead_view.xml +++ b/addons/crm/crm_lead_view.xml @@ -246,7 +246,7 @@ Leads crm.lead - + @@ -262,7 +262,7 @@ - + @@ -295,7 +295,7 @@ - +
    @@ -341,7 +341,7 @@ @@ -364,7 +364,7 @@ - + @@ -544,7 +544,7 @@ Opportunities Tree crm.lead - + @@ -562,7 +562,7 @@ - + @@ -577,7 +577,7 @@ - + diff --git a/addons/event/event_view.xml b/addons/event/event_view.xml index bfed55b17cf..29e3afb04b4 100644 --- a/addons/event/event_view.xml +++ b/addons/event/event_view.xml @@ -208,7 +208,7 @@ event.event.tree event.event - + @@ -219,7 +219,7 @@ - + @@ -326,7 +326,7 @@ - + @@ -421,7 +421,7 @@ event.registration.tree event.registration - + @@ -431,7 +431,7 @@ - + @@ -516,7 +516,7 @@ - + diff --git a/addons/hr_recruitment/hr_recruitment_view.xml b/addons/hr_recruitment/hr_recruitment_view.xml index 548b4f93ead..59d4993bca3 100644 --- a/addons/hr_recruitment/hr_recruitment_view.xml +++ b/addons/hr_recruitment/hr_recruitment_view.xml @@ -76,8 +76,8 @@ Applicants hr.applicant - - + + @@ -205,7 +205,7 @@ - + diff --git a/addons/mail/doc/mail_state.rst b/addons/mail/doc/mail_state.rst index 527a31ba835..fc2772bf094 100644 --- a/addons/mail/doc/mail_state.rst +++ b/addons/mail/doc/mail_state.rst @@ -1,15 +1,15 @@ .. _mail_state: -message_state +message_unread ============= -``message_state`` is a boolean field that states whether the document +``message_unread`` is a boolean field that states whether the document has unread messages. In previous versions, some documents were going back to ``pending`` state when receiving an email through the mail gateway. Now the state related to messages differs from the state or stage of the document itself. -message_state and need action mechanism +message_unread and need action mechanism +++++++++++++++++++++++++++++++++++++++ The ``mail`` module introduces a default behavior for the need_action @@ -23,6 +23,6 @@ mechanism [REF]. """ result = super(ir_needaction_mixin, self).get_needaction_user_ids(cr, uid, ids, context=context) for obj in self.browse(cr, uid, ids, context=context): - if obj.message_state == False and obj.user_id: + if obj.message_unread == False and obj.user_id: result[obj.id].append(obj.user_id.id) return result diff --git a/addons/mail/mail_group.py b/addons/mail/mail_group.py index 7de74db27c3..0ff6c3f798d 100644 --- a/addons/mail/mail_group.py +++ b/addons/mail/mail_group.py @@ -105,6 +105,8 @@ class mail_group(osv.Model): 'alias_domain': False, # always hide alias during creation } + # FP Note: code to be improved. Check we have a code for res.users + # when we give them a new group. def _subscribe_user_with_group_m2m_command(self, cr, uid, ids, group_ids_command, context=None): # form: {'group_ids': [(3, 10), (3, 3), (4, 10), (4, 3)]} or {'group_ids': [(6, 0, [ids]} user_group_ids = [command[1] for command in group_ids_command if command[0] == 4] diff --git a/addons/mail/mail_mail.py b/addons/mail/mail_mail.py index 4599209c305..8d53793341b 100644 --- a/addons/mail/mail_mail.py +++ b/addons/mail/mail_mail.py @@ -18,9 +18,9 @@ class mail_mail(osv.Model): _name = 'mail.mail' _description = 'Outgoing Mails' - _inherits = {'mail.message': 'message_id'} + _inherits = {'mail.message': 'mail_message_id'} _columns = { - 'message_id': fields.many2one('mail.message', 'Message', required=True, ondelete='cascade'), + 'mail_message_id': fields.many2one('mail.message', 'Message', required=True, ondelete='cascade'), 'mail_server_id': fields.many2one('ir.mail_server', 'Outgoing mail server', readonly=1), 'subject': fields.char('Subject', size=128), 'state': fields.selection([ @@ -32,7 +32,7 @@ class mail_mail(osv.Model): ], 'Status', readonly=True), 'auto_delete': fields.boolean('Auto Delete', help="Permanently delete this email after sending it, to save space"), - + 'references': fields.text('References', help='Message references, such as identifiers of previous messages', readonly=1), 'email_from': fields.char('From', size=128, help='Message sender, taken from user preferences.'), 'email_to': fields.text('To', help='Message recipients'), 'email_cc': fields.char('Cc', size=256, help='Carbon copy message recipients'), @@ -129,7 +129,7 @@ class mail_mail(osv.Model): 'datas_fname': fname, 'datas': fcontent and fcontent.encode('base64'), 'res_model': 'mail.message', - 'res_id': msg.message_id.id, + 'res_id': msg.mail_message_id.id, } # FP Note: what's this ??? # if context.has_key('default_type'): diff --git a/addons/mail/mail_message.py b/addons/mail/mail_message.py index c6e901d98e7..3a942bf53a7 100644 --- a/addons/mail/mail_message.py +++ b/addons/mail/mail_message.py @@ -83,7 +83,6 @@ class mail_message(osv.Model): res.append((message.id, name)) return res - _columns = { # should we keep a distinction between email and comment ? 'type': fields.selection([ @@ -105,26 +104,20 @@ class mail_message(osv.Model): 'parent_id': fields.many2one('mail.message', 'Parent Message', select=True, ondelete='set null', help="Initial thread message."), - 'child_ids': fields.one2many('mail.message', 'parent_id', 'Child Messages'), - 'model': fields.char('Related Document Model', size=128, select=1), 'res_id': fields.integer('Related Document ID', select=1), 'record_name': fields.function(get_record_name, type='string', string='Message Record Name', help="Name get of the related document."), - 'subject': fields.char('Subject', size=128), 'date': fields.datetime('Date'), - - 'references': fields.text('References', help='Message references, such as identifiers of previous messages', readonly=1), 'message_id': fields.char('Message-Id', size=256, help='Message unique identifier', select=1, readonly=1), - 'body': fields.text('Content', required=True), } _defaults = { 'type': 'email', - 'date': (lambda *a: fields.datetime.now()), + 'date': lambda *a: fields.datetime.now(), } #------------------------------------------------------ @@ -211,6 +204,7 @@ class mail_message(osv.Model): self.check(cr, uid, ids, 'unlink', context=context) return super(mail_message, self).unlink(cr, uid, ids, context) + # FP Note: to review def parse_message(self, message, save_original=False, context=None): """Parses a string or email.message.Message representing an RFC-2822 email, and returns a generic dict holding the diff --git a/addons/mail/mail_thread.py b/addons/mail/mail_thread.py index a86eaec2896..7cdaa70f5de 100644 --- a/addons/mail/mail_thread.py +++ b/addons/mail/mail_thread.py @@ -39,59 +39,6 @@ _logger = logging.getLogger(__name__) def decode_header(message, header, separator=' '): return separator.join(map(decode,message.get_all(header, []))) -class many2many_reference(fields.many2many): - """ many2many_reference is an override of fields.many2many. It manages - many2many-like table where one id is given by two fields, res_model - and res_id. - """ - - def _get_query_and_where_params(self, cr, model, ids, values, where_params): - """ Add in where: - - mail_followers.res_model = 'crm.lead' - """ - query = 'SELECT %(rel)s.%(id2)s, %(rel)s.%(id1)s \ - FROM %(rel)s, %(from_c)s \ - WHERE %(rel)s.%(id1)s IN %%s \ - AND %(rel)s.%(id2)s = %(tbl)s.id \ - AND %(rel)s.res_model = %%s \ - %(where_c)s \ - %(order_by)s \ - %(limit)s \ - OFFSET %(offset)d' \ - % values - where_params = [model._name] + where_params - return query, where_params - - def set(self, cr, model, id, name, values, user=None, context=None): - """ Override to add the res_model field in queries. """ - if not values: return - rel, id1, id2 = self._sql_names(model) - obj = model.pool.get(self._obj) - for act in values: - if not (isinstance(act, list) or isinstance(act, tuple)) or not act: - continue - if act[0] == 0: - idnew = obj.create(cr, user, act[2], context=context) - cr.execute('INSERT INTO '+rel+' ('+id1+','+id2+',res_model) VALUES (%s,%s,%s)', (id, idnew, model._name)) - elif act[0] == 3: - cr.execute('DELETE FROM '+rel+' WHERE '+id1+'=%s AND '+id2+'=%s AND res_model=%s', (id, act[1], model._name)) - elif act[0] == 4: - # following queries are in the same transaction - so should be relatively safe - cr.execute('SELECT 1 FROM '+rel+' WHERE '+id1+'=%s AND '+id2+'=%s AND res_model=%s', (id, act[1], model._name)) - if not cr.fetchone(): - cr.execute('INSERT INTO '+rel+' ('+id1+','+id2+',res_model) VALUES (%s,%s,%s)', (id, act[1], model._name)) - elif act[0] == 6: - d1, d2,tables = obj.pool.get('ir.rule').domain_get(cr, user, obj._name, context=context) - if d1: - d1 = ' and ' + ' and '.join(d1) - else: - d1 = '' - cr.execute('DELETE FROM '+rel+' WHERE '+id1+'=%s AND res_model=%s AND '+id2+' IN (SELECT '+rel+'.'+id2+' FROM '+rel+', '+','.join(tables)+' WHERE '+rel+'.'+id1+'=%s AND '+rel+'.'+id2+' = '+obj._table+'.id '+ d1 +')', [id, model._name, id]+d2) - for act_nbr in act[2]: - cr.execute('INSERT INTO '+rel+' ('+id1+','+id2+',res_model) VALUES (%s,%s,%s)', (id, act_nbr, model._name)) - else: - return super(many2many_reference, self).set(cr, model, id, name, values, user, context) - class mail_thread(osv.Model): '''Mixin model, meant to be inherited by any model that needs to act as a discussion topic on which messages can be attached. @@ -132,13 +79,11 @@ class mail_thread(osv.Model): result[res_id] = True return result - - def _get_message_data(self, cr, uid, ids, name, args, context=None): res = {} for id in ids: res[id] = { - 'message_state': False, + 'message_unread': False, 'message_Summary': '' } nobj = self.pool.get('mail.notification') @@ -149,7 +94,7 @@ class mail_thread(osv.Model): ('read','=',False) ], context=context) for notif in nobj.browse(cr, uid, nids, context=context): - res[notif.message_id.id]['message_state'] = True + res[notif.message_id.id]['message_unread'] = True for thread in self.browse(cr, uid, ids, context=context): message_ids = thread.message_ids @@ -171,7 +116,7 @@ class mail_thread(osv.Model): domain=lambda self: [('model','=',self._name)], string='Related Messages', help="All messages related to the current document."), - 'message_state': fields.function(_get_message_data, fnct_search=_search_state, 'Message Read', + 'message_unread': fields.function(_get_message_data, fnct_search=_search_state, 'Message Read', help="When checked, new messages require your attention.", multi="_get_message_data"), 'message_summary': fields.function(_get_message_data, method=True, @@ -225,7 +170,7 @@ class mail_thread(osv.Model): def _needaction_domain_get(self, cr, uid, context={}): if self._needaction: - return [('message_state','=',True)] + return [('message_unread','=',True)] return [] #------------------------------------------------------ @@ -969,7 +914,7 @@ class mail_thread(osv.Model): # Thread_state #------------------------------------------------------ - # FP Note: this should be a invert function on message_state field + # FP Note: this should be a invert function on message_unread field def message_mark_as_read(self, cr, uid, ids, context=None): """ Set as read. """ notobj = self.pool.get('mail.notification') diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 02cf1f19149..1a63a3dab14 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -574,8 +574,8 @@ mrp.production.tree mrp.production - - + + diff --git a/addons/project/project_view.xml b/addons/project/project_view.xml index 395a3c63219..3a1d21324f3 100644 --- a/addons/project/project_view.xml +++ b/addons/project/project_view.xml @@ -160,7 +160,7 @@ - + @@ -185,9 +185,9 @@ project.project child_ids - + - + @@ -506,7 +506,7 @@ - + @@ -571,8 +571,8 @@ project.task - - + + @@ -632,7 +632,7 @@ - + diff --git a/addons/project_issue/project_issue_view.xml b/addons/project_issue/project_issue_view.xml index 6dc5ed946f1..be732c8c9a6 100644 --- a/addons/project_issue/project_issue_view.xml +++ b/addons/project_issue/project_issue_view.xml @@ -170,8 +170,8 @@ Project Issue Tracker Tree project.issue - - + + @@ -196,7 +196,7 @@ - + @@ -310,9 +310,9 @@ Project Issue- Feature Tracker Tree project.issue - + - + diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 0cdc8d2d206..158ef53f559 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -298,7 +298,7 @@ - + @@ -323,8 +323,8 @@ purchase.order.tree purchase.order - - + + diff --git a/addons/purchase_requisition/purchase_requisition_view.xml b/addons/purchase_requisition/purchase_requisition_view.xml index 2e9f4104342..34fc8dcb540 100644 --- a/addons/purchase_requisition/purchase_requisition_view.xml +++ b/addons/purchase_requisition/purchase_requisition_view.xml @@ -112,8 +112,8 @@ purchase.requisition.tree purchase.requisition - - + + diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index 07abe9c4318..1e7e3fc1581 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -133,8 +133,8 @@ sale.order 2 - - + + @@ -363,7 +363,7 @@ - +