Przejdź do zawartości
Odoo Menu
  • Zaloguj się
  • Wypróbuj za darmo
  • Aplikacje
    Finanse
    • Księgowość
    • Fakturowanie
    • Wydatki
    • Arkusz kalkulacyjny (BI)
    • Dokumenty
    • Podpisy
    Sprzedaż
    • CRM
    • Sprzedaż
    • PoS Sklep
    • PoS Restauracja
    • Subskrypcje
    • Wypożyczalnia
    Strony Internetowe
    • Kreator Stron Internetowych
    • eCommerce
    • Blog
    • Forum
    • Czat na Żywo
    • eLearning
    Łańcuch dostaw
    • Magazyn
    • Produkcja
    • PLM
    • Zakupy
    • Konserwacja
    • Jakość
    Zasoby Ludzkie
    • Pracownicy
    • Rekrutacja
    • Urlopy
    • Ocena pracy
    • Polecenia Pracownicze
    • Flota
    Marketing
    • Marketing Społecznościowy
    • E-mail Marketing
    • SMS Marketing
    • Wydarzenia
    • Automatyzacja Marketingu
    • Ankiety
    Usługi
    • Projekt
    • Ewidencja czasu pracy
    • Usługi Terenowe
    • Helpdesk
    • Planowanie
    • Spotkania
    Produktywność
    • Dyskusje
    • Sztuczna inteligencja
    • IoT
    • VoIP
    • Wiedza
    • WhatsApp
    Aplikacje trzecich stron Studio Odoo Odoo Cloud Platform
  • Branże
    Sprzedaż detaliczna
    • Księgarnia
    • Sklep odzieżowy
    • Sklep meblowy
    • Sklep spożywczy
    • Sklep z narzędziami
    • Sklep z zabawkami
    Żywienie i hotelarstwo
    • Bar i Pub
    • Restauracja
    • Fast Food
    • Pensjonat
    • Dystrybutor napojów
    • Hotel
    Agencja nieruchomości
    • Agencja nieruchomości
    • Biuro architektoniczne
    • Budowa
    • Zarządzanie nieruchomościami
    • Ogrodnictwo
    • Stowarzyszenie właścicieli nieruchomości
    Doradztwo
    • Biuro księgowe
    • Partner Odoo
    • Agencja marketingowa
    • Kancelaria prawna
    • Agencja rekrutacyjna
    • Audyt i certyfikacja
    Produkcja
    • Tekstylia
    • Metal
    • Meble
    • Jedzenie
    • Browar
    • Prezenty firmowe
    Zdrowie & Fitness
    • Klub sportowy
    • Salon optyczny
    • Centrum fitness
    • Praktycy Wellness
    • Apteka
    • Salon fryzjerski
    Transakcje
    • Złota rączka
    • Wsparcie Sprzętu IT
    • Systemy energii słonecznej
    • Szewc
    • Firma sprzątająca
    • Usługi HVAC
    Inne
    • Organizacja non-profit
    • Agencja Środowiskowa
    • Wynajem billboardów
    • Fotografia
    • Leasing rowerów
    • Sprzedawca oprogramowania
    Przeglądaj wszystkie branże
  • Community
    Ucz się
    • Samouczki
    • Dokumentacja
    • Certyfikacje
    • Szkolenie
    • Blog
    • Podcast
    Pomóż w nauce innym
    • Program Edukacyjny
    • Scale Up! Gra biznesowa
    • Odwiedź Odoo
    Skorzystaj z oprogramowania
    • Pobierz
    • Porównaj edycje
    • Wydania
    Współpracuj
    • Github
    • Forum
    • Wydarzenia
    • Tłumaczenia
    • Zostań partnerem
    • Usługi dla partnerów
    • Zarejestruj swoją firmę rachunkową
    • Referral Program
    Skorzystaj z usług
    • Znajdź partnera
    • Znajdź księgowego
    • Spotkaj się z doradcą
    • Usługi wdrożenia
    • Opinie klientów
    • Wsparcie
    • Aktualizacje
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Zaplanuj demo
  • Cennik
  • Pomoc
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
Wszystkie posty Osoby Odznaki
Tagi (Zobacz wszystko)
odoo accounting v14 pos v15
O tym forum
Pomoc

How to add user email as follower when creating Odoo ticket

Zaprenumeruj

Otrzymaj powiadomienie o aktywności w tym poście

To pytanie dostało ostrzeżenie
pythontickethelpdeskV16
2 Odpowiedzi
1408 Widoki
Awatar
Hemanth
I have this FastAPI endpoint that creates a ticket in my Odoo helpdesk (V16) application from an external request. How can I obtain the user’s email and add them as a follower to the ticket so they will receive an email whenever we reply?

@helpdesk_api_router.post("/ticket/add")
async def add_ticket(
current_user: Annotated[schemas.User, Depends(user.get_current_active_user)],
request: Request,
request_user_data: schemas.AddTicket,
env=Depends(odoo_env)
):
try:
search_departnment = env["helpdesk.ticket.team"].sudo().search([('id', '=', request_user_data.requestTypeId)])
if not search_departnment:
data = {
"success": "false",
"detail": "Request Type id not found",
}
return JSONResponse(content=data, status_code=404)
# Create ticket
ticket_data = env['helpdesk.ticket'].sudo().create({
'wallet_id': request_user_data.walletId,
'name': search_departnment.name,
'description': request_user_data.description,
'team_id': request_user_data.requestTypeId,
})
data = {
"success": "true",
"ticket_id": ticket_data.id,
"ticket_number": ticket_data.number,
"detail": "Ticket added successfully",
}
return JSONResponse(content=data)
except Exception as e:
# Handle exceptions, log errors, and return an appropriate response
return JSONResponse(content={"detail": "Error processing the ticket"}, status_code=500)


