Skip to content
Health
80/100
good
  • Security25/25
    No findings
  • Activity25/25
    Last human commit 1 month ago
  • Required by5/25
    0 modules depend on it
  • Maturity25/25
    In 8 Odoo series since 10.0

Heuristic over the facts below, not an audit · How it's computed

Security findings
Grave / minor (static analysis)
Required by
0
Modules depending on it
External deps
5 pip · 0 bin
Python packages / system binaries
License
AGPL-3
No conflicts with its dependencies
Folder size
0.15 MB
Module directory on disk
Code analysis 0 migration notes 3 models 7 views 0 HTTP endpoints

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.

Dependencies

Odoo dependencies
OCA/l10n-brazil:
odoo/odoo:
- web
- bus
Python dependencies
workalendar, email-validator, erpbrasil-base>=2.4.2, num2words, phonenumbers
System dependencies
None
Required by
None

Code analysis

Extracted from the source by best-effort static analysis (no code is executed); details may be incomplete.

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'
  • 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'
Public methods (12)
  • 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 for THIS calendar. Bank holidays are the ones that close the banking system: national and local holidays (``F``) plus the banking-only ones such as Carnival and Corpus Christi (``B``). :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.
  • previous_bank_business_day(self, reference_date)
    Return the bank business day right before reference_date. Taxes anticipated to the previous working day follow the banking calendar, not the labour one: a bank holiday is not a payment day even when it is a working day for the company. :param datetime reference_date: reference date. If not provided, checks yesterday. :return datetime: previous bank business day from reference_date.
  • previous_business_day(self, reference_date)
    Return the business day right before reference_date. Mirror of :meth:`next_business_day`: strictly before, so a date that already is a business day is not returned. Callers that need "this day or the one before" must check the date first. :param datetime reference_date: reference date. If not provided, checks yesterday. :return datetime: previous 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…

Loading…