[IMP] website_sale: clean categories
Cherry-picked from 61ed580876e88a34fbaab44863fe6f025cb94cda Closes #134
This commit is contained in:
committed by
Richard Mathot
parent
01655be433
commit
b613fa65f6
@@ -525,7 +525,7 @@
|
||||
parent="base.menu_product"
|
||||
sequence="30" groups="base.group_no_one"/>
|
||||
<record id="product_category_action_form" model="ir.actions.act_window">
|
||||
<field name="name">Product Categories</field>
|
||||
<field name="name">Internal Categories</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">product.category</field>
|
||||
<field name="view_type">form</field>
|
||||
|
||||
@@ -168,17 +168,11 @@ class website_sale(http.Controller):
|
||||
else:
|
||||
pricelist = pool.get('product.pricelist').browse(cr, uid, context['pricelist'], context)
|
||||
|
||||
product_obj = pool.get('product.template')
|
||||
|
||||
url = "/shop"
|
||||
product_count = product_obj.search_count(cr, uid, domain, context=context)
|
||||
if search:
|
||||
post["search"] = search
|
||||
if category:
|
||||
url = "/shop/category/%s" % slug(category)
|
||||
pager = request.website.pager(url=url, total=product_count, page=page, step=PPG, scope=7, url_args=post)
|
||||
product_ids = product_obj.search(cr, uid, domain, limit=PPG+10, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context)
|
||||
products = product_obj.browse(cr, uid, product_ids, context=context)
|
||||
|
||||
style_obj = pool['product.style']
|
||||
style_ids = style_obj.search(cr, uid, [], context=context)
|
||||
@@ -189,6 +183,14 @@ class website_sale(http.Controller):
|
||||
categories = category_obj.browse(cr, uid, category_ids, context=context)
|
||||
categs = filter(lambda x: not x.parent_id, categories)
|
||||
|
||||
domain += [('public_categ_ids', 'in', category_ids)]
|
||||
product_obj = pool.get('product.template')
|
||||
|
||||
product_count = product_obj.search_count(cr, uid, domain, context=context)
|
||||
pager = request.website.pager(url=url, total=product_count, page=page, step=PPG, scope=7, url_args=post)
|
||||
product_ids = product_obj.search(cr, uid, domain, limit=PPG+10, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context)
|
||||
products = product_obj.browse(cr, uid, product_ids, context=context)
|
||||
|
||||
attributes_obj = request.registry['product.attribute']
|
||||
attributes_ids = attributes_obj.search(cr, uid, [], context=context)
|
||||
attributes = attributes_obj.browse(cr, uid, attributes_ids, context=context)
|
||||
|
||||
@@ -557,13 +557,8 @@ Weight: 1.1 ounces</field>
|
||||
</record>
|
||||
|
||||
<!-- product.public.category -->
|
||||
|
||||
<record id="product.computers" model="product.public.category">
|
||||
<field name="name">Computers</field>
|
||||
</record>
|
||||
|
||||
<record id="product.Components" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Components</field>
|
||||
</record>
|
||||
|
||||
@@ -597,7 +592,6 @@ Weight: 1.1 ounces</field>
|
||||
</record>
|
||||
|
||||
<record id="product.devices" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Devices</field>
|
||||
</record>
|
||||
|
||||
@@ -635,12 +629,10 @@ Weight: 1.1 ounces</field>
|
||||
</record>
|
||||
|
||||
<record id="product.laptops" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Laptops</field>
|
||||
</record>
|
||||
|
||||
<record id="product.sub_computers" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Computers</field>
|
||||
</record>
|
||||
|
||||
@@ -654,7 +646,6 @@ Weight: 1.1 ounces</field>
|
||||
</record>
|
||||
|
||||
<record id="product.network" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Network</field>
|
||||
</record>
|
||||
|
||||
@@ -672,7 +663,6 @@ Weight: 1.1 ounces</field>
|
||||
</record>
|
||||
|
||||
<record id="product.services" model="product.public.category">
|
||||
<field name="parent_id" ref="product.computers"/>
|
||||
<field name="name">Services</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
</field>
|
||||
</record>
|
||||
<record id="product_public_category_action" model="ir.actions.act_window">
|
||||
<field name="name">Public Product Categories</field>
|
||||
<field name="name">Public Categories</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">product.public.category</field>
|
||||
<field name="view_type">form</field>
|
||||
|
||||
Reference in New Issue
Block a user