This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestClass(http.Controller): | |
@http.route('/test/', type='http', auth='public') | |
def test_function(self, redirect=None, **kw): | |
if request.httprequest.method == 'POST': | |
return request.render('module_name.my_custom_form', { | |
'error': 'error message goes here', | |
'data': data, | |
}) | |
# To resolve this issue modify above controller with below one |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class InheritedHome(Home): | |
@http.route() | |
def web_login(self, redirect=None, **kw): | |
if 'login' in kw: | |
#your_logic_goes_here() | |
return super(Extension_Home, self).web_login() | |
class MyCustomClass(http.Controller): | |
@http.route('/test/', type='http', auth='public', website=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class your_model(models.Model): | |
_name = 'your.model' | |
application_no = fields.Char('Application No.', default='/') | |
# on create method | |
@api.model | |
def create(self, vals): | |
obj = super(your_model, self).create(vals) | |
if obj.application_no == '/': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript"> | |
function disableselect(e){ | |
return false | |
} | |
function reEnable(){ | |
return true | |
} | |
//if IE4+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- 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") |