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

i created a form and now i want to add date on top of the page which should show todays date? How to do that?

อวตาร
ละทิ้ง
คำตอบที่ดีที่สุด

HI,

You can use computed fields: because its is computed on-the-fly.

Define a Date field with compute. Please try this script:


    date = fields.Date(compute='_compute_date', string='Date')

    def _compute_date(self):

        for record in self:

            end = datetime.date.today()

            record.date = end


Hope this helps.


อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

I want to add on top(header part) not below part..so kindly help me with how to add above part..in ACTION Part...??

อวตาร
ละทิ้ง