本文整理汇总了Python中openerp.models.TransientModel方法的典型用法代码示例。如果您正苦于以下问题:Python models.TransientModel方法的具体用法?Python models.TransientModel怎么用?Python models.TransientModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openerp.models
的用法示例。
在下文中一共展示了models.TransientModel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _notify
# 需要导入模块: from openerp import models [as 别名]
# 或者: from openerp.models import TransientModel [as 别名]
def _notify(self, cr, uid, message_id, partners_to_notify=None, context=None,
force_send=False, user_signature=True):
super(mail_notification, self)._notify(cr, uid, message_id, partners_to_notify=partners_to_notify, context=context, force_send=force_send, user_signature=user_signature)
Message = self.pool.get('mail.message')
message = Message.browse(cr, uid, message_id, context=context)
if message.wxcorp_notify:
from openerp import SUPERUSER_ID
user = self.pool.get('res.users').browse(cr, SUPERUSER_ID, uid, context=context)
partners_to_notify.append(user.partner_id.id)
Partner = self.pool.get('res.partner')
for partner in Partner.browse(cr, SUPERUSER_ID, partners_to_notify, context=context):
if partner.wxcorp_user_id:
from ..rpc import corp_client
_body = message.body.replace('<p>','').replace('</p>','')
_content = u'%s\n%s'%(message.subject, _body) if message.subject else _body
_head = u'%s ??? %s'%(message.author_id.name, message.record_name)
try:
corp_client.client.message.send_text(0, partner.wxcorp_user_id.userid, u'%s?%s'%(_head,_content) )
except:
pass
_logger.info('>>>wxcorp_notify: %s'%str((message,partner)))
# class mail_compose_message(models.TransientModel):
# _inherit = 'mail.compose.message'
#
# wxcorp_notify = fields.Boolean('??????')