コンテンツへスキップ
メニュー
この質問にフラグが付けられました
1 返信
4421 ビュー

 
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
4658
5
7月 25
2745
6
11月 24
7631
4
2月 24
5160
0
5月 25
2308