Skip to content

Instantly share code, notes, and snippets.

@sehrishnaz
sehrishnaz / create_custom_report_using_qweb_odoo.xml
Created August 17, 2020 13:09
Creating custom reports using qweb in Odoo
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<!-- Add the report to the XML file responsible for reports -->
<report id="report_unique_xml_id"
model="your.model.name"
string="Report Name"
name="module_name.report_name"
file="module_name.report_unique_xml_id"
@sehrishnaz
sehrishnaz / hide_breadcrumb_in_odoo_using_javascript.js
Created August 27, 2020 11:35
Hide or Disable Breadcrumb in Odoo us JavaScript
(function() {
var instance = openerp;
t = instance.web._t;
instance.web.ActionManager.include({
get_title: function() {
var titles = [];
if (this.breadcrumbs.length > 1){
console.log('->'+this.breadcrumbs.length)
var result_model = this.breadcrumbs[0].action['res_model']
if (result_model != 'your.model.goes.here'){
@sehrishnaz
sehrishnaz / countdown_timer_widget_odoo.js
Created August 28, 2020 11:21
Time Counter Widget in Odoo | Custom Widget in Odoo
openerp.my_custom_module = function (instance){
instance.web.form.MyCustomWidget = instance.web.form.AbstractField.extend(instance.web.form.ReinitializeFieldMixin,
{
init: function(field_manager, node) {
this._super.apply(this, arguments);
},
start: function() {
var self = this;
this._super.apply(this, arguments);
@sehrishnaz
sehrishnaz / disable_right_click_text_selection.js
Created September 4, 2020 09:45
Disable Right Click and Text Selection in Blogger | WordPress
<script type="text/javascript">
function disableselect(e){
return false
}
function reEnable(){
return true
}
//if IE4+
@sehrishnaz
sehrishnaz / create_model_in_odoo13.py
Created September 9, 2020 07:38
Create New Model in Odoo13
# -*- coding: utf-8 -*-
from odoo import models, fields, api
class ModelA(models.Model):
_name = 'model.a'
name = fields.Char(string="Name")
age = fields.Integer(string="Age")
@sehrishnaz
sehrishnaz / create_menuitem_odoo13.xml
Created September 10, 2020 06:59
Create Window Action and Menuitem in Odoo13
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<menuitem name="Main Menu" id="menu_main" sequence="1" />
<menuitem id="menu_sub_main" parent="menu_main" name="Sub Menu" sequence="1" />
<menuitem id="menu_sub_one_main" parent="menu_main" name="Sub Menu 1" sequence="2" />
<menuitem id="menu_sub_two_main" parent="menu_main" name="Sub Menu 2" sequence="3" />
<menuitem id="menu_lo_student_info" action="action_lo_student_info" parent="menu_sub_main" name="Student Info" sequence="1" />
@sehrishnaz
sehrishnaz / create_window_action_odoo13.xml
Created September 10, 2020 06:56
Create Window Action and Menuitem in Odoo13
<odoo>
<data>
<record model="ir.actions.act_window" id="action_lo_student_info">
<field name="name">Student Info</field>
<field name="res_model">lo.student.info</field>
<field name="view_mode">tree,form</field>
<!--<field name="view_ids" eval="[(5, 0, 0),(0, 0, {'view_mode': 'tree', 'view_id': ref('view_test_model_tree')}),(0, 0, {'view_mode': 'form', 'view_id': ref('view_test_model_form')})]"/>-->
<!--<field name="context">{}</field>-->
<!--<field name="domain">[()]</field>-->
<!--<field name="target">new</field>-->
@sehrishnaz
sehrishnaz / create_form_tree_view_odoo13.xml
Created September 10, 2020 10:11
How to Create Form and Tree View in Odoo13
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<record model="ir.ui.view" id="view_lo_student_info_form">
<field name="name">lo.student.info.form</field>
<field name="model">lo.student.info</field>
<field name="type">form</field>
<field name="arch" type="xml">
@sehrishnaz
sehrishnaz / create_sequence_number_in_odoo.xml
Created August 13, 2020 06:22
Generate Sequence Numbesr in Odoo | What is Sequence Number in Odoo
<record id="unique_sequence_id" model="ir.sequence">
<field name="name">Sequence Name Goes Here</field>
<field name="code">your.sequence.code</field>
<field name="active">TRUE</field>
<field name="prefix">OR</field>
<field name="padding">5</field>
<field name="number_next">1</field>
<field name="number_increment">1</field>
</record>
@sehrishnaz
sehrishnaz / odoo_google_recaptcha_validation.py
Created November 18, 2020 10:07
Implement Google reCAPTCHA Validation using Python in Odoo
# -*- coding: utf-8 -*-
from openerp import http
from openerp.http import Controller, route, request
import json
import requests
class Google_Recaptcha(http.Controller):
@http.route('/google_recaptcha_in_odoo/', type='http', auth='public', website=True)
def google_recaptcha(self, redirect=None, **kw):