Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
1 Ответить
4716 Представления

Hi Friends,

Can anyone help me in this situation. Have to create database from openerp form on a button click.Please do help

Аватар
Отменить
Лучший ответ

import openerp.netsvc as netsvc

from openerp.service.web_services import db

def create_db(self, cr, uid, ids, context=None):


     db = db(netsvc.ExportService)

     db.exp_create_database('test', True, 'en_US', user_password='admin') #exp_create_database(self, db_name, demo,  lang, user_password='admin'):

    return True


Please accept the answer if you find it helpful.

Аватар
Отменить
Автор

Error thrown as no named db.Im using version openerp 7.0

Автор

Please can u post full code to create db function with import files.Do help me

Автор

UnboundLocalError: local variable 'db' referenced before assignment

you need to import import openerp.netsvc as netsvc from openerp.service.web_services import db

Автор

I used your code as it is. But it is shown error as UnboundLocalError: local variable 'db' referenced before assignment

I have tested it and it works .. you are doing something wrong .. share a screenshot here

Related Posts Ответы Просмотры Активность
0
мар. 15
4698
1
авг. 23
2018
0
мар. 15
5145
1
нояб. 22
3156
2
мар. 22
10728