Skip to Content
Menu
This question has been flagged
3 Replies
1611 Views

Hi all


I offer products (e.g. "computing course") to various customers (e.g. "school XY").

These products are customer-specific (e.g. "computing course" for "school XY").


When looking the the proper product on the oder line, odoo should list only the products relevant for the respective customer.


I've tried / thought about the following:

Approach

Comment

Drawback

Adding a prefix to the product name reflecting the customer name.


This prefix is shown on the order  too. This "concatenated product name" is not in line with the product name the customers expects.

Entering the customer name in the field "internal reference" of the product.

That seems to work.

However, it seems to add the "internal reference" to the order which is not in line with the product description the customers expects.

Creating order templates per customer with all the products for this very customer.

By design, odoo adds all the products from the selected template.

Every time I have to manually remove the product line, which is not needed in tha particular sales order.

Moreover, trying to add later on a product - that I removed earlier - leads me again in the position of finding products of other customers. This is what I tried to avoid to begin with.

Do you have an idea how to "pre-select" the subset of relevant products in the product selection field of the oder line?


Thanks a lot

Avatar
Discard
Best Answer

It's simple to do in Odoo Studio if you have that installed:

1. Add a many2many field on products for a list of customers who will buy the product

2. Add this field to the domain for the product code, something like this


["&", ("sale_ok", "=", True), ("x_studio_customer", "=", parent.partner_id)]

More information: Adding fields using Odoo Studio - please me know if you need more details on this!

Or the same could be achieved by manually adding the field and displaying it in the Form View.  

Avatar
Discard
Author

Hi Chris
Many thanks for your support. I'm very new to odoo. I've installed Studio now and went through the respective documentation and videos.

Author

I added a new tab to customer called "CU related product" (CU stands for "customization").
I added the many2many field called "CU product of customer".
This part seems to work. I can add / reference products for a specific customer.

I don't understand your comment "add this field to the domain". Can you give me one more hint?

Now, I would like to make sure in my "sales order" to make this new field "CU related product" available in my "product search" in my "sales order -> line item".
This is where I get stuck. Even trying to add this field "CU related product" to "user defined search" does not work, because my new field "CU related product" is not available.

Can you please give me some more hints?

Thank you very much for your support
Reto

I added an example above - the domain is matching the customer on the product with the customer on the sales order. This probably isn't exactlly what you want, but maybe it helps.

Author

Thanks again!!!!
I believe this is exactly what I'm looking for.
However, entering below code in the field "domain" of "product" in "order lines", I'm getting the error message "This domain is not supported".

Do you have an idea what is wrong with "my" code? I also tried out various alternatives with " and '. It did not help. The name of my new attribute is 'CU_product_of_partner' (I changed it compared to my orignal message, since I thought odoo doesn't like spaces in names).

Thank you once more. Thank you for your valuable time and expertise. I really appreciate this a lot!!!

========================

<data>
  <xpath expr="//field[@name='product_template_id']" position="attributes">
    <attribute name="domain">["&amp;", ("sale_ok", "=", True), ("CU_product_of_partner", "=", parent.partner_id)]</attribute>
  </xpath>
</data>
["&", ("sale_ok", "=", True), ("CU_product_of_partner", "=", parent.partner_id)]

========================

I also tried this option. However, I got the same error message:
<data>
  <xpath expr="//field[@name='product_template_id']" position="attributes">
    <attribute name="CU_product_of_partner">["&amp;", ("sale_ok", "=", True), ("CU_product_of_partner", "=", parent.partner_id)]</attribute>
  </xpath>
</data>
["&", ("sale_ok", "=", True), ("CU_product_of_partner", "=", parent.partner_id)]

If you are using Studio, the field name should be something like x_studio_cu_product_of_partner. This is a field on product.product / product.template that contains the customer for a product.

Author Best Answer

Thanks for your thoughts.


The functionality looks promising.


However ... correct me, if I'm wrong:

  • It's not available for "odoo online"; and I am on "odoo online".
  • It's available for odoo V 16.0 but not V 17.0; which I guess is not an issue, right?


Regards

Reto

Avatar
Discard
Related Posts Replies Views Activity
1
Dec 23
1442
3
Oct 21
8977
3
Aug 20
4126
5
Oct 19
8774
1
Mar 25
537