3
這裏是我的Python代碼:爲什麼OpenERP報表查詢結果因SQL查詢結果而異?
class sign_in_out_model_class(osv.osv):
_name = "sign.in.out"
_description = "Sign In/Out Report"
_auto = False
_columns = {
'name': fields.char('Emp No', size=128, readonly=True,select=True),
'reldate':fields.char('Date', readonly=True,select=True),
'sign_in': fields.char('Sign In', readonly=True,select=True),
'sign_out': fields.char('Sign Out', readonly=True,select=True),
}
_order = 'sign_in asc'
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'sign_in_out')
cr.execute("""CREATE OR REPLACE VIEW sign_in_out AS (
select max(dup_id) as id,name,
to_char(min(date),'YY/MM/DD') as reldate,
to_char(min(date),'HH12:MIam') as sign_in,
to_char(max(date),'HH12:MIam') as sign_out
from text_based_attendance
group by date(date),name)""")
sign_in_out_model_class()
低於輸出,使
但是當我在pgAdmin的運行查詢它給出以下結果
我需要知道這種差異的原因是什麼? 我的編碼有問題嗎?
你可以在圖片1中看到,這是默認編號排序odoo _order由id這就是爲什麼順序是變化。 –