Add test call to on_change methods

- Manage None as value of field in on_change method

issue6069
review27851002
This commit is contained in:
Cédric Krier
2016-11-27 22:12:43 +01:00
parent b699dd9bc0
commit dcc1770b5b
2 changed files with 8 additions and 1 deletions
+2 -1
View File
@@ -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):
+6
View File
@@ -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):