Showing 2,652 of 2,652 total issues
Function _create_voucher_line
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_voucher_line(self, account_id, debit, credit, voucher, goods_id, goods_qty):
Avoid deeply nested control flow statements. Open
if province != self.province_id:
self.province_id = province
else:
Function compute_overdue
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def compute_overdue(self):
"""
计算逾期天数: 当前日期 - 到期日,< 0则显示为0;如果逾期金额为0则逾期天数也为0
计算逾期金额: 逾期时等于未核销金额,否则为0
:return: 逾期天数
- Read upRead up
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_bom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onchange_bom(self):
line_out_ids, line_in_ids = [], []
domain = {}
warehouse_id = self.env['warehouse'].search(
[('type', '=', 'stock')], limit=1)
- Read upRead up
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_qty
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onchange_goods_qty(self):
"""
改变商品数量时(wh_assembly 中的goods_qty) 根据物料清单的 数量的比例及成本价的计算
算出新的组合件或者子件的 数量 (line.goods_qty / parent_line_goods_qty * self.goods_qty
line.goods_qty 子件商品数量
- Read upRead up
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 len("%s" % (cell_value)) > columnwidth.get(cell_index):
columnwidth.update(
{cell_index: len("%s" % (cell_value))})
else:
Function onchange_bom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onchange_bom(self):
line_out_ids, line_in_ids = [], []
domain = {}
# TODO
warehouse_id = self.env['warehouse'].search(
- Read upRead up
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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _get_cost(self, warehouse=None, ignore=None):
# 如果没有历史的剩余数量,计算最后一条move的成本
# 存在一种情况,计算一条line的成本的时候,先done掉该line,之后在通过该函数
# 查询成本,此时百分百搜到当前的line,所以添加ignore参数来忽略掉指定的line
self.ensure_one()
- Read upRead up
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 wh_move_line.attribute_id: # 商品存在属性
if not to_delivery_dict.has_key(wh_move_line.attribute_id):
to_delivery_dict.update(
{wh_move_line.attribute_id: wh_move_line.goods_qty})
else:
Avoid deeply nested control flow statements. Open
if is_buy:
todo_buy_lines.append(request_line_ids)
else:
todo_produce_lines.append(request_line_ids)
Function unlink
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def unlink(self):
if not self.is_current_model():
return super(MailThread, self).unlink()
for th in self:
if not len(th._to_approver_ids) and th._approver_num:
- Read upRead up
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_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'请不要重复发料')
- Read upRead up
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_bom
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def onchange_bom(self):
line_out_ids, line_in_ids = [], []
domain = {}
# TODO
warehouse_id = self.env['warehouse'].search(
- Read upRead up
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 _personal_tax_value
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _personal_tax_value(self):
total = self.all_wage - self.endowment - \
self.health - self.unemployment - self.housing_fund
amount = total - 3500
if amount > 80000:
- Read upRead up
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 8 (exceeds 5 allowed). Consider refactoring. Open
def approve_order(self):
for order in self:
if order.state == 'done':
raise UserError(u'请不要重复入库')
if self.env.user.company_id.is_enable_negative_stock:
- Read upRead up
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 bom_line:
is_buy = False
else:
is_buy = True
Avoid deeply nested control flow statements. Open
if wh_move_line.attribute_id: # 商品存在属性
if wh_move_line.attribute_id not in attribute_dict:
attribute_dict.update(
{wh_move_line.attribute_id: wh_move_line.qty_remaining})
else:
Avoid deeply nested control flow statements. Open
if isinstance(cell_value, basestring):
cell_value = re.sub("\r", " ", cell_value)
elif isinstance(cell_value, datetime.datetime):
cell_style = datetime_style
elif isinstance(cell_value, datetime.date):
Avoid deeply nested control flow statements. Open
if wh_move_line.attribute_id: # 商品存在属性
if not to_receipt_dict.has_key(wh_move_line.attribute_id):
to_receipt_dict.update(
{wh_move_line.attribute_id: wh_move_line.goods_qty})
else:
Avoid deeply nested control flow statements. Open
for line_in in assembly.line_in_ids:
line_in.attribute_id = line.attribute_id