Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Diskusi
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

How to use relativedelta in Odoo Studio for the following computed fields?

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
#fields#studio#dateutil#datetime
2 Replies
3416 Tampilan
Avatar
Bhoj Rani Soopal

This is my error: 


RPC_ERROR

Odoo Server Error

Traceback (most recent call last):

  File "/home/odoo/src/odoo/saas-16.4/odoo/tools/safe_eval.py", line 365, in safe_eval

    return unsafe_eval(c, globals_dict, locals_dict)

  File "", line 6, in

TypeError: 'wrap_module' object is not callable


During handling of the above exception, another exception occurred:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/saas-16.4/odoo/http.py", line 1715, in _serve_db

    return service_model.retrying(self._serve_ir_http, self.env)

  File "/home/odoo/src/odoo/saas-16.4/odoo/service/model.py", line 133, in retrying

    result = func()

  File "/home/odoo/src/odoo/saas-16.4/odoo/http.py", line 1742, in _serve_ir_http

    response = self.dispatcher.dispatch(rule.endpoint, args)

  File "/home/odoo/src/odoo/saas-16.4/odoo/http.py", line 1943, in dispatch

    result = self.request.registry['ir.http']._dispatch(endpoint)

  File "/home/odoo/src/odoo/saas-16.4/odoo/addons/base/models/ir_http.py", line 191, in _dispatch

    result = endpoint(**request.params)

  File "/home/odoo/src/odoo/saas-16.4/odoo/http.py", line 717, in route_wrapper

    result = endpoint(self, *args, **params_ok)

  File "/home/odoo/src/odoo/saas-16.4/addons/web/controllers/dataset.py", line 30, in call_kw

    return self._call_kw(model, method, args, kwargs)

  File "/home/odoo/src/odoo/saas-16.4/addons/web/controllers/dataset.py", line 26, in _call_kw

    return call_kw(request.env[model], method, args, kwargs)

  File "/home/odoo/src/odoo/saas-16.4/odoo/api.py", line 466, in call_kw

    result = _call_kw_multi(method, model, args, kwargs)

  File "/home/odoo/src/odoo/saas-16.4/odoo/api.py", line 453, in _call_kw_multi

    result = method(recs, *args, **kwargs)

  File "/home/odoo/src/odoo/saas-16.4/odoo/models.py", line 6781, in onchange

    todo = [

  File "/home/odoo/src/odoo/saas-16.4/odoo/models.py", line 6784, in

    if name not in done and snapshot0.has_changed(name)

  File "/home/odoo/src/odoo/saas-16.4/odoo/models.py", line 6584, in has_changed

    return self[name] != record[name]

  File "/home/odoo/src/odoo/saas-16.4/odoo/models.py", line 6211, in __getitem__

    return self._fields[key].__get__(self, type(self))

  File "/home/odoo/src/odoo/saas-16.4/odoo/fields.py", line 1157, in __get__

    self.recompute(record)

  File "/home/odoo/src/odoo/saas-16.4/odoo/fields.py", line 1367, in recompute

    apply_except_missing(self.compute_value, recs)

  File "/home/odoo/src/odoo/saas-16.4/odoo/fields.py", line 1340, in apply_except_missing

    func(records)

  File "/home/odoo/src/odoo/saas-16.4/odoo/fields.py", line 1389, in compute_value

    records._compute_field_value(self)

  File "/home/odoo/src/odoo/saas-16.4/addons/base_automation/models/base_automation.py", line 434, in _compute_field_value

    _compute_field_value.origin(self, field)

  File "/home/odoo/src/odoo/saas-16.4/addons/mail/models/mail_thread.py", line 395, in _compute_field_value

    return super()._compute_field_value(field)

  File "/home/odoo/src/odoo/saas-16.4/odoo/models.py", line 4553, in _compute_field_value

    fields.determine(field.compute, self)

  File "/home/odoo/src/odoo/saas-16.4/odoo/fields.py", line 104, in determine

    return needle(records, *args)

  File "/home/odoo/src/odoo/saas-16.4/odoo/addons/base/models/ir_model.py", line 38, in

    func = lambda self: safe_eval(text, SAFE_EVAL_BASE, {'self': self}, mode="exec")

  File "/home/odoo/src/odoo/saas-16.4/odoo/tools/safe_eval.py", line 379, in safe_eval

    raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))

ValueError: : "'wrap_module' object is not callable" while evaluating

'for record in self:\n    if record.x_studio_contract_duration_months ==0:\n       record["x_studio_contract_target_end_date"] = record.x_studio_contract_target_start_date \n       \n    if (record.x_studio_contract_target_start_date and record.x_studio_contract_duration_months):\n        future_date = record.x_studio_contract_target_start_date + dateutil.relativedelta(months=+record.x_studio_contract_duration_months)\n        print(future_date)\n        record["x_studio_contract_target_end_date"] = future_date - datetime.timedelta(days=1)\n'


The above server error caused the following client error:

null


And this is the code I am using for: 
for record in self:

    if record.x_studio_contract_duration_months ==0:

       record["x_studio_contract_target_end_date"] = record.x_studio_contract_target_start_date 

       

    if (record.x_studio_contract_target_start_date and record.x_studio_contract_duration_months):

        future_date = record.x_studio_contract_target_start_date + dateutil.relativedelta(months=+record.x_studio_contract_duration_months)

        print(future_date)

        record["x_studio_contract_target_end_date"] = future_date - datetime.timedelta(days=1)


Thanks in advance! 

0
Avatar
Buang
Avatar
Francesco Pranzo
Jawaban Terbai

try to update the code with this:

future_date = record.x_studio_contract_target_start_date + dateutil.relativedelta.relativedelta(months=+record.x_studio_contract_duration_months)



0
Avatar
Buang
Avatar
Cybrosys Techno Solutions Pvt.Ltd
Jawaban Terbai

Hi,In the given question, an attempt is made to add months which could potentially lead to an error. This is due to the usage of 'dateutil.relativedelta' with an argument of months equals to plus record.x_studio_contract_duration_months. The corrected solution uses 'dateutil.relativedelta.relativedelta' with an argument of months equals to record.x_studio_contract_duration_months to accurately apply the relative difference for adding months in date calculations. The key difference is in the correct usage of the relativedelta method for proper date manipulation. This change ensures that the months are added correctly.

By following these steps, you should be able to diagnose and potentially resolve the issue with the missing Studio tabs in your Odoo database.


Hope it helps

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Post Terkait Replies Tampilan Aktivitas
Studio vs Code (V16)
#studio
Avatar
Avatar
1
Agu 23
1971
Filters / Custom Filters (V16) Diselesaikan
#studio
Avatar
Avatar
1
Agu 23
2128
"Time data does not match format" error with custom code Diselesaikan
v17 #datetime
Avatar
Avatar
1
Mar 24
3191
How to delete studio approval rules? Diselesaikan
#studio v17
Avatar
Avatar
Avatar
2
Feb 24
1886
How to make read-only fields false in 17? Diselesaikan
#fields v17
Avatar
Avatar
Avatar
3
Feb 24
5084
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now