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
    Food & Hospitality
    • 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
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et 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
    Browse all 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 for Partners
    • 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

[WEBHOOK][HELPDESK] CREAT A NEW TICKET WITH A WEBHOOK

S'inscrire

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

Cette question a été signalée
helpdeskWebhook
2 Réponses
3958 Vues
Avatar
Stefano Zambrano

I´m trying to create a new ticket, with information of a webhook, I verify that I just neet the field name to create, in logs I don't have any mistake. I saw this helpful video and I can create new contacts but I can't create the ticket https://www.youtube.com/watch?v=D3urHJ9rB2o

Payload

​Webhook #82 triggered with payload {'name': 'NAME OF HELPDESK TICKET FROM ​ ​WEBHOOK'}


Python code
vals = {'name': payload.get('name')  }
env['helpdesk.ticket'].create(vals)


Target record field: []


0
Avatar
Ignorer
Avatar
Niyas Raphy (Walnut Software Solutions)
Meilleure réponse

Hi,
Set target record as:  model.search([], limit=1) and model as automation rule and try.

Update:
there were a bug in the core and it has been resolved and now you will be able to create the ticket without any issues.

FIX: [FIX] base_automation: prevent crash when writing on tracked fields



Create record using webhook:  https://www.youtube.com/watch?v=D3urHJ9rB2o&t=34s


Thanks

0
Avatar
Ignorer
Avatar
Stefano Zambrano
Auteur Meilleure réponse

Yes i tried it, like the video, model is set as automation rule, but if i set target record as:  model.search([], limit=1), I have the following mistake in logs:

Webhook #82 failed with error:


Traceback (most recent call last):

  File "/home/odoo/src/odoo/17.0/odoo/models.py", line 5854, in ensure_one

    _id, = self._ids

ValueError: not enough values to unpack (expected 1, got 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/home/odoo/src/odoo/17.0/odoo/tools/safe_eval.py", line 391, in safe_eval

    return unsafe_eval(c, globals_dict, locals_dict)

  File "ir.actions.server(1416,)", line 24, in

  File "", line 2, in create

  File "/home/odoo/src/odoo/17.0/odoo/api.py", line 414, in _model_create_multi

    return create(self, [arg])

  File "/home/odoo/src/enterprise/17.0/helpdesk_sms/models/helpdesk_ticket.py", line 17, in create

    tickets = super().create(vals_list)

  File "", line 2, in create

  File "/home/odoo/src/odoo/17.0/odoo/api.py", line 415, in _model_create_multi

    return create(self, arg)

  File "/home/odoo/src/enterprise/17.0/helpdesk/models/helpdesk_ticket.py", line 493, in create

    tickets = super(HelpdeskTicket, self).create(list_value)

  File "", line 2, in create

  File "/home/odoo/src/odoo/17.0/odoo/api.py", line 415, in _model_create_multi

    return create(self, arg)

  File "/home/odoo/src/odoo/17.0/addons/mail/models/mail_thread.py", line 285, in create

    thread.sudo().message_post(subtype_id=subtype.id, author_id=self.env.user.partner_id.id)

  File "/home/odoo/src/odoo/17.0/addons/sms/models/mail_thread.py", line 135, in message_post

    return super().message_post(*args, body=body, message_type=message_type, **kwargs)

  File "/home/odoo/src/odoo/17.0/addons/rating/models/mail_thread.py", line 178, in message_post

    message = super(MailThread, self).message_post(**kwargs)

  File "/home/odoo/src/odoo/17.0/addons/mail/models/mail_thread.py", line 2136, in message_post

    if self.env.user._is_public() and guest:

  File "/home/odoo/src/odoo/17.0/odoo/addons/base/models/res_users.py", line 1156, in _is_public

    self.ensure_one()

  File "/home/odoo/src/odoo/17.0/odoo/models.py", line 5857, in ensure_one

    raise ValueError("Expected singleton: %s" % self)

ValueError: Expected singleton: res.users()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "/home/odoo/src/odoo/17.0/addons/base_automation/models/base_automation.py", line 509, in _execute_webhook

    return self._process(record)

  File "/home/odoo/src/odoo/17.0/addons/base_automation/models/base_automation.py", line 671, in _process

    action.with_context(**ctx).run()

  File "/home/odoo/src/odoo/17.0/odoo/addons/base/models/ir_actions.py", line 941, in run

    res = runner(run_self, eval_context=eval_context)

  File "/home/odoo/src/odoo/17.0/addons/website/models/ir_actions_server.py", line 61, in _run_action_code_multi

    res = super(ServerAction, self)._run_action_code_multi(eval_context)

  File "/home/odoo/src/odoo/17.0/odoo/addons/base/models/ir_actions.py", line 771, in _run_action_code_multi

    safz_eval(self.code.strip(), eval_context, mode="exec", nocopy=True, filename=str(self))  # nocopy allows to return 'action'

  File "/home/odoo/src/odoo/17.0/odoo/tools/safe_eval.py", line 405, in safe_eval

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

ValueError: : "Expected singleton: res.users()" while evaluating

"# Available variables:\n#  - env: environment on which the action is triggered\n#  - model: model of the record on which the action is triggered; is a void recordset\n#  - record: record on which the action is triggered; may be void\n#  - records: recordset of all records on which the action is triggered in multi-mode; may be void\n#  - time, datetime, dateutil, timezone: useful Python libraries\n#  - float_compare: utility function to compare floats based on specific precision\n#  - log: log(message, level='info'): logging function to record debug information in ir.logging table\n#  - _logger: _logger.info(message): logger to emit messages in server logs\n#  - UserError: exception class for raising user-facing warning messages\n#  - Command: x2many commands namespace\n# To return an action, assign: action = {...}\n\n\n# Datos del payload\nvals = {\n    'name': payload.get('name')  # Obtiene el nombre del payload\n    #'x_studio_selection_field_1ki_1hl8rqemp':'status1'\n\n}\n\n# Crea el ticket en el modelo helpdesk.ticket\n#env['helpdesk.ticket'].create(vals),\nenv['helpdesk.ticket'].create(vals)"

0
Avatar
Ignorer
Niyas Raphy (Walnut Software Solutions)

resolved the issue in odoo and now all will be fine

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é
¿Cómo puedo hablar con una persona en Aeroméxico 4718?
helpdesk
Avatar
0
nov. 25
3
Sales Order and Invoice Warning Messages in Helpdesk Résolu
helpdesk
Avatar
Avatar
1
août 25
986
Support Process Blueprint functionality in Odoo (Same as Zoho desk Blueprint) | Odoo v17
helpdesk
Avatar
0
mars 25
2405
Update custom field after email is received in helpdesk
helpdesk
Avatar
0
oct. 24
2399
Odoo is creating tickets for me with old emails Résolu
helpdesk
Avatar
Avatar
1
sept. 24
2469
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