mirror of
https://github.com/NaN-tic/tryton-upgrades.git
synced 2023-12-14 03:32:55 +01:00
38 lines
837 B
Python
Executable file
38 lines
837 B
Python
Executable file
#!/usr/bin/env python
|
|
import sys
|
|
import os
|
|
|
|
dbname = sys.argv[1]
|
|
config_file = sys.argv[2]
|
|
from trytond.config import config as CONFIG
|
|
CONFIG.update_etc(config_file)
|
|
|
|
from trytond.transaction import Transaction
|
|
from trytond.pool import Pool
|
|
import trytond.tools as tools
|
|
import logging
|
|
|
|
Pool.start()
|
|
pool = Pool(dbname)
|
|
pool.init()
|
|
|
|
context = {}
|
|
|
|
logger = logging.getLogger(__name__)
|
|
logger.setLevel(logging.DEBUG)
|
|
ch = logging.StreamHandler(sys.stdout)
|
|
ch.setLevel(logging.DEBUG)
|
|
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
ch.setFormatter(formatter)
|
|
logger.addHandler(ch)
|
|
|
|
with Transaction().start(dbname, 0, context=context):
|
|
Data = pool.get('ir.model.data')
|
|
|
|
datas = Data.search([('out_of_sync', '=', True)])
|
|
Data.sync(datas)
|
|
|
|
Transaction().commit()
|
|
|
|
logger.info('Done')
|