summaryrefslogtreecommitdiff
path: root/addons
diff options
context:
space:
mode:
authorwilliam <wan@odoo.com>2020-04-14 12:46:40 +0000
committerwilliam <wan@odoo.com>2020-04-15 15:14:02 +0000
commit387ee3e05a15a1312eb4d3531489dfadb66b2d66 (patch)
tree2a43e388db9a85aef88e4fce206c0f1cf35fcb61 /addons
parentdff06e82b371c8b9610b7f4c5bfdf35fee3b7d7e (diff)
[FIX] account: account type selection in list view
The custom selection widget was only used in the form. A small rework had to be done to make it work in list views because the values were not pre loaded. closes odoo/odoo#49604 X-original-commit: cf942e6df3bf065e299d8ad0dcfd8ed2cc66b29c Signed-off-by: Cedric Snauwaert (csn) <csn@openerp.com> Signed-off-by: wan <william-andre@users.noreply.github.com>
Diffstat (limited to 'addons')
-rw-r--r--addons/account/static/src/js/account_selection.js11
-rw-r--r--addons/account/views/account_account_views.xml2
-rw-r--r--addons/account/views/account_chart_template_views.xml2
-rw-r--r--addons/account/wizard/setup_wizards_view.xml2
4 files changed, 9 insertions, 8 deletions
diff --git a/addons/account/static/src/js/account_selection.js b/addons/account/static/src/js/account_selection.js
index a43083867d8..d098505b593 100644
--- a/addons/account/static/src/js/account_selection.js
+++ b/addons/account/static/src/js/account_selection.js
@@ -18,12 +18,13 @@ odoo.define('account.hierarchy.selection', function (require) {
if (!self.hierarchy_groups) {
prom = this._rpc({
model: 'account.account.type',
- method: 'read',
- args: [
- _.filter(_.map(this.values, v => v[0]), v => typeof v == 'number'),
- ['internal_group'],
- ],
+ method: 'search_read',
+ kwargs: {
+ domain: [],
+ fields: ['id', 'internal_group', 'display_name'],
+ },
}).then(function(arg) {
+ self.values = _.map(arg, v => [v['id'], v['display_name']])
self.hierarchy_groups = [
{
'name': _('Balance Sheet'),
diff --git a/addons/account/views/account_account_views.xml b/addons/account/views/account_account_views.xml
index 52b5f26125a..4fe5c202b41 100644
--- a/addons/account/views/account_account_views.xml
+++ b/addons/account/views/account_account_views.xml
@@ -54,7 +54,7 @@
<tree editable="top" create="1" delete="1" multi_edit="1" string="Chart of accounts">
<field name="code"/>
<field name="name"/>
- <field name="user_type_id"/>
+ <field name="user_type_id" widget="account_hierarchy_selection"/>
<field name="internal_type" invisible="1"/>
<field name="internal_group" invisible="1"/>
<field name="reconcile" widget="boolean_toggle" attrs="{'invisible': ['|', ('internal_type','=','liquidity'), ('internal_group', '=', 'off_balance')]}"/>
diff --git a/addons/account/views/account_chart_template_views.xml b/addons/account/views/account_chart_template_views.xml
index 1ec9e6ea945..db0c38a360f 100644
--- a/addons/account/views/account_chart_template_views.xml
+++ b/addons/account/views/account_chart_template_views.xml
@@ -105,7 +105,7 @@
<tree string="Account Template">
<field name="code"/>
<field name="name"/>
- <field name="user_type_id" invisible="1"/>
+ <field name="user_type_id" widget="account_hierarchy_selection" invisible="1"/>
</tree>
</field>
</record>
diff --git a/addons/account/wizard/setup_wizards_view.xml b/addons/account/wizard/setup_wizards_view.xml
index f6af2ceb31b..d5158f84df1 100644
--- a/addons/account/wizard/setup_wizards_view.xml
+++ b/addons/account/wizard/setup_wizards_view.xml
@@ -78,7 +78,7 @@
<field name="code"/>
<field name="name"/>
<field name="company_id" invisible="1"/>
- <field name="user_type_id"/>
+ <field name="user_type_id" widget="account_hierarchy_selection"/>
<field name="reconcile" widget="boolean_toggle"/>
<field name="opening_debit"/>
<field name="opening_credit"/>