[FIX] mail: handle error while click on follow button
When a user click on the 'Follow' button in the chatterbox of the project Task form view without adding any data, then traceback will appear. Steps to reproduce(i.e Project): - Install project module. - Go to Project >> Tasks >> My task(you can also choose the all task menu) . - In the list view of project.task model, click on the new button. - In-form view of project.task model, Click on Follow Button in the chatterbox. Error: traceback appears: "psycopg2.errors.UndefinedFunction: operator does not exist: integer = boolean" sentry-4243265676 closes odoo/odoo#126749 X-original-commit: eeaee0d57effb50d3a0edad1672e17bffea11d0a Signed-off-by: Alexandre Kühn (aku) <aku@odoo.com>
This commit is contained in:
committed by
Alexandre Kühn
parent
79a3fc20c5
commit
229fe73517
@@ -280,13 +280,28 @@ export class Chatter extends Component {
|
||||
document.body.click(); // hack to close dropdown
|
||||
}
|
||||
|
||||
async onClickFollow() {
|
||||
await this.orm.call(this.props.threadModel, "message_subscribe", [[this.props.threadId]], {
|
||||
async _follow(threadModel, threadId) {
|
||||
await this.orm.call(threadModel, "message_subscribe", [[threadId]], {
|
||||
partner_ids: [this.store.self.id],
|
||||
});
|
||||
this.onFollowerChanged();
|
||||
}
|
||||
|
||||
async onClickFollow() {
|
||||
if (this.props.threadId) {
|
||||
this._follow(this.props.threadModel, this.props.threadId);
|
||||
} else {
|
||||
this.onNextUpdate = (nextProps) => {
|
||||
if (nextProps.threadId) {
|
||||
this._follow(nextProps.threadModel, nextProps.threadId);
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
await this.props.saveRecord?.();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {MouseEvent} ev
|
||||
* @param {import("@mail/core/common/follower_model").Follower} follower
|
||||
|
||||
@@ -57,6 +57,27 @@ QUnit.test('click on "follow" button', async (assert) => {
|
||||
assert.containsOnce($, "button:contains(Following)");
|
||||
});
|
||||
|
||||
QUnit.test('Click on "follow" button should save draft record', async (assert) => {
|
||||
const views = {
|
||||
"res.partner,false,form": `
|
||||
<form string="Partners">
|
||||
<sheet>
|
||||
<field name="name" required="1"/>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids"/>
|
||||
</div>
|
||||
</form>`,
|
||||
};
|
||||
const { openFormView } = await start({ serverData: { views } });
|
||||
await openFormView("res.partner");
|
||||
assert.containsOnce($, "button:contains(Follow)");
|
||||
assert.containsOnce($, "div.o_field_char");
|
||||
|
||||
await click("button:contains(Follow)");
|
||||
assert.containsOnce($, "div.o_field_invalid");
|
||||
});
|
||||
|
||||
QUnit.test('click on "unfollow" button', async (assert) => {
|
||||
const pyEnv = await startServer();
|
||||
const threadId = pyEnv["res.partner"].create({});
|
||||
|
||||
Reference in New Issue
Block a user