Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
4394 Переглядів

 
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

Аватар
Відмінити
Related Posts Відповіді Переглядів Дія
1
черв. 22
4644
5
лип. 25
2721
6
лист. 24
7617
4
лют. 24
5118
0
трав. 25
2301