0
Awatar
Odrzuć
nhavna

Informative, i will copying for future.

Hemanth
Autor

Thanks Pradip, I am referring to the customer who will raise the ticket

Hemanth
Autor

Thank you, Jainesh Shah. If a user replies to the email, I’d like their response to appear in Helpdesk. How can we configure this?

Awatar
Jainesh Shah(Aktiv Software)
Najlepsza odpowiedź

Hi Hemanth,


@helpdesk_api_router.post("/ticket/add")

async def add_ticket(

        current_user: Annotated[schemas.User, Depends(user.get_current_active_user)],

        request: Request,

        request_user_data: schemas.AddTicket,

        env=Depends(odoo_env)

):

    try:

        team = env["helpdesk.ticket.team"].sudo().search([

            ('id', '=', request_user_data.requestTypeId)

        ])

        if not team:

            return JSONResponse(

                content={"success": "false", "detail": "Request Type id not found"},

                status_code=404

            )

 

        # -----------------------------------------

        # 1. Create Ticket

        # -----------------------------------------

        ticket = env['helpdesk.ticket'].sudo().create({

            'wallet_id': request_user_data.walletId,

            'name': team.name,

            'description': request_user_data.description,

            'team_id': request_user_data.requestTypeId,

        })

 

        # -----------------------------------------

        #2. CUSTOMER EMAIL from request body

        # NOTE: Adjusting logic according to the email you are getting

        # -----------------------------------------

        customer_email = getattr(request_user_data, "customer_email", None)

 

        if not customer_email:

            print("No customer email found")

        else:

            # -----------------------------------------

            #3. Find or create customer partner

            # -----------------------------------------

            Partner = env['res.partner'].sudo()

            partner = Partner.search([('email', '=', customer_email)], limit=1)

 

            if not partner:

                partner = Partner.create({

                    "name": getattr(request_user_data, "customer_name", customer_email),

                    "email": customer_email,

                })

            else:

                # NEW LINE → Adjust email to match external input

                partner.write({"email": customer_email})

 

            # -----------------------------------------

            #4. Add customer as follower

            # -----------------------------------------

            ticket.message_subscribe(partner_ids=[partner.id])

 

        # -----------------------------------------

        # Response

        # -----------------------------------------

        return JSONResponse(content={

            "success": "true",

            "ticket_id": ticket.id,

            "ticket_number": ticket.number,

            "detail": "Ticket created and customer subscribed",

        })

 

    except Exception as e:

        return JSONResponse(

            content={"detail": "Error processing ticket", "error": str(e)},

            status_code=500

        )


If you have any questions, feel free to reach out.


Hope this helps!


Thanks and Regards,

Email: odoo@aktivsoftware.com

0
Awatar
Odrzuć
Awatar
Pradip Rangvani
Najlepsza odpowiedź
Hi, could you please clarify whether you're referring to an internal user or a customer, and what data you're getting from the request?

If you intend to add an internal user as a follower, you need to assign the user to the user_id field. Alternatively, if you wish to add a customer as a follower, you must assign them to the partner_id field. Based on this, Odoo will automatically add them to the followers list.

0
Awatar
Odrzuć
Podoba Ci się ta dyskusja? Dołącz do niej!

Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!

Zarejestruj się
Powiązane posty Odpowiedzi Widoki Czynność
Handling Media in Odoo Helpdesk via External App Rozwiązane
ticket helpdesk media V16
Awatar
Awatar
Awatar
2
sty 26
1446
No Notification or Easy Way to Track Email Replies from Customers
ticket email helpdesk V16
Awatar
Awatar
1
mar 26
1829
Reply by email to helpdesk ticket problem Rozwiązane
ticket helpdesk
Awatar
Awatar
Awatar
3
mar 25
7655
[ODOO 11]: Creating new ticket from automated action not working Rozwiązane
python ticket automated actions helpdesk
Awatar
1
sty 22
6934
Change sender email address depending on helpdesk
python helpdesk
Awatar
0
sty 22
4347
Społeczność
  • Samouczki
  • Dokumentacja
  • Forum
Open Source
  • Pobierz
  • Github
  • Runbot
  • Tłumaczenia
Usługi
  • Hosting Odoo.sh
  • Wsparcie
  • Aktualizacja
  • Indywidualne rozwiązania
  • Edukacja
  • Znajdź księgowego
  • Znajdź partnera
  • Zostań partnerem
O nas
  • Nasza firma
  • Zasoby marki
  • Skontaktuj się z nami
  • Oferty pracy
  • Wydarzenia
  • Podcast
  • Blog
  • Klienci
  • Informacje prawne • Prywatność
  • Bezpieczeństwo Odoo
الْعَرَبيّة 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 Svenska ภาษาไทย Türkçe українська Tiếng Việt

Odoo to pakiet aplikacji biznesowych typu open source, które zaspokoją wszystkie potrzeby Twojej firmy: CRM, eCommerce, księgowość, inwentaryzacja, punkt sprzedaży, zarządzanie projektami itp.

Unikalną wartością Odoo jest to, że jest jednocześnie bardzo łatwe w użyciu i w pełni zintegrowane.

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