<t t-extend="template_name">
<t t-jquery="[div,span,button,etc].class_name" t-operation="[replace,after,before]">
<-- your code -->
</t>
</t>
for example :
<t t-extend="website_sale.products_item">
<t t-jquery="div.product_price" t-operation="replace">
<-- your code -->
</t>
</t>
Showing posts with label js. Show all posts
Showing posts with label js. Show all posts
Wednesday, 17 June 2020
Odoo10 - How to inherit t-if tag and extend it template.
Labels:
#docker,
#error,
#odoo,
#odoo11,
#odoo12,
#openerp,
#ubuntu,
erp,
Jquery in odoo,
js,
many2many,
map view,
model,
Odoo,
OpenERP,
OpenERP v8
Friday, 3 August 2018
Change to port 80 instead of 8069 | Odoo
Odoo is very well known ERP system today. Odoo 9 provides great features that will help to grow business. By default odoo runs over port 8069. So we are accessing server using domain:8069. What if we need to access server using only domain like a standard website? We can do it by configuring web server with odoo. Here I am going to show you configuration of Apache web server and Nginx for odoo.
Using Nginx:
sudo apt-get install -y nginx
- cd /etc/nginx/sites-available
- sudo nano local.conf
server {
listen 80 default_server;
server_name .local;
#server_name balbina.com;
# log files
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600s;
client_max_body_size 100m;
location /longpolling
{
proxy_pass http://127.0.0.1:8072;
}
location / {
proxy_pass http://127.0.0.1:8069;
}
}
- sudo service nginx restart
Configure Apache Web Server with Odoo:
Before configuring apache with odoo, first check whether apache web server is installed on your machine or not. If not installed then execute below command to installed it.
sudo apt-get update
sudo apt-get install apache2
After installing apache on your machine, you need to enable some modes by executing below commands.
sudo a2enmod proxy proxy_http
Now go to the directory, “/etc/apache2/sites-available” and create a file with <domain-name>.conf. Here I am going to use “demo.surekhatech.com” domain for my odoo server. So the file name will be “demo.surekhatech.conf”. Add the below content into this file.
<VirtualHost *:80>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
LogLevel warn
ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined
ProxyPass / http://localhost:8069/
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
LogLevel warn
ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined
ProxyPass / http://localhost:8069/
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
After adding the virtual host for odoo server, you need to enable site using the following command.
sudo a2ensite demo.surekhatech.conf
A message will appear showing that site is enabled. After that you need to restart the apache server by executing below command.
sudo service apache2 restart
Make the host file entry in case you have made the configuration on the local machine. Open the “hosts” file by executing below command:
sudo nano /etc/hosts
Add the following entry into this file.
127.0.0.1 demo.surekhatech.com
After completing with above configuration, you can access the odoo server by hitting the “demo.surekhatech.com” in any browser. You can see that the odoo server is running over the “http”. But what if we need to run our odoo server over more secure channel i.e. “https”.
For that you need SSL certificate and key. You can buy the certificate from any trusted vendor. You can also generate certificates and used it. Certificate can be generated using the openssl toolkit. For linux machine you can generate certificate by using the following commands.
To generate key:
openssl genrsa -out demo.surekhatech.com.key 2048
To generate Certificate:
openssl req -new -x509 -key demo.surekhatech.com.key -out demo.surekhatech.com.cert -days 3650
-subj /CN=demo.surekhatech.com
Once you have SSL key and certificate, you need to update the existing virtual host to run odoo server over “https”. Before that first enable the apache SSL mode by executing below command.
sudo a2enmod ssl
Now open “demo.surekhatech.conf” file from the “/etc/apache2/sites-available” and update the virtual host with the below contents.
<VirtualHost *:80>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
Redirect / https://demo.surekhatech.com/
</VirtualHost>
<VirtualHost *:443>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
LogLevel warn
ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/apache2/ssl/demo.surekhatech.com.cert
SSLCertificateKeyFile /etc/apache2/ssl/demo.surekhatech.com.key
ProxyPreserveHost On
ProxyPass / http://localhost:8069/ retry=0
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
Redirect / https://demo.surekhatech.com/
</VirtualHost>
<VirtualHost *:443>
ServerName demo.surekhatech.com
ServerAlias demo.surekhatech.com
LogLevel warn
ErrorLog /var/log/apache2/demo.surekhatech.com.error.log
CustomLog /var/log/apache2/demo.surekhatech.com.access.log combined
SSLEngine on
SSLProxyEngine on
SSLCertificateFile /etc/apache2/ssl/demo.surekhatech.com.cert
SSLCertificateKeyFile /etc/apache2/ssl/demo.surekhatech.com.key
ProxyPreserveHost On
ProxyPass / http://localhost:8069/ retry=0
ProxyPassReverse / http://localhost:8069/
</VirtualHost>
Here we have added the path for the SSL certificate and key file. Create a directory with “ssl” name on “/etc/apache2” location. Copy the SSL certificate and key files into “/etc/apache2/ssl” directory.
Now restart the apache web server using the following command.
sudo service apache2 restart
Open any browser and hit the url “demo.surekhatech.com”. You can see that it will automatically redirect your odoo server over “https”, a more secure channel. Any request to your odoo server will be serve over the “https”.
Thursday, 13 April 2017
How to inherit js file in odoo ?
First, you define a template in your module to add your js assets located in static/src/js:
<template id="assets_backend" name="newmodulename assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/newmodulename/static/src/js/custom.js"></script>
</xpath>
</template>
Then, in your module's new js file, you extend the widget from default module like this:
odoo.define('newmodulename.newmodulename', function (require){
"use strict";
// require original module JS
var instance = openerp;
// Extend widget
instance.web.form.One2ManyListView.include({
....
your code to override here
....
});
}
Tuesday, 7 March 2017
How to call a wizard from js in odoo ?
this.do_action({
type: 'ir.actions.act_window',
res_model: 'Model name',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
context:{}
});
type: 'ir.actions.act_window',
res_model: 'Model name',
view_mode: 'form',
view_type: 'form',
views: [[false, 'form']],
target: 'new',
context:{}
});
Thursday, 2 March 2017
Tuesday, 21 February 2017
How to Make Custom Keyboard shortcuts for odoo ?
Here, i will show you some example to get custom shortcuts works in odoo. you can also override default shortcuts in odoo. as you can see for that we have to create one js file in out module. the path of the file is module / static / src / js / file_js.js
and put the below code into file .
//Edit the current object F2
with this user can save the record with F2 button.
so as simple way we can also create record, delete record, make tree view to unlimited , remove the filter , open calendar and so many things using key board key.
and put the below code into file .
$.shortcut = function(key, callback, args) {$(document).keydown(function(e) {if(!args) args=[]; // IE barks when args is nullconsole.log(e.keyCode)if((e.keyCode == key.charCodeAt(0) || e.keyCode == key)) {callback.apply(this, args);return false;}});};
//Edit the current object F2
$.shortcut('113', function() {$('.oe_form_button_edit').each(function() {if($(this).parents('div:hidden').length == 0){$(this).trigger('click');}});});
with this user can save the record with F2 button.
so as simple way we can also create record, delete record, make tree view to unlimited , remove the filter , open calendar and so many things using key board key.
Thursday, 24 September 2015
How to add a custom css? | Odoo
What is the best way to
add custom css to openerp 7 without modifying any original file of openerp?
Just create a module and add your css file in __openerp__.py as below.
# __openerp__.py
{
'name': "CSS
Example", 'description': "new css
example", 'category': 'Generic
Modules/Others', 'depends':
['web'], 'data': [], 'css':
['static/src/css/my_css.css'],
}
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
<data>
<template
id="custom_assets_backend" name="custom assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="modulename/static/src/js/my_js.js"></script>
</xpath>
</template>
</data>
</openerp>
What is the best way to
add custom css to openerp 7 without modifying any original file of openerp?
Just create a module and add your css file in __openerp__.py as below.
# __openerp__.py
{
'name': "CSS
Example", 'description': "new css
example", 'category': 'Generic
Modules/Others', 'depends':
['web'], 'data': [], 'css':
['static/src/css/my_css.css'],
}
<?xml version="1.0" encoding="utf-8"?>
<!-- vim:fdn=3:
-->
<openerp>
<data>
<template
id="custom_assets_backend" name="custom assets"
inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript"
src="modulename/static/src/js/my_js.js"></script>
</xpath>
</template>
</data>
</openerp>
What is the best way to add custom css and js to odoo ?
Just create a module and add your css file and js file in
views/custom_view.xml as below.
<link rel="stylesheet" href="modulename/static/src/css/my_css.css"/>
What is the best way to add custom css and js to odoo ?
Just create a module and add your css file and js file in views/custom_view.xml as below.
<link rel="stylesheet" href="modulename/static/src/css/my_css.css"/>
Labels:
css,
custom,
erp,
js,
JScript for odoo,
Odoo,
odoo 8,
odoo 9,
open source,
OpenERP
Subscribe to:
Posts (Atom)