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:
- CRM
- e-Commerce
- Kế toán
- Tồn kho
- PoS
- Project
- MRP
Câu hỏi này đã bị gắn cờ
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
Bạn có hứng thú với cuộc thảo luận không? Đừng chỉ đọc, hãy tham gia nhé!
Tạo tài khoản ngay hôm nay để tận hưởng các tính năng độc đáo và tham gia cộng đồng tuyệt vời của chúng tôi!
Đăng kýBài viết liên quan | Trả lời | Lượt xem | Hoạt động | |
---|---|---|---|---|
|
2
thg 7 25
|
4044 | ||
How to inherit web controllers
Đã xử lý
|
|
1
thg 5 24
|
4361 | |
|
0
thg 10 24
|
1042 | ||
How to connect button with function?
Đã xử lý
|
|
3
thg 12 23
|
19790 | |
|
2
thg 3 15
|
4294 |