-
-
Notifications
You must be signed in to change notification settings - Fork 37
[ADD] survey_sign_oca: survey and sign_oca connector #99
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
base: 16.0
Are you sure you want to change the base?
Conversation
Hi @etobella, |
b1607ee
to
cc24057
Compare
@kobros-tech I think you want to make a new module for this connector. I think there needs to be a complete process review too. if the fields are to map from the sign to the survey should that be able to be created from the sign template? maybe we could use the US streamlines as a demo item since it covers the most US states and would be able to then create the exemption needed for the tex service. |
cc24057
to
8c7d389
Compare
now I improved the field item to be just one "Survey" and according to each one of them I compare the placehloder to the key of the answer, video is showing that. I didn't want to give my suggestion of creating a new module untill you give me the suggetion on it. I will try to apply other ones too. |
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.
Create a glue module. do not add the dependancy here
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.
In addition to #99 (review), I believe the module could be similar to maintenance_sign_oca. Besides, it seems that what is commented in #91 (comment) will also be necessary, right?
yes, it's better to have it in a separate module, I wish I could as I have to patch some js methods. |
We will check the hooks and add them if they have sense. Do not worry about that. However, I think we shouldn't add unnecessary dependancies on the module. |
61e9209
to
da313c8
Compare
Now I add a standalone module to connect between sing_oca and survey. |
7e1e4f1
to
0296783
Compare
0296783
to
38ad02c
Compare
If there is a signatur field in the request it will throw error, and it is handle in this PR #102 it is inside sign_oca module. |
bdd58a7
to
41f289c
Compare
ac05641
to
4a518a0
Compare
4a518a0
to
248dbea
Compare
class SignOcaRequest(models.Model): | ||
_inherit = "sign.oca.request" | ||
|
||
# This field is required for the inverse of maintenance.equipment. |
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.
# This field is required for the inverse of maintenance.equipment. | |
# This field is required for the inverse of survey.user.input. |
"default_maintenance_equipment_id": self.id, | ||
"search_default_maintenance_equipment_id": self.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.
"default_maintenance_equipment_id": self.id, | |
"search_default_maintenance_equipment_id": self.id, | |
"default_maintenance_equipment_id": self.id, | |
"search_default_maintenance_equipment_id": self.id, |
These fields are not the correct ones, you will have to change them for the corresponding ones.
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.
It's a big mistake, I will fix
class Survey(models.Model): | ||
_inherit = "survey.survey" | ||
|
||
start_button_name = fields.Char("Survey Start Button Name", default="Start") |
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 is this field necessary for sign_oca? What use case are you trying to cover? Is this really necessary in this module?
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.
The module is extending the concept meaning of survey module, now it can take a rool for many other functions like filling the exemption data but not in the document directly, so the case is not exactly answering a survey.
So survey module can do jobs like: survey, questionaire, filling docs and maybe evenmore.
Start Survey
button name is very specific, and it can be start a survey, stary a questionaire start a foo.
def get_related_survey_answers(self): | ||
self.ensure_one() | ||
# get survey answers for this sign request | ||
model_id = self.request_id.template_id.model_id | ||
survey_participation = self.request_id.record_ref | ||
survey = {} | ||
if survey_participation and model_id and model_id.model == "survey.user_input": | ||
for line in survey_participation.user_input_line_ids: | ||
if line.question_id.question_type == "matrix": | ||
answer = line.suggested_answer_id.value | ||
survey.update({line.matrix_row_id.value: answer}) | ||
elif line.question_id.question_type in ["binary", "signature"]: | ||
answer = line.answer_binary_ids[:1].value_binary | ||
survey.update({line.question_id.display_name: answer}) | ||
else: | ||
answer = line.display_name | ||
survey.update({line.question_id.display_name: answer}) | ||
return survey | ||
|
||
def fill_survey_related_items(self, vals): | ||
survey = self.get_related_survey_answers() | ||
items = vals["items"] | ||
for key in items: | ||
item = items[key] | ||
placeholder = item.get("placeholder") | ||
if survey.get(placeholder) and item["role_id"] == self.role_id.id: | ||
if survey.get(placeholder) and item["field_type"] == "text": | ||
item["value"] = survey.get(placeholder) | ||
elif survey.get(placeholder) and item["field_type"] == "check": | ||
item["value"] = SurveyUtils.format_answer(survey.get(placeholder)) | ||
elif survey.get(placeholder) and item["field_type"] == "signature": | ||
item["value"] = survey.get(placeholder) | ||
return vals | ||
|
||
def get_info(self, access_token=False): | ||
vals = super().get_info(access_token) | ||
vals = self.fill_survey_related_items(vals) | ||
return vals |
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.
Can you explain what this is intended to do (adding comments in the methods explaining what they do would help).
Are you trying to fill in survey data through the signature?
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.
yes, I will
I am just sending the same data from the server to the sign_request frontend so signers will see their answers in the corresponding field places.
survey_sign_oca/__manifest__.py
Outdated
"website": "https://github.com/OCA/sign", | ||
"author": "Kencove, Odoo Community Association (OCA)", | ||
"license": "AGPL-3", | ||
"depends": ["sign_oca", "survey", "survey_question_type_binary"], |
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.
"depends": ["sign_oca", "survey", "survey_question_type_binary"], | |
"depends": ["sign_oca", "survey", "survey_question_type_binary"], |
IMP the survey_question_type_binary
dependency should not be necessary.
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.
it is important if the survey takers will give answers of type binary or multibinary or signature.
It is very important for them to sign, and I can not ignore this field as I need it, and it is available in an OCA module.
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.
but I will try to use get method if the field is present or not, I will try no problem.
@victoralmau |
I removed the dependency from manifest, but still having the external ones. The one related to survey is not critical here and optional, but the one related to sign_oca is important if getting merged otherwise I show the field I want here instead. Some handy comments are added to, changes are in a separate commit for simplicity for now. once you agree we transition to test cases. |
44c8d5f
to
908ca86
Compare
Because of the nice odoo survey interaction and organized questions and well designed format, there is a need to show the signers a survey and fill, then send them a filled sign request waiting for their approval so that we save time for them and fetch information in an interesting way not a boring one.
The commit is under development and we need to apply the idea in a professional way, and business bearing one!
description, configuration is TODO
based on PR
#91
#102
https://github.com/OCA/survey/#157