Trinh Ngoc Hung
Trinh Ngoc Hung

Reputation: 23

Odoo Qweb & javascript

I learn about Qweb and javascirpt in odoo through youtube channel and documnention, but it's too difficult, I can't understand how it works and the organizational structure and syntax. Is there any way you can help me?

Upvotes: 0

Views: 1435

Answers (1)

Ahrimann Steiner
Ahrimann Steiner

Reputation: 1314

Introduction to javascript in odoo : https://www.youtube.com/watch?v=VuUMvzycXQY

Example of use in your module : my_module_custom

  • In my_module_custom/static/src/js/myclientscript.js :
odoo.define('my_module_custom.hidebadgepill', function(require)    
{
  "use strict";
  $(document).ready(function() {
  $(function() {
          
  //your js or jquery script , for instance :
  $('.o_web_index_topbar_filters').find('.badge-pill').hide();

  });
});
  • in my_module_custom/views/assets_frontend.xml :
<?xml version="1.0" encoding="utf-8"?>
<odoo>
  <template id="assets_frontend"    
  inherit_id="website.assets_frontend" name="Date Check">
     <xpath expr="." position="inside">
  
    <script type="text/javascript" src="/my_module_custom    
      /static/src/js/myclientscript.js"/>
    
   </xpath>
  </template> 
 </odoo>
  • in my_module_custom/_manifest.py :
##-*- coding: utf-8 -*-
      
{

  'name': 'my module custom name',
  'version': '13.0.2.0.147',
  
   ...
  
  'data': [
  'views/assets_frontend.xml',
   ...

Upvotes: 2

Related Questions