Odoo Help

3

1
1 Answer
6
Avatar

Kazim Mirza | Founder at TechUltra Solutions India

--Kazim Mirza | Founder at TechUltra Solutions --
866
| 3 3 7
Ahmedabad, India
--Kazim Mirza | Founder at TechUltra Solutions --
 
Kazim Mirza | Founder at TechUltra Solutions India
11/20/15, 6:14 AM

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.

7 Comments
vadivel India
11/20/15, 6:28 AM

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

vadivel India
11/20/15, 11:04 PM

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

Kazim Mirza | Founder at TechUltra Solutions India
11/21/15, 12:57 AM

I have udated answer.

vadivel India
11/21/15, 1:25 AM

UnboundLocalError: local variable 'db' referenced before assignment

Kazim Mirza | Founder at TechUltra Solutions India
11/21/15, 1:28 AM

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

vadivel India
11/21/15, 1:38 AM

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

Kazim Mirza | Founder at TechUltra Solutions India
11/21/15, 1:43 AM

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

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now