From fc6aed2c28af685218c9339c74898e58ee19aa44 Mon Sep 17 00:00:00 2001 From: "Tiffany Chang (tic)" Date: Wed, 29 Jun 2022 16:03:21 +0000 Subject: [PATCH] [IMP] stock: update UX of stock moves lines report Note this includes the view shown when clicking on: - "History" button in inventory adjustments - "Product Moves" button in scrap/product forms - "Reporting" > "Moves History" At time of this commit being written. Other move line views not changed since they are specific to inputting data rather than readonly data. Minor UX updates to stock move lines report: - rename "Units of Measure" column to "Unit" - add color to quantity field (green = incoming qty into stock, red = outgoing, black = all others [i.e. internal transfers/external locations only, etc] - search filter order updated + src/dest location filters replaced with generic filter that checks if either meets condition - add src/dest package to list view - add status, lot, and from/to dest to kanban view and replace picking with reference so inventory adjustments are visible as well - order by date desc so most recent ones are first - always display location src/dest to help understanding of moves Specific to "History" button in Inventory Adjustments / Reporting > Locations (i.e. inventory report), moved product_id from domain to default_search for more user analysis flexibility/ease. "product moves" part of b2b task: 2882539 Part-of: odoo/odoo#97109 --- addons/stock/models/stock_move_line.py | 2 + addons/stock/models/stock_quant.py | 5 +- addons/stock/views/stock_move_line_views.xml | 57 +++++++++++++------ .../views/stock_picking_batch_views.xml | 2 +- 4 files changed, 45 insertions(+), 21 deletions(-) diff --git a/addons/stock/models/stock_move_line.py b/addons/stock/models/stock_move_line.py index 387e262601b..94022f89352 100644 --- a/addons/stock/models/stock_move_line.py +++ b/addons/stock/models/stock_move_line.py @@ -62,6 +62,8 @@ class StockMoveLine(models.Model): compute="_compute_location_id", store=True, readonly=False, precompute=True, ) location_dest_id = fields.Many2one('stock.location', 'To', domain="[('usage', '!=', 'view')]", check_company=True, required=True, compute="_compute_location_id", store=True, readonly=False, precompute=True) + location_usage = fields.Selection(string="Source Location Type", related='location_id.usage') + location_dest_usage = fields.Selection(string="Destination Location Type", related='location_dest_id.usage') lots_visible = fields.Boolean(compute='_compute_lots_visible') picking_partner_id = fields.Many2one(related='picking_id.partner_id', readonly=True) picking_code = fields.Selection(related='picking_id.picking_type_id.code', readonly=True) diff --git a/addons/stock/models/stock_quant.py b/addons/stock/models/stock_quant.py index 4cce7c2cb88..0ed014aff80 100644 --- a/addons/stock/models/stock_quant.py +++ b/addons/stock/models/stock_quant.py @@ -331,7 +331,6 @@ class StockQuant(models.Model): self.ensure_one() action = self.env["ir.actions.actions"]._for_xml_id("stock.stock_move_line_action") action['domain'] = [ - ('product_id', '=', self.product_id.id), '|', ('location_id', '=', self.location_id.id), ('location_dest_id', '=', self.location_id.id), @@ -340,6 +339,8 @@ class StockQuant(models.Model): ('package_id', '=', self.package_id.id), ('result_package_id', '=', self.package_id.id), ] + action['context'] = literal_eval(action.get('context')) + action['context']['search_default_product_id'] = self.product_id.id return action def action_view_orderpoints(self): @@ -433,9 +434,9 @@ class StockQuant(models.Model): 'context': { 'search_default_inventory': 1, 'search_default_done': 1, + 'search_default_product_id': self.product_id.id, }, 'domain': [ - ('product_id', '=', self.product_id.id), ('company_id', '=', self.company_id.id), '|', ('location_id', '=', self.location_id.id), diff --git a/addons/stock/views/stock_move_line_views.xml b/addons/stock/views/stock_move_line_views.xml index 7094fc1c751..e3ef1618344 100644 --- a/addons/stock/views/stock_move_line_views.xml +++ b/addons/stock/views/stock_move_line_views.xml @@ -4,17 +4,23 @@ stock.move.line.tree stock.move.line - + + + - - - - - - + + + + + + + + stock.move.line + + - - - @@ -146,22 +151,38 @@ stock.move.line - -
- - + +
+
+ +
+
+ +
+
+
+ +
+
+ + → + +
+
+ Lot/SN: + + +
- -
- +
@@ -177,7 +198,7 @@ ir.actions.act_window tree,kanban,pivot,form - {'search_default_filter_last_12_months': 1, 'search_default_done': 1, 'create': 0} + {'search_default_done': 1, 'create': 0}

There's no product move yet diff --git a/addons/stock_picking_batch/views/stock_picking_batch_views.xml b/addons/stock_picking_batch/views/stock_picking_batch_views.xml index 916c9b5c360..02e8b76c357 100644 --- a/addons/stock_picking_batch/views/stock_picking_batch_views.xml +++ b/addons/stock_picking_batch/views/stock_picking_batch_views.xml @@ -297,7 +297,7 @@ - +