osbzr/gooderp_addons

View on GitHub
warehouse/models/warehouse_move.py

Summary

Maintainability
D
2 days
Test Coverage

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

Severity: Minor
Found in warehouse/models/warehouse_move.py - About 5 hrs to fix

    WhMove has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WhMove(models.Model):
        _name = 'wh.move'
        _description = u'移库单'
    
        MOVE_STATE = [
    Severity: Minor
    Found in warehouse/models/warehouse_move.py - About 2 hrs to fix

      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: 单据模型
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 2 hrs to fix

      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 scan_barcode_move_in_out_operation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def scan_barcode_move_in_out_operation(self, move, att, conversion, goods, val):
              """
              对仓库各种移库单据上扫码的统一处理
              :return: 是否创建新的明细行
              """
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 1 hr to fix

      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 scan_barcode_each_model_operation has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def scan_barcode_each_model_operation(self, model_name, order_id, att, goods, conversion):
              val = {}
              create_line = False  # 是否创建新的明细行
              order = self.env[model_name].browse(order_id)
              if model_name in ['wh.out', 'wh.in', 'wh.internal']:
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 1 hr to fix

      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 prepare_move_line_data has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def prepare_move_line_data(self, att, val, goods, move):
              """
              准备移库单明细数据
              :return: 字典
              """
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 1 hr to fix

      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 scan_barcode has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def scan_barcode(self, model_name, barcode, order_id):
              """
              扫描条码
              :param model_name: 模型名
              :param barcode: 条码
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 55 mins to fix

      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 scan_barcode_inventory_operation has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def scan_barcode_inventory_operation(self, move, att, conversion, goods, val):
      Severity: Minor
      Found in warehouse/models/warehouse_move.py - About 35 mins to fix

        Function scan_barcode_each_model_operation has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def scan_barcode_each_model_operation(self, model_name, order_id, att, goods, conversion):
        Severity: Minor
        Found in warehouse/models/warehouse_move.py - About 35 mins to fix

          Function scan_barcode_move_in_out_operation has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def scan_barcode_move_in_out_operation(self, move, att, conversion, goods, val):
          Severity: Minor
          Found in warehouse/models/warehouse_move.py - About 35 mins to fix

            Function scan_barcode_inventory_operation has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def scan_barcode_inventory_operation(self, move, att, conversion, goods, val):
                    '''盘点单扫码操作'''
                    create_line = False
                    for line in move.line_ids:
                        # 如果商品属性上存在条码 或 商品上存在条码
            Severity: Minor
            Found in warehouse/models/warehouse_move.py - About 25 mins to fix

            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

            Line too long (88 > 79 characters)
            Open

                        if (att and line.attribute_id == att) or (goods and line.goods_id == goods):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (95 > 79 characters)
            Open

                                               domain="['|',('user_ids','=',False),('user_ids','in',uid)]",
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (88 > 79 characters)
            Open

                        if (att and line.attribute_id == att) or (goods and line.goods_id == goods):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (81 > 79 characters)
            Open

                            'warehouse_id': self.env.ref('warehouse.warehouse_inventory').id,
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (82 > 79 characters)
            Open

                def scan_barcode_inventory_operation(self, move, att, conversion, goods, val):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (100 > 79 characters)
            Open

                                                    domain="['|',('user_ids','=',False),('user_ids','in',uid)]",
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (87 > 79 characters)
            Open

                        line.cost_unit = (line.goods_id.price if val['type'] in ['out', 'internal']
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (93 > 79 characters)
            Open

                date = fields.Date(u'单据日期', required=True, copy=False, default=fields.Date.context_today,
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Missing whitespace after ','
            Open

                    ('cancel', u'已作废'),]
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Each comma, semicolon or colon should be followed by whitespace.

            Okay: [a, b]
            Okay: (3,)
            Okay: a[1:4]
            Okay: a[:4]
            Okay: a[1:]
            Okay: a[1:4:2]
            E231: ['a','b']
            E231: foo(bar,baz)
            E231: [{'a':'b'}]

            Line too long (94 > 79 characters)
            Open

                def scan_barcode_each_model_operation(self, model_name, order_id, att, goods, conversion):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (106 > 79 characters)
            Open

                        if line.goods_qty > result and not line.lot_id and not self.env.context.get('wh_in_line_ids'):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (84 > 79 characters)
            Open

                def scan_barcode_move_in_out_operation(self, move, att, conversion, goods, val):
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (90 > 79 characters)
            Open

                all_line_done = fields.Boolean(u'出库行都完成', compute='compute_all_line_done', store=True)
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            Line too long (90 > 79 characters)
            Open

                                'cost_unit': line.goods_id.cost / (1 + line.goods_id.tax_rate * 0.01),
            Severity: Minor
            Found in warehouse/models/warehouse_move.py by pep8

            Limit all lines to a maximum of 79 characters.

            There are still many devices around that are limited to 80 character
            lines; plus, limiting windows to 80 characters makes it possible to
            have several windows side-by-side.  The default wrapping on such
            devices looks ugly.  Therefore, please limit all lines to a maximum
            of 79 characters. For flowing long blocks of text (docstrings or
            comments), limiting the length to 72 characters is recommended.
            
            Reports error E501.

            There are no issues that match your filters.

            Category
            Status