Odoo Help

Welcome!

This community 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.

0

odoo9: How to return data from popup to main?

By
Drees Far
on 4/19/16, 4:41 AM 267 views

Hello everybody!!!

Can anyone help me to know how can i catch the values that i have created in a popup to the main page.

Thanks a lot in advance.

Best Regards.

0
Motez
On 4/19/16, 4:49 AM

Here is how i did it :

  1. have a one2many or many2one relation between the main model and the model you have in your wizard (popup)

  2. use the value of active_id in context when creating the wizard model to make the relationship between the 2 records:
    Let's say you have a field main_id in your wizard model. You need to do something like this :

    main_id = fields.Many2one('main.model', default=context.get('active_id'))


  3. enjoy !


hey friend i didnt understand the second step :/ Would you please give me an example.

Drees Far
on 4/19/16, 5:00 AM

I Edited my answer. Hope it's clear now.

Motez
on 4/19/16, 5:28 AM

sorry but is the main_id a field in the popup or the main page??

Drees Far
on 4/19/16, 5:39 AM

it is in the popup to link it with the main

Motez
on 4/19/16, 6:12 AM

sorry but the popup is the hr.contract model and in the main is the hr.employee model and in the contract model there is a many2one field of the second model ::/

Drees Far
on 4/19/16, 6:39 AM

it should not be an issue you can set the value in the create method of the contract

Motez
on 4/19/16, 6:47 AM

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 community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 4/19/16, 4:41 AM
Seen: 267 times
Last updated: 4/19/16, 4:49 AM