跳至内容
菜单
此问题已终结
5 回复
16603 查看

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?

形象
丢弃

 \Ray Carnes response is the easyiest way to do it

Extremely useful. Thank you very much Ray.

最佳答案

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:




形象
丢弃

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

最佳答案

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

形象
丢弃
最佳答案

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

形象
丢弃
最佳答案

Hi Ray,

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

Thanks!

形象
丢弃
最佳答案

Hi, 

You can see following for this:

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

Hope it helps,

Thanks

形象
丢弃
相关帖文 回复 查看 活动
1
10月 23
1707
0
7月 23
1450
0
1月 22
1608
1
4月 20
48
2
4月 25
7059