[FIX] website_sale: fix order for the pager in front end.
In psql, use LIMIT and OFFSET together without a fully specified and uniq sort order will generate unexpected behaviour. Eg: > id id_dept name > ------------------- > 1 1 Tom > 2 1 Mike > 3 2 Meggie > 4 2 Marge > 5 3 Bart > 6 3 Lisa > using LIMITed selects like: > SELECT * FROM employee ORDER BY id_dept LIMIT 3 > SELECT * FROM employee ORDER BY id_dept LIMIT 3 OFFSET 3 > SELECT * FROM employee ORDER BY id_dept LIMIT 3 OFFSET 6 > You can have some result missings from the 3 requests, and others duplicated. > Because id_dept is not a uniq order.
This commit is contained in:
@@ -106,7 +106,8 @@ class WebsiteSale(http.Controller):
|
||||
|
||||
def _get_search_order(self, post):
|
||||
# OrderBy will be parsed in orm and so no direct sql injection
|
||||
return 'website_published desc,%s' % post.get('order', 'website_sequence desc')
|
||||
# id is added to be sure that order is a unique sort key
|
||||
return 'website_published desc,%s , id desc' % post.get('order', 'website_sequence desc')
|
||||
|
||||
@http.route(['/shop/change_pricelist/<model("product.pricelist"):pl_id>'], type='http', auth="public", website=True)
|
||||
def pricelist_change(self, pl_id, **post):
|
||||
|
||||
Reference in New Issue
Block a user