osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

Function sell_generate_delivery has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def sell_generate_delivery(self):
        '''由销货订单生成销售发货单'''
        delivery_line = []  # 销售发货单行

        for line in self.line_ids:
Severity: Minor
Found in sell/models/sell_order.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

Function create_voucher_line has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def create_voucher_line(self, vals):
        if vals.get('currency_id') == self.env.user.company_id.currency_id.id or not vals.get('rate_silent'):
            debit = credit = vals.get('amount')
            sell_tax_amount = vals.get('sell_tax_amount')
        else:
Severity: Minor
Found in money/models/generate_accounting.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

Function approve_order has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def approve_order(self):
        ''' 成品入库 '''
        for order in self:
            if order.state == 'done':
                raise UserError(u'请不要重复执行成品入库')
Severity: Minor
Found in warehouse/models/production.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

Function asset_draft has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def asset_draft(self):
        ''' 撤销确认固定资产 '''
        if self.state == 'draft':
            raise UserError(u'请不要重复撤销确认!')
        if self.line_ids:
Severity: Minor
Found in asset/models/asset.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

Function unlink has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def unlink(self):
        """
        限制科目删除条件
        """
        parent_ids =[]
Severity: Minor
Found in finance/models/finance.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

Function buy_to_return has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def buy_to_return(self):
        '''采购入库单转化为采购退货单'''
        return_goods = {}

        return_order_draft = self.search([
Severity: Minor
Found in buy/models/buy_receipt.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

Function buy_generate_receipt has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def buy_generate_receipt(self):
        '''由购货订单生成采购入库/退货单'''
        receipt_line = []  # 采购入库/退货单行

        for line in self.line_ids:
Severity: Minor
Found in buy/models/buy_order.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

Consider simplifying this complex logical expression.
Open

            if invoice.category_id.type == 'income':
                vals.update({'vouch_obj_id': vouch_obj.id, 'partner_credit': invoice.partner_id.id, 'name': invoice.name, 'string': invoice.note or '',
                             'amount': invoice.amount, 'credit_account_id': invoice.category_id.account_id.id, 'partner_debit': invoice.partner_id.id,
                             'debit_account_id': partner_account_id, 'sell_tax_amount': invoice.tax_amount or 0,
                             'credit_auxiliary_id': invoice.auxiliary_id.id, 'currency_id': invoice.currency_id.id or '',
Severity: Critical
Found in money/models/generate_accounting.py - About 1 hr to fix

    Function compute_main_data has 40 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function compute_main_data(rows,export_columns_keys){
        var export_rows = []
    
        $.each(rows, function () {
            var $row = $(this);
    Severity: Minor
    Found in web_export_view_good/static/src/js/web_export_view_good.js - About 1 hr to fix

      Function _wrong_delivery_done has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def _wrong_delivery_done(self):
              '''审核时不合法的给出报错'''
              if self.state == 'done':
                  raise UserError(u'请不要重复发货')
              for line in self.line_in_ids:
      Severity: Minor
      Found in sell/models/sell_delivery.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

      Function staff_contract_over_date has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def staff_contract_over_date(self):
              # 员工合同到期,发送邮件给员工 和 部门经理(如果存在)
              now = datetime.now().strftime("%Y-%m-%d")
              for Staff in self.search([]):
                  if not Staff.contract_ids:
      Severity: Minor
      Found in staff/models/staff.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

      Function sell_order_done has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def sell_order_done(self):
              '''确认销货订单'''
              if self.state == 'done':
                  raise UserError(u'请不要重复确认!')
              if not self.line_ids:
      Severity: Minor
      Found in sell/models/sell_order.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

      Function create has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def create(self, vals):
              ''' 组合产品生成子产品的发货单行 '''
              goods = self.env['goods'].search([('id', '=', vals['goods_id'])])
              bom_line_obj = self.env['wh.bom.line']
      
      
      Severity: Minor
      Found in sell_delivery_by_parts/models/sell_delivery_by_parts.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

      Function change_voucher has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def change_voucher(self):
              """
              生成并审核修正计提凭证
              :return:
              """
      Severity: Minor
      Found in staff_wages/models/staff_wages.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

      Function buy_order_done has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def buy_order_done(self):
              '''确认购货订单'''
              if self.state == 'done':
                  raise UserError(u'请不要重复确认')
              if not self.line_ids:
      Severity: Minor
      Found in buy/models/buy_order.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

      Function create_cn_account_invoice has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def create_cn_account_invoice(self):
              if not self.env.context.get('active_id'):
                  return
              invoice_in = self.env['tax.invoice.in'].browse(self.env.context.get('active_id'))
              """
      Severity: Minor
      Found in tax_invoice_in/models/tax_invoice_in.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

      Function rmb_upper has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def rmb_upper(self, value):
              """
              人民币大写
              来自:http://topic.csdn.net/u/20091129/20/b778a93d-9f8f-4829-9297-d05b08a23f80.html
              传入浮点类型的值返回 unicode 字符串
      Severity: Minor
      Found in core/models/res_currency.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

      Function _create_statements_report_with_goods_line has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def _create_statements_report_with_goods_line(self, goods_code, goods_name, attribute_id, uom_id,
      Severity: Major
      Found in money/wizard/partner_statements_wizard.py - About 1 hr to fix

        Function onchange_partner_id has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def onchange_partner_id(self):
                ''' 选择客户带出其默认联系地址、联系人、电话信息 '''
                if self.partner_id:
                    self.contact = self.partner_id.contact
                    self.mobile = self.partner_id.mobile
        Severity: Minor
        Found in sell_quotation/models/sell_quotation.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

        Function confirm_change has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def confirm_change(self):
                for change in self:
                    if change.change_qty < 0:
                        raise UserError(u'转出数量不能小于零')
                    if change.from_location.id == change.to_location.id:
        Severity: Minor
        Found in warehouse/models/location.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