From 5b07b9d4781ad3fb45322b3c2e97479ca45ffcb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 1 Apr 2018 16:01:22 +0200 Subject: [PATCH] Add field string in missing_account error message issue3144 review46291002 --- product.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/product.py b/product.py index 00001d7914..444e8d66f2 100644 --- a/product.py +++ b/product.py @@ -30,9 +30,11 @@ def account_used(field_name): account = self.get_account(field_name + '_used') # Allow empty values on on_change if not account and not Transaction().readonly: + field_string = ( + self.fields_get([field_name])[field_name]['string']) self.raise_user_error('missing_account', { - 'name': self.name, - 'id': self.id, + 'field': field_string, + 'name': self.rec_name, }) return account return wrapper @@ -128,9 +130,8 @@ class Category(CompanyMultiValueMixin): def __setup__(cls): super(Category, cls).__setup__() cls._error_messages.update({ - 'missing_account': ('There is no account ' - 'expense/revenue defined on the category ' - '%(name)s (%(id)d)'), + 'missing_account': ('There is no ' + '"%(field)s" defined on the category "%(name)s"'), }) cls.parent.domain = [ ('accounting', '=', Eval('accounting', False)), @@ -376,9 +377,8 @@ class Template(CompanyMultiValueMixin): def __setup__(cls): super(Template, cls).__setup__() cls._error_messages.update({ - 'missing_account': ('There is no account ' - 'expense/revenue defined on the product ' - '%(name)s (%(id)d)'), + 'missing_account': ('There is no ' + '"%(field)s" defined on the product "%(name)s"'), }) @classmethod