Odoo Help


How to propagate a field value from parent to child object ?

on 8/8/14, 11:57 AM 1,789 views

I have a Patient view, in which I can create an evaluation for that patient, when i create a new item (evaluation) I want the Patient field to be filled automatically using context.

I don't find how to use context in order to fill that field when filling up the evaluation from the Patient view and not externally.

Here is a part of the code of the evaluation class :

class OeMedicalPatientEvaluation(osv.Model):
        'patient_id':fields.many2one('oemedical.patient', 'Patient'),
        # many other attributes
        'patient_id' : lambda self, cr, uid, context : context['patient_id'] if context and 'patient_id' in context else None

And this is a part of the evaluation view :

<form string="Evaluations">
    <field name="patient_id" />
    <!-- many other fields -->

What to add and how to do in order to fill automatically the patient_id field in the child (pop up) evaluation.

Thanks in advance.




| 5 4 6
Zagreb | Karlovac, Croatia

there is only 10 kind of people the ones that understand binary ... and others

On 8/18/14, 8:47 AM

if you open a popup directy from main form... the value will be automaticly added on saving the record. just ignore entering it manualy, 
test it in dev environment and make the field invisible later... 

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: 8/8/14, 11:57 AM
Seen: 1789 times
Last updated: 3/16/15, 8:10 AM