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
computed field problem on update record - Web2py 2.16.1 #1812
Comments
Does it work with R-2.15.4? |
Yes, Work. I downgraded to this version. |
There is no problem adding a new record, only when updating. Here I registered 1 + 2, in compute field it got 3, so I changed the value from 2 to 5 and made the submission. see here does not show errors, apparently field number2 has been updated, but we can see that compute field has not changed. see here When doing the refresh, nothing has changed. see here |
Same problem here. Computed fields now display, unless readable=False, and errors are thrown (but with no details), unless writable=False. The solution for me is to set writable=False for all the computed fields, and they behave properly, as before. |
@mdipierro what do you think? |
Hi all, fields = {}
for key in self.vars:
fields[key] = self.vars[key]
ret = FORM.accepts(...) self.vars seems to be empty until after FORM.accepts populates it, so the for loop should go after accepts(). |
The second issue sqlhtml.py:1892 elif field.default is None and field.type != 'blob':
self.errors[fieldname] = 'no data'
self.accepted = False
return False This causes an early exit on computed fields and never gets to update the db. I don't know all of the logic behind this code, so I'm not quite sure how to fix this thoroughly. Hopefully one of the contributors can assign and patch this one now. Thanks! |
Just to add my voice to the crowd, I am having the same problem, exact same symptoms as above, will probably revert version for now. |
This should be considered a DAL bug in my opinion, computed fields should be writable=False by default. |
Hi @leonelcamara , |
Problem appears to be gone in 2.17.1, can anyone else confirm? |
Yes. This critical issue is now gone in version 17.2 |
But appears (again?) in case of update via dal (at least with postgresql), if you change the value of a field which is referred to by the compute function... |
@sbourgeois1 this happens if the update doesn't have all the fields the computed field needs, it's a very old issue. |
I have this code:
my model:
my controller:
my view:
on update (appadmin too), the record not update.
see in action (reproduce)
https://drive.google.com/file/d/0B7J2UqggMO7eaHNPTkEycUY3VlhNN2NCUkw3T1FwRWgyT1ZR/view?usp=sharing
https://drive.google.com/file/d/0B7J2UqggMO7eUDZ5NktpUTJubFlVVVd2dUhYZy14eEoyWXlB/view?usp=sharing
https://drive.google.com/file/d/0B7J2UqggMO7eNC1ZZEsyVUtFeFdHTGZNUFBTTXA0OFA3aFhF/view?usp=sharing
The text was updated successfully, but these errors were encountered: