I want to ask users to select a Product Category on every Sales Quotation and have Odoo restrict the products that can be added to only those in the selected category.
How can I do this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
I want to ask users to select a Product Category on every Sales Quotation and have Odoo restrict the products that can be added to only those in the selected category.
How can I do this?
For version 13, this approach might work:
1. Create a new field to link the sale.order model to the product.category model, allowing users a place to store the selected Category for each order:
2. Add this field to the User Interface, together with a domain on the order_line field to restrict products to those in the currently selected category:
<field name="partner_shipping_id" position="after">
<field name="x_product_category"/>
</field>
<xpath expr="//page/field[@name='order_line']/tree/field[@name='product_id']" position="attributes">
<attribute name="domain">[('categ_id','=',parent.x_product_category)]</attribute>
</xpath>
This restricts Users to only the products from the category they select:
Hi Ray - this is useful (as ever), but is it possible to handle a user not selecting a product category?
Also, is it possible to pass the product category when creating a new product? (I tried to add context, but couldn't get it work)
(1) not with this approach (2) you would need to pass context from the sale order line to the product, rather than the order to the product. So this means context would need access to a custom field on the sale order line that stores the current category on that line. "parent." from the perspective of the product is the line, not the order.
Thanks!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
15
Mar 21
|
10266 | ||
|
1
Nov 22
|
955 | ||
|
0
Mar 16
|
2537 | ||
|
3
Dec 19
|
2937 | ||
V8 QUOTATION PRODUCT INPUT
Solved
|
|
4
Oct 15
|
2656 |