OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

Function _BuildAutomaton has 42 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
Severity: Minor
Found in l10n_it_fatturapa/bindings/_ds.py - About 1 hr to fix

    Consider simplifying this complex logical expression.
    Open

            if company.fatturapa_rea_office and company.fatturapa_rea_number:
                CedentePrestatore.IscrizioneREA = IscrizioneREAType(
                    Ufficio=(
                        company.fatturapa_rea_office and
                        company.fatturapa_rea_office.code or None),
    Severity: Critical
    Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 1 hr to fix

      Consider simplifying this complex logical expression.
      Open

              if Summary_datas:
                  for summary in Summary_datas:
                      summary_line = {
                          'tax_rate': summary.AliquotaIVA or 0.0,
                          'non_taxable_nature': summary.Natura or False,
      Severity: Critical
      Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr to fix

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        class FatturapaFormat(models.Model):
            # _position = ['1.1.3']
            _name = "fatturapa.format"
            _description = 'E-invoice Format'
        
        
        Severity: Major
        Found in l10n_it_fatturapa/models/account.py and 4 other locations - About 1 hr to fix
        l10n_it_fatturapa/models/account.py on lines 28..34
        l10n_it_fatturapa/models/account.py on lines 91..97
        l10n_it_fiscal_payment_term/models/account.py on lines 9..15
        l10n_it_fiscal_payment_term/models/account.py on lines 18..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        class FatturapaDocumentType(models.Model):
            # _position = ['2.1.1.1']
            _name = "fatturapa.document_type"
            _description = 'E-invoice Document Type'
        
        
        Severity: Major
        Found in l10n_it_fatturapa/models/account.py and 4 other locations - About 1 hr to fix
        l10n_it_fatturapa/models/account.py on lines 19..25
        l10n_it_fatturapa/models/account.py on lines 91..97
        l10n_it_fiscal_payment_term/models/account.py on lines 9..15
        l10n_it_fiscal_payment_term/models/account.py on lines 18..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if cedPrest.Contatti:
                        vals['phone'] = cedPrest.Contatti.Telefono
                        vals['email'] = cedPrest.Contatti.Email
                        vals['fax'] = cedPrest.Contatti.Fax
        Severity: Major
        Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py and 1 other location - About 1 hr to fix
        l10n_it_ddt/wizard/ddt_from_picking.py on lines 49..52

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @api.multi
            # def move_set_due(self, cr, uid, ids, *args):
            def move_set_due(self):
                for move in self:
                    if move.state in ['paid']:
        Severity: Major
        Found in l10n_it_withholding_tax/models/withholding_tax.py and 1 other location - About 1 hr to fix
        l10n_it_withholding_tax/models/withholding_tax.py on lines 336..342

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        class FatturapaFiscalPosition(models.Model):
            # _position = ['2.1.1.7.7', '2.2.1.14']
            _name = "fatturapa.fiscal_position"
            _description = 'Electronic Invoice Fiscal Position'
        
        
        Severity: Major
        Found in l10n_it_fatturapa/models/account.py and 4 other locations - About 1 hr to fix
        l10n_it_fatturapa/models/account.py on lines 19..25
        l10n_it_fatturapa/models/account.py on lines 28..34
        l10n_it_fiscal_payment_term/models/account.py on lines 9..15
        l10n_it_fiscal_payment_term/models/account.py on lines 18..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        class FatturapaPaymentMethod(models.Model):
            # _position = ['2.4.2.2']
            _name = "fatturapa.payment_method"
            _description = 'Fiscal Payment Method'
        
        
        Severity: Major
        Found in l10n_it_fiscal_payment_term/models/account.py and 4 other locations - About 1 hr to fix
        l10n_it_fatturapa/models/account.py on lines 19..25
        l10n_it_fatturapa/models/account.py on lines 28..34
        l10n_it_fatturapa/models/account.py on lines 91..97
        l10n_it_fiscal_payment_term/models/account.py on lines 9..15

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            @api.multi
            # def move_paid(self, cr, uid, ids, *args):
            def move_paid(self):
                for move in self:
                    if move.state in ['due']:
        Severity: Major
        Found in l10n_it_withholding_tax/models/withholding_tax.py and 1 other location - About 1 hr to fix
        l10n_it_withholding_tax/models/withholding_tax.py on lines 344..350

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                vals['cedente_sede_Indirizzo'] = '{} {}'.format(
                    encode_for_export(partner.street or '', 60),
                    encode_for_export(partner.street2 or '', 60)).strip()
        Severity: Major
        Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 1 hr to fix
        l10n_it_invoices_data_communication/models/communication.py on lines 365..367

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                    if sale:
                        values['partner_id'] = sale.partner_id.id
                        values['partner_invoice_id'] = sale.partner_invoice_id.id
                        values['partner_shipping_id'] = sale.partner_shipping_id.id
        Severity: Major
        Found in l10n_it_ddt/wizard/ddt_from_picking.py and 1 other location - About 1 hr to fix
        l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py on lines 307..310

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                vals['cessionario_sede_Indirizzo'] = '{} {}'.format(
                    encode_for_export(partner.street or '', 60),
                    encode_for_export(partner.street2 or '', 60)).strip()
        Severity: Major
        Found in l10n_it_invoices_data_communication/models/communication.py and 1 other location - About 1 hr to fix
        l10n_it_invoices_data_communication/models/communication.py on lines 290..292

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        class FatturapaPaymentTerm(models.Model):
            # _position = ['2.4.1']
            _name = "fatturapa.payment_term"
            _description = 'Fiscal Payment Term'
        
        
        Severity: Major
        Found in l10n_it_fiscal_payment_term/models/account.py and 4 other locations - About 1 hr to fix
        l10n_it_fatturapa/models/account.py on lines 19..25
        l10n_it_fatturapa/models/account.py on lines 28..34
        l10n_it_fatturapa/models/account.py on lines 91..97
        l10n_it_fiscal_payment_term/models/account.py on lines 18..24

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 46.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function invoiceCreate has 41 lines of code (exceeds 25 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']
        Severity: Minor
        Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 1 hr to fix

          Function _BuildAutomaton_20 has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def _BuildAutomaton_20 ():
              # Remove this helper function from the namespace after it is invoked
              global _BuildAutomaton_20
              del _BuildAutomaton_20
              import pyxb.utils.fac as fac
          Severity: Minor
          Found in l10n_it_fatturapa/bindings/binding.py - About 1 hr to fix

            Function _prepare_cessionario_partner_id has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def _prepare_cessionario_partner_id(self, partner, vals=None):
                    vals = {}
                    # ----- Get vat
                    partner_vat = partner.commercial_partner_id.vat or ''
                    if partner.country_id:
            Severity: Minor
            Found in l10n_it_invoices_data_communication/models/communication.py - About 1 hr to fix

            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 prepareRelDocsLine has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def prepareRelDocsLine(self, invoice, line):
                    res = False
                    sale_order_name = False
                    if line.origin:
                        # if invoiced from picking, get sale_order from picking
            Severity: Minor
            Found in l10n_it_fatturapa_out_sale/wizard/wizard_export_fatturapa.py - About 1 hr to fix

            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 setDettaglioLinea has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
            Open

                def setDettaglioLinea(
                        self, line_no, line, body, price_precision, uom_precision):
                    if not line.invoice_line_tax_id:
                        raise UserError(
                            _("Invoice line %s does not have tax.") % line.name)
            Severity: Minor
            Found in l10n_it_fatturapa_out/wizard/wizard_export_fatturapa.py - About 1 hr to fix

            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

            Identical blocks of code found in 2 locations. Consider refactoring.
            Open

                    if not fiscalyear_ids:
                        fiscalyear_ids = self.pool.get('account.fiscalyear').search(cr, uid, [
                                ('company_id', '=', False),
                                ('date_start', '<=', str_date),
                                ('date_stop', '>=', str_date),
            Severity: Major
            Found in account_fiscal_year_closing/fyc.py and 1 other location - About 1 hr to fix
            account_fiscal_year_closing/fyc.py on lines 239..243

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 45.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language