Showing 341 of 1,161 total issues
Function _tax_amounts_by_tax_id
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def _tax_amounts_by_tax_id(self, move):
res = {}
tax_obj = self.pool.get('account.tax')
for move_line in move.line_id:
if (
- 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 CreateFromDocument
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def CreateFromDocument(xml_string):
try:
root = etree.fromstring(xml_string)
except Exception as e:
_logger.warn('lxml was unable to parse xml: %s' % e)
- 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 importFatturaPA
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def importFatturaPA(self):
fatturapa_attachment_obj = self.env['fatturapa.attachment.in']
fatturapa_attachment_ids = self.env.context.get('active_ids', False)
invoice_model = self.env['account.invoice']
new_invoices = []
- 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_16_xml_import
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def test_16_xml_import(self):
# file B2B downloaded from
# http://www.fatturapa.gov.it/export/fatturazione/it/a-3.htm
res = self.run_wizard('test16a', 'IT01234567890_FPR03.xml')
invoice_ids = res.get('domain')[0][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 create_fatturapa_attachment_in
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create_fatturapa_attachment_in(self, attachment):
decoded = base64.b64decode(attachment.datas)
fatturapa_attachment_in = self.env['fatturapa.attachment.in']
fetchmail_server_id = self.env.context.get('fetchmail_server_id')
company_id = 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 setDatiPagamento
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def setDatiPagamento(self, invoice, body):
if invoice.payment_term and invoice.withholding_tax_line:
DatiPagamento = DatiPagamentoType()
if not invoice.payment_term.fatturapa_pt_id:
raise UserError(
- 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_sepa
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create_sepa(self):
"""Creates the SEPA Credit Transfer file. That's the important code!"""
self.ensure_one()
sepa_export = self[0]
pain_flavor = self.payment_order_ids[0].mode.type.code
- 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 invoiceCreate
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def invoiceCreate(
self, fatt, fatturapa_attachment, FatturaBody, partner_id
):
partner_model = self.env['res.partner']
invoice_model = self.env['account.invoice']
- 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 _build_codes_dict
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def _build_codes_dict(self, tax_code, res=None):
# TODO context
if res is None:
res = {}
tax_model = self.env['account.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 create_account_move
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def create_account_move(self, cr, uid, ids, context=None):
period_obj = self.pool['account.period']
account_move_obj = self.pool['account.move']
account_move_line_obj = self.pool['account.move.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 exportFatturaPA
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def exportFatturaPA(self):
invoice_obj = self.env['account.invoice']
invoices_by_partner = self.group_invoices_by_partner()
attachments = self.env['fatturapa.attachment.out']
for partner_id in invoices_by_partner:
- 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 _BuildAutomaton
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _BuildAutomaton ():
# Remove this helper function from the namespace after it is invoked
global _BuildAutomaton
del _BuildAutomaton
import pyxb.utils.fac as fac
Consider simplifying this complex logical expression. Open
if Delivery:
delivery_id = self.getCarrirerPartner(Delivery)
delivery_dict = {
'carrier_id': delivery_id,
'transport_vehicle': Delivery.MezzoTrasporto or '',
Function setRelatedDocumentTypes
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def setRelatedDocumentTypes(self, invoice, body):
res = super(WizardExportFatturapa, self).setRelatedDocumentTypes(
invoice, body)
if invoice.partner_id.fatturapa_sale_order_data or \
self.env.user.company_id.fatturapa_sale_order_data:
- 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 _export_xml_get_dtr
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _export_xml_get_dtr(self):
# ----- 3 - DTR
x_3_dtr = etree.Element(
etree.QName("DTR"))
# ----- 2.1 - Cessionario Committente DTR
- 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 add_to_ddt
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def add_to_ddt(self):
pickings = self.env['stock.picking'].browse(
self.env.context['active_ids'])
for picking in pickings:
if picking.ddt_ids and \
- 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_totals_tax
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def _compute_totals_tax(self, tax_code_ids):
res = []
tax_obj = self.pool.get('account.tax')
tax_code_obj = self.pool.get('account.tax.code')
tax_codes = tax_code_obj.browse(self.cr, self.uid, tax_code_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 action_move_create
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def action_move_create(self):
'''
Split amount withholding tax on account move lines
'''
dp_obj = self.env['decimal.precision']
- 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_party_agent
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def generate_party_agent(self, parent_node, party_type, party_type_label,
order, party_name, iban, bic, eval_ctx, gen_args,
context=None):
# CBI logic modified for add ABI of debitor
- 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 _export_xml_get_dtr
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
def _export_xml_get_dtr(self):
# ----- 3 - DTR
x_3_dtr = etree.Element(
etree.QName("DTR"))
# ----- 2.1 - Cessionario Committente DTR