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

Hide required fields based on parent context

By
Bruno Figares
on 1/21/14, 4:46 PM 1,111 views

Hello, I'm trying to find a way to hide a required field when I can infer it from context. Specifically, suppose I have a many2one field company --> locals, and I want to make it possible to add locals in two different ways:

  1. straight from a menu showing a tree view of the locals
  2. directly from company

I want the first one to show you the option to pick a company to associate the local with (since it doesn't make sense to have a local not associated with any company), and I also want the second option to not show the company at all and infer it from context. To infer it from context, I have successfully added the 'context={'default_company_id':company_id}}', which I copied from some other place that did exactly what I wanted. What I couldn't find though is how to not show the field at all in case the company_id is inferred from context.

Thanks in advance for any solutions or suggestions.

Best regards, Bruno Figares

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: 1/21/14, 4:46 PM
Seen: 1111 times
Last updated: 3/16/15, 8:10 AM