osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

Function get_time has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_time(self, model):
        ISOTIMEFORMAT = "%Y-%m-%d"
        report_model = self.env['report.template'].search(
            [('model_id.model', '=', model)], limit=1)
        file_address = report_model and report_model[0].file_address or False
Severity: Minor
Found in web_export_view_good/controllers/controllers.py - About 25 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_difference_qty has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_difference_qty(self):
        for line in self:
            line.difference_qty = line.inventory_qty - line.real_qty
            line.difference_uos_qty = line.inventory_uos_qty - line.real_uos_qty

Severity: Minor
Found in warehouse/models/inventory.py - About 25 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 _compute_newly_hired_staff has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _compute_newly_hired_staff(self):
        '''计算新进员工数'''
        read_group_result = self.env['hire.applicant'].read_group(
            [('staff_id', 'in', self.ids), ('job_id.state', '=', 'open')],
            ['staff_id'], ['staff_id'])
Severity: Minor
Found in staff_hire/models/staff.py - About 25 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 do_confirm has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def do_confirm(self):
        active_model = self.env.context.get('active_model')
        active_ids = self.env.context.get('active_ids')

        if active_ids and active_model:
Severity: Minor
Found in common_dialog/wizard/wizard.py - About 25 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 setOutCell has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def setOutCell(self, outSheet, col, row, value):
        """ Change cell value without changing formatting. """

        # 本方法来自 葡萄皮的数据空间[http://biotopiblog.sinaapp.com]
        # 链接http://biotopiblog.sinaapp.com/2014/06/python读写excel如何保留原有格式/
Severity: Minor
Found in web_export_view_good/controllers/controllers.py - About 25 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 cost_order_draft has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def cost_order_draft(self):
        '''撤销确认服务订单'''
        if self.state == 'draft':
            raise UserError(u'请不要重复撤销确认!')

Severity: Minor
Found in account_cost/models/cost_order.py - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_voucher(self, date):
        """
        生成并审核计提凭证
        :param date: 一个日期
        :return:
Severity: Minor
Found in staff_wages/models/staff_wages.py - About 25 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_suggested_cost_by_warehouse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def get_suggested_cost_by_warehouse(
            self, warehouse, qty, lot_id=None, attribute=None, ignore_move=None):
        # 存在一种情况,计算一条line的成本的时候,先done掉该line,之后在通过该函数
        # 查询成本,此时百分百搜到当前的line,所以添加ignore参数来忽略掉指定的line
        if lot_id:
Severity: Minor
Found in warehouse/models/goods.py - About 25 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 open_non_active_report has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def open_non_active_report(self):
        """

        :return:
         返回生成好的 呆滞料报表 记录的tree视图返回,让用户可以直接看到结果
Severity: Minor
Found in warehouse/wizard/non_active_report_wizard.py - About 25 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 is_current_model has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def is_current_model(self):
        """检查是否是当前对象"""
        action_id = self.env.context.get('params', False) \
                    and self.env.context['params'].get('action', False) \
                    or False
Severity: Minor
Found in good_process/models/mail_thread.py - About 25 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 _onchange_job_id_internal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _onchange_job_id_internal(self, job_id):
        '''选择职位具体实现'''
        department_id = False
        user_id = False
        stage_id = self.stage_id.id
Severity: Minor
Found in staff_hire/models/staff_hire.py - About 25 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_or_pay_cancel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_or_pay_cancel(self, line, business_type, name):
        """
        反核销时 对具体核销单行进行的操作
        """
        # 每一行的已核销金额减少、未核销金额增加
Severity: Minor
Found in money/models/money_order.py - About 25 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_parent_child_unique has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_parent_child_unique(self):
        """判断同一个产品不能是组合件又是子件"""
        for child_line in self.line_child_ids:
            for parent_line in self.line_parent_ids:
                if child_line.goods_id == parent_line.goods_id and child_line.attribute_id == parent_line.attribute_id:
Severity: Minor
Found in warehouse/models/production.py - About 25 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 update_result_none_to_false has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_result_none_to_false(self, result):
        for val in result:
            for key, value in val.iteritems():
                if value is None:
                    val[key] = False
Severity: Minor
Found in warehouse/report/report_base.py - About 25 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 scan_barcode_inventory_operation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def scan_barcode_inventory_operation(self, move, att, conversion, goods, val):
        '''盘点单扫码操作'''
        create_line = False
        for line in move.line_ids:
            # 如果商品属性上存在条码 或 商品上存在条码
Severity: Minor
Found in warehouse/models/warehouse_move.py - About 25 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 staff_wages_accrued has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def staff_wages_accrued(self):
        """
        计提方法,如计提凭证已存在,判断当前期间是否与工资期间相同。
        如相同,反审核计提凭证并重新生成计提凭证;
        如不同,生成并审核修正凭证。
Severity: Minor
Found in staff_wages/models/staff_wages.py - About 25 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 compute_trial_balance_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def compute_trial_balance_data(self, trial_balance, last_period, subject_name_id, trial_balance_dict):
        ''' 获得 科目余额表 数据 '''
        initial_balance_credit = trial_balance.ending_balance_credit or 0
        initial_balance_debit = trial_balance.ending_balance_debit or 0
        this_debit = this_credit = ending_balance_credit = 0
Severity: Minor
Found in finance/models/trial_balance.py - About 25 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 _register_hook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _register_hook(self):
        '''
        Register method in BaseModel 
        '''
        @api.multi
Severity: Minor
Found in core/models/core.py - About 25 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_exchange has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def create_exchange(self):
        vouch_obj = self.env['voucher'].create({'date': self.date})
        '''只有外币+期末需要调汇的科目才会能生成调汇凭证的明细行'''
        vals = {}
        for account_id in self.env['finance.account'].search([
Severity: Minor
Found in finance/models/exchange.py - About 25 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 update_cumulative_occurrence has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def update_cumulative_occurrence(self):
        parent_accounts =[]
        account = self.trial_balance_id.subject_name_id
        while account:
            parent_accounts.append(account)
Severity: Minor
Found in finance/models/trial_balance.py - About 25 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

Severity
Category
Status
Source
Language