summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-04-24 16:35:06 +0200
committerChristophe Simonis <chs@odoo.com>2018-04-24 16:35:06 +0200
commitec5e27bb7cc7808d7128eae4e7e67910f40492c0 (patch)
treedd750032f3dd0f1d4e443b44f5b0fcf0d8a5ba11 /addons
parent3b3f6cc0694b95cfbb0300cbff9aa6d9a3a6fe7e (diff)
parent7fd9dbdd9f8f30424cfb977b83a3c463889bb710 (diff)
[MERGE] forward port branch saas-11.2 up to 7fd9dbdd9f8
Diffstat (limited to 'addons')
-rw-r--r--addons/account/models/chart_template.py4
-rw-r--r--addons/web/static/src/js/views/kanban/kanban_controller.js18
-rw-r--r--addons/web/static/tests/helpers/mock_server.js3
-rw-r--r--addons/web/static/tests/views/kanban_tests.js9
4 files changed, 27 insertions, 7 deletions
diff --git a/addons/account/models/chart_template.py b/addons/account/models/chart_template.py
index 7832a2354aa..69413f6bd66 100644
--- a/addons/account/models/chart_template.py
+++ b/addons/account/models/chart_template.py
@@ -853,7 +853,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
@api.multi
def existing_accounting(self, company_id):
- model_to_check = ['account.move.line', 'account.invoice', 'account.move', 'account.payment', 'account.bank.statement']
+ model_to_check = ['account.move.line', 'account.invoice', 'account.payment', 'account.bank.statement']
for model in model_to_check:
if len(self.env[model].search([('company_id', '=', company_id.id)])) > 0:
return True
@@ -888,7 +888,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
accounting_props.unlink()
# delete account, journal, tax, fiscal position and reconciliation model
- models_to_delete = ['account.reconcile.model', 'account.fiscal.position', 'account.tax', 'account.journal']
+ models_to_delete = ['account.reconcile.model', 'account.fiscal.position', 'account.tax', 'account.move', 'account.journal']
for model in models_to_delete:
res = self.env[model].search([('company_id', '=', self.company_id.id)])
if len(res):
diff --git a/addons/web/static/src/js/views/kanban/kanban_controller.js b/addons/web/static/src/js/views/kanban/kanban_controller.js
index 5e8bcbf963f..986fff3a53e 100644
--- a/addons/web/static/src/js/views/kanban/kanban_controller.js
+++ b/addons/web/static/src/js/views/kanban/kanban_controller.js
@@ -79,6 +79,16 @@ var KanbanController = BasicController.extend({
return this.renderer.updateRecord(this.model.get(id));
},
/**
+ * @param {number[]} ids
+ * @private
+ * @returns {Deferred}
+ */
+ _resequenceColumns: function (ids) {
+ var state = this.model.get(this.handle, {raw: true});
+ var model = state.fields[state.groupedBy[0]].relation;
+ return this.model.resequence(model, ids, this.handle);
+ },
+ /**
* This method calls the server to ask for a resequence. Note that this
* does not rerender the user interface, because in most case, the
* resequencing operation has already been displayed by the renderer.
@@ -134,6 +144,10 @@ var KanbanController = BasicController.extend({
_onAddColumn: function (event) {
var self = this;
this.model.createGroup(event.data.value, this.handle).then(function () {
+ var state = self.model.get(self.handle, {raw: true});
+ var ids = _.pluck(state.data, 'res_id').filter(_.isNumber);
+ return self._resequenceColumns(ids);
+ }).then(function () {
return self.update({}, {reload: false});
}).then(function () {
self._updateButtons();
@@ -396,9 +410,7 @@ var KanbanController = BasicController.extend({
*/
_onResequenceColumn: function (event) {
var self = this;
- var state = this.model.get(this.handle, {raw: true});
- var model = state.fields[state.groupedBy[0]].relation;
- this.model.resequence(model, event.data.ids, this.handle).then(function () {
+ this._resequenceColumns(event.data.ids).then(function () {
self._updateEnv();
});
},
diff --git a/addons/web/static/tests/helpers/mock_server.js b/addons/web/static/tests/helpers/mock_server.js
index a66f78ff159..148b7452678 100644
--- a/addons/web/static/tests/helpers/mock_server.js
+++ b/addons/web/static/tests/helpers/mock_server.js
@@ -1015,6 +1015,9 @@ var MockServer = Class.extend({
case '/web/dataset/search_read':
return $.when(this._mockSearchReadController(args));
+
+ case '/web/dataset/resequence':
+ return $.when();
}
if (route.indexOf('/web/image') >= 0 || _.contains(['.png', '.jpg'], route.substr(route.length - 4))) {
return $.when();
diff --git a/addons/web/static/tests/views/kanban_tests.js b/addons/web/static/tests/views/kanban_tests.js
index fbe345887f3..c5e5f606f61 100644
--- a/addons/web/static/tests/views/kanban_tests.js
+++ b/addons/web/static/tests/views/kanban_tests.js
@@ -1579,7 +1579,7 @@ QUnit.module('Views', {
});
QUnit.test('create a column in grouped on m2o', function (assert) {
- assert.expect(13);
+ assert.expect(14);
var nbRPCs = 0;
var kanban = createView({
@@ -1598,6 +1598,11 @@ QUnit.module('Views', {
if (args.method === 'name_create') {
assert.ok(true, "should call name_create");
}
+ //Create column will call resequence to set column order
+ if (route === '/web/dataset/resequence') {
+ assert.ok(true, "should call resequence");
+ return $.when(true);
+ }
return this._super(route, args);
},
});
@@ -1679,7 +1684,7 @@ QUnit.module('Views', {
});
QUnit.test('delete a column in grouped on m2o', function (assert) {
- assert.expect(28);
+ assert.expect(29);
testUtils.patch(KanbanRenderer, {
_renderGrouped: function () {