From 7e310e531e2fa1a6cc6ab532f2c906de64cfd586 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Thu, 15 Sep 2022 13:18:25 +0000 Subject: [PATCH] [IMP] stock{_account}: polish views Followup to inventory back2basics task 2882539 - order stock.move.line tree (Moves History) view by "id desc" for better performance (prev: create_date is not indexed) - order stock.valuation.layer tree (Valuation) view by "id desc" for better performance (prev: date is not indexed) - hide "Moved Quantity" column when in current valuation (not at date) - remove the action: "Set" and print: "Count Sheet" from stock.quant.view when not in "Inventory Adjustment" related view - Fix "Inventory At Date"/"Valuation At Date" button visibility issue that came up due to OWL refactoring - Don't show consumables in stock.valuation.layer (Valuation) report view action (forgot to include domain when creating new action) - Add stock.move menuitem back in under "reporting" in debug mode since this view isn't accesible anywhere else and it is used a lot for qty forecasts by users - Add "Created By" (as "Done By") to stock.move.line history view for easier tracking of inventory adjustments closes odoo/odoo#102929 Task: 2965586 X-original-commit: 8904c3c4b709f94266a883bc734faad8b3b4ba3a Signed-off-by: Arnold Moyaux (arm) --- .../src/views/list/inventory_report_list.xml | 2 +- .../list/inventory_report_list_controller.js | 15 +++++++++++++++ addons/stock/views/stock_move_line_views.xml | 4 +++- addons/stock/views/stock_move_views.xml | 2 ++ .../static/src/xml/inventory_report.xml | 7 ++++--- .../views/stock_valuation_layer_views.xml | 6 +++++- 6 files changed, 30 insertions(+), 6 deletions(-) diff --git a/addons/stock/static/src/views/list/inventory_report_list.xml b/addons/stock/static/src/views/list/inventory_report_list.xml index 853f20d691b..581ac6683de 100644 --- a/addons/stock/static/src/views/list/inventory_report_list.xml +++ b/addons/stock/static/src/views/list/inventory_report_list.xml @@ -3,7 +3,7 @@ - diff --git a/addons/stock/static/src/views/list/inventory_report_list_controller.js b/addons/stock/static/src/views/list/inventory_report_list_controller.js index 5036b8472f3..a5065acab84 100644 --- a/addons/stock/static/src/views/list/inventory_report_list_controller.js +++ b/addons/stock/static/src/views/list/inventory_report_list_controller.js @@ -35,6 +35,21 @@ export class InventoryReportListController extends ListController { }); } + getActionMenuItems() { + const actionMenus = super.getActionMenuItems(); + if (this.props.resModel === "stock.quant" && (!this.props.context.inventory_mode || this.props.context.inventory_report_mode)) { + // hack so we don't show some of the default actions when it's inappropriate to + const {print, action, other} = actionMenus; + return Object.assign( + {}, + print.filter(a => a.name !== 'Count Sheet'), + action.filter(a => a.name !== 'Set'), + { other: other }, + ); + } + return actionMenus; + } + /** * Handler called when a record has been created or updated. * We need to detect when the user added to the list a quant which already exists diff --git a/addons/stock/views/stock_move_line_views.xml b/addons/stock/views/stock_move_line_views.xml index 83a0cbb36bd..b66f95f1592 100644 --- a/addons/stock/views/stock_move_line_views.xml +++ b/addons/stock/views/stock_move_line_views.xml @@ -4,7 +4,7 @@ stock.move.line.tree stock.move.line - + @@ -27,6 +27,7 @@ decoration-muted="state == 'draft'" decoration-success="state == 'done'" decoration-warning="state not in ('draft','cancel','done','assigned')"/> + @@ -97,6 +98,7 @@ + diff --git a/addons/stock/views/stock_move_views.xml b/addons/stock/views/stock_move_views.xml index 4268d3dbb8c..6ddca0e3a35 100644 --- a/addons/stock/views/stock_move_views.xml +++ b/addons/stock/views/stock_move_views.xml @@ -475,4 +475,6 @@ + + diff --git a/addons/stock_account/static/src/xml/inventory_report.xml b/addons/stock_account/static/src/xml/inventory_report.xml index 288e08ab6ea..d30138acc00 100644 --- a/addons/stock_account/static/src/xml/inventory_report.xml +++ b/addons/stock_account/static/src/xml/inventory_report.xml @@ -2,10 +2,11 @@ - - + + diff --git a/addons/stock_account/views/stock_valuation_layer_views.xml b/addons/stock_account/views/stock_valuation_layer_views.xml index 4e6697e8427..e39dc05d10d 100644 --- a/addons/stock_account/views/stock_valuation_layer_views.xml +++ b/addons/stock_account/views/stock_valuation_layer_views.xml @@ -41,7 +41,7 @@ stock.valuation.layer.tree stock.valuation.layer - @@ -115,6 +115,9 @@ primary + + 1 + @@ -131,6 +134,7 @@ tree,form,pivot {'search_default_has_remaining_qty': 1} + [('product_id.type', '=', 'product')]