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

Hi,
In Odoo 18 i want to generate a new field in the other information of an order.
The field should be a computed field, to calculate how many days have passed since the order.
I know how to add fields in studio but have trouble with my compute function:

for record in self:
    if record.date_order:
        delta = (fields.Date.today() - record.date_order.date()).days
        record['x_days_since_order'] = delta
    else:
        record['x_days_since_order'] = 0
อวตาร
ละทิ้ง