Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
1 ตอบกลับ
4701 มุมมอง

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
4685
1
ส.ค. 23
2015
0
มี.ค. 15
5127
1
พ.ย. 22
3148
2
มี.ค. 22
10712