squashed commit

This commit is contained in:
hoangvv
2026-09-18 13:55:25 +07:00
commit 039c98d4d0
45882 changed files with 24235585 additions and 0 deletions
@@ -0,0 +1,25 @@
import { Message } from "@mail/core/common/message_model";
import { Record } from "@mail/core/common/record";
import { patch } from "@web/core/utils/patch";
patch(Message.prototype, {
setup() {
super.setup(...arguments);
this.rating_id = Record.one("rating.rating");
},
computeIsEmpty() {
return super.computeIsEmpty() && !this.rating_id && !this.rating_value;
},
async remove() {
const data = await super.remove(...arguments);
this.rating_value = false;
return data;
},
get removeParams() {
return { ...super.removeParams, rating_value: false };
},
});
@@ -0,0 +1,16 @@
import { Record } from "@mail/core/common/record";
export class Rating extends Record {
static _name = "rating.rating";
static id = "id";
/** @type {number} */
id;
/** @type {number} */
rating;
/** @type {string} */
rating_image_url;
/** @type {string} */
rating_text;
}
Rating.register();
@@ -0,0 +1,4 @@
.o-rating-preview-image {
height: $font-size-base;
width: $font-size-base;
}
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit="mail.MessagingMenu.content" t-inherit-mode="extension">
<xpath expr="//t[@name='threads']/NotificationItem" position="attributes">
<attribute name="rating">message?.rating_id</attribute>
<attribute name="onClick">(isMarkAsRead) => message?.rating_id and !isMarkAsRead ? this.openThread(thread) : this.onClickThread(isMarkAsRead, thread)</attribute>
</xpath>
</t>
</templates>
@@ -0,0 +1,5 @@
/** @odoo-module */
import { NotificationItem } from "@mail/core/public_web/notification_item";
NotificationItem.props = [...NotificationItem.props, "rating?"];
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<templates xml:space="preserve">
<t t-inherit="mail.NotificationItem" t-inherit-mode="extension">
<xpath expr="//*[@name='notificationBody']" position="replace">
<t t-if="props.rating">
<span>Rating:</span>
<img class="o-rating-preview-image ms-2" t-att-src="props.rating.rating_image_url" t-att-alt="props.rating.rating_text"/>
</t>
<t t-else="">$0</t>
</xpath>
</t>
</templates>
+34
View File
@@ -0,0 +1,34 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="310.000000pt" height="120.000000pt" viewBox="0 0 310.000000 120.000000"
preserveAspectRatio="xMidYMid meet">
<g transform="translate(0.000000,120.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path fill="#7C6576" d="M1420 1177 c-170 -51 -284 -160 -344 -326 -18 -51 -20 -87 -24 -444
-3 -372 -3 -389 15 -385 10 2 32 25 49 51 48 73 64 87 100 87 34 0 42 -8 105
-97 23 -34 35 -43 59 -43 24 0 36 9 59 43 63 90 71 97 106 97 39 0 53 -12 100
-86 29 -45 40 -54 64 -54 30 0 41 10 102 97 23 34 35 43 58 43 46 0 58 -8 92
-63 33 -52 56 -77 72 -77 4 0 7 173 5 393 -4 371 -5 395 -25 449 -63 167 -194
282 -367 322 -89 21 -136 19 -226 -7z m100 -392 c25 -13 60 -60 60 -79 0 -3
-13 -3 -30 0 -35 8 -60 -9 -60 -40 0 -28 18 -46 47 -46 34 0 29 -27 -9 -51
-49 -30 -120 -22 -161 20 -28 28 -32 38 -32 87 0 51 3 58 37 90 30 27 46 34
78 34 23 0 54 -7 70 -15z m340 0 c31 -16 60 -51 60 -72 0 -9 -9 -11 -30 -7
-35 8 -60 -9 -60 -40 0 -30 18 -46 53 -46 36 0 32 -17 -13 -47 -106 -72 -243
44 -185 157 34 65 109 89 175 55z"/>
<path d="M2500 1159 c-95 -15 -270 -115 -270 -155 0 -23 27 -16 79 21 26 19
75 47 107 62 53 25 70 28 169 28 94 0 117 -3 162 -24 90 -40 153 -127 153
-212 0 -58 -30 -126 -71 -164 -63 -57 -99 -68 -236 -73 -110 -4 -123 -6 -123
-22 0 -16 13 -18 133 -22 141 -4 201 -21 255 -71 59 -55 87 -173 62 -262 -14
-51 -76 -127 -124 -152 -151 -78 -373 -47 -515 71 -48 40 -59 43 -68 21 -13
-35 134 -132 242 -160 76 -19 204 -19 280 0 85 22 161 77 199 145 29 51 31 62
31 150 0 82 -4 102 -25 144 -30 60 -79 101 -144 122 l-49 17 51 24 c227 107
172 437 -83 501 -62 16 -155 20 -215 11z"/>
<path d="M167 1153 c-11 -10 -8 -511 2 -518 6 -3 41 10 78 29 86 44 136 55
244 56 156 0 249 -47 304 -154 38 -76 41 -174 6 -251 -42 -94 -166 -183 -307
-219 -70 -18 -209 -36 -276 -36 -41 0 -48 -3 -48 -20 0 -18 7 -20 73 -20 144
0 334 45 435 102 72 42 119 87 153 150 32 59 34 69 34 158 -1 117 -24 178 -94
243 -71 66 -142 90 -271 90 -106 1 -171 -12 -240 -48 -59 -30 -60 -26 -60 184
0 104 3 196 6 205 5 14 42 16 305 16 292 0 299 0 299 20 0 20 -7 20 -318 20
-175 0 -322 -3 -325 -7z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 68"><path d="M34,68A34,34,0,1,1,68,34,34,34,0,0,1,34,68ZM34,4A30,30,0,1,0,64,34,30,30,0,0,0,34,4Z" style="fill:#d23f3a"/><path d="M49.55,51.18a2,2,0,0,1-1.63-.84,17.2,17.2,0,0,0-27.84,0A2,2,0,0,1,16.82,48a21.21,21.21,0,0,1,34.36,0,2,2,0,0,1-1.63,3.2Z" style="fill:#d23f3a"/><circle cx="20.9" cy="30.19" r="4.79" style="fill:#d23f3a"/><circle cx="47" cy="30.19" r="4.79" style="fill:#d23f3a"/></svg>

