Skip to Content
Odoo Meniu
  • Autentificare
  • Try it free
  • Aplicații
    Finanțe
    • Contabilitate
    • Facturare
    • Cheltuieli
    • Spreadsheet (BI)
    • Documente
    • Semn
    Vânzări
    • CRM
    • Vânzări
    • POS Shop
    • POS Restaurant
    • Abonamente
    • Închiriere
    Site-uri web
    • Constructor de site-uri
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Lanț Aprovizionare
    • Inventar
    • Producție
    • PLM
    • Achiziție
    • Maintenance
    • Calitate
    Resurse Umane
    • Angajați
    • Recrutare
    • Time Off
    • Evaluări
    • Referințe
    • Flotă
    Marketing
    • Social Marketing
    • Marketing prin email
    • SMS Marketing
    • Evenimente
    • Automatizare marketing
    • Sondaje
    Servicii
    • Proiect
    • Foi de pontaj
    • Servicii de teren
    • Centru de asistență
    • Planificare
    • Programări
    Productivitate
    • Discuss
    • Aprobări
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Aplicații Terțe Odoo Studio Platforma Odoo Cloud
  • Industrii
    Retail
    • Book Store
    • Magazin de îmbrăcăminte
    • Magazin de Mobilă
    • Magazin alimentar
    • Magazin de materiale de construcții
    • Magazin de jucării
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Distribuitor de băuturi
    • Hotel
    Proprietate imobiliara
    • Real Estate Agency
    • Firmă de Arhitectură
    • Construcție
    • Estate Managament
    • Grădinărit
    • Asociația Proprietarilor de Proprietăți
    Consultanta
    • Firma de Contabilitate
    • Partener Odoo
    • Agenție de marketing
    • Law firm
    • Atragere de talente
    • Audit & Certification
    Producție
    • Textil
    • Metal
    • Mobilier
    • Mâncare
    • Brewery
    • Cadouri corporate
    Health & Fitness
    • Club Sportiv
    • Magazin de ochelari
    • Centru de Fitness
    • Wellness Practitioners
    • Farmacie
    • Salon de coafură
    Trades
    • Handyman
    • IT Hardware and Support
    • Asigurare socială de stat
    • Cizmar
    • Servicii de curățenie
    • HVAC Services
    Altele
    • Organizație nonprofit
    • Agenție de Mediu
    • Închiriere panouri publicitare
    • Fotografie
    • Închiriere biciclete
    • Asigurare socială
    Browse all Industries
  • Comunitate
    Învăță
    • Tutorials
    • Documentație
    • Certificări
    • Instruire
    • Blog
    • Podcast
    Empower Education
    • Program Educațional
    • Scale Up! Business Game
    • Visit Odoo
    Obține Software-ul
    • Descărcare
    • Compară Edițiile
    • Lansări
    Colaborați
    • Github
    • Forum
    • Evenimente
    • Translations
    • Devino Partener
    • Services for Partners
    • Înregistrează-ți Firma de Contabilitate
    Obține Servicii
    • Găsește un Partener
    • Găsiți un contabil
    • Meet an advisor
    • Servicii de Implementare
    • Referințe ale clienților
    • Suport
    • Actualizări
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obține un demo
  • Prețuri
  • Ajutor

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

  • CRM
  • e-Commerce
  • Contabilitate
  • Inventar
  • PoS
  • Proiect
  • MRP
All apps
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
All Posts Oameni Insigne
Etichete (View all)
odoo accounting v14 pos v15
Despre acest forum
Suport

How to create a record based on an email received in v17?

Abonare

Primiți o notificare când există activitate la acestă postare

Această întrebare a fost marcată
emailcustommoduleodoov17
2 Răspunsuri
3159 Vizualizări
Imagine profil
Vitor Zucon

I am creating something similar to a help desk system. I need to register a new record in my model when I receive an email. I have already configured the email receiving server, but I don't know how to implement message_new. I have tried in several ways and without success. I am a beginner.


2024-02-26 18:22:37,943 8638 INFO odoo17 odoo.addons.mail.models.fetchmail: start checking for new emails on imap server Receber email TI 

2024-02-26 18:22:38,053 8638 INFO odoo17 odoo.addons.mail.models.mail_thread: Routing mail from "Vitor Augusto Zucon Gonçalves - Zanardo Válvulas" to pipefycb@zanardo.com.br with Message-Id : fallback to model:helpdesk.ticket.model, thread_id:None, custom_values:None, uid:2 

