Hello,
i have two fields
one = fields.Float()
two = fields.Float()
i want
toto = one + two
how can i do that??
ODOO 11
Odoo is the world's easiest all-in-one management software.
 It includes hundreds of business apps:
Hello,
i have two fields
one = fields.Float()
two = fields.Float()
i want
toto = one + two
how can i do that??
ODOO 11
try this one.
one = fields.Float()
two = fields.Float()
total = fields.Float(compute='_get_sum')
@api.depends('one', 'two')
def _get_sum(self):
for rec in self:
rec.update({
'total': rec.one+rec.two,
})
sjmple and to the point:) My father nabaged to add field using your advice (he is non IT 60+). Thanks
Tested in Odoo v11
one = fields.Float()
two = fields.Float()
total = fields.Float(compute='_get_sum')
@api.depends('one', 'two')
def _get_sum(self):
for rec in self:
rec.total = rec.one+rec.two
hello ,
you can add new field as compute field, and that new field make the total of field1 and field2.
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj się| Powiązane posty | Odpowiedzi | Widoki | Czynność | |
|---|---|---|---|---|
|  | 1 wrz 19  | 6993 | ||
|  | 0 kwi 23  | 3451 | ||
|  | 0 maj 15  | 4998 | ||
|  | 2 mar 15  | 4306 | ||
|  | 2 wrz 24  | 3296 | 
Exactly as you did. You can now apply the sum (one + two) to a variable which is shown in the frontend.