After override the field as compute it's not working
<p>I did some changes in product.template and override the field like this</p>

<pre><code>list_price = fields.Float(copy=False, string='Sale Price',  store=True,compute='_calculate_sale_price',
                              help='compute cost as per gun_dealer', default=0.00)
</code></pre>

<p>and the compute methods is like </p>

<pre><code>@api.multi
    @api.depends('profit_per_unit', 'estimated_shipping_charges'
                 , 'flat_rate_charges', 'list_price')
    def _calculate_sale_price(self):

        if self.category_parent_id == 33:
                self.list_price = self.standard_price+self.profit_per_unit+ \
                                  self.estimated_shipping_charges

        else:
            self.list_price = self.standard_price+self.profit_per_unit-self.collected_shipping_charges + \
                                  self.flat_rate_charges
</code></pre>

<p>But after doing this the Unit Price from sale order's order line is not grabbing value of Sales Price from product.template</p>

<p>THIS IS NOT A SOLUTION. But I cant really put this suggestion in a comment.</p>

<p>I am not sure if you should use list_price in your depends decorator arguments. Try placing some logging in and see what is happening when you load the page.</p>

<pre><code>import logging
_logger = logging.getLogger(__name__)

@api.multi
@api.depends('profit_per_unit', 'estimated_shipping_charges', 'flat_rate_charges')
def _calculate_sale_price(self):
    _logger.info("EXECUTING _calculate_sale_price() function")
    if self.category_parent_id == 33:
        _logger.info("CATEGORY PARENT ID IS 33!")
        _logger.info("list_price = {} + {} + {}".format(self.standard_price, self.profit_per_unit, self.estimated_shipping_charges))
        self.list_price = self.standard_price+self.profit_per_unit + self.estimated_shipping_charges
    else:
        _logger.info("CATEGORY PARENT ID IS NOT 33! REPEAT NOT")
        _logger.info("list_price = {} + {} + {} - {} + {}".format(self.standard_price, self.profit_per_unit, self.collected_shipping_charges, self.flat_rate_charges))
        self.list_price = self.standard_price + self.profit_per_unit -self.collected_shipping_charges + self.flat_rate_charges
</code></pre>

python odoo-9