[FIX] web: display_name in analytical tag not displayed

Steps to reproduce:
- Install accounting
- Create more than 6 analytical tags
- Create an invoice
- Create a payment
- Go in Accounting>Actions>Reconciliation, tab Manal Operations
- In the field Analytical Tag, click on 'Search More' and selected 1 or multiple tags

Issue:
Void tags are displayed

Solution:
Fetch the field `display_name`

ref commit: 84f0644802865c6454014059842eb6a9d4fd40e4
opw-2734029

closes odoo/odoo#87311

X-original-commit: 936bad32cf1024570da4880ccc5375b02b30c1c2
Related: odoo/enterprise#25631
Signed-off-by: Aaron Bohy (aab) <aab@odoo.com>
This commit is contained in:
Yolann Sabaux
2022-03-28 10:46:28 +02:00
parent 1266b7f470
commit dd239a604a
3 changed files with 77 additions and 4 deletions
@@ -137,6 +137,23 @@ var ListController = BasicController.extend({
return self.model.get(db_id, {raw: true});
});
},
/**
* Returns the list of currently selected records (with the check boxes on
* the left) or the whole domain records if it is selected
*
* @returns {Promise<{id, display_name}[]>}
*/
getSelectedRecordsWithDomain: async function () {
if (this.isDomainSelected) {
const state = this.model.get(this.handle, {raw: true});
return await this._domainToRecords(state.getDomain(), session.active_ids_limit);
} else {
return Promise.resolve(this.selectedRecords.map(localId => {
const data = this.model.localData[localId].data;
return { id: data.id, display_name: data.display_name };
}));
}
},
/**
* Display and bind all buttons in the control panel
*
@@ -394,6 +411,25 @@ var ListController = BasicController.extend({
self.updateButtons('readonly');
});
},
/**
* Returns the records matching the given domain.
*
* @private
* @param {Array[]} domain
* @param {integer} [limit]
* @returns {Promise<{id, display_name}[]>}
*/
_domainToRecords: function (domain, limit) {
return this._rpc({
model: this.modelName,
method: 'search_read',
args: [domain],
kwargs: {
fields: ['display_name'],
limit: limit,
},
});
},
/**
* Returns the ids of records matching the given domain.
*
@@ -476,8 +476,7 @@ var SelectCreateDialog = ViewDialog.extend({
close: true,
hotkey: 'v',
click: async () => {
const resIds = await this.viewController.getSelectedIdsWithDomain();
const values = resIds.map(e => ({id: e}));
const values = await this.viewController.getSelectedRecordsWithDomain();
this.on_selected(values);
},
});