Skip to Content
Menu
This question has been flagged
1 Reply
4992 Views

Hi,

I want price_lop field that have a null value, get value from another field. also accept the value of zero.

    product_price = fields.Float('Price',related='product.lst_price',readonly=True)
    price_lop = fields.Float(string='Lop Price')

    @api.multi    
    def default_price(self):
        if not self.price_lop :
            self.price_lop = self.product_price
            return self.price_lop


But not accept the value of zero.
How to solve the problem?
please help me.



Avatar
Discard
Best Answer

In Odoo Integer/Float Data type default value always zero.

If float in that case check

if float_value == 0:     (equal to 0)

if float_value != 0:     (not equal to 0)

if float_value > 0:  (greater than)

if float_value < 0:  (less than)

 

Avatar
Discard