Skip ke Konten
Menu
Pertanyaan ini telah diberikan tanda
5 Replies
17268 Tampilan

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?

Avatar
Buang

 \Ray Carnes response is the easyiest way to do it

Extremely useful. Thank you very much Ray.

Jawaban Terbai

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:




Avatar
Buang

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

Jawaban Terbai

Are we able to apply this solution even using the enterprise version of Odoo? Or is it only possible to work out with code? 

Avatar
Buang
Jawaban Terbai

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

Avatar
Buang
Jawaban Terbai

Hi Ray,

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

Thanks!

Avatar
Buang
Jawaban Terbai

Hi, 

You can see following for this:

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

Hope it helps,

Thanks

Avatar
Buang
Post Terkait Replies Tampilan Aktivitas
1
Okt 23
1979
0
Jul 23
1687
0
Jan 22
1810
1
Apr 20
48
2
Apr 25
7416