[FIX] mail: Fix activity progress bar filter
This commit simply fixes how the activity renderer propagates the group.progressValue prop to the ColumnProgress component so that the active value is only set for the filtered column and not for every column. opw-3272571 closes odoo/odoo#120733 X-original-commit: 3bd539913e9ca6f9db9bb55caaa4a85b69a912e0 Signed-off-by: Luca Vitali <luvi@odoo.com>
This commit is contained in:
@@ -74,8 +74,8 @@ export class ActivityRenderer extends Component {
|
||||
},
|
||||
};
|
||||
const typeId = group[0];
|
||||
const progressValue = this.activeFilter.progressValue;
|
||||
const isColumnFiltered = this.activeFilter.activityTypeId === group[0];
|
||||
const progressValue = isColumnFiltered ? this.activeFilter.progressValue : {active: null};
|
||||
|
||||
let totalCount = 0;
|
||||
for (const activities of Object.values(this.props.groupedActivities)) {
|
||||
|
||||
@@ -771,7 +771,29 @@ QUnit.module("test_mail", {}, function () {
|
||||
);
|
||||
|
||||
QUnit.test("Activity view: apply progressbar filter", async function (assert) {
|
||||
assert.expect(9);
|
||||
assert.expect(10);
|
||||
|
||||
const mailActivityTypeIds = pyEnv["mail.activity.type"].search([]);
|
||||
const mailTemplateIds = pyEnv["mail.template"].search([]);
|
||||
const [resUsersId1] = pyEnv["res.users"].search([]);
|
||||
pyEnv["mail.activity"].create([
|
||||
{
|
||||
display_name: "An activity",
|
||||
date_deadline: moment().add(3, "days").format("YYYY-MM-DD"), // now
|
||||
can_write: true,
|
||||
state: "planned",
|
||||
activity_type_id: mailActivityTypeIds[2],
|
||||
mail_template_ids: mailTemplateIds,
|
||||
user_id: resUsersId1,
|
||||
}
|
||||
]);
|
||||
const mailActivityIds = pyEnv["mail.activity"].search([]);
|
||||
const [mailTestActivityId1] = pyEnv["mail.test.activity"].search([
|
||||
["name", "=", "Meeting Room Furnitures"],
|
||||
]);
|
||||
pyEnv["mail.test.activity"].write([mailTestActivityId1], {
|
||||
activity_ids: [mailActivityIds[0], mailActivityIds[3]],
|
||||
});
|
||||
|
||||
serverData.actions = {
|
||||
1: {
|
||||
@@ -802,9 +824,10 @@ QUnit.module("test_mail", {}, function () {
|
||||
"Office planning",
|
||||
"'Office planning' should be first record"
|
||||
);
|
||||
assert.containsOnce(
|
||||
assert.containsN(
|
||||
document.querySelector(".o_activity_view tbody"),
|
||||
".planned",
|
||||
2,
|
||||
"other records should be available"
|
||||
);
|
||||
|
||||
@@ -820,6 +843,11 @@ QUnit.module("test_mail", {}, function () {
|
||||
5,
|
||||
"planned should be active filter"
|
||||
);
|
||||
assert.containsNone(
|
||||
document.querySelector(".o_activity_view thead tr :nth-child(4)"),
|
||||
".progress-bar-animated",
|
||||
"the progress bar of the Call for Demo activity type should not be animated"
|
||||
);
|
||||
assert.strictEqual(
|
||||
document.querySelector(".o_activity_view tbody .o_activity_record").textContent,
|
||||
"Meeting Room Furnitures",
|
||||
|
||||
Reference in New Issue
Block a user