odoo 13 customization multiple companies products and vendor

Viewed 89

I have multiple companies on my odoo server. I have customize a module which control products to showing on the order line. I need this to work on one company only not all. how can i do that?

2 Answers

The method depend that you want to do.

Show or Hide something

You can simply create a group (In res.groups). In the res.config.settings, you added a new option will add all users of a current user company in this group. (I'm don't sure if implied_group working by company, need test).

After for each Fields / Button / Menu must be visible, added groups="module.xml_id"

For specific process

You can do something similar of before. Create a group, add option in config.

And in your python code you can do something like this.

def my_method(self):
    # Code for all cases
    if self.env.user.has_group('module.xml_id'):
        # Code for this specific group of user
    return True

Install module for a specific company

Isn't possible. When Odoo installed a new module the code will be execute in all the case. You need two instances for this two companies.

Separate the companies into databases, so that the modules in each database (now each company) can be different.

I think there's a better way of doing exactly what you are looking for, but I don't know it. So, you can just wait for more/better answers if this does not suit your case.

Related