Showing 165 of 421 total issues
Function _compute_amount
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _compute_amount(self):
super(AccountInvoice, self)._compute_amount()
lines = self.invoice_line_ids
self.total_tax = sum(l.price_tax for l in lines)
self.icms_base = sum(l.icms_base_calculo for l in lines)
Function action_cancel_document
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def action_cancel_document(self, context=None, justificativa=None):
if self.model not in ('55', '65'):
return super(InvoiceEletronic, self).action_cancel_document(
justificativa=justificativa)
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _prepare_eletronic_invoice_values(self):
res = super(InvoiceEletronic, self)._prepare_eletronic_invoice_values()
if self.model not in ('55', '65'):
return res
Function validate_ie_pe
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_ie_pe(inscr_est):
inscr_est = re.sub('[^0-9]', '', inscr_est)
# verificando o tamanho da inscrição estadual
if (len(inscr_est) != 9) and (len(inscr_est) != 14):
- 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_difal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _compute_difal(self, price_base, ipi_value):
icms_inter = self.filtered(lambda x: x.domain == 'icms_inter')
icms_intra = self.filtered(lambda x: x.domain == 'icms_intra')
icms_fcp = self.filtered(lambda x: x.domain == 'fcp')
if not icms_inter or not icms_intra:
- 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_tax_id
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _compute_tax_id(self):
res = super(SaleOrderLine, self)._compute_tax_id()
for line in self:
line._update_tax_from_ncm()
fpos = line.order_id.fiscal_position_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"
Further reading
Function validate_ie_sp
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_ie_sp(inscr_est):
def gera_digito_sp(nova_ie, prod):
r = sum([x * y for (x, y) in zip(nova_ie, prod)]) % 11
if r < 10:
return r
- 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_update_boletos
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def _compute_update_boletos(self):
for item in self:
if item.state != 'open':
item.update_boleto = False
else:
- 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 _change_boleto_state
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _change_boleto_state(self, evento):
nosso_numero = self._get_nosso_numero(evento.nosso_numero)
payment_order_lines = self._get_order_line(
nosso_numero, 'payment.order.line')
- 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 validate_hook
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_hook(self):
errors = []
docs = self.env['invoice.eletronic'].search([
('numero', '>=', self.numeration_start),
('numero', '<=', self.numeration_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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create(self, cr, uid, ids, datas, context=False):
env = odoo.api.Environment(cr, uid, context or {})
nfes = env['invoice.eletronic'].search([('id', 'in', context.get(
- 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_send_eletronic_invoice
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def action_send_eletronic_invoice(self):
super(InvoiceEletronic, self).action_send_eletronic_invoice()
if self.model == '001' and self.state not in ('done', 'cancel'):
self.state = 'error'
- 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_tax_id
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _compute_tax_id(self):
for line in self:
line._update_tax_from_ncm()
fpos = line.order_id.fiscal_position_id or \
line.order_id.partner_id.property_account_position_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 _create_payment_entry
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _create_payment_entry(self, amount):
self = self.with_context(move_line_to_reconcile=self.move_line_id)
if self.invoice_ids:
return super(AccountPayment, self)._create_payment_entry(amount)
- 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_ie
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _check_ie(self):
check_ie = True
if self.inscr_est:
uf = self.state_id and self.state_id.code.lower() or ''
try:
- 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_register_boleto
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def action_register_boleto(self):
boleto_list = []
for move in self:
if not move.payment_mode_id:
raise UserError(u'A fatura ' + move.move_id.name + u' - ' +
- 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 _parse_ofx
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def _parse_ofx(self, data_file):
data_file = data_file.replace('\r\n', '\n').replace('\r', '\n')
ofx = OfxParser.parse(StringIO.StringIO(data_file))
transacoes = []
total = 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_edoc_vals
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _prepare_edoc_vals(self, inv):
res = super(AccountInvoice, self)._prepare_edoc_vals(inv)
res['payment_mode_id'] = inv.payment_mode_id.id
res['ind_pres'] = inv.fiscal_position_id.ind_pres
Function create_wizard
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_wizard(self, object_name, address_id, country_id=False,
Function _compute_difal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _compute_difal(self, price_base, ipi_value):
icms_inter = self.filtered(lambda x: x.domain == 'icms_inter')
icms_intra = self.filtered(lambda x: x.domain == 'icms_intra')
icms_fcp = self.filtered(lambda x: x.domain == 'fcp')
if not icms_inter or not icms_intra: