Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
4 Odpowiedzi
15353 Widoki

I have one Company per Country that I sell into.

I have a Product Catalog that is shared.


Most of my products can be sold in all Countries, so I am not assigning a Company to each product, this way they are visible in all Companies.


Some of my products can only be sold in specific countries, so I'd like to somehow manage this.

Is this possible?

Awatar
Odrzuć

 \Ray Carnes response is the easyiest way to do it

Extremely useful. Thank you very much Ray.

Najlepsza odpowiedź

In this example, we have three Companies:

  • USA, Canada, Australia

... and five products:

  • Sold Everywhere, Sold in USA and Canada, Sold in USA, Sold in Australia, Sold in USA and Australia.




First, create a custom field on the Product that you can use to store which Countries a given Product can be sold in.  We will use the logic that if NO country is listed, it can be sold in ALL Countries.

(the yellow area is completed automatically for you by Odoo)


Then, add this field to the User Interface so you can start managing this relationship.

<page name="inventory" position="after">
<page name="countries" string="Allowed Companies">
<field name="x_company_ids"/>
</page>
</page>


Then, associate the Products with the Companies:


We now need a record rule that restricts the products seen.  I would recommend only applying this record rule based on a specific group of users.  Since the intention is to prevent Salespeople selling products, I would use one of the Sales Groups.


We also need a record rule that clears this restriction.  I recommend setting up a separate group for users who are allowed to see all products.


This is what Users in the Sales Group will see when logged into USA:

This is what Users in the Sales Group will see when logged into Canada:


This is what Users in the Sales Group will see when logged into Australia:




Awatar
Odrzuć

Hi Ray, this looks very useful.

Super useful!

Works but did some minor edits as of odoo 17 needs some changes
First of all Model should be only Product not product template
secondly adding this field to the User Interface should be done with Studio , couldnt do with this code

Najlepsza odpowiedź

Hi there,


Everything is working fine, but I still have some questions about the accounting aspect. It would be really helpful if we could select the default tax account, default income account, and default expense account for each company. This way, when we create invoices, the accounting will be automatically assigned to the correct accounts.


I'm wondering if anyone knows of a solution for this ?

Thanks
Morgan

Awatar
Odrzuć
Najlepsza odpowiedź

Hi Ray,

That solutions works for sales module, will it work for ecommerce as well?

Thanks!

Awatar
Odrzuć
Najlepsza odpowiedź

Hi, 

You can see following for this:

https://youtu.be/GkNgc-fZO-I

Hope it helps,

Thanks

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
1
paź 23
1207
0
lip 23
881
0
sty 22
1206
1
kwi 20
48
2
kwi 25
6465