diff --git a/i18n/fr.po b/i18n/fr.po new file mode 100644 index 0000000000000000000000000000000000000000..6863df49eecba520ac75bc270de31c4c7942a9ff --- /dev/null +++ b/i18n/fr.po @@ -0,0 +1,24 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * survey +# +# Translators: +# Rémi CAZENAVE, 2022 +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2024-04-26 13:31+0000\n" +"PO-Revision-Date: 2022-09-22 05:55+0000\n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=3; plural=(n == 0 || n == 1) ? 0 : n != 0 && n % 1000000 == 0 ? 1 : 2;\n" + +#. module: survey +#: model_terms:ir.ui.view,arch_db:survey.survey_fill_form_start +msgid "Start Survey" +msgstr "Démarrer le questionnaire" diff --git a/models/survey.py b/models/survey.py index 60c6fe8a5a54dab1f53f3bfad613c2580f5b3b5e..5588317d8e08d0a58fbba58fa141cd0a743cb016 100644 --- a/models/survey.py +++ b/models/survey.py @@ -56,6 +56,11 @@ class Survey(models.Model): default=False, help="Afficher un bouton pour pouvoir refaire le sondage une fois terminé", ) + company_id = fields.Many2one( + comodel_name="res.company", + string="Société", + default=lambda self: self.env.company, + ) # ------------------------------------------------------ # Constrains diff --git a/models/survey_user_input.py b/models/survey_user_input.py index 59b6f1e8696881a269c5c0b2ef73b6e16cfe50d1..b6179d9287368ecf390c7f7c0a27801aa672c3ee 100644 --- a/models/survey_user_input.py +++ b/models/survey_user_input.py @@ -7,6 +7,11 @@ from odoo import Command, fields, models class SurveyUserInput(models.Model): _inherit = "survey.user_input" + # Inherit parent + state = fields.Selection(tracking=1) + # New fields + answer_url = fields.Char(string="URL de la réponse", compute="_compute_answer_url") + comment = fields.Text("Notes") firstname = fields.Char("Prénom") company = fields.Char("Structure") is_duplicate_answer = fields.Boolean(default=False) @@ -116,6 +121,11 @@ class SurveyUserInput(models.Model): # ------------------------------------------------------ # Compute # ------------------------------------------------------ + def _compute_answer_url(self): + for answer in self: + answer.answer_url = url_join( + answer.survey_id.get_base_url(), answer.get_start_url() + ) # ------------------------------------------------------ # Actions diff --git a/security/survey_security.xml b/security/survey_security.xml new file mode 100644 index 0000000000000000000000000000000000000000..641a52a4b29499251db4b524e5bfd725662c93de --- /dev/null +++ b/security/survey_security.xml @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="utf-8" ?> +<odoo noupdate="0"> + <record id="survey_server_rule" model="ir.rule"> + <field name="name">survey multi-company</field> + <field name="model_id" ref="survey.model_survey_survey" /> + <field name="perm_read" eval="True"/> + <field name="perm_write" eval="False"/> + <field name="perm_create" eval="False"/> + <field name="perm_unlink" eval="False"/> + <field + name="domain_force" + >[('company_id', 'in', company_ids + [False])]</field> + </record> +</odoo> diff --git a/views/survey.xml b/views/survey.xml index 198e3e25579b9c472d36b36fac8d826a8b7fe6fb..de9a77825e3ecffd1a91b8d32606786f75db214f 100644 --- a/views/survey.xml +++ b/views/survey.xml @@ -143,13 +143,13 @@ <!-- Actions --> <!-- Inherit parent action for domain --> <record model="ir.actions.act_window" id="survey.action_survey_form"> - <field name="domain">[("survey_type", "=", False)]</field> + <field name="domain">[("survey_type", "=", False), ("company_id", "in", allowed_company_ids)]</field> </record> <!-- New Actions --> <record model="ir.actions.act_window" id="action_training_survey"> <field name="name">Questionnaires formation</field> <field name="res_model">survey.survey</field> - <field name="domain">[("survey_type", "=", "training")]</field> + <field name="domain">[("survey_type", "=", "training"), ("company_id", "in", allowed_company_ids)]</field> <field name="view_mode">kanban,tree,form,activity</field> <field name="context">{"default_survey_type": "training"}</field> <field name="search_view_id" ref="training_survey_search" /> diff --git a/views/survey_user_input.xml b/views/survey_user_input.xml index 79b5df77b87a6972f56e207d475cd59e28f5586c..31406194cf4061c2f1ec05a2685b022f2f6750e5 100644 --- a/views/survey_user_input.xml +++ b/views/survey_user_input.xml @@ -8,6 +8,12 @@ <field name="priority">60</field> <field name="arch" type="xml"> <xpath expr="//sheet/group/group" position="inside"> + <field name="comment" /> + <field + name="answer_url" + attrs="{'invisible': [('state', '=', 'done')]}" + widget="CopyClipboardChar" + /> <field name="is_resent" invisible="1" /> <div colspan="2"> <button