-
-
Notifications
You must be signed in to change notification settings - Fork 152
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
Fix TypeError (setRequestID, unexpected keyword argument) on AR Creation #334
Conversation
@@ -1916,7 +1916,7 @@ def getRequestID(self): | |||
return self.getId() | |||
|
|||
@deprecated('[1703] Use setId(new_id) instad') | |||
def setRequestID(self, new_id): | |||
def setRequestID(self, new_id, **kwargs): |
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.
I see this method is tagged as deprecated
. I think would be better to find out where this function is called and replace the call by the one suggested in the deprecation message setId(new_id)
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.
since RequestID
is a field in AR Schema, it is called by default while an AR object is being created. We do not call it anywhere from code currently.
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.
Indeed, the AR create process passes all field values to bika.lims.utils.analysisrequest.create_analysisrequest
:
https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/browser/analysisrequest/add2.py#L1748
which calls processForm
method of the AR:
https://github.com/senaite/bika.lims/blob/senaite-integration/bika/lims/utils/analysisrequest.py#L75
As far as I know, this looks up the default mutator
of the field and calls it with the given value. So we have to probably overwrite that default mutator in the Schema
For detailed information about issue, see #325
Current behavior
ARs are created, but a Traceback occurs in the background.
Traceback:
Expected behavior after this PR
ARs are created w/o Tracebacks
I justified why I added unused parameter to the method here:
#325 (comment)