Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
2502 Lượt xem

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?

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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



Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
1
thg 6 22
1623
1
thg 4 24
1351
1
thg 10 23
1476
1
thg 5 23
1997
0
thg 9 22
1992