Odoo Help


OpenERP: getting values from first part of many2one field in second many2one field

Saghir A. Khatri
on 11/21/14, 7:27 AM 4,765 views

I am stuck in a situation and unable to resolve. Here is the scenario.

I have one `many2one` field named `Parent`, it has `title' that is `many2one` from other module. `Parent` also has another `one2many` field named `subproject`

`Subproject` has title `Question`, which should be filtered from `Parent`'s `title`. Question is also `many2one` field. I have defined it in another module.

I am unable to load subprojects(Question) filtered according to select from Parent(title)

My Parent python loos like:

    class parent_page(osv.osv):
        _name = 'parent.page'
        _description = 'Parent Pages'
        _rec_name = 'title'
        _order = 'sequence'
        _columns = {
            'title': fields.many2one('Project.form', 'Project'),
            'parent_id': fields.many2one('parent', 'Parent', ondelete='cascade'),
            'question_ids': fields.one2many('parent.question', 'page_id', 'Question'),
            'sequence': fields.integer('Page Nr'),
            'note': fields.text('Description'),

My subProject python file looks like this:

    class parent_question(osv.osv):
        _name = 'parent.question'
        _description = 'Parent Question'
        _rec_name = 'question'
        _order = 'sequence'
        _columns = {
            'page_id': fields.many2one('parent.page', 'Parent Page', ondelete='cascade', required=1),
            'question': fields.many2one('subproject.form', 'Question'), ########  I want it to be filtered from parent title i.e project

My project and subproject python is as follows:

    class project_form(osv.osv):
            'emp_id': fields.many2one('hr.employee','Employee Name')
    class subproject_form(osv.osv):

I tried to use domain in xml but got nothing. same with value.

Please point me to right direction.

Note: Sorry for naming of modules as someone else was working on this and i had to continue it.


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