mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-22 07:32:08 +02:00
19.0 vanilla
This commit is contained in:
parent
d1963a3c3a
commit
2d3ee4855a
7430 changed files with 2687981 additions and 2965473 deletions
|
|
@ -1,28 +0,0 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import '@mail/../tests/helpers/mock_server'; // ensure mail overrides are applied first
|
||||
|
||||
import { patch } from "@web/core/utils/patch";
|
||||
import { MockServer } from "@web/../tests/helpers/mock_server";
|
||||
|
||||
patch(MockServer.prototype, 'rating', {
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_mockMailMessageMessageFormat(ids) {
|
||||
const formattedMessages = this._super(...arguments);
|
||||
for (const formattedMessage of formattedMessages) {
|
||||
const [rating] = this.getRecords('rating.rating', [
|
||||
['message_id', '=', formattedMessage.id],
|
||||
]);
|
||||
if (rating) {
|
||||
formattedMessage['rating'] = {
|
||||
'id': rating.id,
|
||||
'ratingImageUrl': rating.rating_image_url,
|
||||
'ratingText': rating.rating_text,
|
||||
};
|
||||
}
|
||||
}
|
||||
return formattedMessages;
|
||||
},
|
||||
});
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
/** @odoo-module **/
|
||||
|
||||
import { addModelNamesToFetch } from '@bus/../tests/helpers/model_definitions_helpers';
|
||||
|
||||
addModelNamesToFetch(['rating.rating']);
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
import { mailModels } from "@mail/../tests/mail_test_helpers";
|
||||
import { mailDataHelpers } from "@mail/../tests/mock_server/mail_mock_server";
|
||||
|
||||
import { getKwArgs, makeKwArgs } from "@web/../tests/web_test_helpers";
|
||||
|
||||
export class MailMessage extends mailModels.MailMessage {
|
||||
_to_store(store, fields, for_current_user, follower_by_message_partner) {
|
||||
const kwargs = getKwArgs(
|
||||
arguments,
|
||||
"store",
|
||||
"fields",
|
||||
"for_current_user",
|
||||
"follower_by_message_partner"
|
||||
);
|
||||
store = kwargs.store;
|
||||
fields = kwargs.fields;
|
||||
|
||||
super._to_store(...arguments, makeKwArgs({ fields: fields.filter((field) => field !== "rating_id") }));
|
||||
if (!fields.includes("rating_id")) {
|
||||
return;
|
||||
}
|
||||
for (const message of this) {
|
||||
const [ratingId] = this.env["rating.rating"].search([["message_id", "=", message.id]]);
|
||||
store._add_record_fields(this.browse(message.id), {
|
||||
rating_id: mailDataHelpers.Store.one(this.env["rating.rating"].browse(ratingId)),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
get _to_store_defaults() {
|
||||
return [...super._to_store_defaults, "rating_id"];
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
import { fields, 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
|
||||
|
||||
get _to_store_defaults() {
|
||||
return [
|
||||
"rating",
|
||||
"rating_image_url",
|
||||
"rating_text",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
@ -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 };
|
||||
Loading…
Add table
Add a link
Reference in a new issue