Skip to Content
Menu
This question has been flagged

 
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()

Avatar
Discard
Best Answer

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

Avatar
Discard
Related Posts Replies Views Activity
1
Jun 22
4454
3
Feb 25
1968
6
Nov 24
7334
4
Feb 24
4191
0
May 25
2042