On Friday, June 9, 2017 at 6:58:15 PM UTC+9, Sergi Almacellas Abellana 
wrote:
>
> El 09/06/17 a les 11:43, Dr. Praveen Bhatia ha escrit: 
> > 
> > This is the code that I wrote: 
> > import os 
> > os.environ['DB_NAME']='mydb' 
> > 
> > from trytond.tests.test_tryton import db_exist, 
> > drop_create,create_db,drop_db 
>
> The problem is here. As you are using the tests functions, the country 
> data is not loaded as it's skiped for tests. 
>
>
Yes, country is not getting loaded. What should I call to load the 
countries?
 

> You should create de database using the backend tools. 
>
>
If I look at the create_db, it DOES use backend as given below in the 
copied code. So I am confused what different should I should ?

def create_db(name=DB_NAME, lang='en'): 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l474>    
Database = backend.get('Database') 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l475>    
if not db_exist(name): 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l476>      
  with Transaction().start( 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l477>      
          None, 0, close=True, autocommit=True, _nocache=True) \ 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l478>      
          as transaction: 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l479>      
      transaction.database.create(transaction.connection, name) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l480> 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l481>      
  with Transaction().start(name, 0, _nocache=True) as transaction,\ 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l482>      
          transaction.connection.cursor() as cursor: 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l483>      
      Database(name).init() 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l484>      
      ir_configuration = Table('ir_configuration') 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l485>      
      cursor.execute(*ir_configuration.insert( 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l486>      
              [ir_configuration.language], [[lang]])) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l487> 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l488>      
  pool = Pool(name) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l489>      
  pool.init(update=['res', 'ir'], lang=[lang]) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l490>      
  with Transaction().start(name, 0) as transaction: 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l491>      
      User = pool.get('res.user') 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l492>      
      Lang = pool.get('ir.lang') 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l493>      
      language, = Lang.search([('code', '=', lang)]) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l494>      
      language.translatable = True 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l495>      
      language.save() 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l496>      
      users = User.search([('login', '!=', 'root')]) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l497>      
      User.write(users, { 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l498>      
              'language': language.id, 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l499>      
              }) 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l500>      
      Module = pool.get('ir.module') 
<https://hg.tryton.org/trytond/file/4.4/trytond/tests/test_tryton.py#l501> 

Module.update_list() 

> Regards, 
> -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/83f5e7c9-aec6-403c-9e39-a18b03043af1%40googlegroups.com.

Reply via email to