From a868581e33ea1138db4a0bd6bbc33bedeb4f7b8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Tue, 20 May 2008 17:38:43 +0200 Subject: [PATCH] Improve product stock view Update the window name with the product name and the default uom --- location.py | 16 ++++++++++++++++ product.xml | 14 ++++++-------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/location.py b/location.py index a4530b96d5..2f66f71479 100644 --- a/location.py +++ b/location.py @@ -95,6 +95,22 @@ class Location(OSV): self._tree_qty(qty_by_ltn, childs, ids, to_compute) return qty_by_ltn + def view_header_get(self, cursor, user, value, view_type='form', + context=None): + product_obj = self.pool.get('product.product') + uom_obj = self.pool.get('product.uom') + if context is None: + context = {} + if context.get('product'): + product_name = product_obj.name_get(cursor, user, context['product'], + context=context)[0][1] + product = product_obj.browse(cursor, user, context['product'], + context=context) + uom_name = uom_obj.name_get(cursor, user, product.default_uom.id, + context=context)[0][1] + return value + ': ' + product_name + ' (' + uom_name + ')' + return False + Location() diff --git a/product.xml b/product.xml index a92af7eea7..ca80aa9185 100644 --- a/product.xml +++ b/product.xml @@ -13,7 +13,7 @@ - ]]> + ]]> @@ -23,23 +23,21 @@ childs - - - - - + + + ]]> - Product Availability + Product Stock product.product stock.location tree {'product': active_id} [('parent', '=', False)] +