Showing 165 of 421 total issues
Function _prepare_eletronic_invoice_values
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_eletronic_invoice_values(self):
res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
if self.model == '001':
tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
dt_emissao = datetime.strptime(self.data_emissao, DTFT)
- 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 _create_statement
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _create_statement(self, stmt_values, account_number):
BankStatement = self.env['account.bank.statement']
BankStatementLine = self.env['account.bank.statement.line']
filtered_values = []
for transaction in stmt_values['transactions']:
- 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_icms
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _compute_icms(self, price_base, ipi_value):
icms_tax = self.filtered(lambda x: x.domain == 'icms')
if not icms_tax:
return []
vals = self._tax_vals(icms_tax)
- 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_eletronic_invoice_values
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_eletronic_invoice_values(self):
res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
if self.model == '008':
tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
dt_emissao = datetime.strptime(self.data_emissao, DTFT)
- 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_eletronic_invoice_values
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_eletronic_invoice_values(self):
res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
if self.model == '002':
tz = pytz.timezone(self.env.user.partner_id.tz) or pytz.utc
dt_emissao = datetime.strptime(self.data_emissao, DTFT)
- 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 create
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def create(self, cr, uid, ids, datas, context=False):
env = odoo.api.Environment(cr, uid, context or {})
active_ids = context.get('active_ids')
active_model = context.get('active_model')
- 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_price
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _compute_price(self):
currency = self.invoice_id and self.invoice_id.currency_id or None
price = self.price_unit * (1 - (self.discount or 0.0) / 100.0)
valor_bruto = self.price_unit * self.quantity
Consider simplifying this complex logical expression. Open
if self.commercial_partner_id:
partner = self.commercial_partner_id
dest = {
'tipo': partner.company_type,
'cnpj_cpf': re.sub('[^0-9]', '', partner.cnpj_cpf or ''),
Consider simplifying this complex logical expression. Open
if responsavel_tecnico:
if len(responsavel_tecnico.child_ids) == 0:
raise UserError(
"Adicione um contato para o responsável técnico!")
Function get_bank
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_bank(bank):
if bank == '237':
from .bancos.bradesco import Bradesco240
return Bradesco240
elif bank == '756':
- 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_cnab
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _check_cnab(self, cnab_file):
if int(base64.b64decode(cnab_file)[0:3]) != int(
self.journal_id.bank_id.bic):
raise UserError(u"O banco do arquivo não corresponde ao\
banco do Diário Contábil!")
- 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 set_result
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def set_result(self, zip_obj=None):
if zip_obj:
zip_code = zip_obj.zip
if len(zip_code) == 8:
zip_code = '%s-%s' % (zip_code[0:5], zip_code[5:8])
- 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 modulo10
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def modulo10(num):
if not isinstance(num, basestring):
raise TypeError
soma = 0
peso = 2
- 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_cancel
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def action_cancel(self):
res = super(AccountInvoice, self).action_cancel()
for item in self:
edocs = self.env['invoice.eletronic'].search(
[('invoice_id', '=', item.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_despesas_frete_seguro
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _onchange_despesas_frete_seguro(self):
amount = 0
for line in self.order_line:
if line.product_id.fiscal_type == 'product':
amount += line.valor_bruto - line.valor_desconto
- 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 modulo11
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def modulo11(self, num, base=9, r=0):
if not isinstance(num, basestring):
raise TypeError
soma = 0
fator = 2
- 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_cnpj_cpf
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _check_cnpj_cpf(self):
check_cnpj_cpf = True
if self.cnpj_cpf:
if self.cpfcnpj_type == 'cnpj':
if not fiscal.validate_cnpj(self.cnpj_cpf):
- 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 get_worked_day_lines
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_worked_day_lines(self, contract_ids, date_from, date_to):
res = super(HrPayslip, self).get_worked_day_lines(
contract_ids, date_from, date_to)
for contract in contract_ids:
leaves = self.env['hr.holidays'].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 _invoice_total
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _invoice_total(self):
account_invoice_report = self.env['account.invoice.report']
if not self.ids:
self.total_invoiced = 0.0
return True
- 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 seach_by_address
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def seach_by_address(self, obj, country_id=False, state_id=False,