RFQ: Rename payroll models to a dedicated namespace for 20.0

Open
#324 4 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Refactor
Clarity
Mostly clear
Activity status
Active
Tech stack
python
Domain
backend

Research direction

Read the payroll models and wizards that declare the listed hr.* names, along with their references across the module. The proposal is to move those collisions to the payroll.* namespace as part of the 20.0 migration; first resolve the open namespace and migration questions with maintainers. Done means the renamed models and references coexist with Enterprise hr_payroll without merging models or tables.

Written by the indexing model from the issue text.

Description

question

Proposal: Rename payroll models to a dedicated namespace for 20.0

TL;DR — Rename the module's models from hr.* to a dedicated payroll.*
namespace (e.g. hr.payslip → payroll.payslip) so the OCA payroll engine can
coexist on a database that also has the Enterprise hr_payroll module
installed. Version 20.0 is the right moment: there is no 20.0 port yet, so the
rename can ride along with the migration instead of being a follow-up breaking
change.

Background

This module descends from the last community hr_payroll (v14) and kept the
historical model names (hr.payslip, hr.salary.rule, ...). Odoo's Enterprise
hr_payroll module defines models with the exact same names:

Model In OCA payroll In Enterprise hr_payroll
hr.payslip yes yes
hr.payslip.line yes yes
hr.payslip.input yes yes
hr.payslip.run yes yes
hr.payslip.worked_days yes yes
hr.salary.rule yes yes
hr.salary.rule.category yes yes
hr.payroll.structure yes yes

When two modules declare the same _name, Odoo merges them into a single model
and table. Today, installing payroll on an Enterprise database does not fail —
it silently produces a franken-model:

  • Conflicting state machines: OCA uses draft/verify/done/cancel,
    Enterprise uses draft/validated/paid/cancel. Selections merge; workflows
    don't.
  • Method collisions: compute_sheet, refund_sheet,
    action_payslip_done, get_worked_day_lines, _get_payslip_lines,
    get_salary_line_total, ... exist in both engines. Since neither module
    depends on the other, load order is not deterministic — whichever loads last
    silently wins.
  • Field-type clashes: name is a plain Char here vs computed there;
    line amount/total are Float vs Monetary; appears_on_payslip is
    Boolean vs Selection; category_id (m2o) vs category_ids (m2m);
    contract_id vs version_id (both → hr.version, different columns).
  • Divergent engines: OCA computes worked days from attendances/leaves;
    Enterprise requires hr.work.entry.type. OCA has contribution registers,
    hr.rule.input, range conditions and parent/child rules — none of which
    exist in Enterprise.

The result is an installation that "works" at install time but is broken in
practice — and every OCA payslip lands in the hr_payslip table, i.e. inside
the Enterprise payroll surface (including its per-employee licensing scope),
even for companies that only intend to use the community engine.

Proposal

Rename all model names that collide with hr_payroll to a dedicated
payroll.* namespace, matching the module's technical name:

Current _name Proposed _name New table
hr.payslip payroll.payslip payroll_payslip
hr.payslip.line payroll.payslip.line payroll_payslip_line
hr.payslip.input payroll.payslip.input payroll_payslip_input
hr.payslip.run payroll.payslip.run payroll_payslip_run
hr.payslip.worked_days payroll.payslip.worked_days payroll_payslip_worked_days
hr.salary.rule payroll.salary.rule payroll_salary_rule
hr.salary.rule.category payroll.salary.rule.category payroll_salary_rule_category
hr.payroll.structure payroll.structure payroll_structure
hr.contribution.register payroll.contribution.register payroll_contribution_register
hr.rule.input payroll.rule.input payroll_rule_input
hr.payslip.employees (wizard) payroll.payslip.employees —
hr.payslip.change.state (wizard) payroll.payslip.change.state —
payslip.lines.contribution.register (wizard) payroll.lines.contribution.register —
report.payroll.* abstracts unchanged (already namespaced) —
Benefits
  1. Coexistence: OCA and Enterprise engines can run side by side — e.g.
    different companies in the same database using different engines — with
    deterministic behavior and zero schema merging.
  2. Independent evolution: the OCA engine keeps features Enterprise lacks
    (contribution registers, rule inputs, range conditions, parent/child rules
    and lines) without grafting onto a schema Odoo SA changes every release.
  3. Clean scope: OCA payslips stay in OCA tables. Deployments using only
    the community engine don't create hr.payslip records, keeping the
    Enterprise payroll surface (and its associated licensing) untouched for
    deployments that don't need it.
  4. Works identically with or without hr_payroll installed — no
    runtime detection or delegation hacks.
Open questions
  1. Namespace choice: payroll.* (module name, proposed here) vs another
    prefix?
  2. Any objection to landing this as part of the 20.0 migration?
Dominant language
Python
Stars
124
Forks
202
Avg merge
21m
Merged PRs (30d)
1

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from OCA/payroll

All issues in OCA/payroll

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.