odoo自定义弹框提示错误

经常使用自带的提示错误,显示的都是Odoo Server Error,有些需求就是要自己定义提示框前面的文字。所以请往下看。

实现代码:

1.字段 py文件

 unit_price = fields.Float(string='单价')

2.视图 xml文件

 <field name="unit_price"/>

 

3.方法

  @api.onchange('unit_price')
    def compute_price(self):
        if self.unit_price < 0:
            return {
                'warning': {
                    'title': "检查到错误",
                    'message': "单价不能小于0",
                },
            }

效果图:

odoo自定义弹框提示错误

相关文章:

  • 2021-08-07
  • 2021-12-06
  • 2021-09-09
  • 2021-10-31
  • 2022-12-23
  • 2021-10-23
  • 2021-04-12
  • 2022-01-04
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
  • 2022-01-19
  • 2022-02-16
相关资源
相似解决方案