Hi can anyone tell me how i can inherit the js document signable is there in
enterprise/sign/static/src/js/common/document_signable
becasuse I want to modify the function
registerCreatedSignItemEvents
with this
registerCreatedSignItemEvents = function ($signatureItem, type, isSignItemEditable) { if (type.name === _t("Date")) { $signatureItem.on("focus", (e) => this.fillTextSignItem( $(e.currentTarget), moment().format(time.getLangDateFormat()) ) ); } if (type.item_type === "signature" || type.item_type === "initial") { $signatureItem.on( "click", (e) => { // when signing for the first time in edit mode, clicking in .o_sign_item_display should cause the sign. // (because both edit and sign are possible) However if you want to change the signature after another // one is set, .o_sign_item_display is not there anymore. if ( this.isDialogOpen || isSignItemEditable && $(e.currentTarget).find('.o_sign_item_display').length && !$(e.target).hasClass('o_sign_item_display') ) { return; } this.handleSignatureDialogClick($(e.currentTarget), type) } ); } if (type.item_type === "sequential") { $signatureItem.on("focus", (e) => { $signatureItem.val('dsadasd') // getSequentialNumberForElementType(type.name) // .then(data => { // const numberFormatted = String(data.sequentialNumber).padStart(data.padding, '0'); // var sequentialNumberComplete // if (typeof data.prefix === 'string' && typeof data.suffix === 'string') { // sequentialNumberComplete = `${data.prefix}${numberFormatted}${data.suffix}`; // } // if (typeof data.prefix === 'string') { // sequentialNumberComplete = `${data.prefix}${numberFormatted}`; // } else if(typeof data.suffix === 'string') { // sequentialNumberComplete = `${numberFormatted}${data.suffix}`; // } // $signatureItem.val(sequentialNumberComplete); // }); }); }
if (type.auto_value && ['text', 'textarea'].includes(type.item_type)) { $signatureItem.on("focus", (e) => this.fillTextSignItem($signatureItem, type.auto_value) ); } if ( config.device.isMobile && ["text", "textarea"].includes(type.item_type) ) { const inputBottomSheet = new InputBottomSheet(this, { type: type.item_type, value: $signatureItem.val(), label: `${type.tip}: ${type.placeholder}`, placeholder: $signatureItem.attr("placeholder"), onTextChange: (value) => { $signatureItem.val(value); }, onValidate: (value) => { $signatureItem.val(value); $signatureItem.trigger("input"); inputBottomSheet.hide(); this.signatureItemNav.goToNextSignItem(); }, }); inputBottomSheet.appendTo(document.body); $signatureItem.on("focus", () => { inputBottomSheet.updateInputText($signatureItem.val()); inputBottomSheet.show(); }); } $signatureItem.on("input", (e) => { this.checkSignItemsCompletion(this.role); this.signatureItemNav.setTip(_t("next")); }); };
but i dont undestand how to inherit and access to that function
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- 客户关系管理
- e-Commerce
- 会计
- 库存
- PoS
- Project
- MRP
此问题已终结
Hi,
You can refer to the below steps.To inherit and override this function in Odoo 16 OWL, you can use the following steps:
Create a new module, for example, my_module.
In your new module, create a file static/src/js/my_module.js and put the following code in it:
import {formatFloat as originalFormatFloat} from 'web/static/src/views/fields/formatters.js';
export function formatFloat(value, options = {}) { //Your custom code is here // You can call the original function using originalFormatFloat() }
In your new module, create a file called views/assets.xml and put the following code in it:
Install your new module in Odoo.
This
will override the formatFloat function in your Odoo instance and use
your custom implementation instead. You can modify the code in the
my_module.js file to customize the behavior of the function as needed
Hope it helps
相关帖文 | 回复 | 查看 | 活动 | |
---|---|---|---|---|
|
2
10月 23
|
3600 | ||
|
1
5月 24
|
4003 | ||
|
0
10月 24
|
742 | ||
|
3
12月 23
|
19208 | ||
|
2
3月 15
|
3925 |