本文整理匯總了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('??????')