[FIX] mail,*: fix style in 1st column of activity view

Task-3290752

closes odoo/odoo#120189

X-original-commit: a97c86a2b962f56955e3c16b7ad99cabb0b13b9c
Related: odoo/enterprise#40564
Signed-off-by: Sébastien Theys (seb) <seb@odoo.com>
Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
Alexandre Kühn
2023-05-03 17:24:58 +02:00
parent 6a5cc4c7b4
commit 9f115fce17
12 changed files with 55 additions and 35 deletions
@@ -172,7 +172,7 @@
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('res.partner', 'avatar_128', record.purchaser_id.raw_value)" t-att-title="record.purchaser_id.value" t-att-alt="record.purchaser_id.value"/>
<div>
<div class="ms-2">
<field name="vehicle_id" display="full"/>
</div>
</div>
@@ -349,11 +349,9 @@
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('fleet.vehicle', 'image_128', record.vehicle_id.raw_value)" role="img" t-att-title="record.vehicle_id.value" t-att-alt="record.vehicle_id.value"/>
<div>
<div class="ms-2">
<field name="vehicle_id"/>
<t t-if="record.description.raw_value">
: <field name="description"/>
</t>
<field t-if="record.description.raw_value" name="description" muted="1"/>
</div>
</div>
</templates>
+4 -3
View File
@@ -328,9 +328,10 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('fleet.vehicle', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<field name="license_plate"/> : <field name="model_id"/>
<img class="rounded-circle" t-att-src="activity_image('fleet.vehicle', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div class="ms-2">
<field name="license_plate" display="full"/>
<field name="model_id" muted="1"/>
</div>
</div>
</templates>
+2 -2
View File
@@ -368,8 +368,8 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div class="ms-2">
<field name="name" display="full"/>
<field name="job_id" muted="1" display="full"/>
</div>
@@ -355,8 +355,8 @@
<field name="employee_id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div class="ms-2">
<field name="name" display="full"/>
<field name="job_id" muted="1" display="full"/>
</div>
+4 -4
View File
@@ -380,8 +380,8 @@
<field name="currency_id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div class="ms-2">
<field name="name" display="full"/>
<field name="total_amount" widget="monetary" muted="1" display="full"/>
</div>
@@ -982,8 +982,8 @@
<field name="currency_id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div class="ms-2">
<field name="name" display="full"/>
<field name="total_amount" widget="monetary" muted="1" display="full"/>
<field name="state" display="right"/>
@@ -408,9 +408,9 @@
<field name="employee_id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div>
<field name="employee_id"/> <span class="text-muted">(<field name="number_of_days"/> days)</span>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value"/>
<div class="ms-2">
<field name="employee_id" bold="1"/> <span class="text-muted">(<field name="number_of_days"/> days)</span>
<field name="holiday_status_id" muted="1" display="full"/>
</div>
</div>
+3 -3
View File
@@ -189,9 +189,9 @@
<field name="number_of_days"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="50" height="50"/>
<div>
<field name="name"/> <span class="text-muted">(<field name="number_of_days"/> days)</span>
<img class="rounded-circle" t-att-src="activity_image('hr.employee', 'avatar_128', record.employee_id.raw_value)" t-att-title="record.employee_id.value" t-att-alt="record.employee_id.value" width="50" height="50"/>
<div class="ms-2">
<field name="name" bold="1"/> <span class="text-muted">(<field name="number_of_days"/> days)</span>
<div class="text-muted">
<field name="date_from" widget="date"/> <i class="fa fa-long-arrow-right" title="to" /> <field name="date_to" widget="date"/>
</div>
@@ -392,7 +392,7 @@
<activity string="Applicants">
<templates>
<div t-name="activity-box">
<div>
<div class="ms-2">
<field name="name" display="full"/>
<field name="partner_name" muted="1" display="full"/>
</div>
@@ -1,6 +1,6 @@
/** @odoo-module **/
import { createElement } from "@web/core/utils/xml";
import { createElement, extractAttributes } from "@web/core/utils/xml";
import { toStringExpression } from "@web/views/utils";
import { toInterpolatedStringExpression, ViewCompiler } from "@web/views/view_compiler";
@@ -10,14 +10,35 @@ export class ActivityCompiler extends ViewCompiler {
*/
compileField(el, params) {
let compiled;
if (!el.hasAttribute("widget")) {
// fields without a specified widget are rendered as simple spans in activity records
compiled = createElement("div", { "class": "d-inline-block", "t-out": `record["${el.getAttribute("name")}"].value` });
if (el.getAttribute("muted")) {
compiled.classList.add("text-muted");
}
} else {
if (el.hasAttribute("widget")) {
compiled = super.compileField(el, params);
} else {
// fields without a specified widget are rendered as simple spans in activity records
compiled = createElement("div", {
"t-out": `record["${el.getAttribute("name")}"].value`,
});
}
const classNames = [];
const { bold, display, muted } = extractAttributes(el, ["bold", "display", "muted"]);
if (display === "right") {
classNames.push("float-end");
}
if (display === "full") {
classNames.push("d-block", "text-truncate");
} else {
classNames.push("d-inline-block");
}
if (bold) {
classNames.push("fw-bold");
}
if (muted) {
classNames.push("text-muted");
}
if (classNames.length > 0) {
const clsFormatted = el.hasAttribute("widget")
? toStringExpression(classNames.join(" "))
: classNames.join(" ");
compiled.setAttribute("class", clsFormatted);
}
const attrs = {};
+2 -2
View File
@@ -79,8 +79,8 @@
<field name="id"/>
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('res.partner', 'avatar_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<img t-att-src="activity_image('res.partner', 'avatar_128', record.id.raw_value)" role="img" t-att-title="record.name.value" t-att-alt="record.name.value"/>
<div class="ms-2">
<field name="name" display="full"/>
<field name="parent_id" muted="1" display="full"/>
</div>
@@ -128,7 +128,7 @@
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('product.template', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<div class="ms-2">
<field name="name" display="full"/>
<div t-if="record.default_code.value" class="text-muted">
[<field name="default_code"/>]
+1 -1
View File
@@ -440,7 +440,7 @@
<templates>
<div t-name="activity-box">
<img t-att-src="activity_image('product.product', 'image_128', record.id.raw_value)" role="img" t-att-title="record.id.value" t-att-alt="record.id.value"/>
<div>
<div class="ms-2">
<field name="name" display="full"/>
<div t-if="record.default_code.value" class="text-muted">
[<field name="default_code"/>]