From dcc1770b5bbffbe6730bcb0de9ea7dad0cdf4fc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Sun, 27 Nov 2016 22:12:43 +0100 Subject: [PATCH] Add test call to on_change methods - Manage None as value of field in on_change method issue6069 review27851002 --- trytond/ir/note.py | 3 ++- trytond/tests/test_tryton.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/trytond/ir/note.py b/trytond/ir/note.py index 7a8c33a654..8f988f195a 100644 --- a/trytond/ir/note.py +++ b/trytond/ir/note.py @@ -37,7 +37,8 @@ class Note(ResourceMixin, ModelSQL, ModelView): @fields.depends('message') def on_change_with_message_wrapped(self, name=None): wrapper = self.get_wrapper() - return '\n'.join(map(wrapper.fill, self.message.splitlines())) + message = self.message or '' + return '\n'.join(map(wrapper.fill, message.splitlines())) @classmethod def get_unread(cls, ids, name): diff --git a/trytond/tests/test_tryton.py b/trytond/tests/test_tryton.py index d80ffad001..fa11f22171 100644 --- a/trytond/tests/test_tryton.py +++ b/trytond/tests/test_tryton.py @@ -305,6 +305,12 @@ class ModuleTestCase(unittest.TestCase): elif attr.startswith('order_'): tables = {None: (model.__table__(), None)} getattr(model, attr)(tables) + elif any(attr.startswith(p) for p in [ + 'on_change_', + 'on_change_with_', + 'autocomplete_']): + record = model() + getattr(record, attr)() @with_transaction() def test_menu_action(self):