PT Proweb Indonesia
The City Tower Level 12 Unit 1-N, Jakarta Pusat

Server Action dengan Mengeksekusi Code Python pada Kustomisasi Odoo

Sep 7, 2026 | Odoo 17 Development

Kita juga dapat server action untuk menjalankan sebuah code dalam bahasa Python pada kustomisasi Odoo 17.

Server action dengan mengeksekusi code Python pada kustomisasi Odoo adalah seperti pada contoh berikut ini

  1. Ke Technical | Server Actions
  2. Membuat contextual action tipe execute code

    if not record.date_deadline:
        raise ValidationError('Task has no deadline!')
    date_format = '%Y-%m-%d'
    delta = record.date_deadline - datetime.datetime.now()
    days = delta.days
    if days==0:
        msg = 'Kejakan hari ini.'
    elif days < 0:
        msg = 'Sudah telat %d hari.' % abs(days)
    else:
        msg = 'Kerjakan %d hari ke depan.' % days
    record.message_post(body=msg, subject='Reminder', subtype_xmlid='mail.mt_comment')
    
  3. Menjalankan action dan melihat hasilnya

Kunjungi https://www.proweb.co.id/implementasi-odoo/ untuk menambah wawasan anda mengenai Odoo ERP.