[FIX] website_sale: order products by sequence ascendant
Sequence is used everywhere as lowest first but was not in ecommerce. Fixes #7263
This commit is contained in:
@@ -221,7 +221,7 @@ class website_sale(http.Controller):
|
||||
|
||||
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, offset=pager['offset'], order='website_published desc, website_sequence desc', context=context)
|
||||
product_ids = product_obj.search(cr, uid, domain, limit=ppg, offset=pager['offset'], order='website_published desc, website_sequence asc', context=context)
|
||||
products = product_obj.browse(cr, uid, product_ids, context=context)
|
||||
|
||||
attributes_obj = request.registry['product.attribute']
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="website_size_x">2</field>
|
||||
<field name="website_size_y">2</field>
|
||||
<field name="website_sequence">5</field>
|
||||
<field name="website_sequence">3</field>
|
||||
<field name="website_style_ids" eval="[(6,0,[ref('website_sale.image_full')])]"/>
|
||||
<field name="website_description" type="html">
|
||||
<section class="mt16 mb16 oe_dark">
|
||||
|
||||
@@ -115,8 +115,8 @@ class product_template(osv.Model):
|
||||
}
|
||||
|
||||
def _defaults_website_sequence(self, cr, uid, *l, **kwargs):
|
||||
cr.execute('SELECT MAX(website_sequence)+1 FROM product_template')
|
||||
next_sequence = cr.fetchone()[0] or 0
|
||||
cr.execute('SELECT MIN(website_sequence)-1 FROM product_template')
|
||||
next_sequence = cr.fetchone()[0] or 10
|
||||
return next_sequence
|
||||
|
||||
_defaults = {
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<record id="product_product_1" model="product.product">
|
||||
<field name="name">Warranty</field>
|
||||
<field name="list_price">20.0</field>
|
||||
<field name="website_sequence">-1</field>
|
||||
<field name="website_sequence">100</field>
|
||||
<field name="website_published" eval="True"/>
|
||||
<field name="type">service</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
|
||||
Reference in New Issue
Block a user