Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.
Module: Inventory
Entity: stock.move
Compute Method: _compute_show_details_visible
| Inputs | Method | Outputs |
|---|---|---|
|
""" According to this field, the button that calls `action_show_details` will be displayed
to work on a move from its picking form view, or not.
"""
- has_package = self.user_has_groups('stock.group_tracking_lot')
- multi_locations_enabled = self.user_has_groups('stock.group_stock_multi_locations')
- consignment_enabled = self.user_has_groups('stock.group_tracking_owner')
+ has_package = self.env.user.has_group('stock.group_tracking_lot')
+ multi_locations_enabled = self.env.user.has_group('stock.group_stock_multi_locations')
+ consignment_enabled = self.env.user.has_group('stock.group_tracking_owner')
show_details_visible = multi_locations_enabled or has_package or consignment_enabled
for move in self:
- if not move.product_id:
+ if (
+ not move.product_id
+ or move.state == "draft"
+ or (
+ not move.picking_type_id.use_create_lots
+ and not move.picking_type_id.use_existing_lots
+ and not self.env.user.has_group("stock.group_stock_tracking_lot")
+ and not self.env.user.has_group("stock.group_stock_multi_locations")
+ )
+ ):
move.show_details_visible = False
elif len(move.move_line_ids) > 1:
move.show_details_visible = True
else:
move.show_details_visible = show_details_visible or move.has_tracking != 'none'
|
|
