diff options
| author | Parth Choksi <pch@odoo.com> | 2019-06-03 11:08:23 +0000 |
|---|---|---|
| committer | Parth Choksi <pch@odoo.com> | 2019-06-13 05:07:43 +0000 |
| commit | 2f8f832ceeae0af78393ba5d5f4deeb03a57c946 (patch) | |
| tree | 6fe119485f2c56da7f102933f0ce27a5036b6526 | |
| parent | d215bd81ca6f7b35985e5eef486d03f5e723469a (diff) | |
[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>
| -rw-r--r-- | addons/mail/static/src/js/composers/chatter_composer.js | 2 | ||||
| -rw-r--r-- | addons/mail/static/tests/chatter_tests.js | 21 |
2 files changed, 19 insertions, 4 deletions
diff --git a/addons/mail/static/src/js/composers/chatter_composer.js b/addons/mail/static/src/js/composers/chatter_composer.js index 33c727a236d..ff9e9e94fb2 100644 --- a/addons/mail/static/src/js/composers/chatter_composer.js +++ b/addons/mail/static/src/js/composers/chatter_composer.js @@ -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, diff --git a/addons/mail/static/tests/chatter_tests.js b/addons/mail/static/tests/chatter_tests.js index 29df0733930..d34334fb772 100644 --- a/addons/mail/static/tests/chatter_tests.js +++ b/addons/mail/static/tests/chatter_tests.js @@ -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(); }); |
