v 12.0 Third Party 19
Download for v 12.0 Deploy on Odoo.sh
Availability
Odoo Online
Odoo.sh
On Premise
Lines of code 299
Technical Name odoo_service_hook
LicenseLGPL-3
Websitehttps://github.com/utherpally/odoo_service_hook
You bought this module and need support? Click here!

Usage

Example add a new method in web.utils service

     // File: extra_utils.js
     odoo.post_define('web.utils', function(utils, require) {
             return _.extend(utils,{
                     pow: function(x) {
                             return x * x;
                     }
             })
     });

     /**
* Add priority to change run order when hook same service.
* (default priority: 13)
*
     **/
     odoo.post_define('web.utils', 15, function(utils, require) {

             var awesome = require('awesome_other_service'); // Add another service as dependency

             return _.extend(utils,{
                     // Override
                     pow: function(x) {
                             return awesome.pow(x);
                     },
                     // Add new
                     sin: function(x) {
                             return awesome.sin(x);
                     }
             })

     });

     /* File: views/assets.xml */

     <template id="hook_assets_common" inherit_id="odoo_service_hook.hook_assets_common">
             <xpath expr="." position="inside">
                     <script type="text/javascript" src="/your_module/static/src/js/extra_utils.js"></script>
             </xpath>
     </template>

     /* Also support: hook_assets_backend, hook_assets_frontend */

It will apply automatically:

odoo.define('using.web.utils', function(require){

    var utils = require('web.utils');
  // No extra require to ensure your hook run completed.

  var x = utils.pow(5);
  var y = utils.sin(1.5);

})

Please log in to comment on this module

  • The author can leave a single reply to each comment.
  • This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
  • If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.
Please choose a rating from 1 to 5 for this module.