콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1 회신
4707 화면

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
4688
1
8월 23
2015
0
3월 15
5131
1
11월 22
3152
2
3월 22
10723