Repository
OCA/l10n-brazil · module folder · Try on Runboat
Module version
2.0.0
Category
Uncategorized
Folder size
0.15 MB
License
AGPL-3
Application
No
Auto-installable
No
Website
https://github.com/OCA/l10n-brazil
Last tracking update
2026-08-07 09:06:24
Authors
Odoo Community Association (OCA), KMEE
Maintainers
Odoo Community Association (OCA), KMEE
Committers
Raphaël Valyi, Weblate, OCA-git-bot, oca-ci, Cristiano Mafra Junior
Odoo dependencies
OCA/l10n-brazil:
odoo/odoo:
- web
- bus
Python dependencies
workalendar, email-validator, erpbrasil.base, num2words, phonenumbers
System dependencies
None
Required by
None
Description
This module extends the core resource module to add data for Brazil. It
defines a Brazilian calendar and some tools to compute dates used in
financial and payroll modules.

Code Analysis

Views touched (7)
XML IDNameModelTypeStatus
resource_calendar_form_view resource.calendar.form (in l10n_br_resource) resource.calendar calendar Inherits resource.resource_calendar_form
resource_calendar_leaves_form_view resource.calendar.leaves.form (in l10n_br_resource) resource.calendar.leaves calendar Inherits resource.resource_calendar_leave_form
resource_calendar_leaves_search_view resource.calendar.leaves.search (in l10n_br_resource) resource.calendar.leaves calendar Inherits resource.view_resource_calendar_leaves_search
resource_calendar_leaves_tree_view resource.calendar.leaves.tree (in l10n_br_resource) resource.calendar.leaves calendar Inherits resource.resource_calendar_leave_tree
resource_calendar_search_view resource.calendar.search (in l10n_br_resource) resource.calendar calendar Inherits resource.view_resource_calendar_search
resource_calendar_tree_view resource.calendar.tree (in l10n_br_resource) resource.calendar calendar Inherits resource.view_resource_calendar_tree
view_workalendar_holiday_import Import Holidays wizard.workalendar.holiday.import form New
HTTP endpoints (0)

No HTTP endpoints found for this module.

Models touched (3)

New fields (7)
  • child_ids One2many → resource.calendar
    string='Child Calendar' args: 'resource.calendar', 'parent_id'
  • country_id Many2one → res.country
    args: 'res.country', 'Country'
  • l10n_br_city_id Many2one → res.city
    domain="[('state_id','=',state_id)]" args: 'res.city', 'Municipality'
  • leave_ids Many2many → resource.calendar.leaves
    comodel_name='resource.calendar.leaves' compute='_compute_leave_ids'
  • parent_id Many2one → resource.calendar
    index=True ondelete='restrict' string='Parent Calendar' args: 'resource.calendar'
  • parent_path Char
    index=True
  • state_id Many2one → res.country.state
    domain="[('country_id','=',country_id)]" args: 'res.country.state', 'State'
Public methods (10)
  • count_business_days(self, start_date, end_date)
    Count the number of business days in a given period. :param datetime start_date: start of the period. :param datetime end_date: end of the period. :return int: number of business days.
  • get_base_days(self, date_from, date_to, commercial_month=True)
    Calculate the number of payable days in a given time interval. :param datetime date_from: start date of the interval. :param datetime date_to: end date of the interval. :param bool commercial_month: if True, uses 30-day commercial month. :return int: number of payable days.
  • get_leave_intervals(self, resource_id=None, start_datetime=None, end_datetime=None)
    Get the leaves of the calendar. Leaves can be filtered on the resource, the start datetime or the end datetime. :param int resource_id: the id of the resource to take into account when computing the leaves. If not set, only general leaves are computed. If set, generic and specific leaves are computed. :param datetime start_datetime: if provided, do not take into account leaves ending before this date. :param datetime end_datetime: if provided, do not take into account leaves beginning after this date. :return list leaves: list of tuples (start_datetime, end_datetime) of leave intervals
  • is_bank_business_day(self, date)
    Check if a date is a bank business day. :param datetime date: date to check. If not provided, checks today. :return boolean: True if it is a bank business day, False otherwise.
  • is_bank_holiday(self, reference_date)
    Check if a date is a bank holiday. :param datetime reference_date: date to check. If not provided, checks today. :return int: number of matching bank holiday leaves (> 0 if it is a bank holiday, 0 otherwise).
  • is_business_day(self, date)
    Check if a date is a business day. :param datetime date: date to check. If not provided, checks today. :return boolean: True if it is a business day, False otherwise.
  • is_extended_holiday(self, reference_date)
    Check if a date is a bridged/extended holiday (feriado emendado). A day is considered bridged when it falls between a holiday and a weekend. :param datetime reference_date: date to check. If not provided, checks today. :return boolean: True if the date is a bridged holiday, False otherwise.
  • is_holiday(self, date)
    Check if a date is a holiday. :param datetime date: date to check. If not provided, checks today. :return boolean: True if the date is a holiday, False otherwise.
  • next_bank_business_day(self, reference_date)
    Return the next bank business day after reference_date. :param datetime reference_date: reference date. If not provided, checks tomorrow. :return datetime: next bank business day from reference_date.
  • next_business_day(self, reference_date)
    Return the next business day after reference_date. :param datetime reference_date: reference date. If not provided, checks tomorrow. :return datetime: next business day from reference_date.

New fields (5)
  • country_id Many2one → res.country
    related='calendar_id.country_id' string='Country' args: 'res.country'
  • coverage Selection
    selection=HOLIDAY_COVERAGE_LABELS
  • l10n_br_city_id Many2one → res.city
    domain="[('state_id','=',state_id)]" related='calendar_id.l10n_br_city_id' args: 'res.city', 'Municipality'
  • leave_type Selection
    selection=HOLIDAY_TYPE_LABELS string='Type'
  • state_id Many2one → res.country.state
    domain="[('country_id','=',country_id)]" related='calendar_id.state_id' args: 'res.country.state', 'State'
Public methods (0)

No public methods.

New fields (5)
  • calendar_id Many2one → resource.calendar
    string='Work Time' args: 'resource.calendar'
  • end_date Date
    compute='_compute_end_date'
  • interval_number Integer
    default=1 string='Interval'
  • interval_type Selection
    default='years' required=True string='Type' args: [('days', 'Day(s)'), ('weeks', 'Week(s)'), ('months', 'Month(s)'), ('years', 'Year(s)')]
  • start_date Date
    default=fields.Date.today readonly=True
Public methods (6)
  • get_calendar_for_city(self, holiday)
  • get_calendar_for_country(self)
  • get_calendar_for_state(self, holiday)
  • get_country_from_calendar(self, holiday)
  • get_state_from_calendar(self, holiday)
  • holiday_import(self)

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…

Loading…