Files
survey-tools/survey_record_generation
Quentin Mondot 0020f35399 [FIX] survey_record_generation: questions without answer no longer empty fields
When a question was not displayed (conditional question) or skipped, its
field was still given to create() with a None value. The field was then
emptied instead of keeping its default or computed value.

Since the link to an already created record is given at creation, this
also made sale.subscription.line price_unit equal to 0 when the "free
amount" question was not displayed, instead of the product price.

Fields without value are now left out of the values, which also allows
several conditional questions to fill up the same field (e.g. one list
of amounts per periodicity).

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-23 08:54:48 +00:00
..

========================
Survey record generation
========================

.. 
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! This file is generated by oca-gen-addon-readme !!
   !! changes will be overwritten.                   !!
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
   !! source digest: sha256:03eeb5c11b7d8330051c416331c84103b2641351fdc1d0a1bad43acd09501a33
   !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
    :target: https://odoo-community.org/page/development-status
    :alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
    :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
    :alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsurvey-lightgray.png?logo=github
    :target: https://github.com/OCA/survey/tree/16.0/survey_record_generation
    :alt: OCA/survey
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
    :target: https://translation.odoo-community.org/projects/survey-16-0/survey-16-0-survey_record_generation
    :alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
    :target: https://runboat.odoo-community.org/builds?repo=OCA/survey&target_branch=16.0
    :alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to generate any record from surveys answers.

**Table of contents**

.. contents::
   :local:

Use Cases / Context
===================

In several cases we want to use survey application to create records. 
Website form application give the same possibility but the design is integrated on the web site. 
Futhermore this module add other functionnalities like "duplicate" check, or creation of several interconnected records

Typical use case : Information request form

#. Submitting the form will create a contact (partner) only if it does not already exist in the database.
#. Submitting the form will also create a crm opportunity linked to previously created partner



Configuration
=============

Record generation configuration
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. |Image of record creation list| image:: https://raw.githubusercontent.com/OCA/survey/16.0/survey_record_generation/static/description/record-creations.png

#. 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)
#. Add a field configuration. So for each field : 

    .. |Image of record creation fields| image:: https://raw.githubusercontent.com/OCA/survey/16.0/survey_record_generation/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
    #. You can configure explicitly where Odoo should retrieve the value of field : 
        * **fixed**: To set explicit value
        * **question**: If value come from user's answer
            For m2o or m2m links, question should be configured before. See Question answers configuration section below.
        * **other created record**: If value come from other created record (m2o case only)

#. Several options exist for the *record creation* :

    #. You can check "Ignore creation if a mandatory field is missing" to prevent the form to crash if some record creations fail.
    #. You can check "Update existing records" to update existing records instead of creating it. For this, you need to
        precise the "Field to retrieve existing records". Only the first matched record will be updated. By default
        the existing values are not replaced, except if you check the option "Update existing values".

Question answers configuration 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

In a survey question : to configure value of choices

.. |Question answers| image:: https://raw.githubusercontent.com/OCA/survey/16.0/survey_record_generation/static/description/question-answers.png

#. Configure a multiple choice question
#. Select value type associated to answer:
    * **Value** > eg: to fill a selection field
    * **Record** > to fill m2o or m2m field
#. In case of *record* type: 
    #. Select referenced model
    #. You can directly fill answers (eventualy with help of the domain field) 
    #. Or create new answers and set associated record
#. In case of *value* type: 
    #. Add new selectable answers and set associated value


Usage
=====

When a survey is properly configured, once it is submited by a user, records should be created.

To find records generated from a participation go to:

#. Survey > participation
#. Click on **# Generated records** button (top-right)

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/survey/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/survey/issues/new?body=module:%20survey_record_generation%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Elabore

Contributors
~~~~~~~~~~~~

* `Elabore <https://www.elabore.coop>`_

  * Clément Thomas

Maintainers
~~~~~~~~~~~

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
   :alt: Odoo Community Association
   :target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/survey <https://github.com/OCA/survey/tree/16.0/survey_record_generation>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.