Showing 2,652 of 2,652 total issues
Function _line_qty_write
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _line_qty_write(self):
if self.order_id:
for line in self.line_in_ids:
line.buy_line_id.quantity_in += line.goods_qty
for line in self.line_out_ids: # 退货单行
- 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_matching_records
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_matching_records(self, warehouse, qty, uos_qty=0, attribute=None,
Function create_source_docx_partner
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_source_docx_partner(self, cr, uid, ids, report, records, init_pay, context=None):
Function read_group
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def read_group(self, domain, fields, groupby, offset=0, limit=80, orderby=False, lazy=True):
Function _create_voucher_line
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_voucher_line(self, account_id, debit, credit, voucher_id, goods_id, goods_qty, partner_id):
Avoid deeply nested control flow statements. Open
if self.county_id.city_id == self.city_id:
domain_dict = {}
else:
self.county_id = False
else:
Function saomiaofapiao
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def saomiaofapiao(self, model_name, barcode, order_id):
"""
扫描发票条码
:param model_name: 模型名
:param barcode: 二维码识别内容
- 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 check_consistency
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def check_consistency(self):
category_id = []
for line in self.line_ids:
if line.category_id and line.category_id.id not in category_id:
category_id.append(line.category_id.id)
- 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 tax_invoice_done
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def tax_invoice_done(self):
for rec in self:
if rec.state == 'done':
raise UserError(u'请不要重复确认')
for line in rec.line_ids:
- 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 fields_view_get
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def fields_view_get(self, view_id=None, view_type='form', toolbar=False, submenu=False):
"""
根据内容判断 报出错误
"""
model = self.env.context.get('active_model')
- 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 province != self.province_id:
self.province_id = province
self.county_id = False
else:
self.county_id = False
Function __str__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self):
'''支持直接在word 上写 many2one 字段'''
name = ''
if self.data and self.data.display_name:
name = self.data.display_name
- 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 create_voucher
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_voucher(self):
"""创建凭证并审核非初始化凭证"""
init_obj = ''
# 初始化单的话,先找是否有初始化凭证,没有则新建一个
if self.is_init:
- 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 _generate_delivery
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _generate_delivery(self, delivery_line):
'''根据明细行生成发货单或退货单'''
# 如果退货,warehouse_dest_id,warehouse_id要调换
warehouse = (self.type == 'sell'
and self.warehouse_id
- 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 change_color
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
change_color: function (rows, $cell, i, j, nbr_measures,field_index) {
Function button_ok
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def button_ok(self):
self.ensure_one()
res = []
dict_part = {}
if self.date_end < self.date_start:
- 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
for line in line_ids:
record_id = self._create_statements_report_with_goods_line(line.goods_id.code,
line.goods_id.name,
line.attribute_id.id,
line.uom_id.id,
Function momentum
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
me.momentum = function (current, start, time, lowerMargin, wrapperSize, deceleration) {
Function _prepare_sell_receipt
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _prepare_sell_receipt(self, delivery):
'''对于传入的发货单/退货单,为创建销售收款一览表准备数据'''
self.ensure_one()
factor = delivery.is_return and -1 or 1 # 如果是退货则金额均取反
sell_amount = factor * (delivery.discount_amount + delivery.amount)
- 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
for line in line_ids:
record_id = self._create_statements_report_with_goods_line(line.goods_id.code,
line.goods_id.name,
line.attribute_id.id,
line.uom_id.id,