Hello All,
I am new to Odoo and learning it. I have developed a simple module to create Student details and show these using different view like as Form view and tree view. Now suppose that when user is creating new student record, I want to apply some validation on click of Submit button like as student name should not contain any number and show warning message in case it fails. then how can I do that .
File : /my_module/__openerp__.py
{
'name' : 'My Module',
.....
# Other Code
'depends': ['base','web'],
'data': [
'views/assets.xml',
....
],
# Code XYZ
.....
}
I already inherited the CSS and JS code like this :-
File : /my_module/views/assets.xml
<template id="assets_backend" name="my_module assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<link rel="stylesheet" href="/my_module/static/src/css/main.css"/>
<script type="text/javascript" src="/my_module/static/src/js/main.js"></script>
</xpath>
</template>
File : /my_module/static/src/js/main.js
console.log("Welcome to my_module");
openerp.my_module = function(instance, local)
{
console.log("Another Message ");
};
Problem :-
I want to execute JS code when user is working on my_module only and if possible then it should be for specified view only
I want to apply CSS for my module view only
How to identify the module name using JS code. For example On which module user is currently working on .
Whats Happening:-
JS code is being executed once Odoo loads my_module
CSS is applied on every page , even on Odoo defined pages like as Settings also
Extra Information :-
I am using Odoo based view only like as Form View , Tree View so I don't know that how to insert HTML based tags and create ID , Classes on that.
It will be very helpful if you will suggest some way on it and about the control flow of Odoo module .