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
    • Discuss
    • 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

Cannot add custom fields to model mailing.mailing

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
customlimitmailingqueue
2 Replies
2517 Tampilan
Avatar
Tomasz Trojan

I'm looking for help in adding custom fields in my custom addon.

My code (mass_mail.py):

from odoo import models, fields, api
from odoo.exceptions import UserError
import time

class MailingMailing(models.Model):
_inherit = "mailing.mailing"
max_emails_per_iteration = fields.Integer(string="Max Emails per Iteration", default=10)
time_interval_between_iterations = fields.Integer(string="Time Interval (seconds)", default=60)

def send_mail(self):
# Split the recipients into smaller groups based on max_emails_per_iteration
recipient_domain = self.mailing_domain
mailing_model_id = self.mailing_model_id

# Fetch the recipients based on the domain
recipients = self.env[self.env["ir.model"].browse(mailing_model_id).model].search([
("id", "in", self.env[self.env["ir.model"].browse(mailing_model_id).model].search([]).filtered_domain(recipient_domain).ids)
])

for i in range(0, len(recipients), self.max_emails_per_iteration):
email_batch = recipients[i:i + self.max_emails_per_iteration]
self.write({
"mailing_domain": [
("id", "in", email_batch.ids),
("model_id", "=", mailing_model_id),
]
})
super(MailingMailing, self).send_mail()
time.sleep(self.time_interval_between_iterations)

# Restore the original domain
self.write({"mailing_domain": [("id", "in", self.env[self.env["ir.model"].browse(mailing_model_id).model].search([]).filtered_domain(recipient_domain).ids)]})


Odoo is not adding new fields. When trying to add those fields in inherited view, it throws me an error:

odoo.exceptions.ValidationError: Error while validating view near:

                    
Field "max_emails_per_iteration" does not exist in model "mailing.mailing"


I have tried to install the addon without inherited view definition, it installs but there are no custom fields in mailing.mailing model added.

System id Odoo 15 Community.

Any help appreciated.

0
Avatar
Buang
Tomasz Trojan
Penulis

Hi Savya,

thank you for your answer. My Odoo instance is running in docker (with docker-compose.yml). I have tried already to restart container, restart database, update and restart server and rebuild container (docker-compose down / up -d).

Still have the same error. What can be wrong? 

Savya Sachin

I have updated the answer, please check

Tomasz Trojan
Penulis

I am trying (maybe not understand docker perfectly):

docker run -v odoo-project_odoo-db-data,odoo-project_odoo-web-data odoo:15.0 odoo -u all -d DATABASENAME

error: Database connection failure: could not translate host name "db" to address: Name or service not known

Tried with real database name instead, the same error. Should I build new container alongside existing one to do this? Beacause this command builds new container in the docker.. 

Avatar
Savya Sachin
Jawaban Terbai

Hi,

Try to upgrade the module upon restarting the server. In your run configuration add 

-u custom_module

eg:

-c your_odoo.conf -u custom_module

restart and check if the field is added.

for docker setup, try 

docker run -v [your volumes] odoo:version odoo -u all -d DATABASENAME

-u all #updates all

-u module_name #update specific module


Thanks

1
Avatar
Buang
Avatar
Tomasz Trojan
Penulis Jawaban Terbai

Thank you, problem solved. Cannot mark your answer as Best one due to insufficient karma, but it was right one.

One more mistake I have made was an empty _ _ i n i t . p y _ _ file in the root of the addon. It should contain one line:

from . import models


Sorry for the confusion.

Best regards!

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
Bug odoo v18 sending abandoned cart x2
mailing
Avatar
0
Jul 25
1789
Self hosting Odoo custom Diselesaikan
custom
Avatar
1
Agu 24
2953
Invalid link on Task invitation
mailing
Avatar
0
Mei 22
2885
How-To Add Salesperson field from Contact to Mailings to be used as Dynamic Placeholder
mailing
Avatar
0
Mei 21
2323
Unable to send email after clicked retry on Mass Mailings
mailing
Avatar
Avatar
Avatar
2
Jul 16
5878
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