Showing 391 of 2,652 total issues
Consider simplifying this complex logical expression. Open
if good.attribute_ids: # 商品存在属性
for attribute in good.attribute_ids:
qty = attribute in attribute_dict and attribute_dict[attribute] or 0
to_sell_qty = attribute in to_sell_dict and to_sell_dict[attribute] or 0
to_delivery_qty = attribute in to_delivery_dict and to_delivery_dict[
WhDisassembly
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class WhDisassembly(models.Model):
_name = 'wh.disassembly'
_description = u'拆卸单'
_inherit = ['mail.thread']
_order = 'date DESC, id DESC'
WhAssembly
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class WhAssembly(models.Model):
_name = 'wh.assembly'
_description = u'组装单'
_inherit = ['mail.thread']
_order = 'date DESC, id DESC'
ReportBase
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class ReportBase(models.Model):
_name = 'report.base'
_description = u'使用search_read来直接生成数据的基本类,其他类可以直接异名继承当前类来重用搜索、过滤、分组等函数'
_expired_time = 60
WhMove
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class WhMove(models.Model):
_name = 'wh.move'
_description = u'移库单'
MOVE_STATE = [
Function _nearestSnap
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
_nearestSnap: function (x, y) {
if ( !this.pages.length ) {
return { x: 0, y: 0, pageX: 0, pageY: 0 };
}
Function sell_to_return
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def sell_to_return(self):
'''销售发货单转化为销售退货单'''
return_goods = {}
return_order_draft = self.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 create_zero_wh_in
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def create_zero_wh_in(self, wh_in, model_name):
"""
创建一个缺货向导
:param wh_in: 单据实例
:param model_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 generate_inventory
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def generate_inventory(self):
for inventory in self:
if self.state in ['done', 'confirmed']:
raise UserError(u'请不要重复点击生成盘点单据按钮')
out_line, in_line = [], []
- 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 button_ok
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def button_ok(self):
'''生成按钮,复制销货订单行到购货订单中'''
for wizard in self:
if not wizard.sell_line_ids:
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
SellDelivery
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class SellDelivery(models.Model):
_name = 'sell.delivery'
_inherits = {'wh.move': 'sell_move_id'}
_inherit = ['mail.thread']
_description = u'销售发货单'
outsource
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class outsource(models.Model):
_name = 'outsource'
_description = u'委外加工单'
_inherit = ['mail.thread']
_order = 'date DESC, id DESC'
BuyOrder
has 21 functions (exceeds 20 allowed). Consider refactoring. Open
class BuyOrder(models.Model):
_name = "buy.order"
_inherit = ['mail.thread']
_description = u"购货订单"
_order = 'date desc, id desc'
Function Indicator
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Indicator (scroller, options) {
this.wrapper = typeof options.el == 'string' ? document.querySelector(options.el) : options.el;
this.wrapperStyle = this.wrapper.style;
this.indicator = this.wrapper.children[0];
this.indicatorStyle = this.indicator.style;
Function prev_action_done
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def prev_action_done(self):
"""
发货 matching
"""
for line in self:
- 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_user_group__
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def __get_user_group__(self, active_id, active_model, users, mode_row):
all_groups = []
process_rows = self.env['good_process.process'].search([('model_id.model', '=', active_model),
('type', '=', getattr(mode_row, 'type', False))],
order='sequence')
- 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 schedule_backup
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def schedule_backup(self):
confs = self.search([])
master_pass = tools.config.get('admin_passwd', False)
res_user_obj = self.env.get('res.users')
if not master_pass:
- 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 init
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
init: function init(options) {
options = $.extend({
iscroll: {
mouseWheel: true,
preventDefault: false
File jquery.stickytableheaders.js
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*! Copyright (c) 2011 by Jonas Mosbech - https://github.com/jmosbech/StickyTableHeaders
MIT license info: https://github.com/jmosbech/StickyTableHeaders/blob/master/license.txt */
;(function ($, window, undefined) {
'use strict';
Consider simplifying this complex logical expression. Open
if in_xls_data.get(u'商品名称') and in_xls_data.get(u'商品名称') != u'小计':
self.env['cn.account.invoice.line'].create({
'order_id': invoice_id.id,
'product_name': goods_name or '',
'product_type': product_type or '',