تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
3 الردود
28481 أدوات العرض

Isn't there a way to list all products under all subcategories of one parent category?

Example:

  • Category 1
    • Subcategory A
      • Product 1
      • Product 2
    • Subcategory B
      • Product 3
      • Product 4
  • Category 2
    • Subcategory C
      • Product 5
      • Product 6

How do I list products 1, 2, 3, and 4 only, which are all the products under the top-level Category 1?

الصورة الرمزية
إهمال
الكاتب

I have no problem listing products immediately under a category or a subcategory. I can use "Group by Category" in the Products screen for that, or use the steps you mentioned.

I want to list all products under all subcategories of one main category.

Question updated with an example.

Ok, I understand. For now, I don't see any other option to list out all products under all subcategories of one main category. You need to do customization for it, I think.

أفضل إجابة

You can go to Sales --> Products --> Products by Category menu and delete the filter in search bar. You'll have all product of the category tree.

Or you can create a filter like

<filter string="NAME" icon="terp-accessories-archiver" domain="[('categ_id','child_of',X]"/>

where X is the ID of your category. You can use a list of categories like domain="[('categ_id','child_of',[X,Y])]"

الصورة الرمزية
إهمال
الكاتب

This is exactly what I was looking for. Unintuitive, but at least it's possible.

أفضل إجابة

What I understood is that You want to list out all products of subcategory of parent category. For that, Go to the Sales --> Products --> Products by Category menu. Expand categories and click on it. You will see all products related to that category. Otherwise let me know more information regarding it.

Thanks, Priyesh Solanki

الصورة الرمزية
إهمال
أفضل إجابة

Late answer for those who come here from Google

If when you set a category filter in the search widget you want to display all products in that category or subcategories (the default behaviour is to display only products with that exact category set, which is kind of stupid if you ask me), you can modify the search view defined in product_product: add this xml in a custom module:

<record id="view_product_search_child_categories" model="ir.ui.view">
    <field name="name">Redefined product search view: subcategories</field>
    <field name="model">product.product</field>
    <field name="inherit_id" ref="product.product_search_form_view" />
    <field name="arch" type="xml">
        <field name="categ_id" position="attributes">
            <attribute name="operator">child_of</attribute>
        </field>
    </field>
</record>
الصورة الرمزية
إهمال

this the same solution than mine but it's a better integration. Thanks for the trick.

Yes, and you don't need to specify the ID of the category, so you can use it for all categories. But it is indeed based on your answer.

How to do this?

I added this xml in /addons/product/product_view_all.xml together with the and . Then I edited __openerp__.py to include the new xml on the 'data' :[] But i still can't find the way to make it work. Where can I add the XML?

المنشورات ذات الصلة الردود أدوات العرض النشاط
0
سبتمبر 19
3234
2
مارس 15
4667
3
فبراير 24
13058
0
مارس 15
4167
3
نوفمبر 22
17260