Skip to content

Conversation

@clementelabore
Copy link

A new module used to create records when user responds to a survey.

@github-actions
Copy link

There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this PR to never become stale, please ask a PSC member to apply the "no stale" label.

@github-actions github-actions bot added the stale PR/Issue without recent activity, it'll be soon closed automatically. label Jul 27, 2025
@github-actions github-actions bot closed this Aug 31, 2025
@gurneyalex gurneyalex reopened this Sep 17, 2025
@gurneyalex gurneyalex added work in progress and removed stale PR/Issue without recent activity, it'll be soon closed automatically. labels Sep 17, 2025
@gurneyalex
Copy link
Member

@OCA/crm-sales-marketing-maintainers I'm discussing with the authors of this module at OCA days and reopened the PR. I think it is interesting, and your feedback is welcome.

@gurneyalex
Copy link
Member

@petrus-v Could there be a path on this for the product configuration?

Copy link
Member

@gurneyalex gurneyalex left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First review, not super in depth, with some typo fixes and rewording suggestions.

I would like to see some automated tests for this module.

Having in the data an example of the module an example survey, for instance the "typical case" explained (or a subset which does not require a dependency on crm could be a great addition.

@@ -0,0 +1 @@
This module allows to generate any record from surveys answers. No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This module allows to generate any record from surveys answers.
This module allows to generate any record from survey answers.

.. |Image of record creation list| image:: ../static/description/record-creations.png

#. Go to the the survey
#. In *Record creation* tab add a new line
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#. In *Record creation* tab add a new line
#. In the *Record creation* tab, add a new line


#. Go to the the survey
#. In *Record creation* tab add a new line
#. Set a name for created record, select the Model of the record (eg: Prospect)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not clear reading this what the name will be used for. It also seems there are two steps. Or setting a name and selecting the model is the same thing?

.. |Image of record creation fields| image:: ../static/description/record-creation-customer.png

#. You can check "unicity constraint" to prevent duplicates.
In case of duplicates and if other record use this record to fill a m2o field, the founded record will be used
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In case of duplicates and if other record use this record to fill a m2o field, the founded record will be used
In case of duplicates and if other records use this record to fill a m2o field, the already present record will be used


#. You can check "unicity constraint" to prevent duplicates.
In case of duplicates and if other record use this record to fill a m2o field, the founded record will be used
#. You can configure explicitly where Odoo should retrieve the value of field :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#. You can configure explicitly where Odoo should retrieve the value of field :
#. You can configure explicitly how Odoo should retrieve the value of field :

if not rec:
raise UserError(_("No record found in %s", self.model_id.name))
else:
for answer in self.suggested_answer_ids:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain the logic of this onchange? Maybe it's me not understanding the structure of the Survey models but this looks strange.

)
model_id = fields.Many2one("ir.model", related="question_id.model_id")
answer_values_type = fields.Selection(related="question_id.answer_values_type")
value_char = fields.Char("Value")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a help string explaining what this field is for?

survey_record_creation_id = fields.Many2one(
"survey.record.creation", "Survey record creation", readonly=True
)
user_input_id = fields.Many2one("survey.user_input", "Participation", readonly=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about the name. Is it a leftover from a version not in English?

survey_record_creation_ids = fields.One2many(
"survey.record.creation",
"survey_id",
"Records creation",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"Records creation",
"Created records",

def _selection_target_model(self):
return [
(model.model, model.name)
for model in self.env["ir.model"].sudo().search([])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same remark about the domain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants