Odoo Help


function field

on 3/10/13, 5:40 PM 1,919 views

I have two objects linked by one2many, the first object contains a function field, and the second object contains a function field too, now when i modify the first function field, the modification is not done on the second function in the second object,

How can I trigger the modification of the second field when I change the first field ?

    'partie1': fields.function(_get_partie1, method=True, type='char', string=u'Partie 1', store=True),

Hi,the function field in one2many depend of the result of parent class ? Bye

Cyril Gaspard (GEM)
on 3/10/13, 6:22 PM

Cyril Gaspard (GEM)

--Cyril Gaspard (GEM)--

| 5 6 8
Paris, France
--Cyril Gaspard (GEM)--

Forum contributor since 2008

Cyril Gaspard (GEM)
On 3/10/13, 7:34 PM


no need to add an answer, just update your question.

If I well understood, you want to display in yours lines one2many the value of field partie1 of parent class. Where is the field one2many in your class doo_notariat ? Where is the field type many2one in class notariat_repertoire (repertoire = directory in english) which do relation with class parent doo_notariat Else, For that you just have to use a fields.related, not a fields.function, by using partie1_in_2_id:

fields.related('field many2one of relation to parent class which is also present as attribute in field on2many in parent class', 'partie1', relation='doo.notariat', type='char', size='size_you_need', store=True, string="Partie 1"),

but modification will be done I think when you will save you record.


On 3/10/13, 6:29 PM


this is my code :

the first object :

classer doo_notariat {

    'partie1': fields.function(_get_partie1, method=True, type='char', string=u'Partie 1', store=True),


the second object :

class notariat_repertoire(osv.osv):

def _get_funcion(self, cr, uid, ids, name, args, context):
    if not ids: return {}
    res = {}
    for line in self.browse(cr, uid, ids, context=context):
        res[line.id] = line.dossier_id.partie1
    return res 

_columns = {

    'partie1': fields.function(_get_function, method=True, type='char', string=u'Partie 1', store=True),


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: 3/10/13, 5:40 PM
Seen: 1919 times
Last updated: 3/16/15, 8:10 AM