OCA/l10n-italy

View on GitHub

Showing 1,161 of 1,161 total issues

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

        if partner_id:
            partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
            result['value'][
                'carriage_condition_id'] = partner.carriage_condition_id.id
            result['value'][
Severity: Major
Found in l10n_it_ddt/models/sale.py and 1 other location - About 6 hrs to fix
l10n_it_ddt/models/account.py on lines 42..53

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 109.

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 statement.previous_debit_vat_amount:
                previous_debit_vat_data = {
                    'name': _('Previous Debits VAT'),
                    'account_id': statement.previous_debit_vat_account_id.id,
                    'move_id': move_id,
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 464..480

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 106.

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 3 locations. Consider refactoring.
Open

            if statement.previous_credit_vat_amount:
                previous_credit_vat_data = {
                    'name': _('Previous Credits VAT'),
                    'account_id': statement.previous_credit_vat_account_id.id,
                    'move_id': move_id,
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 483..500
account_vat_period_end_statement/models/account.py on lines 540..555

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 106.

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 3 locations. Consider refactoring.
Open

            for generic_line in statement.generic_vat_account_line_ids:
                generic_vat_data = {
                    'name': _('Other VAT Credits / Debits'),
                    'account_id': generic_line.account_id.id,
                    'move_id': move_id,
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 483..500
account_vat_period_end_statement/models/account.py on lines 502..519

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 106.

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 3 locations. Consider refactoring.
Open

                if credit_line.amount != 0.0:
                    credit_vat_data = {
                        'name': _('Credit VAT'),
                        'account_id': credit_line.account_id.id,
                        'move_id': move_id,
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 2 other locations - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 502..519
account_vat_period_end_statement/models/account.py on lines 540..555

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 106.

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 debit_line.amount != 0.0:
                    debit_vat_data = {
                        'name': _('Debit VAT'),
                        'account_id': debit_line.account_id.id,
                        'move_id': move_id,
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 521..538

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 106.

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

    def create_wt_26_40q(self):
        return self.env['withholding.tax'].create({
            'name': '2640q',
            'code': '2640q',
            'account_receivable_id': self.payable_account_id,
Severity: Major
Found in l10n_it_fatturapa_in/tests/fatturapa_common.py and 4 other locations - About 6 hrs to fix
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 36..48
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 51..63
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 66..78
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 96..108

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 105.

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

    def create_wt_23_20(self):
        return self.env['withholding.tax'].create({
            'name': '2320',
            'code': '2320',
            'account_receivable_id': self.payable_account_id,
Severity: Major
Found in l10n_it_fatturapa_in/tests/fatturapa_common.py and 4 other locations - About 6 hrs to fix
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 51..63
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 66..78
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 81..93
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 96..108

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 105.

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

    def create_wt_23_50(self):
        return self.env['withholding.tax'].create({
            'name': '2320',
            'code': '2320',
            'account_receivable_id': self.payable_account_id,
Severity: Major
Found in l10n_it_fatturapa_in/tests/fatturapa_common.py and 4 other locations - About 6 hrs to fix
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 36..48
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 66..78
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 81..93
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 96..108

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 105.

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

    def create_wt_27_20q(self):
        return self.env['withholding.tax'].create({
            'name': '2720q',
            'code': '2720q',
            'account_receivable_id': self.payable_account_id,
Severity: Major
Found in l10n_it_fatturapa_in/tests/fatturapa_common.py and 4 other locations - About 6 hrs to fix
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 36..48
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 51..63
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 66..78
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 81..93

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 105.

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

    def create_wt_26_20q(self):
        return self.env['withholding.tax'].create({
            'name': '2620q',
            'code': '2620q',
            'account_receivable_id': self.payable_account_id,
Severity: Major
Found in l10n_it_fatturapa_in/tests/fatturapa_common.py and 4 other locations - About 6 hrs to fix
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 36..48
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 51..63
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 81..93
l10n_it_fatturapa_in/tests/fatturapa_common.py on lines 96..108

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 105.

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

            for debit_tax_code_id in debit_tax_code_ids:
                debit_tax_code = tax_code_pool.browse(
                    cr, uid, debit_tax_code_id, context)
                total = 0.0
                for period in statement.period_ids:
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 650..662

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 104.

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

            for credit_tax_code_id in credit_tax_code_ids:
                credit_tax_code = tax_code_pool.browse(
                    cr, uid, credit_tax_code_id, context)
                total = 0.0
                for period in statement.period_ids:
Severity: Major
Found in account_vat_period_end_statement/models/account.py and 1 other location - About 6 hrs to fix
account_vat_period_end_statement/models/account.py on lines 631..643

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 104.

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

File fyc.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2010 Pexego Sistemas Informáticos. All Rights Reserved
Severity: Minor
Found in account_fiscal_year_closing/fyc.py - About 6 hrs to fix

    File test_fatturapa_xml_validation.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Copyright 2014 Davide Corio
    # Copyright 2015-2016 Lorenzo Battistini - Agile Business Group
    # Copyright 2018-2019 Alex Comba - Agile Business Group
    # Copyright 2019 Sergio Corato
    Severity: Minor
    Found in l10n_it_fatturapa_out/tests/test_fatturapa_xml_validation.py - About 6 hrs to fix

      Function _BuildAutomaton_6 has 149 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function getPartnerBase has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            def getPartnerBase(self, DatiAnagrafici, supplier=True):
                if not DatiAnagrafici:
                    return False
                partner_model = self.env['res.partner']
                cf = DatiAnagrafici.CodiceFiscale or False
        Severity: Minor
        Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 hrs 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 _createPaymentsLine has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
        Open

            def _createPaymentsLine(self, payment_id, line, partner_id):
                details = line.DettaglioPagamento or False
                if details:
                    PaymentModel = self.env['fatturapa.payment.detail']
                    PaymentMethodModel = self.env['fatturapa.payment_method']
        Severity: Minor
        Found in l10n_it_fatturapa_in/wizard/wizard_import_fatturapa.py - About 5 hrs 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 _BuildAutomaton_5 has 147 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

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

              def move_payment_to_draft(self, cr, uid, ids, *args):
                  wt_move_obj = self.pool['withholding.tax.move']
                  for move in self.browse(cr, uid, ids):
                      if move.state in ['confirmed']:
                          self.write(cr, uid, [move.id], {'state': 'draft'})
          Severity: Major
          Found in l10n_it_withholding_tax_payment/models/withholding_tax.py and 1 other location - About 5 hrs to fix
          l10n_it_withholding_tax_payment/models/withholding_tax.py on lines 210..219

          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 96.

          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