Skip to content

[17.0][IMP] hr_course: add reference code to courses and schedules#1580

Open
miquelrosell99 wants to merge 1 commit into
OCA:17.0from
miquelrosell99:17.0-add-hr_course-code
Open

[17.0][IMP] hr_course: add reference code to courses and schedules#1580
miquelrosell99 wants to merge 1 commit into
OCA:17.0from
miquelrosell99:17.0-add-hr_course-code

Conversation

@miquelrosell99
Copy link
Copy Markdown

This PR adds a reference code field to both `hr.course` and `hr.course.schedule`.

Changes:

  • Added `code` (Reference) field to `hr.course` and `hr.course.schedule`
  • Auto-generates codes via `ir.sequence` on create if not provided
  • Sequences are defined with `noupdate=1` following Odoo core practices:
    • Courses: prefix `C`, padding 5 (e.g., `C00001`)
    • Schedules: prefix `CS`, padding 5 (e.g., `CS00001`)
  • Added unique SQL constraints on `code` for both models
  • Updated views (form, tree, search) to display the reference
  • Added `name_search` support and `display_name` formatting (`[CODE] Name`)
  • Added tests for auto-generation, uniqueness, and search by code

This aligns with standard Odoo patterns used in `sale.order`, `purchase.order`, etc.

@miquelrosell99 miquelrosell99 force-pushed the 17.0-add-hr_course-code branch 2 times, most recently from 4cf16fb to 7d505c6 Compare May 28, 2026 10:10
@miquelrosell99 miquelrosell99 force-pushed the 17.0-add-hr_course-code branch from 7d505c6 to f6ebcd0 Compare May 28, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants