Hello,
I have this action
@auth.requires(auth.has_membership(CHECKER_ROLE) or auth.has_membership(SUPERVISOR_ROLE))
def list_tags_to_issue():
"""List tags to issue.
:return: Dict with grid.
"""
query = ((db.wo.is_active == True)
& (db.wo.tags_issued == False)
& (db.wo.pies_verified == False)
& (db.wo.equipment_id == db.equipment.id))
grid = SQLFORM.grid(
query,
create=False,
csv=False,
deletable=False,
details=False,
editable=False,
fields=[db.wo.est_finish,
db.equipment.name,
db.wo.sn,
db.wo.opts,
db.wo.finished, # Necessary dummy entry.
db.wo.canceled_on, # Necessary dummy entry.
db.wo.canceled_by, # Necessary dummy entry.
db.wo.cancel_approved_by, # Necessary dummy entry.
],
orderby=db.wo.est_finish,
)
return dict(grid=grid)
With this view
{{extend 'layout.html'}}
<h2>{{=T('List tags to issue')}}</h2>
{{=grid}}
{{if DEV:
=response.toolbar()
pass}}
If I try to change the sorting in the default orderby column (est_finish) it doesn't occur.
The URL is changed from ...orderby=do.wo.est_finish to ...orderby=~db.wo.est_finish, but the grid doesn't change.
When I see the db stats, the SQL command also didn't change.
The SQL command is always
SELECT "wo"."est_finish", "equipment"."name", "wo"."sn", "wo"."opts", "wo"."finished", "wo"."canceled_on", "wo"."canceled_by", "wo"."cancel_approved_by", "wo"."id"
FROM "wo", "equipment"
WHERE (((("wo"."is_active" = 'T') AND ("wo"."tags_issued" = 'F')) AND ("wo"."pies_verified" = 'F')) AND ("wo"."equipment_id" = "equipment"."id"))
ORDER BY "wo"."est_finish", "wo"."id" LIMIT 20 OFFSET 0;
no matter the URL changing from ...orderby=do.wo.est_finish to ...orderby=~db.wo.est_finish.
This is one of 3 different views (all have in common a orderby with a date column) that show this problem. All others work correctly.
If I remove the orderby parameter from the grid or change it to a non-date one, everything works, including the sorting of the date column.
Any ideas?
Thanks,
JM