OCA/l10n-italy

View on GitHub
l10n_it_fatturapa/models/account.py

Summary

Maintainability
D
2 days
Test Coverage

File account.py has 400 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright 2014 Davide Corio <davide.corio@abstract.it>
# Copyright 2018 Gianmarco Conte, Marco Calcagni - Dinamiche Aziendali srl
# Copyright 2019 Sergio Corato
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl).
Severity: Minor
Found in l10n_it_fatturapa/models/account.py - About 5 hrs to fix

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

        @api.model
        def create(self, vals):
            if vals.get('invoice_line_id'):
                line_obj = self.env['account.invoice.line']
                line = line_obj.browse(vals['invoice_line_id'])
    Severity: Major
    Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
    l10n_it_fatturapa/models/account.py on lines 214..220
    l10n_it_fatturapa/models/account.py on lines 499..505

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

    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

        @api.model
        def create(self, vals):
            if vals.get('invoice_line_id'):
                line_obj = self.env['account.invoice.line']
                line = line_obj.browse(vals['invoice_line_id'])
    Severity: Major
    Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
    l10n_it_fatturapa/models/account.py on lines 214..220
    l10n_it_fatturapa/models/account.py on lines 264..270

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

    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

        @api.model
        def create(self, vals):
            if vals.get('invoice_line_id'):
                line_obj = self.env['account.invoice.line']
                line = line_obj.browse(vals['invoice_line_id'])
    Severity: Major
    Found in l10n_it_fatturapa/models/account.py and 2 other locations - About 4 hrs to fix
    l10n_it_fatturapa/models/account.py on lines 264..270
    l10n_it_fatturapa/models/account.py on lines 499..505

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

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

    There are no issues that match your filters.

    Category
    Status