From ae5ccb6ffcf19194b613fd7e6a2a1d48f435f460 Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Wed, 11 Jan 2023 13:13:27 +0000 Subject: [PATCH] [IMP] stock: update product quantity on hand Now, the button "Update Quantity" and the stat button "Qty. On Hand" on the product's form view will both call `action_update_quantity_on_hand`, which who can call `action_open_quants` is an advance option is enable (multilocation, owner or package) or if the product is tracked by lot or serial numbers. Also, displays the product's UoM in the `stock.change.product.qty` wizard and changes its style so labels have more space. task-3076044 Part-of: odoo/odoo#109511 --- addons/stock/models/product.py | 5 ++-- addons/stock/views/product_views.xml | 4 +-- .../stock/wizard/stock_change_product_qty.py | 1 + .../wizard/stock_change_product_qty_views.xml | 26 +++++++++++++------ 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/addons/stock/models/product.py b/addons/stock/models/product.py index 8e3336c2672..dcc727af49a 100644 --- a/addons/stock/models/product.py +++ b/addons/stock/models/product.py @@ -909,11 +909,10 @@ class ProductTemplate(models.Model): def action_update_quantity_on_hand(self): advanced_option_groups = [ 'stock.group_stock_multi_locations', - 'stock.group_production_lot', 'stock.group_tracking_owner', - 'product.group_tracking_lot' + 'stock.group_tracking_lot' ] - if (self.env.user.user_has_groups(','.join(advanced_option_groups))): + if (self.env.user.user_has_groups(','.join(advanced_option_groups))) or self.tracking != 'none': return self.action_open_quants() else: default_product_id = self.env.context.get('default_product_id', len(self.product_variant_ids) == 1 and self.product_variant_id.id) diff --git a/addons/stock/views/product_views.xml b/addons/stock/views/product_views.xml index 473c3de6771..1e2d8e64919 100644 --- a/addons/stock/views/product_views.xml +++ b/addons/stock/views/product_views.xml @@ -258,7 +258,7 @@