From ee14dc0302b60a7c86584bf0e66303e25f760de5 Mon Sep 17 00:00:00 2001 From: svs-odoo Date: Mon, 2 Sep 2019 14:13:11 +0000 Subject: [PATCH] [FIX] purchase: units purchased product button Before this commit, user got a traceback when he clicks on Units Purchased button from product view form. The issue was we asked to the purchase report to be based on a field who doesn't exist anymore. The fix only replaces `unit_quantity` for `qty_ordered`. closes odoo/odoo#36342 Signed-off-by: Simon Lejeune (sle) --- addons/purchase/models/product.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/purchase/models/product.py b/addons/purchase/models/product.py index 90ed7ad196a..b6459638716 100644 --- a/addons/purchase/models/product.py +++ b/addons/purchase/models/product.py @@ -42,7 +42,7 @@ class ProductTemplate(models.Model): action = self.env.ref('purchase.action_purchase_order_report_all').read()[0] action['domain'] = ['&', ('state', 'in', ['purchase', 'done']), ('product_tmpl_id', 'in', self.ids)] action['context'] = { - 'graph_measure': 'unit_quantity', + 'graph_measure': 'qty_ordered', 'search_default_orders': 1, 'time_ranges': {'field': 'date_approve', 'range': 'last_365_days'} } @@ -77,7 +77,7 @@ class ProductProduct(models.Model): action['context'] = { 'search_default_last_year_purchase': 1, 'search_default_status': 1, 'search_default_order_month': 1, - 'graph_measure': 'unit_quantity' + 'graph_measure': 'qty_ordered' } return action