[ADD] Added ir_needaction, holding override a get_needaction_user_ids when having mail.thread.

bzr revid: tde@openerp.com-20120608143556-dhwbasi16tn8fapm
This commit is contained in:
Thibault Delavallée 2012-06-08 16:35:56 +02:00
parent dc890702a5
commit b0eb2913eb
2 changed files with 55 additions and 4 deletions

View File

@ -1,6 +1,9 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--
<data noupdate="1">
-->
<!-- Demo Leads -->
<record id="crm_case_itisatelesalescampaign0" model="crm.lead">
<field name="type_id" ref="crm.type_lead1"/>
@ -21,7 +24,6 @@
<field eval="'Plan to Attend a Training'" name="name"/>
<field eval="'0033 769 703-274'" name="phone"/>
</record>
<record id="crm_case_electonicgoodsdealer0" model="crm.lead">
<field name="type_id" ref="crm.type_lead7"/>
<field eval="'4'" name="priority"/>
@ -76,7 +78,6 @@
<field eval="'(514) 698-4118'" name="phone"/>
<field eval="'hmc@thgascompany.com'" name="email_from"/>
</record>
<record id="crm_case_itdeveloper0" model="crm.lead">
<field name="type_id" ref="crm.type_lead4"/>
<field eval="'3'" name="priority"/>
@ -96,7 +97,6 @@
<field eval="'(855) 924-4364'" name="phone"/>
<field eval="'helle@stonageit.be'" name="email_from"/>
</record>
<record id="crm_case_mgroperations0" model="crm.lead">
<field eval="1" name="active"/>
<field name="type_id" ref="crm.type_lead3"/>
@ -209,7 +209,15 @@
<!-- Call Function to Cancel the leads (set as Dead) -->
<function model="crm.lead" name="case_cancel"
eval="[ref('crm_case_company_partnership0'), ref('crm_case_vpoperations0'), ref('crm_case_developingwebapplications0'), ref('crm_case_webvisitor0')], {'install_mode': True}"
eval="[ ref('crm_case_company_partnership0'), ref('crm_case_vpoperations0'),
ref('crm_case_developingwebapplications0'), ref('crm_case_webvisitor0')],
{'install_mode': True}"
/>
<!-- Call Function to set the leads as Unread -->
<function model="crm.lead" name="message_mark_as_unread"
eval="[ ref('crm_case_imported_contact0'), ref('crm_case_employee0'),
ref('crm_case_business_card0'), ref('crm_case_webvisitor0')],
{'install_mode': True}"
/>
<!-- Demo Opportunities -->

View File

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# 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 osv
class ir_needaction_mixin(osv.Model):
""" Update of res.users class
- add a preference about sending emails about notificatoins
- make a new user follow itself
"""
_name = 'ir.needaction_mixin'
_inherit = ['ir.needaction_mixin']
def get_needaction_user_ids(self, cr, uid, ids, context=None):
""" Returns the user_ids that have to perform an action
:return: dict { record_id: [user_ids], }
"""
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_thread_read == False and obj.user_id:
result[obj.id].add(obj.user_id.id)
return result
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: