Showing 391 of 2,652 total issues
Function get_next_char
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_next_char(self, number_next):
def _interpolation_dict():
now = range_date = effective_date = datetime.now(
pytz.timezone(self._context.get('tz') or 'UTC'))
if self._context.get('ir_sequence_date'):
- 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 render_value
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render_value: function() {
var $pdf_viewer = this.$('.o_form_pdf_controls').children().add(this.$('.o_pdfview_iframe')),
$select_upload_el = this.$('.o_select_file_button').first(),
$iFrame = this.$('.o_pdfview_iframe'),
value = this.get('value'),
Function _initKeys
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initKeys: function (e) {
// default key bindings
var keys = {
pageUp: 33,
pageDown: 34,
Function get_condition
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_condition(self, args):
"""
返回定价策略的各种条件及报错信息
:param args: 传入的参数字典
:return: 取数的条件和按此条件取到多条策略时的报错信息,返回一个有序列表,
Function pad_table_to
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
pad_table_to: function (count) {
count -=3; /* 表格预留空行太多很难看 */
if (this.records.length >= count ||
_(this.columns).any(function (column) { return column.meta; })) {
return;
Function _end
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
_end: function (e) {
if ( !this.initiated ) {
return;
}
Function start
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function() {
var self = this,
res = this._super.apply(this, arguments);
self.$el.on('keydown', '.ge_scan_barcode', function(event) {
Function format
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
format: function (row_data, options) {
/* Return a valid img tag. For image fields, test if the
field's value contains just the binary size and retrieve
the image from the dedicated controller in that case.
Otherwise, assume a character field containing either a
Function createDefaultScrollbar
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createDefaultScrollbar (direction, interactive, type) {
var scrollbar = document.createElement('div'),
indicator = document.createElement('div');
if ( type === true ) {
Function start
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function() {
var self = this,
res = this._super.apply(this, arguments);
self.$el.on('keydown', '.do_input_invoice_code', function(event) {
Function compute_footer_data
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
function compute_footer_data(amount,export_columns_keys) {
var export_rows = []
var footer = 0;
$.each(amount, function () {
var $row = $(this);
Function _create_voucher_line
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _create_voucher_line(self, line, name, account_id, debit, credit, voucher_id, partner_id, currency_id):
Function _prepare_vouch_line_data
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _prepare_vouch_line_data(self, line, name, account_id, debit, credit, voucher_id, partner_id, currency_id):
Function calc_length
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def calc_length(s):
"""
把字符串,数字类型的参数转化为docx的长度对象,如:
12 => Pt(12)
'12' => Pt(12)
- 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_context
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_context(self, sql_type='out', context=None):
date_end = datetime.datetime.strptime(
context.get('date_end'), '%Y-%m-%d') + datetime.timedelta(days=1)
date_end = date_end.strftime('%Y-%m-%d')
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 other_money_draft
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def other_money_draft(self):
'''其他收支单的反审核按钮'''
self.ensure_one()
# 根据单据类型更新账户余额
if self.type == 'other_pay':
- 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 _compute_partner_address
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def _compute_partner_address(self):
'''如果业务伙伴地址中有默认地址,则显示在业务伙伴列表上'''
if not self.child_ids:
return {}
for child in self.child_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 onchange_warehouse_id
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def onchange_warehouse_id(self):
'''当订单行的仓库变化时,带出定价策略中的折扣率'''
if self.warehouse_id and self.goods_id:
partner_id = self.env.context.get('default_partner')
partner = self.env['partner'].browse(
- 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_context
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def get_context(self, sql_type='out', context=None):
date_end = datetime.datetime.strptime(
context.get('date_end'), '%Y-%m-%d') + datetime.timedelta(days=1)
date_end = date_end.strftime('%Y-%m-%d')
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 to_other_money_order
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def to_other_money_order(self):
other_money_order = self.with_context(type='other_pay').env['other.money.order'].create({
'state': 'draft',
'partner_id': self.partner_id and self.partner_id.id or '',
'date': self.date,
- 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"