跳至內容
選單
此問題已被標幟
1 回覆
5841 瀏覽次數

Need to override the base function

頭像
捨棄
作者 最佳答案

Here is the syntax for inheritance of js in odoo15

odoo.define("js_demo.DemoJs",function(require){ // odoo.define("ModuleName.FileName/DesiredName",function(require)
"use.strict";

const PosComponent = require('point_of_sale.PosComponent');
const { _t } = require('web.core');
const { getDataURLFromFile } = require('web.utils');
const Registries = require("point_of_sale.Registries");
var ClientDetailsEdit = require("point_of_sale.ClientDetailsEdit"); //var VaraibleName1 = require("InheritModuleName.InheritClassName");
// VaraibleName1 same as InheritClassName

var ClientDetailsEditInherit = (ClientDetailsEdit) => //var VaraibleName2 = (VaraibleName1) =>Arrow function
class extends ClientDetailsEdit { //class extends InheritClassName
savesChanges() { //BaseFunctionToInherit()
let processedChanges = {};
for (let [key, value] of Object.entries(this.changes)) {
if (this.intFields.includes(key)) {
processedChanges[key] = parseInt(value) || false;
} else {
processedChanges[key] = value;
}
}
if ((!this.props.partner.name && !processedChanges.name) ||
processedChanges.name === '' ){
return this.showPopup('ErrorPopup', {
title: _t(' Name Is Required'),
});
}
processedChanges.id = this.props.partner.id || false;
this.trigger('save-changes', { processedChanges });

}

};

Registries.Component.extend(ClientDetailsEdit,ClientDetailsEditInherit); //Registries.Component.extend(VaraibleName1,VaraibleName2)
return ClientDetailsEdit; //return VaraibleName1;
});

頭像
捨棄
相關帖文 回覆 瀏覽次數 活動
1
3月 25
3683
2
4月 23
3805
0
2月 23
1899
1
3月 22
1740
3
2月 25
12244