[IMP] mail cleaning

bzr revid: fp@tinyerp.com-20120817111936-2d33nlqlbvkjb374
This commit is contained in:
Fabien Pinckaers 2012-08-17 13:19:36 +02:00
parent 66ece041f0
commit 6ac583c0f7
24 changed files with 47 additions and 33 deletions

View File

@ -23,7 +23,7 @@
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>With OpenERP's accounting, you can get an instant access to all your financial data, setup your analytic accounting, forecast your taxes, control your budgets, easily create and send invoices, record bank statements, etc.

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>OpenERP's electronic invoicing allows to ease and fasten the creation of invoices and collection of customer payments. Invoices are created in a few clicks and your customers receive them by email. They can pay online and/or import them in their own system.

View File

@ -55,7 +55,7 @@
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>From the top menu Sales, you can: trace leads and opportunities, get accurate forecast on your sales pipeline, plan meetings and phonecalls, get realtime statistics and efficiently organize the communication with your prospects.

View File

@ -14,7 +14,7 @@
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>From the top menu Events, you can organize events, manage registrations, automate communication around your event and sell events through your quotations.</value>

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage your human resources in OpenERP: employees and hierarchy, HR departments and jobs.

View File

@ -14,7 +14,7 @@
<field name="sequence">100</field>
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Create evaluations for your subordinates or manager. You can define a plan with several surveys, where you organize evaluation surveys related to the hierarchy levels. Evaluations filled by employees can exported as pdf files.</value>

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage your employee's expenses, with validations by employee manager and accountant, creation and payment of invoices.

View File

@ -13,7 +13,7 @@
<field name="sequence">100</field>
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage employee leaves from the top menu "Human Resources". Employees can create leave requests that are validated by their manager and/or HR people. Once validated, they are visible in the employee's calendar. HR people can define leave types and allocate off-days for employees.</value>

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage job positions and the recruitment process in your company. This module is integrated with the module Survey to help you to define interviews for different jobs.

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>From the top menu "Human Resources", encode and validate timesheets and attendances.</value>

View File

@ -20,9 +20,9 @@
##############################################################################
import mail_alias
import mail_followers
import mail_message
import mail_mail
import mail_followers
import mail_thread
import mail_group
import res_partner

View File

@ -13,7 +13,7 @@
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Your homepage is a summary of messages you received and key information about documents you follow.

View File

@ -45,9 +45,8 @@ class mail_followers(osv.Model):
ondelete='cascade', required=True, select=1),
}
class mail_notification(osv.Model):
""" mail_notification is a relational table modeling messages pushed to partners.
"""
_name = 'mail.notification'
_rec_name = 'partner_id'
_log_access = False
@ -55,14 +54,14 @@ class mail_notification(osv.Model):
_columns = {
'partner_id': fields.many2one('res.partner', string='Contact',
ondelete='cascade', required=True, select=1),
'message_id': fields.many2one('mail.message', string='Message',
ondelete='cascade', required=True, select=1),
'read': fields.boolean('Read'),
# this will be added in mail_message.py
#'message_id': fields.many2one('mail.message', string='Message',
# ondelete='cascade', required=True, select=1),
}
_defaults = {
'read': False,
}
# FP Note: todo: check that we can not create a notification for
# a message we can not read.
# def create(self, ...)

View File

