Browse Source
[FIX] sent.js correction set_channel_flags() and get_domain() methods for correct sent messages filtration
[FIX] sent.js correction set_channel_flags() and get_domain() methods for correct sent messages filtration
[FIX] base.js correction "cls" to "chat_manager.mail_tools" [FIX] models.py correction _get_sent() method and remove outdated notification method [REF] menu.xml move "sent" menu item to after "inbox" menu item and change iconpull/6/head
x620
9 years ago
7 changed files with 28 additions and 68 deletions
-
12mail_base/static/src/js/base.js
-
2mail_sent/__init__.py
-
26mail_sent/models.py
-
1mail_sent/models/__init__.py
-
13mail_sent/static/src/js/sent.js
-
4mail_sent/static/src/xml/menu.xml
-
38mail_sent/views.xml
@ -1,3 +1,3 @@ |
|||||
# -*- coding: utf-8 -*- |
# -*- coding: utf-8 -*- |
||||
|
|
||||
from . import models |
|
||||
|
import models |
@ -1,28 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
from openerp import api, models, fields |
from openerp import api, models, fields |
||||
|
|
||||
|
|
||||
class mail_message(models.Model): |
|
||||
|
class MailMessage(models.Model): |
||||
_inherit = 'mail.message' |
_inherit = 'mail.message' |
||||
|
|
||||
|
sent = fields.Boolean('Sent', compute="_get_sent", help='Was message sent to someone', store=True) |
||||
|
|
||||
@api.one |
@api.one |
||||
@api.depends('author_id', 'notified_partner_ids') |
|
||||
|
@api.depends('author_id', 'partner_ids') |
||||
def _get_sent(self): |
def _get_sent(self): |
||||
self_sudo = self.sudo() |
self_sudo = self.sudo() |
||||
self_sudo.sent = len(self_sudo.notified_partner_ids) > 1 or len(self_sudo.notified_partner_ids) == 1 and self_sudo.author_id and self_sudo.notified_partner_ids[0].id != self_sudo.author_id.id |
|
||||
|
|
||||
sent = fields.Boolean('Sent', compute=_get_sent, help='Was message sent to someone', store=True) |
|
||||
|
|
||||
|
|
||||
class mail_notification(models.Model): |
|
||||
_inherit = 'mail.notification' |
|
||||
|
self_sudo.sent = len(self_sudo.partner_ids) > 1 \ |
||||
|
or len(self_sudo.partner_ids) == 1 \ |
||||
|
and self_sudo.author_id \ |
||||
|
and self_sudo.partner_ids[0].id != self_sudo.author_id.id |
||||
|
|
||||
def _notify(self, cr, uid, message_id, **kwargs): |
|
||||
super(mail_notification, self)._notify(cr, uid, message_id, **kwargs) |
|
||||
self.pool['mail.message'].browse(cr, uid, message_id)._get_sent() |
|
||||
|
|
||||
|
|
||||
class mail_compose_message(models.TransientModel): |
|
||||
|
|
||||
|
class MailComposeMessage(models.TransientModel): |
||||
_inherit = 'mail.compose.message' |
_inherit = 'mail.compose.message' |
||||
sent = fields.Boolean('Sent', help='dummy field to fix inherit error') |
sent = fields.Boolean('Sent', help='dummy field to fix inherit error') |
||||
|
|
@ -1 +0,0 @@ |
|||||
# -*- coding: utf-8 -*- |
|
@ -1,38 +0,0 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||
<openerp> |
|
||||
<data> |
|
||||
<record id="action_mail_sent_feeds" model="ir.actions.client"> |
|
||||
<field name="name">Sent</field> |
|
||||
<field name="tag">mail.wall</field> |
|
||||
<field name="context">{ |
|
||||
'default_model': 'res.users', |
|
||||
'default_res_id': uid, |
|
||||
'thread_model': 'res.partner', |
|
||||
'needaction_menu_ref': ['mail.mail_tomefeeds', 'mail.mail_starfeeds', 'mail.mail_inboxfeeds'] |
|
||||
}</field> |
|
||||
<field name="params" eval=""{ |
|
||||
'domain': [ |
|
||||
('author_id.user_ids', 'in', [uid]), |
|
||||
('sent', '=', True), |
|
||||
], |
|
||||
'view_mailbox': True, |
|
||||
'show_compose_message': False |
|
||||
}""/> |
|
||||
<field name="help" type="html"> |
|
||||
<p> |
|
||||
No message found and no message sent yet. |
|
||||
</p><p> |
|
||||
Click on the top-right icon to compose a message. This |
|
||||
message will be sent by email if it's an internal contact. |
|
||||
</p> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
|
||||
<record id="mail_sentfeeds" model="ir.ui.menu"> |
|
||||
<field name="name">Sent</field> |
|
||||
<field name="sequence" eval="10"/> |
|
||||
<field name="action" ref="action_mail_sent_feeds"/> |
|
||||
<field name="parent_id" ref="mail.mail_feeds"/> |
|
||||
</record> |
|
||||
</data> |
|
||||
</openerp> |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue