Search code examples
odooodoo-15

How inherit web.sign_name_and_signature in odoo V15


I'm trying to inherit the signature module modal dialog to remove drawing and automatic options.

But I can't do that because the model is deleted after loading in the web module.

Loading the file by Odoo


Solution

  • The sign_name_and_signature widget will load the xmlDependencies files in its willStart method, so the template will be ready when the rendering is performed.

    The template will be loaded just after initializing the widget, you can't use the template inheritance mechanism to alter the template but you can define a new template and inherit the NameAndSignature widget and change the XML dependencies to the new template file path

    Example:

    /** @odoo-module alias=MODULE_NAME.signature_dialog **/
    
    import { NameAndSignature } from 'web.name_and_signature';
    
    NameAndSignature.include({
        template: 'MODULE_NAME.sign_name_and_signature',
        xmlDependencies: ['/MODULE_NAME/static/src/xml/sign_name_and_signature.xml'],
    });
    

    Note that the JS code may be changed depending on the template code