Showing 13 of 31 total issues
Function find_or_create
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def find_or_create(self, company_id, sale_tax_ids, purchase_tax_ids):
at_obj = self.env['account.tax']
# Search for existing Fiscal Classification
fcs = self.search(
- 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 action_create
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def action_create(self):
obj_tax = self.env['account.tax']
obj_tax_template = self.env['account.tax.template']
obj_fc = self.env['account.product.fiscal.classification']
obj_fc_template = self.env[
- 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 generate_eu_oss_taxes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def generate_eu_oss_taxes(self):
oss_rate = self.env["oss.tax.rate"]
account_tax = self.env["account.tax"]
selected_taxes = []
fpos_obj = self.env["account.fiscal.position"]
- 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
Consider simplifying this complex logical expression. Open
if len(sale_tax_ids) == 0 and len(purchase_tax_ids) == 0:
name = _('No taxes')
elif len(purchase_tax_ids) == 0:
name = _('No Purchase Taxes - Sale Taxes: ')
for tax in at_obj.browse(sale_tax_ids):
Function fields_view_get
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def fields_view_get(
Function _get_invoice_vals
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _get_invoice_vals(self, cr, uid, key, inv_type, journal_id, move,
Function fiscal_position_map
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fiscal_position_map(self, **kwargs):
result = {'fiscal_position': False}
partner_id = kwargs.get('partner_id')
company_id = kwargs.get('company_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 _template_vals
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _template_vals(self, cr, uid, template, company_id,
Function onchange_partner_id
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def onchange_partner_id(self, type, partner_id, date_invoice=False,
Function onchange_company_id
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def onchange_company_id(self, company_id, part_id, type,
Function search
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def search(self, args, offset=0, limit=None, order=None, count=False):
Function create_fiscal_classification_from_product_template
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def create_fiscal_classification_from_product_template(cr, registry):
"""Generate Fiscal Classification for each combinations of Taxes set
in product"""
env = api.Environment(cr, SUPERUSER_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 action_create
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def action_create(self):
obj_fpr_temp = self.env['account.fiscal.position.rule.template']
company_id = self.company_id.id
fsc_rule_template = obj_fpr_temp.search([])
- 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"