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

Loading many2many depending on domain and view opened

By
Victor
on 8/25/15, 6:57 AM 456 views

Hello,


I developped a little module that adds 2 boolean fields into res.partner.tags. (customer and supplier)


I would like load the category_id of res.partner view depending on this new fields. If I open the form view by customer menu, I want that it loads the categories marked like customer, if I open the form by supplier menu, I want that it loads categories marked like supplier and if I open contact view, it should show all categories. 


I saw that this 3 actions call the same form view and I don't know how adapt the domain in this field.


Somebody knows how do that?


Thank you in advance


Bravo! Thank you very much! It works very good!

Victor
on 11/17/15, 7:56 PM

Happy to help you

Axel Mendoza
on 12/23/15, 1:35 PM
1

Axel Mendoza

--Axel Mendoza--
10238
| 7 7 8
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full time employee trying to understand what to do an how

Reach me at aekroft@gmail.com

Axel Mendoza
On 8/26/15, 2:58 AM

You could do that by using the context values on each of those actions. Suppliers have a context setted with a search_default_supplier = 1. Customers have search_default_customer = 1. You could use it in your domains combining & with | to get the desired domain. Something like this:

<field name="category_id" domain="['|',('field_bool_supp', '=', bool(context.get('search_default_supplier', 0))),('field_bool_cust', '=', bool(context.get('search_default_customer', 0)))]"/>

please vote if that's ok to you

Axel Mendoza
on 8/26/15, 6:24 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

2 follower(s)

Stats

Asked: 8/25/15, 6:57 AM
Seen: 456 times
Last updated: 11/17/15, 7:56 PM