Skip to Content
Odoo เมนู
  • ลงชื่อเข้าใช้
  • ทดลองใช้ฟรี
  • แอป
    การเงิน
    • ระบบบัญชี
    • ระบบการออกใบแจ้งหนี้
    • ระบบบัญชีรายจ่าย
    • ระบบการจัดการข้อมูลผ่านสเปรดชีต (BI)
    • เอกสาร
    • ระบบลงลายเซ็น
    การขาย
    • ลูกค้าสัมพันธ์
    • การขาย
    • POS ร้านค้า
    • POS ร้านอาหาร
    • ระบบสมัครสมาชิก
    • การเช่า
    การจัดการเว็บไซต์
    • เครื่องมือสร้างเว็บไซต์
    • ระบบการขายออนไลน์
    • บล็อก
    • ฟอรั่ม
    • ไลฟ์แชท
    • ระบบการอบรมออนไลน์
    ซัพพลายเชน
    • คลังสินค้า
    • ระบบการผลิต
    • PLM
    • ระบบการจัดซื้อ
    • การซ่อมบำรุง
    • ระบบจัดการคุณภาพ
    ทรัพยากรบุคคล
    • ข้อมูลพนักงาน
    • ระบบสรรหาบุคลากร
    • ระบบการลา
    • การประเมิน
    • ระบบการแนะนำพนักงาน
    • ระบบจัดการยานพาหนะ
    การตลาด
    • โซเชียลมาร์เก็ตติ้ง
    • การตลาดผ่านอีเมล
    • ระบบการตลาดผ่าน SMS
    • ระบบการจัดงานอีเวนต์
    • การตลาดแบบอัตโนมัติ
    • ระบบแบบสำรวจ
    การบริการ
    • โปรเจกต์
    • ระบบบันทึกเวลา
    • ระบบการจัดการบริการภาคสนาม
    • ระบบดูแลช่วยเหลือ
    • การวางแผน
    • การนัดหมาย
    ประสิทธิผล
    • ระบบแสดงความคิดเห็น
    • ระบบการอนุมัติ
    • ไอโอที
    • VoIP
    • คลังข้อมูล
    • WhatsApp
    แอปพลิเคชันของบุคคลที่สาม Odoo สตูดิโอ แพลตฟอร์มคลาวด์ของ Odoo
  • อุตสาหกรรม
    การค้าปลีก
    • ร้านขายหนังสือ
    • ร้านขายเสื้อผ้า
    • ร้านขายเฟอร์นิเจอร์
    • ร้านขายของชำ
    • ร้านขายฮาร์ดแวร์
    • ร้านขายของเล่น
    Food & Hospitality
    • บาร์และผับ
    • ร้านอาหาร
    • อาหารฟาสต์ฟู้ด
    • Guest House
    • ตัวแทนจำหน่ายเครื่องดื่ม
    • Hotel
    อสังหาริมทรัพย์
    • Real Estate Agency
    • บริษัทสถาปัตยกรรม
    • บริษัทรับเหมา
    • การจัดการอสังหาริมทรัพย์
    • การจัดสวน
    • สมาคมเจ้าของอสังหาริมทรัพย์
    ปรึกษา
    • สำนักงานบัญชี
    • Odoo พาร์ทเนอร์
    • เอเจนซี่การตลาด
    • สำนักงานกฎหมาย
    • บริการสรรหาบุคลากร
    • การตรวจสอบและการรับรอง
    ระบบการผลิต
    • Textile
    • เหล็ก
    • เฟอร์นิเจอร์
    • อาหาร
    • Brewery
    • ของขวัญขององค์กร
    สุขภาพ & ฟิตเนส
    • ชมรมกีฬา
    • ร้านขายแว่นตา
    • ฟิตเนส
    • ผู้ประกอบวิชาชีพด้านสุขภาพ
    • ร้านขายยา
    • ร้านทำผม
    Trades
    • ช่างซ่อม
    • ฮาร์ดแวร์และการสนับสนุนด้านไอที
    • ระบบพลังงานแสงอาทิตย์
    • ช่างทำรองเท้า
    • บริการทำความสะอาด
    • HVAC Services
    อื่น ๆ
    • Nonprofit Organization
    • สำนักงานสิ่งแวดล้อม
    • ร้านเช่าป้ายโฆษณา
    • การถ่ายภาพ
    • ร้านเช่าจักรยาน
    • ตัวแทนจำหน่ายซอฟต์แวร์
    Browse all Industries
  • คอมมูนิตี้
    ศึกษา
    • บทเรียน
    • เอกสารกำกับโปรแกรม
    • การรับรอง
    • การฝึกอบรม
    • บล็อก
    • พอดแคสต์
    เพิ่มศักยภาพให้กับการศึกษา
    • โปรแกรมการศึกษา
    • Scale Up! Business Game
    • เยี่ยมชม Odoo
    รับซอฟต์แวร์
    • ดาวน์โหลด
    • เปรียบเทียบรุ่น
    • เผยแพร่
    ทำงานร่วมกัน
    • Github
    • ฟอรั่ม
    • ระบบการจัดงานอีเวนต์
    • การแปล
    • ร่วมเป็นพาร์ทเนอร์
    • Services for Partners
    • ลงทะเบียนเพื่อสร้างบัญชีบริษัทของคุณ
    รับบริการ
    • ค้นหาพาร์ทเนอร์
    • ค้นหานักบัญชี
    • พบกับที่ปรึกษา
    • บริการติดตั้งระบบเพื่อใช้งาน
    • ข้อมูลอ้างอิงลูกค้า
    • การสนับสนุน
    • อัปเกรด
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    รับการสาธิต
  • ราคา
  • ช่วยเหลือ

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

  • ลูกค้าสัมพันธ์
  • e-Commerce
  • ระบบบัญชี
  • สินค้าคงคลัง
  • PoS
  • โปรเจกต์
  • MRP
