bmya/odoo-bmya-cl

View on GitHub

Showing 71 of 71 total issues

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

    def get_employee(self, form):
        emp_salary = []
        salary_list = []
        last_year = form['end_date'][0:4]
        last_month = form['end_date'][5:7]
Severity: Major
Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py and 1 other location - About 5 days to fix
l10n_cl_hr_payroll/report/report_hr_salary_book.py on lines 139..201

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

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

    def get_employee2(self, form):
        emp_salary = []
        salary_list = []
        last_year = form['end_date'][0:4]
        last_month = form['end_date'][5:7]
Severity: Major
Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py and 1 other location - About 5 days to fix
l10n_cl_hr_payroll/report/report_hr_salary_book.py on lines 203..266

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

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 invoice.py has 520 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
Severity: Major
Found in l10n_cl_dte/models/invoice.py - About 1 day to fix

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

        @api.one
        def _get_amounts(self):
            """
            """
            amount_untaxed = False
    Severity: Major
    Found in l10n_cl_account_vat_ledger/account.py and 1 other location - About 6 hrs to fix
    l10n_cl_account_vat_ledger/account.py on lines 115..129

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

    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

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

        @api.one
        def _get_amounts(self):
            """
            """
            amount_untaxed = False
    Severity: Major
    Found in l10n_cl_account_vat_ledger/account.py and 1 other location - About 6 hrs to fix
    l10n_cl_account_vat_ledger/account.py on lines 18..32

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

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

    openerp.l10n_cl_pos_credit_card_voucher = function(instance){
        var module = instance.point_of_sale;
        var QWeb = instance.web.qweb;
        var _t = instance.web._t;
    
    
    Severity: Minor
    Found in l10n_cl_pos_credit_card_voucher/static/src/js/pos_cc_voucher.js - About 4 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 do_dte_send_invoice has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def do_dte_send_invoice(self):
            cant_doc_batch = 0
            for inv in self.with_context(lang='es_CL'):
                # control de DTE
                if inv.sii_document_class_id.dte == False:
    Severity: Minor
    Found in l10n_cl_dte/models/invoice.py - About 3 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 l10n_cl_pos_credit_card_voucher has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    openerp.l10n_cl_pos_credit_card_voucher = function(instance){
        var module = instance.point_of_sale;
        var QWeb = instance.web.qweb;
        var _t = instance.web._t;
    
    
    Severity: Major
    Found in l10n_cl_pos_credit_card_voucher/static/src/js/pos_cc_voucher.js - About 3 hrs to fix

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

          def get_worked_days(self, form, emp_id, emp_salary, mes, ano):
      
              self.cr.execute(
                  '''select number_of_days from hr_payslip_worked_days as p
      left join hr_payslip as r on r.id = p.payslip_id
      Severity: Major
      Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py and 1 other location - About 3 hrs to fix
      l10n_cl_hr_payroll/report/report_hr_salary_book.py on lines 65..83

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

      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

          def get_employe_basic_info(self, emp_salary, cod_id, mes, ano):
      
              self.cr.execute(
                  '''select sum(pl.total) from hr_payslip_line as pl
      left join hr_payslip as p on pl.slip_id = p.id
      Severity: Major
      Found in l10n_cl_hr_payroll/report/report_hr_salary_book.py and 1 other location - About 3 hrs to fix
      l10n_cl_hr_payroll/report/report_hr_salary_book.py on lines 48..63

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

      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 invoice.py has 304 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      from openerp import osv, models, fields, api, _
      from openerp.osv import fields as old_fields
      from openerp.exceptions import except_orm, Warning
      from openerp.addons import decimal_precision as dp
      Severity: Minor
      Found in l10n_cl_invoice/models/invoice.py - About 3 hrs to fix

        Function create_journal_document has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            def create_journal_document(self, cr, uid, letter_ids, document_type,
                                        journal_id, wz, context=None):
        
                print(document_type, letter_ids)
                if_zf = [] if wz.free_tax_zone else [901, 906, 907]
        Severity: Minor
        Found in l10n_cl_invoice/wizard/journal_config_wizard.py - About 2 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

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

            @api.one
            @api.depends('sii_document_class_id', 'sii_document_number', 'number')
            def _get_document_number(self):
                if self.sii_document_number and self.sii_document_class_id:
                    document_number = (
        Severity: Major
        Found in l10n_cl_invoice/models/invoice.py and 1 other location - About 2 hrs to fix
        l10n_cl_invoice/models/account.py on lines 69..82

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

        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.one
            @api.depends(
                'sii_document_number',
                'name',
                'document_class_id',
        Severity: Major
        Found in l10n_cl_invoice/models/account.py and 1 other location - About 2 hrs to fix
        l10n_cl_invoice/models/invoice.py on lines 238..246

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

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

            def create_journals(self, cr, uid, journal_ids, wz, context=None):
                for journal in self.pool['account.journal'].browse(
                        cr, uid, journal_ids, context=context):
                    responsability = journal.company_id.responsability_id
                    if not responsability.id:
        Severity: Minor
        Found in l10n_cl_invoice/wizard/journal_config_wizard.py - About 2 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

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

            dte_service_provider = fields.Selection(
                (
                    ('', 'None'),
                    ('EFACTURADELSUR', 'efacturadelsur.cl'),
                    ('EFACTURADELSUR_TEST', 'efacturadelsur.cl (test mode)'),
        Severity: Major
        Found in l10n_cl_dte/models/invoice.py and 1 other location - About 1 hr to fix
        l10n_cl_dte/models/company.py on lines 11..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 48.

        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

                    self.document_number = '%s.%s.%s-%s' % (
                        document_number[0:2], document_number[2:5],
                        document_number[5:8], document_number[-1])
        Severity: Major
        Found in l10n_cl_invoice/models/partner.py and 1 other location - About 1 hr to fix
        l10n_cl_base_rut/base_vat.py on lines 42..44

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

        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

                self.formated_vat = '%s.%s.%s-%s' % (
                    formated_vat[0:2], formated_vat[2:5], formated_vat[5:8],
                    formated_vat[-1])
        Severity: Major
        Found in l10n_cl_base_rut/base_vat.py and 1 other location - About 1 hr to fix
        l10n_cl_invoice/models/partner.py on lines 53..55

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

        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

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

            dte_service_provider = fields.Selection(
                (
                    ('', 'None'),
                    ('EFACTURADELSUR', 'efacturadelsur.cl'),
                    ('EFACTURADELSUR_TEST', 'efacturadelsur.cl (test mode)'),
        Severity: Major
        Found in l10n_cl_dte/models/company.py and 1 other location - About 1 hr to fix
        l10n_cl_dte/models/invoice.py on lines 434..447

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

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

            def _get_available_journal_document_class(self):
                invoice_type = self.type
                document_class_ids = []
                document_class_id = False
        
        
        Severity: Minor
        Found in l10n_cl_invoice/models/invoice.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

        Severity
        Category
        Status
        Source
        Language