Showing 391 of 2,652 total issues
File warehouse_move_line.py
has 438 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
import odoo.addons.decimal_precision as dp
from utils import safe_division
from jinja2 import Environment, PackageLoader
from odoo import models, fields, api
Function sell_adjust_done
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def sell_adjust_done(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
File inventory.py
has 408 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from odoo.osv import osv
# from odoo.osv import fields
from utils import create_name, safe_division
Function onchange_city
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def onchange_city(self):
# 为地址填写时方便,当选定市时 ,县区的列表里面只有所选市的
if self.city_id:
domain_dict = {'county_id': [('city_id', '=', self.city_id.id)]}
province = self.city_id.province_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 buy_adjust_done
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def buy_adjust_done(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 create_wave
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def create_wave(self):
"""
创建拣货单
"""
warehouse_id = False
- 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
File core.js
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
odoo.define('core.core', function (require) {
"use strict";
var ListView = require('web.ListView');
var common = require('web.list_common');
var form_relational = require('web.form_relational');
Function Drawer
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
}(function Drawer($) {
'use strict';
var namespace = 'drawer';
var touches = typeof document.ontouchstart != 'undefined';
var __ = {
File warehouse_move.py
has 382 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import UserError
Function partner_statements_with_goods
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def partner_statements_with_goods(self):
"""
业务伙伴对账单: 带商品明细
:return: action
"""
- 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 money_order_draft
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def money_order_draft(self):
"""
收付款单反审核方法
: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
File mail_thread.py
has 377 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from odoo import models, fields, api
from odoo.exceptions import ValidationError
from odoo.tools.safe_eval import safe_eval
Function compute_profit
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def compute_profit(self, parameter_str, period_id, compute_field_list):
""" 根据传进来的 的科目的code 进行利润表的计算 """
if parameter_str:
parameter_str_list = parameter_str.split('~')
subject_vals_in = []
- 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 a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def get_matching_records(self, warehouse, qty, uos_qty=0, attribute=None,
ignore_stock=False, ignore=None, move_line=False):
"""
获取匹配记录,不考虑批号
:param ignore_stock: 当参数指定为True的时候,此时忽略库存警告
- 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 _wrong_receipt_done
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def _wrong_receipt_done(self):
if self.state == 'done':
raise UserError(u'请不要重复入库')
batch_one_list_wh = []
batch_one_list = []
- 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_vouchers_summary
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def create_vouchers_summary(self):
"""创建出根据所选期间范围内的 明细帐记录"""
last_period = self.env['create.trial.balance.wizard'].compute_last_period_id(
self.period_begin_id)
if last_period:
- 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
File task.py
has 358 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
from odoo import api, fields, models
from odoo.tools import float_is_zero
from odoo.exceptions import UserError
Function write
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def write(self, vals):
'''
如果单据的审批流程已经开始(第一个人同意了才算开始) —— 至少一个审批人已经审批通过,不允许对此单据进行修改。
'''
if not self.is_current_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
WhMoveLine
has 35 functions (exceeds 20 allowed). Consider refactoring. Open
class WhMoveLine(models.Model):
_name = 'wh.move.line'
_description = u'移库单明细'
_order = 'lot'
Function create_trial_balance
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def create_trial_balance(self):
""" \
生成科目余额表 \
1.如果所选区间已经关闭则直接调出已有的科目余额表记录
2.判断如果所选的区间的 前一个期间没有关闭则报错
- 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"