Odoo Help

0

how to pass variables from one view to another?

By
Mymate
on 4/3/14, 3:51 PM 1,612 views

lets say we have a module A which has a one2many field to module B and a company field. after choosing company in the form view from module A we click on "Add an Item" to add an item to the one2many field, which opens the view form from module B.

how can I e.g. automatically set the company in module B to the same which was selected in view from module A?

thank you.

1
Ray Carnes
On 4/3/14, 4:13 PM

context

You probably want something like context="{'company_id':company_id}" and this would go on the field that represents the one2many relationship

See also https://accounts.openerp.com/forum/Help-1/question/8598

_defaults = { 'a_field' : lambda self, cr, uid, context : context['a_field'] if context and 'a_field' in context else None }

Mymate
on 4/3/14, 5:07 PM
0
Mymate
On 4/3/14, 5:12 PM

thanks, another thing we need is the following:

_defaults = { 'a_field' : lambda self, cr, uid, context : context['a_field'] if context and 'a_field' in context else None }

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.

Register

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

0 follower(s)

Stats

Asked: 4/3/14, 3:51 PM
Seen: 1612 times
Last updated: 3/16/15, 8:10 AM