Skip to Content
Menu
This question has been flagged
3 Replies
8915 Views

<field name="num1"/>
<field name="num2"/>

<!-- result-->

<field name="result" sum="(num1 + num2)"/>

It is not working, is there any way to solved this simple problem?

Avatar
Discard
Best Answer

Hi,

You can use onchange  your python file

eg:

num1 = fields.Float"Num1")
​num2= fields.Float("Num2")
result = fields.Float(" Result")

api.onchange('num1','num2')
def onchange_function(self):
self.result = self.num1+self.num2
in your xml,
<field name="result"/>

Thanks !!!  

Aswini @ iWesabe


Avatar
Discard
Best Answer

You can not sum diffrent fields values in xml file. You can create a new field in same module as computed to sum values and store it. Then you can show that field in xml view.

You can also use on_change decorater for doing sum calculation and assign value in new field.

Avatar
Discard
Best Answer

Hello Jonart,


Check this answer : https://stackoverflow.com/questions/29853506/addsum-two-values-in-odoo


Thanks

Avatar
Discard