Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Restauration & Hôtellerie
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brasserie
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Commerce
    • Bricoleur
    • Matériel informatique & support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Parcourir toutes les industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services pour partenaires
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

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

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
emailcustommoduleodoov17
2 Réponses
3135 Vues
Avatar
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
Avatar
Ignorer
Avatar
PULSE MIDDLE EAST TRADING L.L.C
Meilleure réponse

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
Avatar
Ignorer
Avatar
Vitor Zucon
Auteur Meilleure réponse

  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
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
Invoice state changed (Automated email sent)
email automation odoo v17
Avatar
Avatar
1
mai 24
2448
Since 17.0, the "attrs" and "states" attributes are no longer used. Résolu
odoo v17
Avatar
Avatar
Avatar
Avatar
Avatar
7
oct. 25
33845
How to Remove powered by odoo from online invoice footer ?
odoo v17
Avatar
Avatar
Avatar
2
juil. 25
3193
UncaughtPromiseError after insert and apply embeded code in the footer
odoo v17
Avatar
0
mars 25
2093
[FR/EN]Problème pour envoyer des mails dans les factures/devis / Problem sending emails in invoices/quotes
odoo v17
Avatar
1
juil. 24
2897
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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