From 6db7feaea21a5b2d270c3464bbb9da21fdec7b74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Wed, 26 Jul 2017 23:43:23 +0200 Subject: [PATCH] Ensure rec_name is a char, text type Model.default_get with 'default_rec_name' context relies on the fact that rec_name is a string base field. issue6630 review36501002 --- product.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/product.py b/product.py index ce64f023ff..f211d8db01 100644 --- a/product.py +++ b/product.py @@ -22,7 +22,6 @@ class ProductCostPrice: class ProductCostHistory(ModelSQL, ModelView): 'History of Product Cost' __name__ = 'product.product.cost_history' - _rec_name = 'date' product = fields.Many2One('product.product', "Product") date = fields.DateTime('Date') cost_price = fields.Numeric('Cost Price') @@ -50,6 +49,9 @@ class ProductCostHistory(ModelSQL, ModelView): Coalesce(history.write_date, history.create_date), history.product, history.cost_price)) + def get_rec_name(self, name): + return str(self.date) + class OpenProductCostHistory(Wizard): 'Open Product Cost History'