diff --git a/addons/mrp/views/stock_picking_views.xml b/addons/mrp/views/stock_picking_views.xml index bf64a2579f6..0bf2821ad19 100644 --- a/addons/mrp/views/stock_picking_views.xml +++ b/addons/mrp/views/stock_picking_views.xml @@ -103,9 +103,6 @@ {"invisible": [("code", "=", "mrp_operation")]} - - {"invisible": [("code", "=", "mrp_operation")]} - diff --git a/addons/point_of_sale/models/pos_order.py b/addons/point_of_sale/models/pos_order.py index 1c1a4bbe840..331fc192fb4 100644 --- a/addons/point_of_sale/models/pos_order.py +++ b/addons/point_of_sale/models/pos_order.py @@ -912,7 +912,7 @@ class PosOrder(models.Model): 'lot_id': lot_id, }) if not pack_lots and not float_is_zero(qty_done, precision_rounding=move.product_uom.rounding): - if len(move._get_move_lines()) < 2: + if len(move.move_line_ids) < 2: move.quantity_done = qty_done else: move._set_quantity_done(qty_done) diff --git a/addons/stock/models/stock_move.py b/addons/stock/models/stock_move.py index 19da209adfb..c2492c3a572 100644 --- a/addons/stock/models/stock_move.py +++ b/addons/stock/models/stock_move.py @@ -130,7 +130,6 @@ class StockMove(models.Model): picking_type_id = fields.Many2one('stock.picking.type', 'Operation Type') inventory_id = fields.Many2one('stock.inventory', 'Inventory') move_line_ids = fields.One2many('stock.move.line', 'move_id') - move_line_nosuggest_ids = fields.One2many('stock.move.line', 'move_id', domain=[('product_qty', '=', 0.0)]) origin_returned_move_id = fields.Many2one('stock.move', 'Origin return move', copy=False, help='Move that created the return move') returned_move_ids = fields.One2many('stock.move', 'origin_returned_move_id', 'All returned moves', help='Optional: all returned moves created from this move') reserved_availability = fields.Float( @@ -242,13 +241,7 @@ class StockMove(models.Model): rounding_method = self._context.get('rounding_method', 'UP') self.product_qty = self.product_uom._compute_quantity(self.product_uom_qty, self.product_id.uom_id, rounding_method=rounding_method) - def _get_move_lines(self): - """ This will return the move lines to consider when applying _quantity_done_compute on a stock.move. - In some context, such as MRP, it is necessary to compute quantity_done on filtered sock.move.line.""" - self.ensure_one() - return self.move_line_ids or self.move_line_nosuggest_ids - - @api.depends('move_line_ids.qty_done', 'move_line_ids.product_uom_id', 'move_line_nosuggest_ids.qty_done') + @api.depends('move_line_ids.qty_done', 'move_line_ids.product_uom_id') def _quantity_done_compute(self): """ This field represents the sum of the move lines `qty_done`. It allows the user to know if there is still work to do. @@ -260,14 +253,14 @@ class StockMove(models.Model): """ for move in self: quantity_done = 0 - for move_line in move._get_move_lines(): + for move_line in move.move_line_ids: quantity_done += move_line.product_uom_id._compute_quantity(move_line.qty_done, move.product_uom, round=False) move.quantity_done = quantity_done def _quantity_done_set(self): quantity_done = self[0].quantity_done # any call to create will invalidate `move.quantity_done` for move in self: - move_lines = move._get_move_lines() + move_lines = move.move_line_ids if not move_lines: if quantity_done: # do not impact reservation here @@ -459,14 +452,7 @@ class StockMove(models.Model): """ self.ensure_one() - # If "show suggestions" is not checked on the picking type, we have to filter out the - # reserved move lines. We do this by displaying `move_line_nosuggest_ids`. We use - # different views to display one field or another so that the webclient doesn't have to - # fetch both. - if self.picking_id.picking_type_id.show_reserved: - view = self.env.ref('stock.view_stock_move_operations') - else: - view = self.env.ref('stock.view_stock_move_nosuggest_operations') + view = self.env.ref('stock.view_stock_move_operations') return { 'name': _('Detailed Operations'), diff --git a/addons/stock/models/stock_picking.py b/addons/stock/models/stock_picking.py index 1d9f26857e8..281cc193eba 100644 --- a/addons/stock/models/stock_picking.py +++ b/addons/stock/models/stock_picking.py @@ -52,8 +52,6 @@ class PickingType(models.Model): show_operations = fields.Boolean( 'Show Detailed Operations', default=_default_show_operations, help="If this checkbox is ticked, the pickings lines will represent detailed stock operations. If not, the picking lines will represent an aggregate of detailed stock operations.") - show_reserved = fields.Boolean( - 'Show Reserved', default=True, help="If this checkbox is ticked, Odoo will show which products are reserved (lot/serial number, source location, source package).") # Statistics for the kanban view last_done_picking = fields.Char('Last 10 Done Pickings', compute='_compute_last_done_picking') @@ -139,11 +137,6 @@ class PickingType(models.Model): self.default_location_src_id = self.env.ref('stock.stock_location_stock').id self.default_location_dest_id = self.env.ref('stock.stock_location_customers').id - @api.onchange('show_operations') - def onchange_show_operations(self): - if self.show_operations is True: - self.show_reserved = True - def _get_action(self, action_xmlid): # TDE TODO check to have one view + custo in methods action = self.env.ref(action_xmlid).read()[0] diff --git a/addons/stock/views/stock_move_views.xml b/addons/stock/views/stock_move_views.xml index a89b280ddbc..b80ffcac730 100644 --- a/addons/stock/views/stock_move_views.xml +++ b/addons/stock/views/stock_move_views.xml @@ -167,19 +167,6 @@ - - stock.move.operations.nosuggest.form - stock.move - 1000 - primary - - - - - - - - stock.move.line.operations.tree stock.move.line diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index 5b36be67aff..d73ee9e22d5 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -51,7 +51,6 @@ -