[IMP] base,sms,mail: server actions UX

- add some placeholders to guide users
- slight rework of code actions (use notebooks again)

Task-3450200

Part-of: odoo/odoo#138804
This commit is contained in:
Damien Bouvy
2023-10-26 13:41:07 +00:00
parent 37976ec5e1
commit a4b25aba17
3 changed files with 15 additions and 9 deletions
@@ -21,18 +21,21 @@
</div>
<field name="activity_user_type" required="state == 'next_activity'"/>
<field name="activity_user_field_name" placeholder="e.g. user_id" invisible="activity_user_type == 'specific'" required="state == 'next_activity' and activity_user_type == 'generic'"/>
<field name="activity_user_id" placeholder="Select a user..." invisible="activity_user_type == 'generic'" required="state == 'next_activity' and activity_user_type == 'specific'"/>
<field name="activity_user_id" placeholder="Choose a user..." invisible="activity_user_type == 'generic'" required="state == 'next_activity' and activity_user_type == 'specific'"/>
</group>
<field name="activity_note" class="oe-bordered-editor" placeholder="Add a description to your activity..." invisible="state != 'next_activity'"/>
</xpath>
<xpath expr="//field[@name='link_field_id']" position="after">
<field name="partner_ids" string="Followers to add" widget="many2many_tags"
placeholder="Choose a user..."
invisible="state != 'followers'"
required="state == 'followers'"/>
<field name="partner_ids" string="Followers to remove" widget="many2many_tags"
placeholder="Choose a user..."
invisible="state != 'remove_followers'"
required="state == 'remove_followers'"/>
<field name="template_id"
placeholder="Choose a template..."
invisible="state != 'mail_post'"
required="state == 'mail_post'"
context="{'default_model': model_name,
@@ -8,6 +8,7 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='link_field_id']" position="after">
<field name="sms_template_id"
placeholder="Choose a template..."
context="{'default_model': model_name}"
invisible="state != 'sms'"
required="state == 'sms'"/>
+10 -8
View File
@@ -385,10 +385,12 @@
invisible="state != 'object_create'"
required="state == 'object_create'"/>
<field name="crud_model_name" invisible="1"/>
<field name="value" widget="char" string="Name" invisible="state != 'object_create'"/>
<field name="value" widget="char" string="Name" invisible="state != 'object_create'"
help="The name of the record to create" placeholder="e.g. Follow-up"/>
<field name="link_field_id"
domain="[('model_id', '=', model_id), ('relation', '=', crud_model_name),
('ttype', 'in', ['many2one', 'one2many', 'many2many'])]"
placeholder="Select a field to link the record to"
options="{'no_create': True, 'no_open': True}"
invisible="state != 'object_create'"
context="{'default_model_id': model_id, 'default_relation': crud_model_name}"/>
@@ -405,11 +407,11 @@
If several child actions return an action, only the last one will be executed.
This may happen when having server actions executing code that returns an action, or server actions returning a client action.
</p>
<label for="code" invisible="state != 'code'"/>
<field name="code" invisible="state != 'code'" widget="code" options="{'mode': 'python'}" placeholder="Enter Python code here. Help about Python expression is available in the help tab of this document."/>
<div class="mb-3 opacity-75" invisible="state != 'code'">
<button class="btn btn-sm btn-secondary" data-bs-toggle="collapse" data-bs-target="#code-help-collapse" aria-expanded="false" aria-controls="code-help-collapse">Available variables and libraries</button>
<div class="collapse ps-3" id="code-help-collapse">
<notebook invisible="state != 'code'">
<page string="Code">
<field name="code" invisible="state != 'code'" widget="code" options="{'mode': 'python'}" placeholder="Enter Python code here. Help about Python expression is available in the help tab of this document."/>
</page>
<page string="Help">
<p>The following variables can be used:</p>
<ul>
<li><code>env</code>: environment on which the action is triggered</li>
@@ -430,8 +432,8 @@
env['res.partner'].create({'name': partner_name})
</pre>
</div>
</div>
</div>
</page>
</notebook>
</sheet>
</form>
</field>