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
- Księgowość
- Zapasy
- PoS
- Project
- MRP
To pytanie dostało ostrzeżenie
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
Podoba Ci się ta dyskusja? Dołącz do niej!
Stwórz konto dzisiaj, aby cieszyć się ekskluzywnymi funkcjami i wchodzić w interakcje z naszą wspaniałą społecznością!
Zarejestruj sięPowiązane posty | Odpowiedzi | Widoki | Czynność | |
---|---|---|---|---|
|
2
paź 23
|
3608 | ||
How to inherit web controllers
Rozwiązane
|
|
1
maj 24
|
4010 | |
|
0
paź 24
|
747 | ||
How to connect button with function?
Rozwiązane
|
|
3
gru 23
|
19250 | |
|
2
mar 15
|
3928 |