Hello,
i'm using odoo10 community
i'm customizing the partner form for adding custom fields, to do that i did go to "developer mode" and than modify the "res.partner" module by adding custom fields, i created Float,chat, text, int without problems.
than to show the new customized fields i did go in "user interface" -> "views" and modified the "res.partner.form" by adding the field in the place i wanted.
during fields creation i discovered that is possible to compute fields, but i'm not getting exactly how to do it, in the Field creation form there's an "advanced properties" and an area where to add the "computing code", so i did some search but i did not find enough infos...that's why i'm posting here...
i'd like to make a computed field to calculate the total sum of 4 other fields, will this value be possible to be shown immediatly after 4 fields filling? will this "sum" be stored in database or it will stay on the fly? when i will check the partner view there's still be that computed field with the SUM value?
i'm using this code, added directly inside the "compute" area in the field creation form, all fields, sum and other 4 are float.
@api.one
@api.depends('res.partner')
def _compute_totale(self):
x_expenseTotal = 0x_expenseTotal = x_expenseOFF1 + x_expenseOFF2 + x_expenseON1 + x_expenseON2
self.totale = x_expenseTotal