From be2fa6fa5b33af01c264d502f378ffa3292a1887 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 5 Jul 2017 14:51:46 +0200 Subject: [PATCH] Move cost price to product level instead of template issue6515 review41321002 --- product.py | 10 +++++----- view/product_cost_history_tree.xml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/product.py b/product.py index 85a318f6c3..ce64f023ff 100644 --- a/product.py +++ b/product.py @@ -23,7 +23,7 @@ class ProductCostHistory(ModelSQL, ModelView): 'History of Product Cost' __name__ = 'product.product.cost_history' _rec_name = 'date' - template = fields.Many2One('product.template', 'Product') + product = fields.Many2One('product.product', "Product") date = fields.DateTime('Date') cost_price = fields.Numeric('Cost Price') @@ -44,11 +44,11 @@ class ProductCostHistory(ModelSQL, ModelView): Max(history.write_date).as_('write_date'), Coalesce(history.write_date, history.create_date).as_('date'), - history.template.as_('template'), + history.product.as_('product'), history.cost_price.as_('cost_price'), group_by=(history.id, Coalesce(history.write_date, history.create_date), - history.template, history.cost_price)) + history.product, history.cost_price)) class OpenProductCostHistory(Wizard): @@ -64,11 +64,11 @@ class OpenProductCostHistory(Wizard): active_id = Transaction().context.get('active_id') if not active_id or active_id < 0: action['pyson_domain'] = PYSONEncoder().encode([ - ('template', '=', None), + ('product', '=', None), ]) else: product = Product(active_id) action['pyson_domain'] = PYSONEncoder().encode([ - ('template', '=', product.template.id), + ('product', '=', product.id), ]) return action, {} diff --git a/view/product_cost_history_tree.xml b/view/product_cost_history_tree.xml index ad411c2c27..1e11954742 100644 --- a/view/product_cost_history_tree.xml +++ b/view/product_cost_history_tree.xml @@ -2,7 +2,7 @@ - +