Wednesday, 27 March 2019

Linking Custom JS, CSS files in Odoo Custom Module

 Linking Custom JS, CSS files in Odoo Custom Module


Step 1: Create a Module: 

Create a App/Module  "cost_estimator"


Step 2: Create a .css file inside

cost_estimator -> static -> src -> css ->  select.css


 
Step 3: Create a .js file   
 
cost_estimator -> static -> src -> js ->  select.js




Step 4: Create a file "resources.xml"

inside the folder

cost_estimator -> views ->  resources.xml



<?xml version="1.0" encoding="UTF-8"?><odoo>    <data>        <template id="assets_backend" name="cost_estimator_assets" inherit_id="web.assets_backend">            <xpath expr="." position="inside">                <!-- All Links to CSS and JS files are added here -->                <link rel="stylesheet" href="/cost_estimator/static/src/css/select.css"/>                <script type="text/javascript" src="/cost_estimator/static/src/js/select.js"/>            </xpath>        </template>    </data></odoo>



Step 5: Update the details in  manifest

All the file details and locations should be updated in manifest 







No comments:

Post a Comment