osbzr/gooderp_addons

View on GitHub

Showing 391 of 2,652 total issues

Function _other_pay has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _other_pay(self):
        '''选择结算账户,生成其他支出单 '''
        self.ensure_one()
        StaffWages = self.env.ref('staff_wages.staff_wages')
        endowment = self.env.ref('staff_wages.endowment')
Severity: Minor
Found in staff_wages/models/staff_wages.py - About 35 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 pre_out_vourcher_line_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def pre_out_vourcher_line_data(self, assembly, voucher):
        """
        准备出库凭证行数据
        借:生产成本-基本生产成本(核算分类上)
        贷:库存商品(商品上)
Severity: Minor
Found in warehouse/models/production.py - About 35 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_is_child_enable has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_is_child_enable(self):
        for child_line in self.line_out_ids:
            for parent_line in self.line_in_ids:
                if child_line.goods_id.id == parent_line.goods_id.id and child_line.attribute_id.id == parent_line.attribute_id.id:
                    raise UserError(u'子件中不能包含与组合件中相同的 产品+属性,%s' % parent_line.goods_id.name)
Severity: Minor
Found in warehouse/models/production.py - About 35 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 cancel_approved_order has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def cancel_approved_order(self):
        for order in self:
            if order.state == 'feeding':
                raise UserError(u'请不要重复撤销')
            # 反审核入库到废品仓的移库单
Severity: Minor
Found in warehouse/models/production.py - About 35 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_partner_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def onchange_partner_id(self):
        """
        onchange 类型字段 当改变 客户或者转入往来单位  业务类型 自动生成 对应的
        核销单各种明细。
        :return:
Severity: Minor
Found in money/models/money_order.py - About 35 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_vourcher_line_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def create_vourcher_line_data(self, assembly, voucher_row):
        """
        准备入库凭证行数据
        借:库存商品(商品上)
        贷:生产成本-基本生产成本(核算分类上)
Severity: Minor
Found in warehouse/models/production.py - About 35 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 approve_order has a Cognitive Complexity of 7 (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 35 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 pre_out_vourcher_line_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def pre_out_vourcher_line_data(self, outsource, voucher):
        """
        准备出库凭证行数据
        借:委托加工物资(核算分类上)
        贷:库存商品(商品上)
Severity: Minor
Found in warehouse/models/production.py - About 35 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 __add_approver__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def __add_approver__(self, thread_row, model_name, active_id):
        # TODO 加上当前用户的部门经理
        approver_rows = []
        users = []
        process_rows = self.env['good_process.process'].search([('model_id.model', '=', model_name),
Severity: Minor
Found in good_process/models/mail_thread.py - About 35 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 cancel_approved_order has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def cancel_approved_order(self):
        for order in self:
            if order.state == 'feeding':
                raise UserError(u'请不要重复撤销')
            # 反审核入库到废品仓的移库单
Severity: Minor
Found in warehouse/models/production.py - About 35 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 apportion_cost has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def apportion_cost(self, cost):
        for outsource in self:
            if not outsource.line_in_ids:
                continue

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

    def create_source_docx_partner(self, cr, uid, ids, report, records, init_pay, context=None):
        # 2016-11-2 支持了图片
        # 1.导入依赖,python3语法
        # from . import report_helper
        # 2. 需要添加一个"tpl"属性获得模版对象
Severity: Minor
Found in money/report/supplier_statements.py - About 35 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_confim has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def cost_order_confim(self):
        '''确认服务订单'''
        if not self.name:
            self.update(
                {'name': self.env['ir.sequence'].next_by_code('cost.order') or '/'})
Severity: Minor
Found in account_cost/models/cost_order.py - About 35 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_goods_id has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def onchange_goods_id(self):
        '''当订单行的商品变化时,带出商品上的成本价,以及公司的进项税'''
        self.ensure_one()
        if self.goods_id:
            is_return = self.env.context.get('default_is_return')
Severity: Minor
Found in buy/models/buy_receipt.py - About 35 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_current_occurrence_amount has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_current_occurrence_amount(self, period, subject_name):
        """计算出 本期的科目的 voucher_line的明细记录 """
        child_ids = self.env['finance.account'].search([('id','child_of',subject_name.id)])
        account_ids = tuple(child_ids.ids)
        sql = ''' select vo.date as date, vo.id as voucher_id,COALESCE(vol.debit,0) as debit,vol.name
Severity: Minor
Found in finance/models/trial_balance.py - About 35 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_line has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _create_voucher_line(self, account_id, debit, credit, voucher_id, goods_id, goods_qty, partner_id):
        '''返回voucher line'''
        rate_silent = currency_amount = 0
        currency = self.currency_id != self.env.user.company_id.currency_id and self.currency_id.id or False
        if self.currency_id and self.currency_id != self.env.user.company_id.currency_id:
Severity: Minor
Found in buy/models/buy_receipt.py - About 35 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_cost_depreciation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_cost_depreciation(self):
        ''' 计算每月折旧 '''
        if self.no_depreciation == True:  # 不提折旧不要算
            self.cost_depreciation = 0
        else:                             # 原值减残值减已折旧额,再除以剩余折旧期数
Severity: Minor
Found in asset/models/asset.py - About 35 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 find_source_order has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def find_source_order(self):
        # 查看原始单据,三情况:收付款单、采购退货单、采购入库单、核销单
        self.ensure_one()
        model_view = {
            'money.order': {'name': u'付款单',
Severity: Minor
Found in buy/report/supplier_statements.py - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    def name_search(self, name='', args=None, operator='ilike', limit=100):
        """
        在many2one字段中支持按编号搜索
        """
        args = args or []
Severity: Minor
Found in core/models/partner.py - About 35 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_period has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_period(self, date):
        """
        根据参数date 得出对应的期间
        :param date: 需要取得期间的时间
        :return: 对应的期间
Severity: Minor
Found in finance/models/finance.py - About 35 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