[FIX] mail: traceback on opening chat full composer
When full composer is opened it checks for partner information by calling get_partner_info controller, if information are missing then it opens missing partner information popup to fill missing partner information, currently if partner information is missing and if try to open full composer it throws traceback, this is due to commit: https://github.com/odoo/odoo/commit/957c99abd53b42fa82903ad7ad03300797a706cf here this._rpc is used in inner function which is wrong, it should be self._rpc Scenario: we go to an opportunity and set the email but we do not set a customer, and then when we open the chat composer by sending a message, we're getting the traceback. It will be fixed in this commit. task-2005890 closes odoo/odoo#34084 Signed-off-by: Martin Geubelle (mge) <mge@openerp.com>
This commit is contained in:
@@ -88,7 +88,7 @@ var ChatterComposer = BasicComposer.extend({
|
||||
// partner_id
|
||||
var def;
|
||||
if (namesToFind.length > 0) {
|
||||
def = this._rpc({
|
||||
def = self._rpc({
|
||||
route: '/mail/get_partner_info',
|
||||
params: {
|
||||
model: self._model,
|
||||
|
||||
@@ -1374,12 +1374,12 @@ QUnit.test('chatter: discard changes on message post with post_refresh "recipien
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
QUnit.test('chatter: discard changes on opening full-composer', async function (assert) {
|
||||
QUnit.test('chatter: discard changes on opening full-composer and open missing partner info popup', async function (assert) {
|
||||
// When we open the full-composer, any following operations by the user
|
||||
// will reload the record (even closing the full-composer). Therefore,
|
||||
// we should warn the user when we open the full-composer if the record
|
||||
// is dirty (= has some unsaved changes).
|
||||
assert.expect(2);
|
||||
assert.expect(3);
|
||||
|
||||
var form = await createView({
|
||||
View: FormView,
|
||||
@@ -1396,11 +1396,24 @@ QUnit.test('chatter: discard changes on opening full-composer', async function (
|
||||
' \'post_refresh\': \'always\'}"/>' +
|
||||
'</div>' +
|
||||
'</form>',
|
||||
archs: {
|
||||
'res.partner,false,form':
|
||||
'<form string="partners">' +
|
||||
'<field name="name"/>' +
|
||||
'</form>',
|
||||
},
|
||||
res_id: 2,
|
||||
session: {},
|
||||
mockRPC: function (route, args) {
|
||||
if (route === "/mail/get_suggested_recipients") {
|
||||
return Promise.resolve({2: []});
|
||||
return Promise.resolve({2: [[
|
||||
false,
|
||||
'pikapika@pikachu.com',
|
||||
''
|
||||
]]});
|
||||
}
|
||||
if (route === "/mail/get_partner_info") {
|
||||
return Promise.resolve([{full_name: "pikapika@pikachu.com", partner_id: false}]);
|
||||
}
|
||||
return this._super(route, args);
|
||||
},
|
||||
@@ -1421,6 +1434,8 @@ QUnit.test('chatter: discard changes on opening full-composer', async function (
|
||||
assert.strictEqual($modal.find('.modal-body').text(),
|
||||
"The record has been modified, your changes will be discarded. Do you want to proceed?",
|
||||
"should warn the user that any unsaved changes will be lost");
|
||||
await testUtils.dom.click($modal.find('.modal-footer .btn.btn-primary'));
|
||||
assert.strictEqual($modal.length, 1, "should have a modal opened");
|
||||
|
||||
form.destroy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user