You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Message from the user:
We are using your OpenAPI module for Odoo V13 and found some really
interesting behaviour when error is raises.
In short:
Defining a public method to a model class and enabling access to it.
Editing any field on the model through API
Raising any error in the defined function
All changes are saved to record of the model even when error is raised
So based on our investigation it seems that OpenAPI doesn't handle odoo
rollbacks correctly and this leads to possible saving incomplete data to DB.
Is this intended behaviour or a bug in the OpenAPI implementation?
In full (POC):
Setting up a public method to any class. (res.partner this case):
@api.modeldeftest_call(self):
random_partner=self.env['res.partner'].browse(85)
# add a bit of information to some fieldrandom_partner.function+="C"# raise error right afterraiseValidationError("error")
calling the function from the API
Response is returned from the API call that has the validation error
with the text error
Changes are still implemented in the DB
(When stepping through the OpenAPI code these key points were found)
** When exception is hit in the called method, pinguin.py controller_method_wrapper seems to catch it and form a response:*
odoo\http.py__exit__ method is reached that does the commit() in DB
def__exit__(self, exc_type, exc_value, traceback):
_request_stack.pop()
ifself._cr:
try:
ifexc_typeisNoneandnotself._failed:
# --------- COMMIT is made here as no exception israisedandselfhasnotfailedself._cr.commit()
ifself.registry:
self.registry.signal_changes()
elifself.registry:
self.registry.reset_changes()
finally:
self._cr.close()
# just to be sure no one tries to re-use the requestself.disable_db=Trueself.uid=None
The text was updated successfully, but these errors were encountered:
Message from the user:
We are using your OpenAPI module for Odoo V13 and found some really
interesting behaviour when error is raises.
In short:
So based on our investigation it seems that OpenAPI doesn't handle odoo
rollbacks correctly and this leads to possible saving incomplete data to DB.
Is this intended behaviour or a bug in the OpenAPI implementation?
In full (POC):
res.partner
this case):calling the function from the API
Response is returned from the API call that has the validation error
with the text error
Changes are still implemented in the DB
(When stepping through the OpenAPI code these key points were found)
** When exception is hit in the called method,
pinguin.py
controller_method_wrapper
seems to catch it and form a response:***
apijsonrequest.py
dispatch
method that handles the request that hasthe actual
_handle_exception
method is never reached*odoo\http.py
__exit__
method is reached that does thecommit()
in DBThe text was updated successfully, but these errors were encountered: