Q:

Adding field which is not in model

I have just started using Odoo and i am creating my own module, so i added a new field to Products for example: 
class ProductTemplate(models. Model):
    _inherit = 'product.template'

    netto_price = fields. Float()

now i will have few extra field which change based on netto_price and netto_price will change based on them.  Basicaly all of them are calculated from netto_price.  Now i tryed to add another field:
<field name="calculated_price"/>

But as its not in model it crash.  So any ideas how i woul be able to add it?  I tryed with input field (html) but when i am not add edit mode there is still input field which is not what i want. 

A:

from openerp import api

class ProductTemplate(models. Model):
    _inherit = 'product.template'

    netto_price = fields. Float()
    calculated_price = fields. Float('Calculated price') # or whatever type you want it to be

    @api.onchange('netto_price')
    def netto_change(self):

        return {value: {'calculated_price': self.netto_price}}

Basically what you need to do is add the new field calculated, and then decorate any function you want to be triggered when a particular field is changed with api.onchange passing in the field that you want to trigger the function as the first argument, and in this function i just set the value of calculated_price to that of netto

