Hi, I can help you with this problem that I have. Can multiple values be calculated using the same python function? To simplify, suppose we have two numbers, can the product and division be calculated within the same function? I try to do this, compile well inside Odoo but when giving values in the view I get the error that multiplication is not defined
num_uno=fields.Integer("Value 1")
num_dos=fields.Integer('Value 2')
campocalculado = fields.Float(string='Calculated field', compute='multiplicar')
campocalculado2 = fields.Float(string='Calculated field', compute='dividir')
@api.onchange('num_uno', 'num_dos')
def _computeVar(self):
for record in self:
record.multiplicar = record.num_uno * record.num_dos
record.dividir = record.num_dos / record.num_uno
I know that in the field of the calculated field it must have the name of the function and not that of the record. But since they are multiple values, I don't know what to do to read the values
Any thoughts are welcomed.
Thanks