优化现有代码问题

This commit is contained in:
mgw
2023-11-22 09:54:31 +08:00
parent 423d5cec8e
commit d6dcb6bf55
8 changed files with 14 additions and 13 deletions

View File

@@ -11,7 +11,7 @@ var Dialog = require('web.Dialog');
patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', { patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
// 你可以重写或者添加一些方法和属性 // 你可以重写或者添加一些方法和属性
async _onDiscardChanges() { async _onDiscardChanges() {
var self = this; // var self = this;
Dialog.confirm(this, _t("Are you sure you want to discard changes?"), { Dialog.confirm(this, _t("Are you sure you want to discard changes?"), {
title: _t("Discard Changes"), title: _t("Discard Changes"),
@@ -25,7 +25,8 @@ patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', {
// if (window.confirm("Are you sure you want to discard changes?")) { // if (window.confirm("Are you sure you want to discard changes?")) {
// await this.props.discard(); // await this.props.discard();
// } // }
const result = await this._confirmDiscardChange(); // const result = await this._confirmDiscardChange();
await this._confirmDiscardChange();
await this.props.discard(); await this.props.discard();
}, },

View File

@@ -10,7 +10,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
// The following code manipulates the DOM directly to avoid having to wait for a // The following code manipulates the DOM directly to avoid having to wait for a
// render + patch which would occur on the next frame and cause flickering. // render + patch which would occur on the next frame and cause flickering.
freezeColumnWidths() { freezeColumnWidths() {
console.log('ccccccccccccccccccccccccccc') // console.log('ccccccccccccccccccccccccccc')
if (!this.keepColumnWidths) { if (!this.keepColumnWidths) {
this.columnWidths = null; this.columnWidths = null;
} }

View File

@@ -1,4 +1,4 @@
# import cpca import cpca
import base64 import base64
import logging import logging
from datetime import datetime from datetime import datetime

View File

@@ -1,12 +1,12 @@
odoo.define('my_module.barcode_handler', function (require) { odoo.define('my_module.barcode_handler', function (require) {
"use strict"; "use strict";
var core = require('web.core'); // var core = require('web.core');
var registry = require('web.field_registry'); var registry = require('web.field_registry');
var session = require('web.session'); var session = require('web.session');
var FieldChar = require('web.basic_fields').FieldChar; var FieldChar = require('web.basic_fields').FieldChar;
var _t = core._t; // var _t = core._t;
var BarcodeHandlerField = FieldChar.extend({ var BarcodeHandlerField = FieldChar.extend({
init: function () { init: function () {

View File

@@ -56,7 +56,7 @@ export class BarcodeHandlerField extends Component {
// }); // });
await this.actionService.doAction(response.result); await this.actionService.doAction(response.result);
} else { } else {
console.error("Barcode not found or RPC call failed."); // console.error("Barcode not found or RPC call failed.");
} }
} }

View File

@@ -16,7 +16,7 @@ class CustomChar extends CharField {
onMounted() { onMounted() {
super.onMounted(); super.onMounted();
console.log('CustomChar.onMounted1'); // console.log('CustomChar.onMounted1');
// 当光标聚焦于输入框时,选中输入框内容 // 当光标聚焦于输入框时,选中输入框内容
this.input.el.addEventListener('focus', function () { this.input.el.addEventListener('focus', function () {
this.select(); this.select();

View File

@@ -14,11 +14,11 @@ class CustomMany2One extends Many2OneField {
* @returns {Promise} * @returns {Promise}
*/ */
setup() { setup() {
console.log('CustomMany2One.setup11111111111111'); // console.log('CustomMany2One.setup11111111111111');
super.setup(); super.setup();
} }
onMounted() { onMounted() {
console.log('CustomMany2One.onMounted1'); // console.log('CustomMany2One.onMounted1');
// 当光标聚焦于输入框时,选中输入框内容 // 当光标聚焦于输入框时,选中输入框内容
this.input.el.addEventListener('focus', function () { this.input.el.addEventListener('focus', function () {
this.select(); this.select();

View File

@@ -5,10 +5,10 @@ import {_lt} from "@web/core/l10n/translation";
import {standardFieldProps} from "@web/views/fields/standard_field_props"; import {standardFieldProps} from "@web/views/fields/standard_field_props";
import {session} from "@web/session"; import {session} from "@web/session";
import core from 'web.core'; // import core from 'web.core';
var QWeb = core.qweb; // var QWeb = core.qweb;
import {Component} from "@odoo/owl"; import {Component} from "@odoo/owl";
@@ -43,7 +43,7 @@ export class StepViewer extends Component {
} }
} else { } else {
var oImg = document.getElementsByClassName('test')[0] var oImg = document.getElementsByClassName('test')[0]
console.log(oImg) // console.log(oImg)
} }
} }
} }