Showing 88 of 547 total issues
HrAward
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class HrAward(models.Model):
_name = "hr.award"
_description = "Employee Award"
_inherit = [
"mail.thread",
File hr_overtime_request_batch.py
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
# Copyright 2018 OpenSynergy Indonesia
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from datetime import datetime
Function setUp
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setUp(self, *args, **kwargs):
super(BaseCase, self).setUp()
self.obj_partner = self.env["res.partner"]
self.obj_user = self.env["res.users"]
Function _compute_attendance
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _compute_attendance(self):
obj_attendance = self.env["hr.attendance"]
for schedule in self:
criteria = [
("schedule_id", "=", schedule.id),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function onchange_general_account_id
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def onchange_general_account_id(self):
account = False
is_sale_line = False
obj_substitution = self.env["account.analytic_general_account_substitution"]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _check_att_sign_in_out
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _check_att_sign_in_out(self):
for document in self:
company = document.employee_id.company_id
if not document.schedule_id:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function setUp
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def setUp(self):
super(BaseTestHrPayslip, self).setUp()
# Object
self.obj_timesheet = self.env["hr_timesheet_sheet.sheet"]
self.obj_wd = self.env["hr.payslip.worked_days"]
Function _compute_point
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _compute_point(self):
for rec in self:
if rec.state == "reached":
if rec.line_id.reach_point_method == "fixed":
rec.point = rec.line_id.reach_point
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function onchange_pricelist_id
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def onchange_pricelist_id(self):
_super = super(HrAnalyticTimesheet, self)
_super.onchange_pricelist_id()
obj_pricelist = self.env["hr.contract_timesheet_pricelist"]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function onchange_amount
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def onchange_amount(self):
is_sale_line = False
obj_price_type = self.env["product.price.type"]
obj_precision = self.env["decimal.precision"]
result = 0.0
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _prepare_contract_update
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_contract_update(self):
self.ensure_one()
return {
"job_id": self.new_job_id and self.new_job_id.id or False,
"working_hours": self.new_working_hour_id
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function button_compute_sheet
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def button_compute_sheet(self):
self.ensure_one()
obj_hr_payslip = self.env["hr.payslip"]
context = self._context
record_ids = context["active_ids"]
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _compute_summary_info
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _compute_summary_info(self):
obj_hr_attendance = self.env["hr.attendance"]
for sheet_day in self:
first_sign_in = False
last_sign_out = False
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _prepare_contract_revert
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_contract_revert(self):
self.ensure_one()
return {
"job_id": self.previous_job_id and self.previous_job_id.id or False,
"working_hours": self.previous_working_hour_id
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_import_data
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def test_import_data(self):
# Generate Payslip
vals = {
"name": "Test Payslip",
"date_end": time.strftime("%Y-%m-%d"),
Function _batch_create_goal
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _batch_create_goal(self, user, line):
self.ensure_one()
date_start = datetime.strptime(self.date_start, "%Y-%m-%d")
date_end = False
if self.date_end:
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function test_import_data
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def test_import_data(self):
# Generate Payslip
vals = {
"name": "Test Payslip",
"date_end": time.strftime("%Y-%m-%d"),
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _prepare_new_contract
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_new_contract(self):
self.ensure_one()
return {
"employee_id": self.employee_id.id,
"job_id": self.new_job_id and self.new_job_id.id or False,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _compute_policy
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _compute_policy(self):
for holiday in self:
if self.env.user.id == SUPERUSER_ID:
holiday.confirm_ok = (
holiday.approve_ok
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function _compute_state
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _compute_state(self):
for attn in self:
if attn.start_attendance_id and attn.end_attendance_id:
attn.state = "present"
elif (attn.start_attendance_id and not attn.end_attendance_id) or (
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"