@ -45,7 +45,6 @@ def decode(text):
if text:
text = decode_header(text.replace('\r', ''))
return ''.join([tools.ustr(x[0], x[1]) for x in text])
class mail_message(osv.Model):
"""Model holding messages: system notification (replacing res.log
notifications), comments (for OpenChatter feature). This model also
@ -112,9 +111,13 @@ class mail_message(osv.Model):
'message_id': fields.char('Message-Id', size=256, help='Message unique identifier', select=1, readonly=1),
'body': fields.html('Content', required=True),
}
def _get_default_author(self, cr, uid, context={}):
return self.pool.get('res.users').browse(cr, uid, uid, context=context).partner_id.id
_defaults = {
'type': 'email',
'date': lambda *a: fields.datetime.now(),
'author_id': _get_default_author
}
#------------------------------------------------------
@ -174,7 +177,9 @@ class mail_message(osv.Model):
notification_obj = self.pool.get('mail.notification')
modobj = self.pool.get(values.get('model'))
follower_notify = []
for follower in modobj.message_follower_ids:
print values.get('res_id'), '**'
print modobj.browse(cr, uid, values.get('res_id'), context=context)
for follower in modobj.browse(cr, uid, values.get('res_id'), context=context).message_follower_ids:
if follower.id <> uid:
follower_notify.append(follower.id)
self.pool.get('mail.notification').notify(cr, uid, follower_notify, newid, context=context)
@ -202,3 +207,13 @@ class mail_message(osv.Model):
return super(mail_message, self).unlink(cr, uid, ids, context)
class mail_notification(osv.Model):
""" mail_notification is a relational table modeling messages pushed to partners.
"""
_inherit = 'mail.notification'
_columns = {
'message_id': fields.many2one('mail.message', string='Message',
ondelete='cascade', required=True, select=1),
}

View File

@ -109,7 +109,7 @@ class mail_thread(osv.Model):
_columns = {
'message_is_follower': fields.function(_get_is_follower,
type='boolean', string='Is a Follower'),
'message_follower_ids': fields.one2many('mail.subscription', 'res_id',
'message_follower_ids': fields.many2many('res.partner', 'mail_subscription', 'res_id', 'partner_id',
domain=lambda self: [('res_model','=',self._name)],
string='Followers'),
'message_ids': fields.one2many('mail.message', 'res_id',
@ -749,7 +749,7 @@ class mail_thread(osv.Model):
module instead of by the res.log mechanism. Please \
use the mail.thread OpenChatter API instead of the \
now deprecated res.log.")
self.message_post(cr, uid, [id], message, context=context)
self.message_post(cr, uid, id, message, context=context)
def message_post(self, cr, uid, res_id, body, subject=False,
mtype='notification', attachments=None, context=None, **kwargs):
@ -757,7 +757,7 @@ class mail_thread(osv.Model):
context = context or {}
attachments = attachments or {}
if type(res_id) in (list, tuple):
res_is = res_id[0]
res_id = res_id[0]
to_attach = []
for fname, fcontent in attachments:
@ -773,12 +773,12 @@ class mail_thread(osv.Model):
value = kwargs
value.update( {
'res_model': self._name,
'model': self._name,
'res_id': res_id,
'body': body,
'subject': subject,
'type': mtype,
'attachment_ids': data_attach
'attachment_ids': to_attach
})
return self.pool.get('mail.message').create(cr, uid, value, context=context)

View File

@ -778,7 +778,7 @@ openerp.mail = function(session) {
var comment_node = this.$element.find('textarea');
var body_text = comment_node.val();
comment_node.val('');
return this.ds.call('message_append_note', [[this.params.res_id], '', body_text, this.params.parent_id, 'comment', 'plain']).then(
return this.ds.call('message_post', [[this.params.res_id], body_text], {parent_id: this.params.parent_id, mtype: 'comment'}).then(
this.proxy('init_comments'));
},

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage your manufacturing process in OpenERP by defining bill of materials (BoM), routings and work centers. This module supports complete integration and planification of stockable goods, consumable, and services.

View File

@ -24,7 +24,7 @@
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Encode sale orders, register payments, compute money to return, create invoices, and manage refunds of former sales through a specific, web-based, touch-screen user interface.

View File

@ -85,7 +85,7 @@
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage multi-level projects and tasks. You can delegate tasks, track the work done on tasks, and review your planning based on the entered data.

View File

@ -26,7 +26,7 @@
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Add todo items on project tasks, to help you organize your work. This module supports the methodology Getting Things Done (GTD), created by David Allen, and described in the book of the same name.</value>

View File

@ -32,7 +32,7 @@
</record>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage the issues you might face in a project, like bugs in a system, client complaints or material breakdowns. You can record issues, assign them to some responsible person, and keep track of their status as they evolve over time.

View File

@ -3,7 +3,7 @@
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>From the top menu Purchases, create purchase orders to buy products from your suppliers, encode supplier invoices and manage your payments.

View File

@ -41,7 +41,7 @@
<function eval="('default',False,'shop_id', [('sale.order', False)], sale_shop_1, True, False, False, False, True)" id="sale_default_set" model="ir.values" name="set"/>
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>This modules allows you to create and send easily quotations and process your sales orders; from the delivery to the invoicing.

View File

@ -2,7 +2,7 @@
<openerp>
<data noupdate="1">
<!-- notify all employees of module installation -->
<function model="mail.group" name="message_append_note">
<function model="mail.group" name="message_post">
<!-- ids, subject, body, parent_id=False, type='notification', content_subtype='html' -->
<value eval="[ref('mail.group_all_employees')]"/>
<value>Manage your product inventoy and stock locations. You can control your stock moves history and planning, perform stock valuation, and trace product lots upstream and downstream (based on serial numbers.)</value>