[FIX] base,*: remove force_email from the context in views

ba1a550#diff-36973ac6e1f20b32a00fbcdc1f811c923bbb44ca15a0e068018e904ff565644fR97
The previous PR added some constraints on what can be used on the
context of views. The key word 'force-email' is no longer relevant and
will be removed from the context before reaching the next view/python
code.

This commit's purpose is to remove the force_email that were forgotten.
In order to still open the simplified partner form view, the ref of the
view is given in the context instead. While at it, we also fix the
create option given on the partner_ids field that was inconsistent.

affected version 17.0 - master
task - 3538000
https://www.odoo.com/web#id=3538000&menu_id=4720&cids=1&action=333&active_id=4105&model=project.task&view_type=form

Please enter the commit message for your changes. Lines starting

closes odoo/odoo#149806

Related: odoo/enterprise#54549
Signed-off-by: Xavier Bol (xbo) <xbo@odoo.com>
This commit is contained in:
damr
2024-02-07 12:48:50 +00:00
committed by Xavier Bol (xbo)
parent d8b294ad96
commit cc6ecce5f0
10 changed files with 17 additions and 15 deletions
@@ -54,7 +54,8 @@
<field name="mail_partner_ids"
widget="many2many_tags_email"
placeholder="Add contacts to notify..."
context="{'force_email': True, 'show_email': True}"/>
options="{'no_quick_create': True}"
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
</div>
<field name="mail_subject"
placeholder="Subject..."
+4 -2
View File
@@ -232,7 +232,8 @@
<div class="d-flex align-items-baseline" colspan="2">
<field name="partner_ids" widget="many2manyattendee"
placeholder="Select attendees..."
context="{'force_email':True}"
options="{'no_quick_create': True}"
context="{'form_view_ref': 'base.view_partner_simple_form'}"
domain="[('type','!=','private')]"
class="oe_inline"
readonly="not user_can_edit"
@@ -311,7 +312,8 @@
<field name="allday"/>
<field name="partner_ids" widget="many2manyattendee"
placeholder="Add attendees..."
context="{'force_email':True}"
options="{'no_quick_create': True}"
context="{'form_view_ref': 'base.view_partner_simple_form'}"
class="oe_inline"
/>
<label for="videocall_location" class="opacity-100"/>
@@ -39,7 +39,7 @@
<div groups="base.group_user" invisible="composition_mode != 'comment' or subtype_is_log">
<span name="document_followers_text" invisible="not model or composition_mode == 'mass_mail'">Followers of the document and</span>
<field name="partner_ids" widget="many2many_tags_email" placeholder="Add contacts to notify..."
context="{'force_email':True, 'show_email':True}"/>
options="{'no_quick_create': True}" context="{'show_email':True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
</div>
<field name="subject" placeholder="Welcome to MyCompany!" required="True"/>
</group>
@@ -13,7 +13,8 @@
<field name="res_id" invisible="1"/>
<field name="partner_ids" widget="many2many_tags_email"
placeholder="Add contacts to notify..."
context="{'force_email':True, 'show_email':True}"/>
options="{'no_quick_create': True}"
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
<field name="notify"/>
<field name="message" invisible="not notify"
options="{'style-inline': true, 'no-attachment': true}"
@@ -25,7 +25,7 @@
<label for="partner_ids" string="Invite People" invisible="access_mode == 'read'"/>
<label for="partner_ids" invisible="access_mode == 'edit'"/>
</div>
<field name="partner_ids" widget="many2many_tags_email" options="{'no_quick_create': True}" placeholder="Add contacts to share the project..." nolabel="1" context="{'force_email':True}" class="mb-4"/>
<field name="partner_ids" widget="many2many_tags_email" options="{'no_quick_create': True}" placeholder="Add contacts to share the project..." nolabel="1" context="{'form_view_ref': 'base.view_partner_simple_form'}" class="mb-4"/>
</group>
<field name="note" placeholder="Add a note" nolabel="1"/>
<footer>
@@ -24,9 +24,8 @@
<group col="2">
<field name="recipient_ids"
widget="many2many_tags_email"
context="{'force_email': True,
'show_email': True,
'no_create_edit': True}"/>
options="{'no_quick_create': True}"
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"/>
</group>
<group col="2">
<field name="subject" placeholder="Subject"/>
+2 -2
View File
@@ -25,8 +25,8 @@
invisible="survey_access_mode != 'public'"/>
<field name="partner_ids"
widget="many2many_tags_email"
placeholder="Add existing contacts..."
context="{'force_email':True, 'show_email':True, 'no_create_edit': True}"
placeholder="Add existing contacts..." options="{'no_quick_create': True}"
context="{'show_email': True, 'form_view_ref': 'base.view_partner_simple_form'}"
required="True"
invisible="not send_email"/>
<field name="emails"
@@ -24,7 +24,8 @@
widget="many2many_tags_email"
placeholder="Add contacts..."
required="send_email"
context="{'force_email':True, 'show_email':True, 'no_create_edit': True, 'no_quick_create': True}"/>
options="{'no_create_edit': True, 'no_quick_create': True}"
context="{'show_email': True}"/>
</group>
<group col="2" invisible="not send_email">
<field name="lang" invisible="1"/>
-2
View File
@@ -434,8 +434,6 @@ class Partner(models.Model):
@api.model
def _get_view(self, view_id=None, view_type='form', **options):
if (not view_id) and (view_type == 'form') and self._context.get('force_email'):
view_id = self.env.ref('base.view_partner_simple_form').id
arch, view = super()._get_view(view_id, view_type, **options)
company = self.env.company
if company.country_id.vat_label:
+1 -1
View File
@@ -113,7 +113,7 @@
<group>
<field name="function" placeholder="e.g. Sales Director" invisible="is_company"/>
<field name="user_ids" invisible="1"/>
<field name="email" widget="email" context="{'gravatar_image': True}" required="context.get('force_email', False) or user_ids"/>
<field name="email" widget="email" context="{'gravatar_image': True}" required="True"/>
<field name="phone" widget="phone" options="{'enable_sms': false}"/>
<field name="mobile" widget="phone" options="{'enable_sms': false}"/>
</group>