osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

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

    def approve_feeding(self):
        ''' 发料 '''
        for order in self:
            if order.state == 'feeding':
                raise UserError(u'请不要重复发料')
Severity: Minor
Found in warehouse/models/production.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_receipt has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def _generate_receipt(self, receipt_line):
        '''根据明细行生成入库单或退货单'''
        # 如果退货,warehouse_dest_id,warehouse_id要调换
        warehouse = (self.type == 'buy'
                     and self.env.ref("warehouse.warehouse_supplier")
Severity: Minor
Found in buy/models/buy_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 name_search has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def name_search(self, name='', args=None, operator='ilike', limit=100):
        '''在many2one字段中支持按编号搜索'''
        args = args or []
        code_search_goods = []
        if name:
Severity: Minor
Found in core/models/goods.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 not year_profit_account:
                            raise UserError(u'公司本年利润科目未配置')
                        if not remain_account:
Severity: Major
Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if year_total != 0:
                                year_line_ids = [{
                                    'name': u'年度结余',
                                    'account_id': remain_account.id,
                                    'debit': 0,
    Severity: Major
    Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if next_period.is_closed:
                                  raise UserError(u'下一个期间%s已结账!' % next_period.name)
                          # 重新打开会计期间
                          balance.period_id.is_closed = False
      Severity: Major
      Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                if not last_period.is_closed:
                                    raise UserError(u'上一个期间%s未结账' % last_period.name)
                                if period_id.year != last_period.year:
        Severity: Major
        Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

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

              def onchange_goods_id(self):
                  '''当订单行的商品变化时,带出商品上的单位、成本价。
                  在采购订单上选择供应商,自动带出供货价格,没有设置供货价的取成本价格。'''
                  if not self.order_id.partner_id:
                      raise UserError(u'请先选择一个供应商!')
          Severity: Minor
          Found in buy/models/buy_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

          Avoid deeply nested control flow statements.
          Open

                                  for revenue_account_id in revenue_account_ids:
                                      voucher_line_ids = voucher_line_obj.search([
                                          ('account_id', '=', revenue_account_id.id),
                                          ('voucher_id.period_id', '=', balance.period_id.id),
                                          ('state', '=', 'done')])
          Severity: Major
          Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if (revenue_total - expense_total) > 0:
                                        res = {
                                            'name': u'利润结余',
                                            'account_id': year_profit_account.id,
                                            'debit': 0,
            Severity: Major
            Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if balance.period_id.month == '12':
                                          self.env['finance.period'].create({'year': str(int(balance.period_id.year) + 1),
                                                                             'month': '1', })
                                      else:
                                          self.env['finance.period'].create({'year': balance.period_id.year,
              Severity: Major
              Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

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

                    def _default_get(self, data):
                        ''' 给明细行摘要、借方金额、贷方金额字段赋默认值 '''
                        move_obj = self.env['voucher']
                        total = 0.0
                        context = self._context
                Severity: Minor
                Found in finance/models/finance.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 voucher_line:
                                            valus = {
                                                'is_checkout': True,
                                                'date': self.date,
                                                'line_ids': [
                Severity: Major
                Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

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

                      def get_unclose_year_balance(self, initial_balance_new, period, subject_name):
                          """取得没有关闭的期间的 本期合计和 本年累计"""
                          current_occurrence = {}
                          child_ids = self.env['finance.account'].search([('id','child_of',subject_name.id)])
                          account_ids = tuple(child_ids.ids)
                  Severity: Minor
                  Found in finance/models/trial_balance.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 expense_account_id in expense_account_ids:
                                              voucher_line_ids = voucher_line_obj.search([
                                                  ('account_id', '=', expense_account_id.id),
                                                  ('voucher_id.period_id', '=', balance.period_id.id),
                                                  ('state', '=', 'done')])
                  Severity: Major
                  Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if not remain_account:
                                                raise UserError(u'公司未分配利润科目未配置')
                                            if (revenue_total - expense_total) > 0:
                    Severity: Major
                    Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if (revenue_total - expense_total) < 0:
                                                  res = {
                                                      'name': u'利润结余',
                                                      'account_id': year_profit_account.id,
                                                      'debit': expense_total - revenue_total,
                      Severity: Major
                      Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                                for year_profit_id in year_profit_ids:
                                                    year_total += (year_profit_id.credit -
                                                                   year_profit_id.debit)
                                                precision = self.env['decimal.precision'].precision_get(
                        Severity: Major
                        Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                                  if period_id.year != last_period.year:
                                                      # 按年,而且是第一个会计期间
                                                      last_voucher_number = reset_init_number
                                                  else:
                                                      # 查找上一期间最后凭证号
                          Severity: Major
                          Found in finance/wizard/checkout_wizard.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                    if voucher_id.state != 'done':
                                                        draft_voucher_count += 1
                                                if draft_voucher_count != 0:
                            Severity: Major
                            Found in finance/wizard/checkout_wizard.py - About 45 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language