From dca2dd055099e914a0e1c627d4bdeffe92f2b12e Mon Sep 17 00:00:00 2001 From: Ethan Vincent Date: Fri, 2 Feb 2024 12:35:29 +0100 Subject: [PATCH] [FIX] website_crm_partner_assign: require fields **Current behavior:** Trying to create an opportunity as a portal user and leaving any of the fields empty will cause an unnecessary exception dialog to flash on screen. **Expected behavior:** Submitting the form with empty required fields will just prompt the user to add values to all fields. **Steps to reproduce:** 1. In the Contacts application, go to a portal user and in the Partner Assignment notebook tab, give them a partner level 2. In the CRM app, create a new lead and assign the portal user who was granted the partner level as the customer 3. Login as the portal user, and convert the lead in My Leads to an opportunity 4. Go to the my/opportunities website menu 3. Select 'Create Opportunity' in the top right and leave any/all of the fields empty then select 'Confirm' **Cause of the issue:** The catch block in the _buttonExec() function is rejecting its Promise when it catches anything aside from an RPCError. **Fix:** Only reject the Promise when the catch block encounters an actual Error, preventing dialog window popups when non-critical exceptions (non-Errors) are thrown. opw-3703238 closes odoo/odoo#151982 Signed-off-by: Thibault Delavallee (tde) --- .../static/src/js/crm_partner_assign.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js b/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js index 12d7e13d19a..33e904a4aff 100644 --- a/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js +++ b/addons/website_crm_partner_assign/static/src/js/crm_partner_assign.js @@ -3,7 +3,6 @@ import { _t } from "@web/core/l10n/translation"; import publicWidget from "@web/legacy/js/public/public_widget"; import { parseDate, formatDate, serializeDate } from "@web/core/l10n/dates"; -import { RPCError } from "@web/core/network/rpc_service"; const { DateTime } = luxon; publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({ @@ -40,7 +39,7 @@ publicWidget.registry.crmPartnerAssign = publicWidget.Widget.extend({ $btn.prop('disabled', true); return callback.call(this).catch(function (e) { $btn.prop('disabled', false); - if (!(e instanceof RPCError)) { + if (e instanceof Error) { return Promise.reject(e); } });