[FIX] survey: send email toggle button fix

Currently when user tries to share the survey and the access mode is public
(Anyone with the link) , the 'Send by email' button is flickering and not
working properly.
As we have used the widget 'boolean_toggle' it saves everything on Change,
and as a result  compute function '_compute_send_email' was called every time
which is not required and caused toggle button to deactivate itself
automatically.

This commit fixes the issue and 'Send by Email' button does not flicker and
works properly by using autosave='False' used from
(https://github.com/odoo/odoo/pull/117103).
Recipients (partner_ids)  field is set to required in XML.
Hence we stopped the widget from saving on Change and hence a result every time
compute method is not called and toggle button maintains its state.

Task-3240813

closes odoo/odoo#120236

X-original-commit: 7962a7b751e18cea55b6f72208583931beec6b08
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
Aman Patel
2023-05-17 09:29:55 +02:00
committed by Pratik Raval (PRRA)
parent c2b77cc244
commit a4ab4fa76c
+2 -1
View File
@@ -20,9 +20,10 @@
attrs="{'invisible':[('survey_access_mode', '!=', 'public')]}"/>
<field name="survey_start_url" nolabel="1" readonly="1" widget="CopyClipboardChar"
attrs="{'invisible':[('survey_access_mode', '!=', 'public')]}"/>
<field string="Send by Email" name="send_email" widget="boolean_toggle"
<field string="Send by Email" name="send_email" widget="boolean_toggle" options="{'autosave': False}"
attrs="{'invisible':[('survey_access_mode', '!=', 'public')]}"/>
<field name="partner_ids"
required="true"
widget="many2many_tags_email"
placeholder="Add existing contacts..."
context="{'force_email':True, 'show_email':True, 'no_create_edit': True}"