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
import xmlrpclib | |
from openerp.exceptions import except_orm | |
url = "http://localhost:8009" | |
db = "your_db_name" | |
user = "abc@gmail.com" | |
pwd = "1234" | |
url = 'http://localhost:8069' or '' | |
try: |
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
self.env.cr.execute(""" CREATE TABLE IF NOT EXISTS your_table( | |
count decimal, mean decimal, std decimal, min decimal, twentyfive decimal, | |
fifty decimal, seventyfive decimal, max decimal, cv decimal, | |
uid integer, report_type text,name text)""") | |
self.env.cr.commit() | |
csv_file= open(filepath,"r") | |
columns=['count','mean','std','min','twentyfive','fifty','seventyfive','max','cv','uid','report_type','name'] | |
self.env.cr.copy_from(csv_file, 'your_table', sep='|', columns=columns) | |
self.env.cr.commit() |
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
from openerp.tools import config | |
config = tools.config | |
dir = config['data_dir'] |
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
from openerp.tools import config | |
config = tools.config | |
dir = config['addons_path'] |
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
[options] | |
; This is the password that allows database operations: | |
; admin_passwd = admin | |
db_host = False | |
db_port = 5434 | |
db_user = openpg | |
db_password = 123 | |
dbfilter = .* | |
addons_path = D:\odoo-8.0-20171001\openerp\addons,D:\odoo-8.0-20171001\openerp\your_custom_addons | |
log_handler = [':INFO'] |
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="server_action_any_name" model="ir.actions.server"> | |
<field name="name">Any Name Goes Here</field> | |
<field name="condition">True</field> | |
<field name="type">ir.actions.server</field> | |
<field name="model_id" ref="model_your_model_name" /> | |
<field name="state">code</field> | |
<field name="code">action=self.get_filtered_record(cr, uid, context.get('active_ids', []), context=context)</field> | |
</record> | |
<menuitem name="Your Menu Name" id="menu_any_name" action="server_action_any_name"/> |
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
@api.multi | |
def get_filtered_record(self): | |
if self._context.get('params', False): | |
params = self._context.get('params', False) | |
if params.get('menu_id', False): | |
raise ValidationError( | |
"Attention:You are not allowed to access this page due to Security Policy. In case of any query, please contact ERP Admin or Configuration Manager.") | |
else: | |
return False | |
view_id_form = self.env['ir.ui.view'].search([('name', '=', 'your.form.view.name')]) |
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 model="ir.ui.view" id="view_any_name_form"> | |
<field name="name">any.name.form</field> | |
<field name="model">your.model</field> | |
<field name="groups_id"></field> | |
<field name="type">form</field> | |
<field name="arch" type="xml"> | |
<form string="My Form"> | |
<sheet> | |
<group> | |
<field name="field_1"/> |
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 model="ir.actions.act_window" id="action_any_name_goes_here"> | |
<field name="name">My Action</field> | |
<field name="res_model">your.model</field> | |
<field name="view_type">form</field> | |
<field name="view_mode">form</field> | |
<field name="target">new</field> | |
</record> |
OlderNewer