From a767c6491ff301d00454efe487462d7b606eff8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E5=B0=A7?= Date: Tue, 20 Aug 2024 14:05:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=A7=BB=E9=99=A4=E7=84=A6?= =?UTF-8?q?=E7=82=B9=E7=9A=84controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sf_base/__manifest__.py | 1 + sf_base/static/src/js/remove_focus.js | 23 +++++++++++++++++++ .../wizard/workpiece_delivery_views.xml | 7 +----- 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 sf_base/static/src/js/remove_focus.js diff --git a/sf_base/__manifest__.py b/sf_base/__manifest__.py index ceedcdd0..b10c2630 100644 --- a/sf_base/__manifest__.py +++ b/sf_base/__manifest__.py @@ -35,6 +35,7 @@ ], 'web.assets_backend': [ 'sf_base/static/src/scss/*.scss', + 'sf_base/static/src/js/*.js', ], }, diff --git a/sf_base/static/src/js/remove_focus.js b/sf_base/static/src/js/remove_focus.js new file mode 100644 index 00000000..3e4cbb22 --- /dev/null +++ b/sf_base/static/src/js/remove_focus.js @@ -0,0 +1,23 @@ +/** @odoo-module **/ + +import { registry } from '@web/core/registry'; + +import { formView } from '@web/views/form/form_view'; +import { FormController } from '@web/views/form/form_controller'; + +import { onRendered, onMounted } from "@odoo/owl"; + +export class RemoveFocusController extends FormController { + setup() { + super.setup(); + + onMounted(() => { + this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur()); + }) + } +} + +registry.category('views').add('remove_focus_view', { + ...formView, + Controller: RemoveFocusController, +}); \ No newline at end of file diff --git a/sf_manufacturing/wizard/workpiece_delivery_views.xml b/sf_manufacturing/wizard/workpiece_delivery_views.xml index a4723b6b..676fa6b2 100644 --- a/sf_manufacturing/wizard/workpiece_delivery_views.xml +++ b/sf_manufacturing/wizard/workpiece_delivery_views.xml @@ -4,7 +4,7 @@ sf.workpiece.delivery.wizard.form.view sf.workpiece.delivery.wizard -
+ @@ -21,11 +21,6 @@