From ae9a73488ecc6983cce81a62cd26802487f1c1c8 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 22 May 2017 20:57:33 +0200 Subject: [PATCH] mrp_average_cost: Fix decimal precision product_usability: add link to show history of standard price --- product_usability/product.py | 28 ++++++++++++++++++++++++++++ product_usability/product_view.xml | 16 +++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/product_usability/product.py b/product_usability/product.py index ce91ef8..fb15faa 100644 --- a/product_usability/product.py +++ b/product_usability/product.py @@ -16,6 +16,17 @@ class ProductTemplate(models.Model): purchase_ok = fields.Boolean(track_visibility='onchange') active = fields.Boolean(track_visibility='onchange') + def show_product_price_history(self): + self.ensure_one() + products = self.env['product.product'].search( + [('product_tmpl_id', '=', self._context['active_id'])]) + action = self.env['ir.actions.act_window'].for_xml_id( + 'product_usability', 'product_price_history_action') + action.update({ + 'domain': "[('id', 'in', %s)]" % products.ids, + }) + return action + class ProductProduct(models.Model): _inherit = 'product.product' @@ -38,9 +49,26 @@ class ProductProduct(models.Model): 'unique(default_code)', 'This internal reference already exists!')] + def show_product_price_history(self): + self.ensure_one() + action = self.env['ir.actions.act_window'].for_xml_id( + 'product_usability', 'product_price_history_action') + action.update({ + 'domain': "[('product_id', '=', %d)]" % self.ids[0], + }) + return action + class ProductSupplierinfo(models.Model): _inherit = 'product.supplierinfo' name = fields.Many2one( domain=[('supplier', '=', True), ('parent_id', '=', False)]) + + +class ProductPriceHistory(models.Model): + _inherit = 'product.price.history' + + company_currency_id = fields.Many2one( + related='company_id.currency_id', readonly=True, + string='Company Currency') diff --git a/product_usability/product_view.xml b/product_usability/product_view.xml index 30dd2ae..7079743 100644 --- a/product_usability/product_view.xml +++ b/product_usability/product_view.xml @@ -16,8 +16,9 @@ - + + @@ -30,8 +31,9 @@ - + + @@ -67,13 +69,9 @@ product.template - + +