Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2581 มุมมอง

I want to updated time value in float field from datetime field by psql query odoo 14. So, i can i get this.

My code is below:

start_datetime = fields.Datetime("Start DateTime", required=True)
duration = fields.Float('Duration', readonly=True)

def init(self):
    '''Create the view'''
    tools.drop_view_if_exists(self._cr, self._table)
    self._cr.execute("""
    CREATE OR REPLACE VIEW %s AS (
    SELECT
     ROW_NUMBER() OVER() as id,

     aal.start_datetime as start_datetime,
     (start_datetime at time zone 'utc') ::timestamp as duration
     --Try to update above duration field with time only
     from account_analytic_line aal
     left join project_project pro on pro.id = aal.project_id
    )""" % (self._table,))

Thanks in advance.


อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ค. 24
3280
1
เม.ย. 24
27022
1
พ.ย. 22
2693
2
ก.ค. 22
3429
2
ก.ค. 22
3239