Bỏ qua để đến Nội dung
Soul of NOTE
  • Khóa học
  • Check-in
    • NOTE
    • Headspace Vietnam
    • Fosllea
  • Diễn đàn
  • Company
    • Blog
    • Success Stories
  • 0
  • 0
  • Đăng nhập
Soul of NOTE
  • 0
  • 0
    • Khóa học
    • Check-in
      • NOTE
      • Headspace Vietnam
      • Fosllea
    • Diễn đàn
    • Company
      • Blog
      • Success Stories
  • Đăng nhập

[T17] T17 — E-Learning Certification: Cách gắn Survey tốt nghiệp vào khoá học

  • Tất cả blog
  • Knowledge Base
  • [T17] T17 — E-Learning Certification: Cách gắn Survey tốt nghiệp vào khoá học
  • 15 tháng 3, 2026 bởi
    [T17] T17 — E-Learning Certification: Cách gắn Survey tốt nghiệp vào khoá học
    Viet Nguyen
    ⚠️ HIGH  |  Category: Odoo Tips  |  ID: T17  |  Owner: CEO

    T17 — E-Learning Certification: Cách gắn Survey tốt nghiệp vào khoá học

    Tóm tắt

    Odoo 19 E-Learning certification KHÔNG gắn survey vào slide.channel — phải tạo slide.slide với slide_category='certification' + survey_id. Ngoài ra, survey.question.answer.answer_score mặc định = 0.0 kể cả đáp án đúng → NV luôn fail nếu không fix.

    Chi tiết

    Issue 1: slide.channel KHÔNG có field survey_id

    Nhiều tài liệu cũ (Odoo 14-16) nói slide.channel có survey_id để gắn certification survey. Odoo 19 không có field này.

    Certification gắn qua slide.slide bên trong channel:

    ĐÚNG — tạo/update slide thành certification slide

    models.execute_kw(db, uid, key, 'slide.slide', 'write', [[slide_id], { 'slide_category': 'certification', 'slide_type': 'certification', 'survey_id': survey_id, # link tới survey.survey }])

    Computed fields trên slide.channel sau khi gắn:

  • nbr_certification: đếm slides có slide_category='certification'
  • members_certified_count: đếm members đã pass certification
  • members_completed_count: đếm members hoàn thành 100% slides
  • Issue 2: survey.survey.certification mặc định = False

    Tạo survey xong PHẢI bật certification=True thủ công:

    models.execute_kw(db, uid, key, 'survey.survey', 'write', [[survey_id], {
        'certification': True,
    }])
    

    Nếu không bật, survey chỉ là form khảo sát — không cấp badge, không track trên khoá học.

    Issue 3: answer_score = 0.0 kể cả đáp án đúng (CRITICAL)

    survey.question.answer có field is_correct=True nhưng answer_score mặc định = 0.0. Khi survey dùng scoring_type='scoring_with_answers', score tính bằng tổng answer_score, KHÔNG phải đếm is_correct.

    → NV trả lời đúng hết vẫn được 0% và fail.

    Fix: set answer_score cho tất cả đáp án đúng

    answers = models.execute_kw(db, uid, key, 'survey.question.answer', 'search_read', [[('question_id.survey_id', '=', survey_id), ('is_correct', '=', True)]], {'fields': ['id', 'answer_score'], 'limit': 0})

    for a in answers: if a['answer_score'] == 0.0: models.execute_kw(db, uid, key, 'survey.question.answer', 'write', [[a['id']], {'answer_score': 1.0}])

    Issue 4: Fields KHÔNG tồn tại trong Odoo 19

    | Model | Field bị lỗi | Thay thế | |-------|-------------|----------| | survey.survey | state | KHÔNG có — survey luôn active | | slide.channel.partner | completed (boolean) | member_status ('joined', 'ongoing', 'completed') + completion (integer %) |

    Issue 5: JSON-2 trả 500 cho survey.survey

    survey.survey KHÔNG hoạt động qua JSON-2 endpoint — phải dùng XML-RPC.

    SAI — 500 Internal Server Error

    requests.post(f'{url}/json/2/survey.survey/search_read', ...)

    ĐÚNG — XML-RPC

    models.execute_kw(db, uid, key, 'survey.survey', 'search_read', [[]], { 'fields': ['title', 'scoring_type', 'certification'], 'limit': 0, })

    Cấu trúc đúng — E-Learning với Certification

    slide.channel (khoá học)
    ├── slide.slide (article) — Bài 1 + quiz mini
    ├── slide.slide (article) — Bài 2 + quiz mini
    ├── ...
    └── slide.slide (certification) ← slide_category='certification'
        └── survey_id → survey.survey ← certification=True
                        ├── survey.question (20 câu)
                        │   └── survey.question.answer ← answer_score=1.0 cho đáp án đúng
                        └── scoring_success_min=70%
    

    Flow NV: 1. Học hết slides → completion=100%, member_status='completed' 2. Click certification slide → mở survey 3. Pass ≥ 70% → survey_certification_success=True → members_certified_count +1 4. Fail → thi lại (tuỳ is_attempts_limited)

    Ảnh hưởng

  • Ai bị ảnh hưởng: Tất cả khoá e-learning có quiz tốt nghiệp (Onboarding, future tracks)
  • Mức độ: high — NV hoàn thành khoá nhưng KHÔNG BIẾT đã tốt nghiệp hay chưa
  • Tần suất gặp: Mỗi khi tạo khoá học mới với certification
  • Cách xử lý / Phòng tránh

    1. Tạo khoá mới: Luôn tạo 1 slide slide_category='certification' ở cuối 2. Survey: Luôn bật certification=True + set scoring_success_min 3. Đáp án: Verify answer_score > 0 cho mọi đáp án đúng — KHÔNG tin is_correct alone 4. API: Dùng XML-RPC cho survey.survey — JSON-2 trả 500 5. Checklist tạo khoá: - [ ] Channel tạo → slides tạo → quiz mini mỗi bài - [ ] Survey tốt nghiệp tạo + certification=True + scoring - [ ] Đáp án đúng có answer_score > 0 - [ ] Slide certification tạo + link survey_id - [ ] Test 1 NV: học → thi → certified

    Bằng chứng / Tham khảo

  • Session 11 (2026-03-14): Onboarding channel 14, survey 29, slide 963
  • Trước fix: 2 NV (Nhi, Quyên) completion=100% nhưng certified=False, score=0%
  • Sau fix: certification flow hoạt động, cần thi lại để ghi nhận
  • Liên quan

  • [T16](T16_elearning_api_gotchas.md) — E-Learning API gotchas (vals_list, enrollment)
  • [T08](T08-odoo19-multicompany-fields.md) — JSON-2 fail pattern + XML-RPC fallback

  • 📚 Published from Company Knowledge Base — T17
    Last updated: 2026-03-14
    Review by: 2026-06-12

    trong Knowledge Base
    # Odoo Tips
    [T16] T16 — Odoo 19 E-Learning API Gotchas



    Bản quyền thuộc CÔNG TY TNHH NOTE
    Cung cấp bởi Odoo - Một nền tảng thương mại điện tử mã nguồn mở hàng đầu