Created
May 30, 2017 10:15
-
-
Save ilyasProgrammer/3320a187326f47383655058648e05cf1 to your computer and use it in GitHub Desktop.
Connect to Odoo 8 database using terminal
This file contains hidden or 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 openerp | |
ODOO_CONF = '/pd/tv_service/odoo.cfg' | |
UID = openerp.SUPERUSER_ID | |
openerp.tools.config.parse_config(['--config=%s' % ODOO_CONF]) | |
with openerp.api.Environment.manage(): | |
registry = openerp.modules.registry.RegistryManager.get('fl') | |
with registry.cursor() as cr: | |
ctx = openerp.api.Environment(cr, UID, {})['res.users'].context_get() | |
env = openerp.api.Environment(cr, UID, ctx) | |
emps = env['hr.employee'].search([('user_id', '=', 1)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment