2014-06-05 1 views
2

OpenERP를 사용자 정의하고 있습니다. 사용자가 만든 제품을 "구매 관리자"에게 통보 메시지를 표시해야합니다. "만든 제품"이라고 말하여>메시지 ->이메일 - Openerp - 제품 생성시 메시지로 사용자에게 알립니다.

나는 메시지가 설정에서 만들어 보았다. 그러나 주 메뉴 아래 관리자에게 표시되지 않습니다 메시징 -> 수신함.

나는이 메시지를 관리자에게 통보하기를 원합니다. 그러나 Google에서는 좋은 문서를 찾을 수 없습니다.

기본 논리가 누락되면 수정하십시오.

답변

2

시도는 제품 모듈을 상속 이런 식으로 만들 방법 오버라이드 (override) :

def create(self, cr, uid, datas, context=None): 
    new_id = super(class_name, self).create(cr, uid, datas, context=context) 
    self.log_prod(cr, uid, new_id, context) 
    return new_id 

def log_prod(self, cr, uid, ids, context=None): 
    product = self.pool.get('product.product').browse(cr, uid, ids) 
    msg = "Product %s has been created" % product.name 
    msg_id = self.message_post(cr, uid, ids, body=msg, context=context) 
    notif_obj = self.pool.get('mail.notification') 
    all_groups = self.pool.get('res.groups') 
    h1m_group = all_groups.browse(
      cr, 
      uid, 
      all_groups.search(
        cr, 
        uid, 
        [('name','=','Access Rights')], 
      )) 
    for ids in h1m_group[0].users: 
     notif_obj.create(
       cr, 
       uid, 
       { 
        'partner_id': ids.partner_id.id, 
        'read': False, 
        'message_id': msg_id, 
       }, 
       context=context) 
    return True 
관련 문제