-
-
Notifications
You must be signed in to change notification settings - Fork 330
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CHG] Temporary values as JSON #127
[CHG] Temporary values as JSON #127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
@benwillig Just a test for empty_scanner_values() ?
17eedc0
to
8862602
Compare
@rousseldenis Done |
👍 |
@benwillig This means that any module that defines properties cannot be installed with Also, removing the properties will make our scenarios fail when we'll update the module... :( Anyway, you should split the tests, at least one per method, instead of a big single method, to be able to see which test fails. |
Having properties on a model is not the problem. The error which is raised on startup (or during test) is caused by the I can write a migration script which stores the value of tmp_val (if it's a valid json) in |
I understand the issue, but removing the properties will need to adapt scenarios with a simple update of the module. I made some tests, and I can confirm that any module with properties will crash if they contain Even if it's a bit ugly, what di you think about adding a warning in the properties, and remove them for the next version ? @property
@api.multi
def json_tmp_val1(self):
if not self:
logger.warning('DEPRECATED: This attribute will be removed in the next version.')
return
self.ensure_one()
return json.loads(self.tmp_val1 or 'null') IMO, the best solution would be to find a way to list methods without calling the properties in |
I thought about this solution but as you said, it's a bit ugly. But I think it's the only workaround at the moment. I will change this PR to readd thoses properties with the warning. |
@benwillig I finally found how to fix diff --git queue_job/models/base.py queue_job/models/base.py
index 5ded5c66ebf6..4ab252281fc5 100644
--- queue_job/models/base.py
+++ queue_job/models/base.py
@@ -23,7 +23,7 @@ def _register_hook(self):
if attr_name == '_cache':
continue
try:
- attr = getattr(self, attr_name)
+ attr = getattr(self.__class__, attr_name)
except AttributeError:
continue
if inspect.ismethod(attr) and getattr(attr, 'delayable', None): The issue was caused by using a recordset (eg. an instance of the class) instead of the class itself. Uing a Serialized field is a great idea, and I'll hapilly approve the PR, but this is not related to the bug anymore :) |
Sorry I didn't have time to readd properties. The code you gave comes from v11, so we need to backport thoses commits to 10.0, then I will be able to add your properties without the warning. |
I'm currently creating PRs on Edit: OCA/queue#49 (10.0) and OCA/queue#50 (11.0) |
ca64ed0
to
7670540
Compare
Updated my PR. Thanks again @sylvain-garancher |
Thanks. Also, could you split the test in several smaller tests ? |
7670540
to
62821b6
Compare
Spllited and added a test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Fixes #126.
@sylvain-garancher With this way, we can add as much temporary values as we want.