From 8ff33b212d96a4f5a1abf440d7904f65eff8ee23 Mon Sep 17 00:00:00 2001 From: "Maximilien (malb)" Date: Mon, 12 Feb 2024 08:51:39 +0000 Subject: [PATCH] [FIX] account: analytic widget UX On the analytic widget, when putting an Analytic Account, a floppy disk appear on top of the wizard. This button is used to create a new analytic distribution template. It is confusing for users that thinks that the purpose of the button is to save the analytic distribution. This PR will replace the button to be a link called "New model". Also, this pr will fill some field (partner_id, account_prefix and product_id) if there are populated. closes odoo/odoo#155611 Task: 3736786 X-original-commit: c44367a2f67f305052d28a3b9e313ad63ff46907 Signed-off-by: Habib Ayob (ayh) Signed-off-by: Maximilien La Barre (malb) --- .../analytic_distribution/analytic_distribution.js | 4 ++++ .../analytic_distribution/analytic_distribution.xml | 6 ++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js index fece91c7f64..1a7cb58cd71 100644 --- a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js +++ b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.js @@ -458,8 +458,12 @@ export class AnalyticDistribution extends Component { onSaveNew() { this.closeAnalyticEditor(); + const { record, product_field, account_field } = this.props; this.openTemplate({ resId: false, context: { 'default_analytic_distribution': this.dataToJson(), + 'default_partner_id': record.data['partner_id'] ? record.data['partner_id'][0] : undefined, + 'default_product_id': product_field ? record.data[product_field][0] : undefined, + 'default_account_prefix': account_field ? record.data[account_field][1].substr(0, 3) : undefined, }}); } diff --git a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.xml b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.xml index cabaaa203cc..7c9f4e61207 100644 --- a/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.xml +++ b/addons/analytic/static/src/components/analytic_distribution/analytic_distribution.xml @@ -16,9 +16,11 @@