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/packing.py b/packing.py index 898eea540f..8045f76348 100644 --- a/packing.py +++ b/packing.py @@ -683,4 +683,25 @@ SelectMove() class PackingOutReport(CompanyReport): _name = 'stock.packing.out' + def parse(self, cursor, user, report, objects, datas, context): + if context is None: + context = {} + context = context.copy() + context['product_id2name'] = {} + context['product_names'] = lambda moves, lang: self.product_names( + cursor, user, moves, lang, context) + return super(PackingOutReport, self).parse(cursor, user, report, + objects, datas, context) + + def product_names(self, cursor, user, moves, lang, context): + product_obj = self.pool.get('product.product') + ctx = context.copy() + ctx['language'] = lang + product_ids = [x.product.id for x in moves] + if product_ids: + for product_id, product_name in product_obj.name_get(cursor, user, + product_ids, context=ctx): + context['product_id2name'][product_id] = product_name + return '' + PackingOutReport() diff --git a/packing_out.odt b/packing_out.odt index ddd4176695..db6bc2e8b5 100644 Binary files a/packing_out.odt and b/packing_out.odt differ 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)] +