All apps
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
All Posts คน เหรียญรางวัล
แท็ก (View all)
odoo accounting v14 pos v15
เกี่ยวกับฟอรั่มนี้
ช่วยเหลือ

How to add user email as follower when creating Odoo ticket

ติดตาม

รับการแจ้งเตือนเมื่อมีกิจกรรมในโพสต์นี้

คำถามนี้ถูกตั้งค่าสถานะ
pythontickethelpdeskV16
2 ตอบกลับ
163 มุมมอง
อวตาร
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
อวตาร
ละทิ้ง
nhavna

Informative, i will copying for future.

Hemanth
ผู้เขียน

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

อวตาร
Jainesh Shah(Aktiv Software)
คำตอบที่ดีที่สุด

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
อวตาร
ละทิ้ง
อวตาร
Pradip Rangvani
คำตอบที่ดีที่สุด
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
อวตาร
ละทิ้ง
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!

สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!

ลงชื่อ
Related Posts ตอบกลับ มุมมอง กิจกรรม
Reply by email to helpdesk ticket problem แก้ไขแล้ว
ticket helpdesk
อวตาร
อวตาร
อวตาร
3
มี.ค. 25
5982
[ODOO 11]: Creating new ticket from automated action not working แก้ไขแล้ว
python ticket automated actions helpdesk
อวตาร
1
ม.ค. 22
5875
Change sender email address depending on helpdesk
python helpdesk
อวตาร
0
ม.ค. 22
3618
How to get first help desk message from the customer in the create method?
ticket helpdesk
อวตาร
0
พ.ค. 21
4833
How to Create a Custom Autogenerating Ticket Number in Odoo Helpdesk (e.g., INC-12345)? แก้ไขแล้ว
ticket helpdesk FieldService
อวตาร
อวตาร
1
เม.ย. 25
3347
คอมมูนิตี้
  • บทเรียน
  • เอกสารกำกับโปรแกรม
  • ฟอรั่ม
โอเพนซอร์ส
  • ดาวน์โหลด
  • Github
  • Runbot
  • การแปล
บริการ
  • โฮสติ้ง odoo.sh เซิร์ฟเวอร์
  • การสนับสนุน
  • อัปเกรด
  • การพัฒนาที่กำหนดเอง
  • การศึกษา
  • ค้นหานักบัญชี
  • ค้นหาพาร์ทเนอร์
  • ร่วมเป็นพาร์ทเนอร์
เกี่ยวกับเรา
  • บริษัทของเรา
  • ทรัพย์สินในรูปของเครื่องหมายการค้า
  • ติดต่อเรา
  • งาน
  • ระบบการจัดงานอีเวนต์
  • พอดแคสต์
  • บล็อก
  • ลูกค้า
  • กฎหมาย • ความเป็นส่วนตัว
  • ความปลอดภัย
الْعَرَبيّة 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 เป็นชุดแอปธุรกิจแบบเปิดที่ครอบคลุมทุกความต้องการของบริษัทของคุณ อาธิ CRM eCommerce ระบบบัญชี ระบบสินค้าคงคลัง ระบบการขายหน้าร้าน โปรเจกต์ และ อีกมากมาย

ความเหนือกว่าอันเป็นเอกลักษณ์ของ 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