After

Width:  |  Height:  |  Size: 454 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 68"><path d="M34,68A34,34,0,1,1,68,34,34,34,0,0,1,34,68ZM34,4A30,30,0,1,0,64,34,30,30,0,0,0,34,4Z" style="fill:#f7931e"/><path d="M18.45,47.15a2,2,0,0,1,0-4h31.1a2,2,0,0,1,0,4Z" style="fill:#f7931e"/><circle cx="20.9" cy="30.19" r="4.79" style="fill:#f7931e"/><circle cx="47" cy="30.19" r="4.79" style="fill:#f7931e"/></svg>

After

Width:  |  Height:  |  Size: 380 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 68 68"><path d="M34,68A34,34,0,1,1,68,34,34,34,0,0,1,34,68ZM34,4A30,30,0,1,0,64,34,30,30,0,0,0,34,4Z" style="fill:#008818"/><path d="M34,55.21a21.26,21.26,0,0,1-17.18-8.78,2,2,0,1,1,3.26-2.36,17.18,17.18,0,0,0,27.84,0,2,2,0,0,1,3.26,2.36A21.26,21.26,0,0,1,34,55.21Z" style="fill:#008818"/><circle cx="20.9" cy="30.19" r="4.79" style="fill:#008818"/><circle cx="47" cy="30.19" r="4.79" style="fill:#008818"/></svg>

After

Width:  |  Height:  |  Size: 466 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

@@ -0,0 +1,5 @@
.o_rating_rating_kanban .o_kanban_renderer {
.o_kanban_record {
width: 350px;
}
}
@@ -0,0 +1,36 @@
.o_rating_page_thank_you {
min-height: 80vh;
}
/* Rating feedback */
.o_rating_page_submit {
.btn-group > .btn:not(:first-child),
.btn-group > .btn-group:not(:first-child) > .btn {
margin-left: 0 !important;
}
.o_rating_label {
opacity: 0.5;
border: none !important;
&:hover {
transform: scale(1.1);
}
img {
&.bg-white:hover,
&.bg-white:focus {
background-color: #ffffff !important;
}
}
}
.btn-check:checked + .o_rating_label {
transform: scale(1.2);
opacity: 1;
img {
&.bg-white:hover,
&.bg-white:focus {
background-color: #ffffff !important;
}
}
}
}
@@ -0,0 +1,5 @@
/** @odoo-module **/
import { addModelNamesToFetch } from '@bus/../tests/helpers/model_definitions_helpers';
addModelNamesToFetch(['rating.rating']);
@@ -0,0 +1,32 @@
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { mailDataHelpers } from "@mail/../tests/mock_server/mail_mock_server";
import { getKwArgs } from "@web/../tests/web_test_helpers";
export class MailMessage extends mailModels.MailMessage {
_to_store(ids, store, fields, for_current_user, follower_by_message_partner) {
const kwargs = getKwArgs(
arguments,
"ids",
"store",
"fields",
"for_current_user",
"follower_by_message_partner"
);
ids = kwargs.ids;
store = kwargs.store;
fields = kwargs.fields;
/** @type {import("mock_models").MailMessage} */
const MailMessage = this.env["mail.message"];
if (!fields) {
fields = ["rating_id"];
}
super._to_store(...arguments);
for (const message of MailMessage.browse(ids)) {
const [ratingId] = this.env["rating.rating"].search([["message_id", "=", message.id]]);
store.add(this.browse(message.id), {
rating_id: mailDataHelpers.Store.one(this.env["rating.rating"].browse(ratingId)),
});
}
}
}
@@ -0,0 +1,20 @@
import { fields, getKwArgs, models } from "@web/../tests/web_test_helpers";
export class RatingRating extends models.ServerModel {
_name = "rating.rating";
res_model = fields.Char({ string: "Related Document Model", related: false }); // FIXME: related removed otherwise it cannot be set properly
/**
* @param {Number[]} ids
* @returns {Record<string, ModelRecord>}
*/
_to_store(ids, store, fields) {
const kwargs = getKwArgs(arguments, "ids", "store", "fields");
fields = kwargs.fields;
if (!fields) {
fields = ["rating", "rating_image_url", "rating_text"];
}
store.add(this._name, this._read_format(ids, fields, false));
}
}
@@ -0,0 +1,5 @@
import { mailModels } from "@mail/../tests/mail_test_helpers";
import { MailMessage } from "@rating/../tests/mock_server/models/mail_message";
import { RatingRating } from "@rating/../tests/mock_server/models/rating_rating";
export const ratingModels = { ...mailModels, MailMessage, RatingRating };