Odoo Help


numeric value on an inherit field. computed fields.

on 6/23/16, 5:39 PM 221 views

from openerp import models, fields, api, exceptions

import re

class ColombianTaxes(models.Model):

    """ Model to create and manipulate personal taxes"""

     _description= "Model to create own taxes"

    _name = 'account.invoice'

    _inherit = 'account.invoice'

# This is a colombian tax named Retenciòn en la fuente

     resul= fields.Integer(string='resultado', default = 10 ,store=True, compute="_resul_pc")



    def _resul_pc(self):

        self.resul = 100

the field on the view just dont take the value is still 0, i tried with and without @api.onchange @api.one, @api.depends('resul') without any @api it just dont change, and i dont have any error by odoo.

on 6/23/16, 5:44 PM

i tried



def _onchange_field(self):

if self.resul:

resultado ="10"

self.resul= resultado

on 6/23/16, 5:45 PM
Krupesh Laiya
On 6/24/16, 1:51 AM


Put your function before the field defination.

and use below code:


def _onchange_field(self):
     self.resul = 100 # or here you can do your calculation.

then update the module and refresh the view of the form on save you will get the 100 in resul field.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

1 follower(s)


Asked: 6/23/16, 5:39 PM
Seen: 221 times
Last updated: 6/24/16, 1:51 AM