跳至內容
選單
此問題已被標幟
1 回覆
4691 瀏覽次數

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

相關帖文 回覆 瀏覽次數 活動
0
3月 15
4681
1
8月 23
2015
0
3月 15
5127
1
11月 22
3146
2
3月 22
10710