akretion/odoo-shopinvader

View on GitHub

Showing 91 of 91 total issues

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

Severity: Major
Found in product_stock_state/models/product_template.py and 1 other location - About 5 hrs to fix
product_stock_state/models/product_category.py on lines 0..33

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

Severity: Major
Found in product_stock_state/models/product_category.py and 1 other location - About 5 hrs to fix
product_stock_state/models/product_template.py on lines 0..36

CartService has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class CartService(Component):
_inherit = "shopinvader.abstract.sale.service"
_name = "shopinvader.cart.service"
_usage = "cart"
 
 
Severity: Minor
Found in shopinvader/services/cart.py - About 4 hrs to fix

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

    def _convert_invoicing(self, sale):
    if (
    sale.partner_invoice_id
    == self.shopinvader_backend.anonymous_partner_id
    ):
    Severity: Major
    Found in shopinvader/services/abstract_sale.py and 1 other location - About 3 hrs to fix
    shopinvader/services/abstract_sale.py on lines 83..92

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

    def _convert_shipping(self, sale):
    if (
    sale.partner_shipping_id
    == self.shopinvader_backend.anonymous_partner_id
    ):
    Severity: Major
    Found in shopinvader/services/abstract_sale.py and 1 other location - About 3 hrs to fix
    shopinvader/services/abstract_sale.py on lines 97..106

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

    Severity: Major
    Found in shopinvader_lead/models/notification.py and 1 other location - About 3 hrs to fix
    shopinvader_quotation/models/shopinvader_notification.py on lines 0..23

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

    Severity: Major
    Found in shopinvader_quotation/models/shopinvader_notification.py and 1 other location - About 3 hrs to fix
    shopinvader_lead/models/notification.py on lines 0..23

    Function _synchronize_all_binding_stock_level has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def _synchronize_all_binding_stock_level(self):
    """
    The goal of this function is to compute the new stock information
    and update them in the data field. If data have change and the binding
    is in done state we force it to 'to_update'.
    Severity: Minor
    Found in shopinvader_product_stock/models/product_product.py - About 3 hrs to fix

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

    @api.model
    def default_get(self, fields_list):
    result = super(ShopinvaderCategoryBindingWizard, self).default_get(
    fields_list
    )
    Severity: Major
    Found in shopinvader/wizards/shopinvader_category_binding_wizard.py and 1 other location - About 3 hrs to fix
    shopinvader/wizards/shopinvader_category_unbinding_wizard.py on lines 20..30

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

    @api.model
    def default_get(self, fields_list):
    result = super(ShopinvaderCategoryUnbindingWizard, self).default_get(
    fields_list
    )
    Severity: Major
    Found in shopinvader/wizards/shopinvader_category_unbinding_wizard.py and 1 other location - About 3 hrs to fix
    shopinvader/wizards/shopinvader_category_binding_wizard.py on lines 29..37

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

    @api.model
    def default_get(self, fields_list):
    res = super(ShopinvaderVariantBindingWizard, self).default_get(
    fields_list
    )
    Severity: Major
    Found in shopinvader/wizards/shopinvader_variant_binding_wizard.py and 1 other location - About 2 hrs to fix
    shopinvader/wizards/shopinvader_variant_unbinding_wizard.py on lines 20..28

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

    @api.model
    def default_get(self, fields_list):
    res = super(ShopinvaderVariantUnbindingWizard, self).default_get(
    fields_list
    )
    Severity: Major
    Found in shopinvader/wizards/shopinvader_variant_unbinding_wizard.py and 1 other location - About 2 hrs to fix
    shopinvader/wizards/shopinvader_variant_binding_wizard.py on lines 25..33

    File cart.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    # Copyright 2016 Akretion (http://www.akretion.com)
    # Sébastien BEAU <sebastien.beau@akretion.com>
    # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
    # pylint: disable=consider-merging-classes-inherited
    Severity: Minor
    Found in shopinvader/services/cart.py - About 2 hrs to fix

      File shopinvader_backend.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      # Copyright 2017 Akretion (http://www.akretion.com).
      # @author Sébastien BEAU <sebastien.beau@akretion.com>
      # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
       
       
      Severity: Minor
      Found in shopinvader/models/shopinvader_backend.py - About 2 hrs to fix

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

        @api.model
        def create(self, value):
        res = super(AbstractUrl, self).create(value)
        synced = res._sync_urls()
        super(AbstractUrl, synced).write({"is_urls_sync_required": False})
        Severity: Major
        Found in base_url/models/abstract_url.py and 1 other location - About 2 hrs to fix
        base_url/models/abstract_url.py on lines 207..212

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

        @api.multi
        def write(self, value):
        res = super(AbstractUrl, self).write(value)
        synced = self._sync_urls()
        super(AbstractUrl, synced).write({"is_urls_sync_required": False})
        Severity: Major
        Found in base_url/models/abstract_url.py and 1 other location - About 2 hrs to fix
        base_url/models/abstract_url.py on lines 200..205

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

        @skip_if(lambda self, record, **kwargs: self.no_connector_export(record))
        def on_record_write(self, record, fields=None):
        if record.is_guest:
        return
        return super(ShopinvaderBindingListener, self).on_record_write(
        shopinvader_locomotive_guest_mode/component/shopinvader_binging_event_listeners.py on lines 13..17

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

        def _search_shopinvader_backend_ids(self, operator, value):
        si_var_obj = self.env["shopinvader.variant"]
        bindings = si_var_obj.search([("backend_id.name", operator, value)])
         
        return [("id", "in", bindings.mapped("record_id").ids)]
        Severity: Major
        Found in shopinvader/models/product_product.py and 1 other location - About 2 hrs to fix
        shopinvader/models/product_template.py on lines 12..16

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

        def _search_shopinvader_backend_ids(self, operator, value):
        si_var_obj = self.env["shopinvader.product"]
        bindings = si_var_obj.search([("backend_id.name", operator, value)])
         
        return [("id", "in", bindings.mapped("record_id").ids)]
        Severity: Major
        Found in shopinvader/models/product_template.py and 1 other location - About 2 hrs to fix
        shopinvader/models/product_product.py on lines 12..16

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

        @skip_if(lambda self, record, **kwargs: self.no_connector_export(record))
        def on_record_create(self, record, fields=None):
        if record.is_guest:
        return
        return super(ShopinvaderBindingListener, self).on_record_create(
        shopinvader_locomotive_guest_mode/component/shopinvader_binging_event_listeners.py on lines 21..25
        Severity
        Category
        Status
        Source
        Language