l10n_it_fatturapa/models/company.py
Consider simplifying this complex logical expression. Open
Open
if company_id:
company = self.pool.get('res.company').browse(
cr, uid, company_id, context=context)
default_sequence = self.pool.get('ir.sequence').search(cr, uid, [
('code', '=', 'account.invoice.fatturapa')
Function onchange_company_id
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
Open
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
res = super(AccountConfigSettings, self).onchange_company_id(
cr, uid, ids, company_id, context=context)
if company_id:
company = self.pool.get('res.company').browse(
- 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_company_id
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
Function _check_fatturapa_sequence_id
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
Open
def _check_fatturapa_sequence_id(self):
for company in self:
if company.fatturapa_sequence_id:
journal = self.env['account.journal'].search([
('sequence_id', '=', company.fatturapa_sequence_id.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"