跳至内容
菜单
此问题已终结
1 回复
2538 查看

In sales application, when creating a new quotation I am entering a specific pricelist and when I add a product the unit price is automatically updated to match the pricelist. I want to add a new feature where I check if the unit price is less than the price list (unit price changed manually) then I will request admin approval. How can I access the unit price in the one2many field here. Any help please?

形象
丢弃
最佳答案

You can inherit the sales order lines model in the sales module and make a method with any of Odoo api decorations for example. @api.constrains or @api.onchange to notify the user with a ValidationError if he is not allowed to change the price


Example:

class SalesOrderLines(models.model):
    _inherit = 'sale.order.line'

    @api.constrains('unit_price')
    def _const_price(self):
        #your condition and raise ValidationError



Happy to help :) an upvote will be awesome



形象
丢弃
相关帖文 回复 查看 活动
1
6月 22
1643
1
4月 24
1370
1
10月 23
1514
1
5月 23
2003
0
9月 22
2006