2024-02-26 18:22:38,055 8638 INFO odoo17 odoo.addons.mail.models.fetchmail: Failed to process mail from imap server Receber email TI. 

Traceback (most recent call last):

  File "/home/vazgoncalves/projects/odoo/addons/mail/models/fetchmail.py", line 211, in fetch_mail

    res_id = MailThread.with_context(**additionnal_context).message_process(server.object_id.model, data[0][1], save_original=server.original, strip_attachments=(not server.attach))

  File "/home/vazgoncalves/projects/odoo/addons/mail/models/mail_thread.py", line 1357, in message_process

    thread_id = self._message_route_process(message, msg_dict, routes)

  File "/home/vazgoncalves/projects/odoo/addons/mail/models/mail_thread.py", line 1250, in _message_route_process

    thread = ModelCtx.message_new(message_dict, custom_values)

TypeError: CardModel.message_new() missing 1 required positional argument: 'msg_dict'

2024-02-26 18:22:38,061 8638 INFO odoo17 odoo.addons.mail.models.fetchmail: Fetched 1 email(s) on imap server Receber email TI; 0 succeeded, 1 failed.


my code: 


 

    ​@api.model    

​def _create_mail_thread_defaults(self):

        return {            

​ ​'email_send_default': True,

        }


    ​def register_models(registry):

​ ​registry['helpdesk.ticket.model'] = CardModel


​def message_new(self, cr, uid, msg_dict, custom_values=None, context=None):

​        data = {            

​ ​ ​'title_card': msg_dict.get('subject')

​        }        

​ ​model = CardModel()

​        if custom_values == None:

​   ​      custom_values = {}        

​ ​data.update(custom_values)        

​ ​res_id = model.pool.create(cr, uid, data, context=context)        

​ ​return res_id


0
Imagine profil
Abandonează
Imagine profil
PULSE MIDDLE EAST TRADING L.L.C
Cel mai bun răspuns

Hello Vitor, 

Can you please share the whole model that uses this def method ? or you just inherited it in a default app ?

Thanks

0
Imagine profil
Abandonează
Imagine profil
Vitor Zucon
Autor Cel mai bun răspuns

  I finally found a way that worked for me:


@api.model    
def message_new(self, msg_dict, custom_values=None, context=None):        
	​data = {            
	​	​'title_card': msg_dict.get('subject'),             
	​	​'description_card': msg_dict.get('body')        
	​}        
	​custom_values = custom_values or {}        
	​data.update(custom_values)        
	​card = self.env['your.custom.model'].create(data)        
	​return card



0
Imagine profil
Abandonează
Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Înscrie-te
Related Posts Răspunsuri Vizualizări Activitate
Invoice state changed (Automated email sent)
email automation odoo v17
Imagine profil
Imagine profil
1
mai 24
2452
Since 17.0, the "attrs" and "states" attributes are no longer used. Rezolvat
odoo v17
Imagine profil
Imagine profil
Imagine profil
Imagine profil
Imagine profil
7
oct. 25
33901
How to Remove powered by odoo from online invoice footer ?
odoo v17
Imagine profil
Imagine profil
Imagine profil
2
iul. 25
3197
UncaughtPromiseError after insert and apply embeded code in the footer
odoo v17
Imagine profil
0
mar. 25
2103
[FR/EN]Problème pour envoyer des mails dans les factures/devis / Problem sending emails in invoices/quotes
odoo v17
Imagine profil
1
iul. 24
2899
Comunitate
  • Tutorials
  • Documentație
  • Forum
Open Source
  • Descărcare
  • Github
  • Runbot
  • Translations
Servicii
  • Hosting Odoo.sh
  • Suport
  • Actualizare
  • Custom Developments
  • Educație
  • Găsiți un contabil
  • Găsește un Partener
  • Devino Partener
Despre Noi
  • Compania noastră
  • Active de marcă
  • Contactați-ne
  • Locuri de muncă
  • Evenimente
  • Podcast
  • Blog
  • Clienți
  • Aspecte juridice • Confidențialitate
  • Securitate
الْعَرَبيّة 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 este o suită de aplicații de afaceri open source care acoperă toate nevoile companiei dvs.: CRM, comerț electronic, contabilitate, inventar, punct de vânzare, management de proiect etc.

Propunerea de valoare unică a Odoo este să fie în același timp foarte ușor de utilizat și complet integrat.

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