osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

Function _line_qty_write has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _line_qty_write(self):
        if self.order_id:
            for line in self.line_in_ids:
                line.buy_line_id.quantity_in += line.goods_qty
            for line in self.line_out_ids:  # 退货单行
Severity: Minor
Found in buy/models/buy_receipt.py - About 55 mins 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 get_matching_records has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def get_matching_records(self, warehouse, qty, uos_qty=0, attribute=None,
Severity: Major
Found in warehouse/models/goods.py - About 50 mins to fix

    Function create_source_docx_partner has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def create_source_docx_partner(self, cr, uid, ids, report, records, init_pay, context=None):
    Severity: Major
    Found in money/report/supplier_statements.py - About 50 mins to fix

      Function read_group has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def read_group(self, domain, fields, groupby, offset=0, limit=80, orderby=False, lazy=True):
      Severity: Major
      Found in warehouse/report/report_base.py - About 50 mins to fix

        Function _create_voucher_line has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def _create_voucher_line(self, account_id, debit, credit, voucher_id, goods_id, goods_qty, partner_id):
        Severity: Major
        Found in buy/models/buy_receipt.py - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if self.county_id.city_id == self.city_id:
                                      domain_dict = {}
                                  else:
                                      self.county_id = False
                          else:
          Severity: Major
          Found in partner_address/models/partner_address.py - About 45 mins to fix

            Function saomiaofapiao has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def saomiaofapiao(self, model_name, barcode, order_id):
                    """
                    扫描发票条码
                    :param model_name: 模型名
                    :param barcode: 二维码识别内容
            Severity: Minor
            Found in staff_expense/models/hr_expense.py - About 45 mins 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 check_consistency has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def check_consistency(self):
                    category_id = []
                    for line in self.line_ids:
                        if line.category_id and line.category_id.id not in category_id:
                            category_id.append(line.category_id.id)
            Severity: Minor
            Found in staff_expense/models/hr_expense.py - About 45 mins 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 tax_invoice_done has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def tax_invoice_done(self):
                    for rec in self:
                        if rec.state == 'done':
                            raise UserError(u'请不要重复确认')
                        for line in rec.line_ids:
            Severity: Minor
            Found in tax_invoice_out/models/tax_invoice_out.py - About 45 mins 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 fields_view_get has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
                    """
                    根据内容判断 报出错误
                    """
                    model = self.env.context.get('active_model')
            Severity: Minor
            Found in warehouse_wave/models/wave.py - About 45 mins 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

            Avoid deeply nested control flow statements.
            Open

                                    if province != self.province_id:
                                        self.province_id = province
                                        self.county_id = False
                                    else:
                                        self.county_id = False
            Severity: Major
            Found in partner_address/models/partner_address.py - About 45 mins to fix

              Function __str__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def __str__(self):
                      '''支持直接在word 上写 many2one 字段'''
                      name = ''
                      if self.data and self.data.display_name:
                          name = self.data.display_name
              Severity: Minor
              Found in report_docx/report/report_docx.py - About 45 mins 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 create_voucher has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def create_voucher(self):
                      """创建凭证并审核非初始化凭证"""
                      init_obj = ''
                      # 初始化单的话,先找是否有初始化凭证,没有则新建一个
                      if self.is_init:
              Severity: Minor
              Found in money/models/other_money_order.py - About 45 mins 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 _generate_delivery has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def _generate_delivery(self, delivery_line):
                      '''根据明细行生成发货单或退货单'''
                      # 如果退货,warehouse_dest_id,warehouse_id要调换
                      warehouse = (self.type == 'sell'
                                   and self.warehouse_id
              Severity: Minor
              Found in sell/models/sell_order.py - About 45 mins 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 change_color has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                      change_color: function (rows, $cell, i, j, nbr_measures,field_index) {
              Severity: Minor
              Found in core/static/src/js/core.js - About 45 mins to fix

                Function button_ok has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def button_ok(self):
                        self.ensure_one()
                        res = []
                        dict_part = {}
                        if self.date_end < self.date_start:
                Severity: Minor
                Found in sell/wizard/sell_receipt_wizard.py - About 45 mins 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

                Avoid deeply nested control flow statements.
                Open

                                        for line in line_ids:
                                            record_id = self._create_statements_report_with_goods_line(line.goods_id.code,
                                                                                                       line.goods_id.name,
                                                                                                       line.attribute_id.id,
                                                                                                       line.uom_id.id,
                Severity: Major
                Found in money/wizard/partner_statements_wizard.py - About 45 mins to fix

                  Function momentum has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
                  Severity: Minor
                  Found in backend_theme/static/lib/js/iscroll-probe.5.2.0.js - About 45 mins to fix

                    Function _prepare_sell_receipt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _prepare_sell_receipt(self, delivery):
                            '''对于传入的发货单/退货单,为创建销售收款一览表准备数据'''
                            self.ensure_one()
                            factor = delivery.is_return and -1 or 1  # 如果是退货则金额均取反
                            sell_amount = factor * (delivery.discount_amount + delivery.amount)
                    Severity: Minor
                    Found in sell/wizard/sell_receipt_wizard.py - About 45 mins 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

                    Avoid deeply nested control flow statements.
                    Open

                                            for line in line_ids:
                                                record_id = self._create_statements_report_with_goods_line(line.goods_id.code,
                                                                                                           line.goods_id.name,
                                                                                                           line.attribute_id.id,
                                                                                                           line.uom_id.id,
                    Severity: Major
                    Found in money/wizard/partner_statements_wizard.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language