Compare commits
merge into: RemiFr82:12.0
RemiFr82:12.0
RemiFr82:16.0
pull from: RemiFr82:16.0
RemiFr82:12.0
RemiFr82:16.0
8 Commits
Author | SHA1 | Message | Date |
---|---|---|---|
RemiFr82 | 88bccf704a |
[MIG] survey_partner_input
|
5 days ago |
RemiFr82 | 30ab700373 |
[REM] survey_page_duplicate
|
5 days ago |
RemiFr82 | 2ec606e232 |
[IMP] survey_deadline_autoclose
|
5 days ago |
RemiFr82 | 9124716399 |
[MIG] survey_input_dates to survey_input_duration
|
5 days ago |
RemiFr82 | 82c88c4bf4 |
[REM] survey_description
|
6 days ago |
RemiFr82 | 74ae747290 |
[MIG] survey_deadline_autoclose
|
6 days ago |
RemiFr82 | 2d99ccdc6a |
[ADD] survey_pass_fail_messages
|
2 weeks ago |
RemiFr82 | 5021c335e4 |
[MIG] set all addons uninstallable
|
2 weeks ago |
43 changed files with 448 additions and 636 deletions
-
2survey_custom_matrix/__manifest__.py
-
13survey_deadline_autoclose/__manifest__.py
-
5survey_deadline_autoclose/data/ir_cron.xml
-
15survey_deadline_autoclose/data/mail_message_subtype.xml
-
114survey_deadline_autoclose/i18n/fr.po
-
96survey_deadline_autoclose/models/survey_survey.py
-
85survey_deadline_autoclose/views/survey_survey.xml
-
0survey_description/__init__.py
-
34survey_description/i18n/fr.po
-
19survey_description/views/survey_page.xml
-
29survey_description/views/survey_survey.xml
-
2survey_input_attachment/__manifest__.py
-
71survey_input_dates/i18n/fr.po
-
14survey_input_dates/models/survey_survey.py
-
55survey_input_dates/models/survey_user_input.py
-
65survey_input_dates/views/survey_user_input.xml
-
0survey_input_duration/__init__.py
-
12survey_input_duration/__manifest__.py
-
36survey_input_duration/i18n/fr.po
-
1survey_input_duration/models/__init__.py
-
22survey_input_duration/models/survey_user_input.py
-
58survey_input_duration/views/survey_user_input.xml
-
2survey_input_odoo_debrand/__manifest__.py
-
2survey_input_template_custom/__manifest__.py
-
2survey_link_input_ratio/__manifest__.py
-
0survey_page_duplicate/__init__.py
-
39survey_page_duplicate/__manifest__.py
-
22survey_page_duplicate/i18n/fr.po
-
16survey_page_duplicate/views/survey_survey.xml
-
14survey_partner_input/i18n/fr.po
-
43survey_partner_input/models/res_partner.py
-
10survey_partner_input/views/res_partner.xml
-
4survey_partner_input/views/survey_user_input.xml
-
1survey_pass_fail_messages/__init__.py
-
12survey_pass_fail_messages/__manifest__.py
-
77survey_pass_fail_messages/i18n/fr.po
-
1survey_pass_fail_messages/models/__init__.py
-
17survey_pass_fail_messages/models/survey_survey.py
-
25survey_pass_fail_messages/views/survey_survey.xml
-
15survey_pass_fail_messages/views/survey_templates.xml
-
2survey_question_duplicate/__manifest__.py
-
2survey_select_input/__manifest__.py
-
2survey_template/__manifest__.py
@ -1,86 +1,62 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo.exceptions import UserError |
|||
from datetime import timedelta |
|||
from pytz import timezone, utc |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class SurveySurvey(models.Model): |
|||
_inherit = "survey.survey" |
|||
|
|||
@api.model |
|||
def cron_close_deadline_survey(self): |
|||
deadline = self.search( |
|||
def cron_close_passed_deadline_survey(self): |
|||
to_close = self.search( |
|||
[ |
|||
("date_deadline", "!=", False), |
|||
("date_deadline", "<", fields.Date.today()), |
|||
("deadline", "!=", False), |
|||
("deadline", "<", fields.Date.today()), |
|||
("auto_close", "=", True), |
|||
] |
|||
) |
|||
to_close = deadline.filtered("auto_close") |
|||
if to_close: |
|||
to_close.action_close_survey() |
|||
for survey in deadline - to_close: |
|||
survey.message_post( |
|||
subtype="survey_deadline_autoclose.mail_message_subtype_survey_deadline", |
|||
body=_("This survey has expired."), |
|||
) |
|||
to_close.action_archive() |
|||
|
|||
date_deadline = fields.Date( |
|||
string="Deadline", copy=False, track_visibility="onchange" |
|||
deadline = fields.Date( |
|||
string="Deadline", |
|||
copy=False, |
|||
tracking=True, |
|||
help="The day after date at 00:00 will be set as default answer deadline on survey sharing.", |
|||
) |
|||
auto_close = fields.Boolean( |
|||
string="Auto close", |
|||
default=False, |
|||
help="If checked, the survey will be automatically closed when deadline is overpassed.", |
|||
track_visibility="onchange", |
|||
string="Auto closing", |
|||
help="If checked, this survey will be automatically closed after the deadline.", |
|||
) |
|||
active = fields.Boolean( |
|||
tracking=True, |
|||
) |
|||
|
|||
# ACTIONS |
|||
|
|||
@api.multi |
|||
def action_send_survey(self): |
|||
self.ensure_one() |
|||
action = super(SurveySurvey, self).action_send_survey() |
|||
action["context"].update( |
|||
{ |
|||
"default_date_deadline": self.date_deadline, |
|||
"default_deadline": timezone(self.env.user.tz) |
|||
.localize( |
|||
fields.Datetime.to_datetime(fields.Date.to_string(self.deadline)) |
|||
+ timedelta(days=1) |
|||
) |
|||
.astimezone(utc), |
|||
} |
|||
) |
|||
return action |
|||
|
|||
@api.multi |
|||
def action_close_survey(self): |
|||
stage = self.env["survey.stage"].search([("closed", "=", True)], limit=1) |
|||
if not stage: |
|||
if self.env.context.get("cron", False): |
|||
for survey in self: |
|||
survey.message_post( |
|||
subtype="survey_deadline_autoclose.mail_message_subtype_survey_closed", |
|||
subject=_("Survey closing impossible"), |
|||
body=_( |
|||
'Survey should have been automatically closed but no "closed" ' |
|||
"stage was found, the requested operation was impossible to proceed.\n" |
|||
'To fix this situation, you have to check "Closed" at least on one survey stage.' |
|||
), |
|||
) |
|||
else: |
|||
raise UserError( |
|||
_( |
|||
'No "closed" stage found, the requested operation is impossible.\n' |
|||
'To fix this situation, you have to check "Closed" at least on one survey stage.' |
|||
) |
|||
) |
|||
else: |
|||
self.write({"stage_id": stage.id}) |
|||
for survey in self: |
|||
survey.message_post( |
|||
subtype="survey_deadline_autoclose.mail_message_subtype_survey_closed", |
|||
body=_("This survey was automatically closed."), |
|||
) |
|||
|
|||
# ONCHANGES |
|||
|
|||
@api.onchange("date_deadline") |
|||
def onchange_date_deadline(self): |
|||
@api.onchange("deadline") |
|||
def onchange_deadline(self): |
|||
self.ensure_one() |
|||
if not self.date_deadline: |
|||
if not self.deadline and self.auto_close: |
|||
self.auto_close = False |
|||
elif not self.auto_close: |
|||
self.auto_close = True |
|||
|
|||
def _track_subtype(self, init_values): |
|||
self.ensure_one() |
|||
if "active" in init_values: |
|||
return self.env.ref( |
|||
"survey_deadline_autoclose.mail_message_subtype_survey_closing" |
|||
) |
|||
return super(SurveySurvey, self)._track_subtype(init_values) |
@ -1,80 +1,71 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_survey_form" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose survey.survey form</field> |
|||
<record id="survey_survey_view_form" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose form</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_form"/> |
|||
<field name="inherit_id" ref="survey.survey_survey_view_form" /> |
|||
<field name="priority">28</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="stage_id" position="before"> |
|||
<button name="action_close_survey" string="Close survey" type="object" attrs="{'invisible': [('is_closed', '=', True)]}"/> |
|||
<field name="scoring_type" position="before"> |
|||
<label for="deadline" /> |
|||
<div class="o_row"> |
|||
<field name="deadline" class="oe_inline" /> |
|||
<label for="auto_close" string="Automatic closing ?" attrs="{'invisible': [('deadline', '=', False)]}" /> |
|||
<field name="auto_close" attrs="{'invisible': [('deadline', '=', False)]}" /> |
|||
</div> |
|||
</field> |
|||
<xpath expr="//field[@name='users_can_go_back']/../.." position="inside"> |
|||
<group name="options"> |
|||
</group> |
|||
</xpath> |
|||
<group name="options" position="inside"> |
|||
<xpath expr="//field[@name='users_can_go_back']/.." position="move"/> |
|||
</group> |
|||
<group name="options" position="inside"> |
|||
<group name="deadline" class="o_label_nowrap"> |
|||
<field name="date_deadline" class="oe_inline"/> |
|||
<field name="auto_close" attrs="{'invisible': [('date_deadline','=',False)]}"/> |
|||
</group> |
|||
</group> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_survey_tree" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose survey.survey tree</field> |
|||
<record id="survey_survey_view_tree" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose tree</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_tree"/> |
|||
<field name="inherit_id" ref="survey.survey_survey_view_tree" /> |
|||
<field name="priority">28</field> |
|||
<field name="arch" type="xml"> |
|||
<tree position="attributes"> |
|||
<attribute name="decoration-muted">is_closed</attribute> |
|||
</tree> |
|||
<tree position="inside"> |
|||
<field name="is_closed" invisible="1"/> |
|||
</tree> |
|||
<field name="stage_id" position="after"> |
|||
<field name="date_deadline"/> |
|||
<field name="user_id" position="after"> |
|||
<field name="deadline" /> |
|||
<field name="auto_close" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_survey_kanban" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose survey.survey kanban</field> |
|||
<record id="survey_survey_view_kanban" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose kanban</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_kanban"/> |
|||
<field name="inherit_id" ref="survey.survey_survey_view_kanban" /> |
|||
<field name="priority">28</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="title" position="after"> |
|||
<field name="date_deadline"/> |
|||
<field name="color" position="after"> |
|||
<field name="auto_close" /> |
|||
</field> |
|||
<li id="survey_test" position="before"> |
|||
<li t-if="record.date_deadline.raw_value" id="deadline" class="text-muted" t-att-title="record.auto_close.raw_value and 'Auto close on expiration' or 'Manual close'"> |
|||
<t t-if="record.auto_close.raw_value">Expiration : <strong class="text-danger"><field name="date_deadline"/></strong></t> |
|||
<t t-else="">Expiration : <strong><field name="date_deadline"/></strong></t> |
|||
</li> |
|||
</li> |
|||
<xpath expr="//div[hasclass('o_survey_kanban_card_ungrouped', 'row', 'mx-0')]/div[1]" position="after"> |
|||
<div t-if="!selection_mode and record.deadline.raw_value" class="col-lg-1 col-sm-4 col-6 py-0 my-2"> |
|||
<span t-attf-class="fw-bold"> |
|||
<field name="deadline" widget="date" /> |
|||
</span> |
|||
<br /> |
|||
<span class="text-muted" |
|||
t-attf-title="#{record.auto_close.raw_value ? 'Survey will be automatically closed once deadline passed' : ''}"> |
|||
Deadline <i t-if="record.auto_close.raw_value" class="fa fa-cogs" /> <i |
|||
t-if="record.auto_close.raw_value" class="fa fa-long-arrow-right" /> <i |
|||
t-if="record.auto_close.raw_value" class="fa fa-archive" /></span> |
|||
</div> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_survey_search" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose survey.survey search</field> |
|||
<record id="survey_survey_view_search" model="ir.ui.view"> |
|||
<field name="name">survey_deadline_autoclose search</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_survey_view_search" /> |
|||
<field name="priority">28</field> |
|||
<field name="arch" type="xml"> |
|||
<search position="inside"> |
|||
<group expand="0" string="Group By"> |
|||
<filter string="Expiration month" name="group_date_deadline_month" context="{'group_by':'date_deadline:month'}"/> |
|||
</group> |
|||
</search> |
|||
<xpath expr="//filter[@name='group_by_responsible']" posititon="after"> |
|||
<filter string="Deadline" name="group_by_deadline" |
|||
context="{'group_by':'deadline'}" /> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
|
@ -1,34 +0,0 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * survey_description |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2023-02-28 18:18+0000\n" |
|||
"PO-Revision-Date: 2023-02-28 18:18+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: survey_description |
|||
#: model_terms:ir.ui.view,arch_db:survey_description.survey_survey_form |
|||
msgid "Description" |
|||
msgstr "" |
|||
|
|||
#. module: survey_description |
|||
#: model_terms:ir.ui.view,arch_db:survey_description.survey_survey_form |
|||
msgid "Thank you page" |
|||
msgstr "Page de remerciement" |
|||
|
|||
#. module: survey_description |
|||
#: model_terms:ir.ui.view,arch_db:survey_description.survey_survey_form |
|||
msgid "This content will be displayed between the title of the survey and the \"Start\" button, on the answer homepage.<br/>\n" |
|||
" You can also add a custom content on each page of the survey through the \"Description\" field on each page." |
|||
msgstr "Ce contenu sera affiché entre le titre du sondage et le bouton \"Commencer\", sur la page d'accueil des réponses aux sondages.<br/>\n" |
|||
" Vous pouvez également ajouter du contenu spécifique sur chacune des pages du sondage via le champ \"Description\" de chaque page." |
|||
|
@ -1,19 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_page_form" model="ir.ui.view"> |
|||
<field name="name">survey_description survey.page form</field> |
|||
<field name="model">survey.page</field> |
|||
<field name="inherit_id" ref="survey.survey_page_form"/> |
|||
<field name="priority">20</field> |
|||
<field name="arch" type="xml"> |
|||
<h1 position="after"> |
|||
<label for="description" class="oe_edit_only"/> |
|||
</h1> |
|||
<field name="question_ids" position="before"> |
|||
<field name="description" nolabel="1" colspan="2"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,29 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_survey_form" model="ir.ui.view"> |
|||
<field name="name">survey_description survey.survey form</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_form"/> |
|||
<field name="priority">20</field> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//notebook/page[descendant::field[@name='page_ids']]" position="after"> |
|||
<page name="description" string="Description"> |
|||
<group> |
|||
<p colspan="2" class="text-muted oe_edit_only"> |
|||
This content will be displayed between the title of the survey and the "Start" button, on the answer homepage.<br/> |
|||
You can also add a custom content on each page of the survey through the "Description" field on each page. |
|||
</p> |
|||
<field name="description" nolabel="1" colspan="2"/> |
|||
</group> |
|||
</page> |
|||
<page name="thank_you" string="Thank you page"> |
|||
<group class="o_label_nowrap"> |
|||
<field name="thank_you_message"/> |
|||
</group> |
|||
</page> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,71 +0,0 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * survey_input_dates |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2023-02-28 20:38+0000\n" |
|||
"PO-Revision-Date: 2023-02-28 20:38+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,field_description:survey_input_dates.field_survey_user_input__date_done |
|||
#: model_terms:ir.ui.view,arch_db:survey_input_dates.survey_user_input_search |
|||
msgid "Date done" |
|||
msgstr "Réponse terminée le" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,field_description:survey_input_dates.field_survey_user_input__duration |
|||
#: model:ir.model.fields,field_description:survey_input_dates.field_survey_user_input__duration_txt |
|||
msgid "Duration" |
|||
msgstr "Durée" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,help:survey_input_dates.field_survey_user_input__duration |
|||
msgid "Duration in seconds" |
|||
msgstr "Durée en secondes" |
|||
|
|||
#. module: survey_input_dates |
|||
#: code:addons/survey_input_dates/models/survey_user_input.py:39 |
|||
#, python-format |
|||
msgid "Not done yet" |
|||
msgstr "Pas encore terminé" |
|||
|
|||
#. module: survey_input_dates |
|||
#: code:addons/survey_input_dates/models/survey_user_input.py:36 |
|||
#, python-format |
|||
msgid "Not started yet" |
|||
msgstr "Pas encore démarré" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,field_description:survey_input_dates.field_survey_user_input__date_start |
|||
msgid "Start date" |
|||
msgstr "Début de réponse le" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model,name:survey_input_dates.model_survey_survey |
|||
msgid "Survey" |
|||
msgstr "Sondage" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model,name:survey_input_dates.model_survey_user_input |
|||
msgid "Survey User Input" |
|||
msgstr "Saisie utilisateur du sondage" |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,help:survey_input_dates.field_survey_user_input__date_start |
|||
msgid "This date is set when the user clicks on \"Start survey\" button for the first time." |
|||
msgstr "Cette date est renseignée lorsque le répondant clique sur le bouton \"Répondre\" pour la première fois." |
|||
|
|||
#. module: survey_input_dates |
|||
#: model:ir.model.fields,help:survey_input_dates.field_survey_user_input__date_done |
|||
msgid "This date is set when the user input is set ton \"Done\" status." |
|||
msgstr "Cette date est renseignée lorsque la réponse passe au statut \"Terminé\"." |
|||
|
@ -1,14 +0,0 @@ |
|||
from odoo import models, fields, api |
|||
|
|||
|
|||
class SurveySurvey(models.Model): |
|||
_inherit = 'survey.survey' |
|||
|
|||
@api.model |
|||
def next_page(self, user_input, page_id, go_back=False): |
|||
res = super(SurveySurvey, self).next_page(user_input, page_id, go_back) |
|||
if not user_input.date_start and page_id == 0: |
|||
user_input.write({ |
|||
'date_start': fields.Datetime.now(), |
|||
}) |
|||
return res |
@ -1,55 +0,0 @@ |
|||
from odoo import models, fields, api, _ |
|||
|
|||
|
|||
class SurveyUserInput(models.Model): |
|||
_inherit = "survey.user_input" |
|||
|
|||
date_start = fields.Datetime( |
|||
string="Start date", |
|||
readonly=True, |
|||
help='This date is set when the user clicks on "Start survey" button for the first time.', |
|||
) |
|||
date_done = fields.Datetime( |
|||
string="Date done", |
|||
readonly=True, |
|||
help='This date is set when the user input is set ton "Done" status.', |
|||
) |
|||
duration = fields.Integer( |
|||
string="Duration", |
|||
compute="_get_duration", |
|||
store=True, |
|||
help="Duration in seconds", |
|||
) |
|||
duration_txt = fields.Char( |
|||
string="Duration", |
|||
compute="_get_duration", |
|||
store=True, |
|||
) |
|||
|
|||
@api.depends("date_start", "date_done") |
|||
def _get_duration(self): |
|||
for input in self: |
|||
start = input.date_start |
|||
done = input.date_done |
|||
if not start: |
|||
input.duration = 0 |
|||
input.duration_txt = _("Not started yet") |
|||
elif not done: |
|||
input.duration = 0 |
|||
input.duration_txt = _("Not done yet") |
|||
else: |
|||
input.duration = int((done - start).total_seconds()) |
|||
input.duration_txt = self.env["ir.qweb.field.duration"].value_to_html( |
|||
(done - start).total_seconds(), |
|||
{"unit": "second", "round": "second"}, |
|||
) |
|||
|
|||
@api.multi |
|||
def write(self, vals): |
|||
if vals.get("state", False) == "done": |
|||
vals.update( |
|||
{ |
|||
"date_done": fields.Datetime.now(), |
|||
} |
|||
) |
|||
return super(SurveyUserInput, self).write(vals) |
@ -1,65 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_user_input_form" model="ir.ui.view"> |
|||
<field name="name">survey_input_dates survey.user_input form</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_form"/> |
|||
<field name="priority">26</field> |
|||
<field name="groups_id" eval="[(6,0,[ref('survey.group_survey_manager')])]"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="date_create" position="after"> |
|||
<field name="date_start"/> |
|||
<field name="date_done"/> |
|||
<field name="duration" invisible="1"/> |
|||
<field name="duration_txt"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_user_input_tree" model="ir.ui.view"> |
|||
<field name="name">survey_input_dates survey.user_input tree</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_tree"/> |
|||
<field name="priority">26</field> |
|||
<field name="groups_id" eval="[(6,0,[ref('survey.group_survey_manager')])]"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="date_create" position="after"> |
|||
<field name="date_start"/> |
|||
<field name="date_done"/> |
|||
<field name="duration" invisible="1"/> |
|||
<field name="duration_txt"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="view_survey_user_input_kanban" model="ir.ui.view"> |
|||
<field name="name">survey_input_dates survey.user_input kanban</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.view_survey_user_input_kanban"/> |
|||
<field name="priority">26</field> |
|||
<field name="groups_id" eval="[(6,0,[ref('survey.group_survey_manager')])]"/> |
|||
<field name="arch" type="xml"> |
|||
<field name="date_create" position="after"> |
|||
<field name="date_start"/> |
|||
<field name="date_done"/> |
|||
<field name="duration"/> |
|||
<field name="duration_txt"/> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_user_input_search" model="ir.ui.view"> |
|||
<field name="name">survey_input_dates survey.user_input search</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_search"/> |
|||
<field name="priority">26</field> |
|||
<field name="groups_id" eval="[(6,0,[ref('survey.group_survey_manager')])]"/> |
|||
<field name="arch" type="xml"> |
|||
<filter name="group_by_partner" position="after"> |
|||
<filter string="Date done" name="by_date_done" domain="[]" context="{'group_by': 'date_done:week'}"/> |
|||
</filter> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,36 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * survey_input_duration |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 16.0-20230613\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2024-12-28 16:49+0000\n" |
|||
"PO-Revision-Date: 2024-12-28 16:49+0000\n" |
|||
"Last-Translator: \n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: survey_input_duration |
|||
#: model_terms:ir.ui.view,arch_db:survey_input_duration.survey_user_input_view_search |
|||
msgid "Date done" |
|||
msgstr "Date de fin" |
|||
|
|||
#. module: survey_input_duration |
|||
#: model:ir.model.fields,field_description:survey_input_duration.field_survey_user_input__duration |
|||
msgid "Duration" |
|||
msgstr "Durée" |
|||
|
|||
#. module: survey_input_duration |
|||
#: model:ir.model.fields,help:survey_input_duration.field_survey_user_input__duration |
|||
msgid "Duration in hours" |
|||
msgstr "Durée en heures" |
|||
|
|||
#. module: survey_input_duration |
|||
#: model:ir.model,name:survey_input_duration.model_survey_user_input |
|||
msgid "Survey User Input" |
|||
msgstr "Entrée utilisateur du sondage" |
@ -1,2 +1 @@ |
|||
from . import survey_survey |
|||
from . import survey_user_input |
@ -0,0 +1,22 @@ |
|||
from odoo import models, fields, api, _ |
|||
|
|||
|
|||
class SurveyUserInput(models.Model): |
|||
_inherit = "survey.user_input" |
|||
|
|||
duration = fields.Integer( |
|||
string="Duration", |
|||
compute="_get_duration", |
|||
store=True, |
|||
help="Duration in hours", |
|||
) |
|||
|
|||
@api.depends("start_datetime", "end_datetime") |
|||
def _get_duration(self): |
|||
for input in self: |
|||
start = input.start_datetime |
|||
done = input.end_datetime |
|||
if not (start and done): |
|||
input.duration = 0 |
|||
else: |
|||
input.duration = int((done - start).total_seconds()) / 3600 |
@ -0,0 +1,58 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_user_input_view_form" model="ir.ui.view"> |
|||
<field name="name">survey_input_duration survey.user_input form</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_view_form" /> |
|||
<field name="priority">26</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="deadline" position="after"> |
|||
<field name="start_datetime" /> |
|||
<field name="end_datetime" /> |
|||
<field name="duration" widget="float_time" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_user_input_view_tree" model="ir.ui.view"> |
|||
<field name="name">survey_input_duration survey.user_input tree</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_view_tree" /> |
|||
<field name="priority">26</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="deadline" position="after"> |
|||
<field name="start_datetime" optional="hide" /> |
|||
<field name="end_datetime" optional="hide" /> |
|||
<field name="duration" widget="float_time" optional="show" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_user_input_viuew_kanban" model="ir.ui.view"> |
|||
<field name="name">survey_input_duration survey.user_input kanban</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_viuew_kanban" /> |
|||
<field name="priority">26</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="create_date" position="after"> |
|||
<field name="start_datetime" /> |
|||
<field name="end_datetime" /> |
|||
<field name="duration" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
<record id="survey_user_input_view_search" model="ir.ui.view"> |
|||
<field name="name">survey_input_duration survey.user_input search</field> |
|||
<field name="model">survey.user_input</field> |
|||
<field name="inherit_id" ref="survey.survey_user_input_view_search" /> |
|||
<field name="priority">26</field> |
|||
<field name="arch" type="xml"> |
|||
<filter name="group_by_partner" position="after"> |
|||
<filter string="Date done" name="by_end_datetime" domain="[]" context="{'group_by': 'end_datetime'}" /> |
|||
</filter> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -1,39 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html). |
|||
{ |
|||
"name": "Survey page duplicate", |
|||
"version": "1.0.0", |
|||
"summary": """ |
|||
Quick duplicate surveys' pages |
|||
""", |
|||
"description": """ |
|||
This module adds a \"Duplicate\" button in pages lines on survey form, only in edit mode. |
|||
""", |
|||
"author": "RemiFr82", |
|||
"contributors": "Sudokeys", |
|||
"website": "https://remifr82.me", |
|||
"license": "LGPL-3", |
|||
"category": "Marketing", |
|||
# "price": 0, |
|||
# "currency": "EUR", |
|||
"application": False, |
|||
"installable": True, |
|||
"auto_install": False, |
|||
"pre_init_hook": "", |
|||
"post_init_hook": "", |
|||
"uninstall_hook": "", |
|||
"excludes": [], |
|||
"external_dependencies": [], |
|||
"depends": [ |
|||
"survey", |
|||
], |
|||
"data": [ |
|||
"views/survey_survey.xml", |
|||
], |
|||
"css": [], |
|||
"images": [], |
|||
"js": [], |
|||
"test": [], |
|||
"demo": [], |
|||
"maintainer": "RemiFr82", |
|||
} |
@ -1,22 +0,0 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * survey_page_duplicate |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 12.0\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2023-03-02 16:54+0000\n" |
|||
"PO-Revision-Date: 2023-03-02 16:54+0000\n" |
|||
"Last-Translator: <>\n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: survey_page_duplicate |
|||
#: model_terms:ir.ui.view,arch_db:survey_page_duplicate.survey_survey_form |
|||
msgid "Duplicate" |
|||
msgstr "Dupliquer" |
|||
|
@ -1,16 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="survey_survey_form" model="ir.ui.view"> |
|||
<field name="name">survey_page_duplicate survey.survey form</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_form"/> |
|||
<field name="priority">20</field> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='page_ids']/tree" position="inside"> |
|||
<button type="object" name="copy" string="Duplicate" icon="fa-copy" class="oe_edit_only"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1 @@ |
|||
from . import models |
@ -0,0 +1,77 @@ |
|||
# Translation of Odoo Server. |
|||
# This file contains the translation of the following modules: |
|||
# * survey_pass_fail_messages |
|||
# |
|||
msgid "" |
|||
msgstr "" |
|||
"Project-Id-Version: Odoo Server 16.0-20230613\n" |
|||
"Report-Msgid-Bugs-To: \n" |
|||
"POT-Creation-Date: 2024-12-22 14:49+0000\n" |
|||
"PO-Revision-Date: 2024-12-22 14:49+0000\n" |
|||
"Last-Translator: \n" |
|||
"Language-Team: \n" |
|||
"MIME-Version: 1.0\n" |
|||
"Content-Type: text/plain; charset=UTF-8\n" |
|||
"Content-Transfer-Encoding: \n" |
|||
"Plural-Forms: \n" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form |
|||
msgid "" |
|||
"Certification failed end message (following the standard \"Unfortunately, " |
|||
"you have failed the test.\" message)" |
|||
msgstr "" |
|||
"Message de fin en cas d'échec (inséré après le message \"Malheureusement, " |
|||
"vous avez raté le test.\")" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form |
|||
msgid "" |
|||
"Certification passed end message (following the standard \"Congratulations, " |
|||
"you have passed the test!\" message)" |
|||
msgstr "" |
|||
"Message de fin en cas de réussite (inséré après le message \"Félicitations, " |
|||
"vous avez réussi le test !\")" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model:ir.model.fields,field_description:survey_pass_fail_messages.field_survey_survey__description_done_fail |
|||
msgid "Failed end message" |
|||
msgstr "Message d'échec" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model:ir.model.fields,field_description:survey_pass_fail_messages.field_survey_survey__description_done_pass |
|||
msgid "Passed end message" |
|||
msgstr "Message de réussite" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model:ir.model,name:survey_pass_fail_messages.model_survey_survey |
|||
msgid "Survey" |
|||
msgstr "Sondage" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model:ir.model.fields,help:survey_pass_fail_messages.field_survey_survey__description_done_fail |
|||
msgid "" |
|||
"This message will be displayed when survey is completed and the user failed " |
|||
"the test." |
|||
msgstr "" |
|||
"Ce message sera affiché quand le sondage est terminé si l'utilisateur rate " |
|||
"le test." |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model:ir.model.fields,help:survey_pass_fail_messages.field_survey_survey__description_done_pass |
|||
msgid "" |
|||
"This message will be displayed when survey is completed and the user passed " |
|||
"the test." |
|||
msgstr "" |
|||
"Ce message sera affiché quand le sondage est terminé si l'utilisateur " |
|||
"réussit le test." |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form |
|||
msgid "e.g. \"Passing the test gives you the possibility to...\"" |
|||
msgstr "ex. \"Réussir ce test vous permet de...\"" |
|||
|
|||
#. module: survey_pass_fail_messages |
|||
#: model_terms:ir.ui.view,arch_db:survey_pass_fail_messages.survey_survey_form |
|||
msgid "e.g. \"You can retry this test after...\"" |
|||
msgstr "ex. \"Vous pourrez retenter ce test après...\"" |
@ -0,0 +1 @@ |
|||
from . import survey_survey |
@ -0,0 +1,17 @@ |
|||
from odoo import models, fields, api, _ |
|||
from odoo.exceptions import UserError |
|||
|
|||
|
|||
class SurveySurvey(models.Model): |
|||
_inherit = "survey.survey" |
|||
|
|||
description_done_pass = fields.Html( |
|||
string="Passed end message", |
|||
translate=True, |
|||
help="This message will be displayed when survey is completed and the user passed the test.", |
|||
) |
|||
description_done_fail = fields.Html( |
|||
string="Failed end message", |
|||
translate=True, |
|||
help="This message will be displayed when survey is completed and the user failed the test.", |
|||
) |
@ -0,0 +1,25 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<!-- survey views and actions --> |
|||
|
|||
<record id="survey_survey_form" model="ir.ui.view"> |
|||
<field name="name">survey_template survey.survey form</field> |
|||
<field name="model">survey.survey</field> |
|||
<field name="inherit_id" ref="survey.survey_survey_view_form" /> |
|||
<field name="priority">22</field> |
|||
<field name="arch" type="xml"> |
|||
<field name="description_done" position="after"> |
|||
<label for="description_done_pass" attrs="{'invisible':[('scoring_type','=','no_scoring')]}" |
|||
string="Certification passed end message (following the standard "Congratulations, you have passed the test!" message)" /> |
|||
<field name="description_done_pass" attrs="{'invisible':[('scoring_type','=','no_scoring')]}" |
|||
placeholder="e.g. "Passing the test gives you the possibility to..."" /> |
|||
<label for="description_done_fail" attrs="{'invisible':[('scoring_type','=','no_scoring')]}" |
|||
string="Certification failed end message (following the standard "Unfortunately, you have failed the test." message)" /> |
|||
<field name="description_done_fail" attrs="{'invisible':[('scoring_type','=','no_scoring')]}" |
|||
placeholder="e.g. "You can retry this test after..."" /> |
|||
</field> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
|
|||
<template id="survey_fill_form_done" name="Survey: finished score" inherit_id="survey.survey_fill_form_done"> |
|||
<xpath expr="//t[@t-if='answer.scoring_success']/div[1]" position="after"> |
|||
<div t-field="survey.description_done_pass" class="oe_no_empty" /> |
|||
</xpath> |
|||
<xpath expr="//t[@t-else='']/div[1]" position="after"> |
|||
<div t-field="survey.description_done_fail" class="oe_no_empty" /> |
|||
</xpath> |
|||
</template> |
|||
|
|||
</data> |
|||
</odoo> |
Reference in new issue
xxxxxxxxxx