去掉多余的js文件
This commit is contained in:
@@ -1,62 +0,0 @@
|
|||||||
/** @odoo-module **/
|
|
||||||
|
|
||||||
import { registry } from "@web/core/registry";
|
|
||||||
import { barcodeGenericHandlers } from '@barcodes/barcode_handlers';
|
|
||||||
import { patch } from "@web/core/utils/patch";
|
|
||||||
|
|
||||||
// 定义新的 clickOnButton 函数
|
|
||||||
function customClickOnButton(selector) {
|
|
||||||
console.log("This is the custom clickOnButton function!");
|
|
||||||
|
|
||||||
const buttons = document.body.querySelectorAll(selector);
|
|
||||||
|
|
||||||
let length = buttons.length;
|
|
||||||
if (length > 0) {
|
|
||||||
buttons[length - 1].click();
|
|
||||||
} else {
|
|
||||||
console.warn(`Button with selector ${selector} not found`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
patch(barcodeGenericHandlers, "start", {
|
|
||||||
start(env, { ui, barcode, notification }) {
|
|
||||||
// 使用新定义的 clickOnButton 函数
|
|
||||||
const COMMANDS = {
|
|
||||||
"O-CMD.EDIT": () => customClickOnButton(".o_form_button_edit"),
|
|
||||||
"O-CMD.DISCARD": () => customClickOnButton(".o_form_button_cancel"),
|
|
||||||
"O-CMD.SAVE": () => customClickOnButton(".o_form_button_save"),
|
|
||||||
"O-CMD.PREV": () => customClickOnButton(".o_pager_previous"),
|
|
||||||
"O-CMD.NEXT": () => customClickOnButton(".o_pager_next"),
|
|
||||||
"O-CMD.PAGER-FIRST": () => updatePager("first"),
|
|
||||||
"O-CMD.PAGER-LAST": () => updatePager("last"),
|
|
||||||
"O-CMD.CONFIRM": () => customClickOnButton(".jikimo_button_confirm"),
|
|
||||||
"O-CMD.FLUSHED": () => customClickOnButton(".jikimo_button_flushed"),
|
|
||||||
};
|
|
||||||
|
|
||||||
barcode.bus.addEventListener("barcode_scanned", (ev) => {
|
|
||||||
const barcode = ev.detail.barcode;
|
|
||||||
if (barcode.startsWith("O-BTN.")) {
|
|
||||||
let targets = [];
|
|
||||||
try {
|
|
||||||
targets = getVisibleElements(ui.activeElement, `[barcode_trigger=${barcode.slice(6)}]`);
|
|
||||||
} catch (_e) {
|
|
||||||
console.warn(`Barcode '${barcode}' is not valid`);
|
|
||||||
}
|
|
||||||
for (let elem of targets) {
|
|
||||||
elem.click();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (barcode.startsWith("O-CMD.")) {
|
|
||||||
const fn = COMMANDS[barcode];
|
|
||||||
if (fn) {
|
|
||||||
fn();
|
|
||||||
} else {
|
|
||||||
notification.add(env._t("Barcode: ") + `'${barcode}'`, {
|
|
||||||
title: env._t("Unknown barcode command"),
|
|
||||||
type: "danger"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
})
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
/** @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 { listView } from '@web/views/list/list_view';
|
|
||||||
import { ListController } from '@web/views/list/list_controller'
|
|
||||||
|
|
||||||
import { onRendered, onMounted } from "@odoo/owl";
|
|
||||||
|
|
||||||
export class RemoveFocusFormController extends FormController {
|
|
||||||
setup() {
|
|
||||||
super.setup();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registry.category('views').add('remove_focus_form_view', {
|
|
||||||
...formView,
|
|
||||||
Controller: RemoveFocusFormController,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
export class RemoveFocusListController extends ListController {
|
|
||||||
setup() {
|
|
||||||
super.setup();
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
this.__owl__.bdom.el.querySelectorAll(':focus').forEach(element => element.blur());
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
registry.category('views').add('remove_focus_list_view', {
|
|
||||||
...listView,
|
|
||||||
Controller: RemoveFocusListController,
|
|
||||||
});
|
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
'category': 'sf',
|
'category': 'sf',
|
||||||
'website': 'https://www.sf.jikimo.com',
|
'website': 'https://www.sf.jikimo.com',
|
||||||
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse', 'jikimo_attachment_viewer',
|
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse', 'jikimo_attachment_viewer',
|
||||||
'jikimo_sale_multiple_supply_methods', 'product'],
|
'jikimo_sale_multiple_supply_methods', 'product', 'jikimo_tree_header_buttons_always_visible'],
|
||||||
'data': [
|
'data': [
|
||||||
'data/cron_data.xml',
|
'data/cron_data.xml',
|
||||||
'data/stock_data.xml',
|
'data/stock_data.xml',
|
||||||
|
|||||||
Reference in New Issue
Block a user