From 3f082a0ba7ac7900a03b107c4725a03bf059c7c0 Mon Sep 17 00:00:00 2001 From: cubells Date: Fri, 11 Aug 2017 12:30:22 +0200 Subject: [PATCH] [FIX] Incorrect field name to track signature (#691) --- web_widget_digitized_signature/models/res_users.py | 4 ++-- .../tests/test_signature_tracking.py | 10 +++++++--- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/web_widget_digitized_signature/models/res_users.py b/web_widget_digitized_signature/models/res_users.py index 7816ba91..1feeac91 100644 --- a/web_widget_digitized_signature/models/res_users.py +++ b/web_widget_digitized_signature/models/res_users.py @@ -18,10 +18,10 @@ class ResUsers(models.Model): @api.model def create(self, vals): res = super(ResUsers, self).create(vals) - res._track_signature(vals, 'signature') + res._track_signature(vals, 'signature_image') return res @api.multi def write(self, vals): - self._track_signature(vals, 'signature') + self._track_signature(vals, 'signature_image') return super(ResUsers, self).write(vals) diff --git a/web_widget_digitized_signature/tests/test_signature_tracking.py b/web_widget_digitized_signature/tests/test_signature_tracking.py index 1b6ee0af..d0b3fbe7 100644 --- a/web_widget_digitized_signature/tests/test_signature_tracking.py +++ b/web_widget_digitized_signature/tests/test_signature_tracking.py @@ -9,7 +9,11 @@ class TestSignatureTracking(common.SavepointCase): @classmethod def setUpClass(cls): super(TestSignatureTracking, cls).setUpClass() - cls.user = cls.env.user + cls.user = cls.env['res.users'].create({ + 'name': 'Test User', + 'login': 'Test User', + 'email': 'test@example.com', + }) cls.user.lang = 'en_US' # Simple 1x1 transparent base64 encoded GIF cls.image = 'R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==' @@ -21,14 +25,14 @@ class TestSignatureTracking(common.SavepointCase): direct chatter""" prev_attachment_num = self.attachment_obj.search_count([]) prev_messages = self.message_obj.search([]) - self.user.signature = self.image + self.user.signature_image = self.image current_attachment_num = self.attachment_obj.search_count([]) self.assertEqual(current_attachment_num - prev_attachment_num, 1) current_messages = self.message_obj.search([]) message = current_messages - prev_messages self.assertIn('Signature has been created.', message.body) prev_messages = current_messages - self.user.signature = False + self.user.signature_image = False current_messages = self.message_obj.search([]) message = current_messages - prev_messages self.assertIn('Signature has been deleted.', message.body)