콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다

 
I want to display a warning message and then proceed with executing the function
this is override post_action method.



    def action_post(self):

        ​...        

​if total_debit > (line.product_id.product_credit_limit * 0.8):

            raise exceptions.ValidationError(_('Credit limit is over 80%'))

            # return {            

​#     'type': 'ir.actions.client',           

​#     'tag': 'display_notification',            

​#     'params': {            

​#     'message': message,            

​#     'type': 'danger',            

​#     'sticky': True,            

​#     }            

​# }        

​print(' I am Here')        

​return super(AccountMove, self).action_post()

아바타
취소
베스트 답변

Hi,

You can try this bus method before raising validation exception
 self.env['bus.bus']._sendone(self.env.user.partner_id, 'simple_notification', {
                'type': 'danger',
                'title': _("Warning"),
                'message': ('Your message')))
            })

Self.env.user.partner_id or self.env.user try around with both of these in the first arg of the _sendone method


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
1
6월 22
4650
5
7월 25
2730
6
11월 24
7624
4
2월 24
5133
0
5월 25
2306