-
-
Notifications
You must be signed in to change notification settings - Fork 673
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
[15.0][FIX] stock_return_request: Cache miss error when access to qty_returnable computed field on stock move #1843
base: 15.0
Are you sure you want to change the base?
Conversation
@@ -16,7 +16,10 @@ class StockMove(models.Model): | |||
def _compute_qty_returnable(self): | |||
"""Looks for chained returned moves to compute how much quantity | |||
from the original can be returned""" | |||
for move in self.filtered(lambda x: x.state not in ["draft", "cancel"]): |
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.
@sergio-teruel
To avoid multiple __set__
calls and n condition evaluations, do this:
self.update({"qty_returnable": 0.0})
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.
AFAIK, doing self.qty_returnable = 0
has the same performance against update
, as there's only one value to set.
@@ -16,7 +16,10 @@ class StockMove(models.Model): | |||
def _compute_qty_returnable(self): | |||
"""Looks for chained returned moves to compute how much quantity | |||
from the original can be returned""" | |||
for move in self.filtered(lambda x: x.state not in ["draft", "cancel"]): |
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.
Why not simply setting it to False
at the beggining?
…nable computed field on stock move TT54590
1a7ecbc
to
fb5c128
Compare
changes done! |
cc @Tecnativa TT54590
ping @chienandalu @carlosdauden