[REM] *: removes 'show reserved' Picking option

Removes the 'Show Reserved' option in operation type (PickingType).

Task #1944853

closes odoo/odoo#31523

Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
svs-odoo
2019-04-02 12:35:07 +00:00
parent 7ffaa69e72
commit 1774fcf778
6 changed files with 5 additions and 43 deletions
-3
View File
@@ -103,9 +103,6 @@
<field name="show_operations" position="attributes">
<attribute name="attrs">{"invisible": [("code", "=", "mrp_operation")]}</attribute>
</field>
<field name="show_reserved" position="attributes">
<attribute name="attrs">{"invisible": [("code", "=", "mrp_operation")]}</attribute>
</field>
</field>
</record>
</odoo>
+1 -1
View File
@@ -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)
+4 -18
View File
@@ -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'),
-7
View File
@@ -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]
-13
View File
@@ -167,19 +167,6 @@
</field>
</record>
<record id="view_stock_move_nosuggest_operations" model="ir.ui.view">
<field name="name">stock.move.operations.nosuggest.form</field>
<field name="model">stock.move</field>
<field name="priority">1000</field>
<field name="mode">primary</field>
<field name="inherit_id" ref="stock.view_stock_move_operations"/>
<field name="arch" type="xml">
<field name="move_line_ids" position="replace">
<field name="move_line_nosuggest_ids" attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}" context="{'tree_view_ref': 'stock.view_stock_move_line_operation_tree','default_picking_id': picking_id, 'default_move_id': id, 'default_product_id': product_id, 'default_location_id': location_id, 'default_location_dest_id': location_dest_id}"/>
</field>
</field>
</record>
<record id="view_stock_move_line_operation_tree" model="ir.ui.view">
<field name="name">stock.move.line.operations.tree</field>
<field name="model">stock.move.line</field>
@@ -51,7 +51,6 @@
<field name="code"/>
<field attrs='{"invisible": [("code", "not in", ["incoming", "outgoing", "internal"])]}' name="return_picking_type_id"/>
<field name="show_operations"/>
<field name="show_reserved" attrs="{'invisible': [('show_operations', '!=', False)]}"/>
</group>
</group>
<group>