[FIX] website_blog: order of blog_post must be by create_date
authorchm@openerp.com <>
Mon, 31 Mar 2014 14:41:40 +0000 (16:41 +0200)
committerchm@openerp.com <>
Mon, 31 Mar 2014 14:41:40 +0000 (16:41 +0200)
bzr revid: chm@openerp.com-20140331144140-hjokx0g6jklxp18m

addons/website_blog/controllers/main.py
addons/website_blog/data/website_blog_demo.xml

index a1b4d9d..400bc81 100644 (file)
@@ -99,7 +99,7 @@ class WebsiteBlog(http.Controller):
         blog_posts = None
 
         blog_obj = request.registry['blog.blog']
-        blog_ids = blog_obj.search(cr, uid, [], context=context)
+        blog_ids = blog_obj.search(cr, uid, [], order="create_date asc", context=context)
         blogs = blog_obj.browse(cr, uid, blog_ids, context=context)
 
         path_filter = ""
@@ -115,7 +115,7 @@ class WebsiteBlog(http.Controller):
             path_filter += "date/%s" % date
             domain += [("create_date", ">=", date.split("_")[0]), ("create_date", "<=", date.split("_")[1])]
 
-        blog_post_ids = blog_post_obj.search(cr, uid, domain, context=context)
+        blog_post_ids = blog_post_obj.search(cr, uid, domain, order="create_date asc", context=context)
         blog_posts = blog_post_obj.browse(cr, uid, blog_post_ids, context=context)
 
         pager = request.website.pager(
index 913c2dd..54581ba 100644 (file)
         <record id="blog_post_3" model="blog.post">
             <field name="name">Touchscreen Point of Sale for 6.1</field>
             <field name="blog_id" ref="blog_blog_1"/>
+            <field name="create_date" eval="(DateTime.today() - relativedelta(months=2)).strftime('%Y-%m-%d %H:%M')"/>
             <field name="tag_ids" eval="[(6, 0, [ref('blog_tag_1'), ref('blog_tag_2')])]"/>
             <field name="website_meta_keywords">Point of Sale, Hardware, Interface, Payment Terminal, Store</field>
             <field name="website_meta_description">Point of Sale with no installation required that runs online and offline.</field>