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

Can I use context to enforce associations?

By
mike
on 8/9/13, 1:40 PM 545 views

I have a Vendor model and it has one2many field for the Application model. The Application model has a one2many field for the Document model. I want the document model associated with both Application and Vendor. When a user views the Vendor form a tab shows a tree of related Applications. Clicking an Application opens its form in a dialog and a tab there shows related Documents. Now if user clicks "Add Item" and creates a new Document that Document is related to the Application but not also the Vendor.

Can I put the vendor_id into the context when the Vendor form is rendered and then access that value from the create method of Document so I can add vendor_id to vals? If so how do I go about it?

Ultimately I want to create an alternate Vendor form with a tab to show all related Documents for the Vendor even if they aren't associated with an Application.

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

0 follower(s)

Stats

Asked: 8/9/13, 1:40 PM
Seen: 545 times
Last updated: 3/16/15, 8:10 AM