Odoo 20.0 Community · Persistent

hr.time.rule: fields, relations and API

The hr.time.rule model ("Time Rule") is a persistent model declared by the Work Entries module, then extended by 3 other modules. It exposes 40 fields, 34 of them declared directly on the model; 2 fields from other models point to it. Below you will find every field with its technical name, type, label and relations, followed by an Odoo 20 JSON-2 API call.

Model identity

Technical name
hr.time.rule
Label
Time Rule
Type
Persistent (models.Model)
SQL table
hr_time_rule
Origin module
Work Entries (hr_work_entry)
Extended by
hr_attendance, hr_holidays, hr_holidays_attendance
Default order (_order)
sequence, id

Model fields

34 own fields, 0 inherited from mixins and 6 automatic ORM fields. Click a name to get a direct link to that field.

40 of 40 fields shown

Technical nameLabelTypeDetails
activeActiveboolean
allocation_type_idAllocate tomany2one

added by Time Off (hr_holidays)

amount_rateSalary Ratefloat
computed, stored
apply_fridayApply Fridayboolean
apply_mondayApply Monday

Define a condition based on the timing of the time entry.

boolean
apply_on_public_holidaysApply On Public Holidaysboolean
apply_saturdayApply Saturdayboolean
apply_sundayApply Sundayboolean
apply_thursdayApply Thursdayboolean
apply_tuesdayApply Tuesdayboolean
apply_wednesdayApply Wednesdayboolean
calendar_sourceCalendar Source

Which schedule to use as the expected-hours baseline.

selection
computed, stored

Values: employee (Employee Schedule), reference (Reference Schedule)

company_idCompanymany2one
condition_labelConditionchar
computed
condition_work_entry_type_idsTime Type

If set, only the selected types will be considered by this rule.

many2many
required
country_codeCountry Codechar

related: country_id.code

country_idCountrymany2one
computed, stored
country_work_entry_type_idsCountry Work Entry Typemany2many
computed
descriptionDescriptiontext
employee_domainEmployees

The rule will automatically apply to all time entries for matching employees.

char
employee_toleranceEmployee Tolerancefloat
employer_toleranceEmployer Tolerancefloat
expected_hoursUsual work hoursfloat
computed, stored
leave_compensation_rateAllocate %

Leave allocated or taken at this rate of the excess or deficit. 100% = 1:1.

float

added by Time Off (hr_holidays)

nameNamechar
required
quantity_periodQuantity Periodselection
computed, stored

Values: day (Day), week (Week)

resource_calendar_idSchedulemany2one
sequenceSequenceinteger
threshold_operatorThreshold Operatorselection
required

Values: exceed (Exceed), less_than (Less than)

timing_startFromfloat
timing_stopTofloat
week_startWeek Starts Onselection

Values: 0 (Monday), 1 (Tuesday), 2 (Wednesday), 3 (Thursday), 4 (Friday), 5 (Saturday), 6 (Sunday)

work_entry_type_idSet Excess to

Define a time type that will be created to count the amount of time in excess or missing.

many2one
working_hours_modeWorking Hours Mode

Define a condition based on the quantity of work made by the employee on a specific period of time.

selection
required

Values: schedule_day (the daily schedule), schedule_week (the weekly schedule), day (per day), week (per week)

create_dateCreated ondatetime
read-onlyautomatic
create_uidCreated bymany2one
read-onlyautomatic
display_nameDisplay Namechar
read-onlycomputedautomatic
idIDinteger
read-onlyautomatic
write_dateLast Updated ondatetime
read-onlyautomatic
write_uidLast Updated bymany2one
read-onlyautomatic

Relations

Models linked from this model

Fields of other models pointing here

Reading this model through the API

Odoo 20 JSON-2 API call reading the first five records with real fields of the model. Replace the instance, database and API key with your own.

curl
curl -X POST "https://your-instance.odoo.com/json/2/hr.time.rule/search_read" \
  -H "Authorization: bearer $ODOO_API_KEY" \
  -H "X-Odoo-Database: your-db" \
  -H "Content-Type: application/json" \
  -d '{"domain":[],"fields":["name","threshold_operator","working_hours_mode","allocation_type_id","company_id"],"limit":5}'
Python (requests)
import requests

BASE_URL = "https://your-instance.odoo.com/json/2"
headers = {"Authorization": f"bearer {API_KEY}", "X-Odoo-Database": "your-db"}

res = requests.post(
    f"{BASE_URL}/hr.time.rule/search_read",
    headers=headers,
    json={"domain": [], "fields": ["name","threshold_operator","working_hours_mode","allocation_type_id","company_id"], "limit": 5},
)
res.raise_for_status()
print(res.json())
  • External API access requires Odoo's Custom plan.
  • XML-RPC and JSON-RPC will be removed in Odoo 22 (fall 2028): use JSON-2.
  • The access rights and record rules of the key's user apply.

Cite this tool

Writing a tutorial, internal documentation or a forum answer? Copy this link to send your readers to the up-to-date reference.

<a href="https://aidoo.ai/en/outils/explorateur-modeles-odoo/hr-time-rule">hr.time.rule (Odoo 20.0)</a>

Sources

Data verified on September 25, 2026 · Odoo 20.0 Community

Have an Odoo project, or want to put your ERP to work with AI? Let's talk

Implementation, custom module development, connecting Claude or ChatGPT to your data: tell us about your context and we will reply within 24 business hours.