Skip to content

Commit 908ca86

Browse files
committed
[IMP] survey_sign_oca: review changes
1 parent 248dbea commit 908ca86

File tree

7 files changed

+20
-6
lines changed

7 files changed

+20
-6
lines changed

survey_sign_oca/README.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,9 @@ fields as checked/unchecked.
113113
Answers of type binary can be trated as signature fields if the survey
114114
question is the same as the signature placeholder in sign request.
115115

116+
In that case make sure to have this module:
117+
``survey_question_type_binary`` from OCA installed.
118+
116119
Signers can still update the input values if they want.
117120

118121
Bug Tracker

survey_sign_oca/__manifest__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"website": "https://github.com/OCA/sign",
88
"author": "Kencove, Odoo Community Association (OCA)",
99
"license": "AGPL-3",
10-
"depends": ["sign_oca", "survey", "survey_question_type_binary"],
10+
"depends": ["sign_oca", "survey"],
1111
"data": [
1212
"views/survey_user_views.xml",
1313
"views/res_config_settings_view.xml",

survey_sign_oca/models/sign_oca_request.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
from odoo import api, fields, models
44

55

6+
# This class is to format questions of type (yes, no)
7+
# in case we need the answer as (True, False) in case of filling checkboxes
68
class SurveyUtils:
79
@staticmethod
810
def is_yes_no_answer(value):
@@ -22,7 +24,7 @@ def format_answer(answer):
2224
class SignOcaRequest(models.Model):
2325
_inherit = "sign.oca.request"
2426

25-
# This field is required for the inverse of maintenance.equipment.
27+
# This field is required for the inverse of survey.user.input.
2628
survey_user_input_id = fields.Many2one(
2729
comodel_name="survey.user_input",
2830
compute="_compute_survey_user_input_id",
@@ -51,6 +53,8 @@ def get_related_survey_answers(self):
5153
survey = {}
5254
if survey_participation and model_id and model_id.model == "survey.user_input":
5355
for line in survey_participation.user_input_line_ids:
56+
# Questions of type matrix have questions and suggested answers like a matrix
57+
# We map the answeres to the questions for each matrix type
5458
if line.question_id.question_type == "matrix":
5559
answer = line.suggested_answer_id.value
5660
survey.update({line.matrix_row_id.value: answer})
@@ -68,6 +72,9 @@ def fill_survey_related_items(self, vals):
6872
for key in items:
6973
item = items[key]
7074
placeholder = item.get("placeholder")
75+
# According to placeholder we target the answer of a question
76+
# having same text as the placeholder
77+
# and we choose the answer format based on the item field_typ
7178
if survey.get(placeholder) and item["role_id"] == self.role_id.id:
7279
if survey.get(placeholder) and item["field_type"] == "text":
7380
item["value"] = survey.get(placeholder)

survey_sign_oca/models/survey_invite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ def action_view_sign_requests(self):
4242
ctx = dict(self.env.context)
4343
ctx.update(
4444
{
45-
"default_maintenance_equipment_id": self.id,
46-
"search_default_maintenance_equipment_id": self.id,
45+
"default_survey_user_input_id": self.id,
46+
"search_default_survey_user_input_id": self.id,
4747
}
4848
)
4949
result["context"] = ctx

survey_sign_oca/readme/USAGE.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,7 @@ checked/unchecked.
2323
Answers of type binary can be trated as signature fields if the survey question is the
2424
same as the signature placeholder in sign request.
2525

26+
In that case make sure to have this module: `survey_question_type_binary` from OCA
27+
installed.
28+
2629
Signers can still update the input values if they want.

survey_sign_oca/static/description/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,8 @@ <h1><a class="toc-backref" href="#toc-entry-2">Usage</a></h1>
456456
fields as checked/unchecked.</p>
457457
<p>Answers of type binary can be trated as signature fields if the survey
458458
question is the same as the signature placeholder in sign request.</p>
459+
<p>In that case make sure to have this module:
460+
<tt class="docutils literal">survey_question_type_binary</tt> from OCA installed.</p>
459461
<p>Signers can still update the input values if they want.</p>
460462
</div>
461463
<div class="section" id="bug-tracker">

survey_sign_oca/views/survey_survey_views.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
<field name="model">survey.survey</field>
66
<field name="inherit_id" ref="survey.survey_survey_view_form" />
77
<field name="arch" type="xml">
8-
<field name="description" position="before">
9-
<label for="start_button_name" string="Survey Start Button" />
8+
<field name="users_can_go_back" position="after">
109
<field name="start_button_name" />
1110
</field>
1211
</field>

0 commit comments

Comments
 (0)