[MERGE] forward port branch 11.0 up to b9ce1affbf
This commit is contained in:
@@ -845,7 +845,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def existing_accounting(self, company_id):
|
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:
|
for model in model_to_check:
|
||||||
if len(self.env[model].search([('company_id', '=', company_id.id)])) > 0:
|
if len(self.env[model].search([('company_id', '=', company_id.id)])) > 0:
|
||||||
return True
|
return True
|
||||||
@@ -880,7 +880,7 @@ class WizardMultiChartsAccounts(models.TransientModel):
|
|||||||
accounting_props.unlink()
|
accounting_props.unlink()
|
||||||
|
|
||||||
# delete account, journal, tax, fiscal position and reconciliation model
|
# 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:
|
for model in models_to_delete:
|
||||||
res = self.env[model].search([('company_id', '=', self.company_id.id)])
|
res = self.env[model].search([('company_id', '=', self.company_id.id)])
|
||||||
if len(res):
|
if len(res):
|
||||||
|
|||||||
@@ -83,6 +83,16 @@ var KanbanController = BasicController.extend({
|
|||||||
}
|
}
|
||||||
return this.renderer.updateRecord(this.model.get(id));
|
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
|
* This method calls the server to ask for a resequence. Note that this
|
||||||
* does not rerender the user interface, because in most case, the
|
* does not rerender the user interface, because in most case, the
|
||||||
@@ -139,6 +149,10 @@ var KanbanController = BasicController.extend({
|
|||||||
_onAddColumn: function (event) {
|
_onAddColumn: function (event) {
|
||||||
var self = this;
|
var self = this;
|
||||||
this.model.createGroup(event.data.value, this.handle).then(function () {
|
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});
|
return self.update({}, {reload: false});
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
self._updateButtons();
|
self._updateButtons();
|
||||||
@@ -389,9 +403,7 @@ var KanbanController = BasicController.extend({
|
|||||||
*/
|
*/
|
||||||
_onResequenceColumn: function (event) {
|
_onResequenceColumn: function (event) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var state = this.model.get(this.handle, {raw: true});
|
this._resequenceColumns(event.data.ids).then(function () {
|
||||||
var model = state.fields[state.groupedBy[0]].relation;
|
|
||||||
this.model.resequence(model, event.data.ids, this.handle).then(function () {
|
|
||||||
self._updateEnv();
|
self._updateEnv();
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -994,6 +994,9 @@ var MockServer = Class.extend({
|
|||||||
|
|
||||||
case '/web/dataset/search_read':
|
case '/web/dataset/search_read':
|
||||||
return $.when(this._mockSearchReadController(args));
|
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))) {
|
if (route.indexOf('/web/image') >= 0 || _.contains(['.png', '.jpg'], route.substr(route.length - 4))) {
|
||||||
return $.when();
|
return $.when();
|
||||||
|
|||||||
@@ -1579,7 +1579,7 @@ QUnit.module('Views', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('create a column in grouped on m2o', function (assert) {
|
QUnit.test('create a column in grouped on m2o', function (assert) {
|
||||||
assert.expect(13);
|
assert.expect(14);
|
||||||
|
|
||||||
var nbRPCs = 0;
|
var nbRPCs = 0;
|
||||||
var kanban = createView({
|
var kanban = createView({
|
||||||
@@ -1598,6 +1598,11 @@ QUnit.module('Views', {
|
|||||||
if (args.method === 'name_create') {
|
if (args.method === 'name_create') {
|
||||||
assert.ok(true, "should call 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);
|
return this._super(route, args);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@@ -1679,7 +1684,7 @@ QUnit.module('Views', {
|
|||||||
});
|
});
|
||||||
|
|
||||||
QUnit.test('delete a column in grouped on m2o', function (assert) {
|
QUnit.test('delete a column in grouped on m2o', function (assert) {
|
||||||
assert.expect(28);
|
assert.expect(29);
|
||||||
|
|
||||||
testUtils.patch(KanbanRenderer, {
|
testUtils.patch(KanbanRenderer, {
|
||||||
_renderGrouped: function () {
|
_renderGrouped: function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user