Add some new SQL and scripts to upgrade 4.8
This commit is contained in:
parent
5349486228
commit
f64befcd2d
|
@ -0,0 +1,53 @@
|
|||
#!/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):
|
||||
Company = pool.get('company.company')
|
||||
Module = pool.get('ir.module')
|
||||
ModuleDependency = pool.get('ir.module.dependency')
|
||||
|
||||
cursor = Transaction().connection.cursor()
|
||||
|
||||
to_delete = []
|
||||
for module in Module.search([('state', '=', 'not activated')]):
|
||||
try:
|
||||
with tools.file_open(os.path.join(module.name, 'tryton.cfg')) as fp:
|
||||
pass
|
||||
except:
|
||||
to_delete.append(module)
|
||||
|
||||
logger.info('Modules to delete: %s' % ','.join([m.name for m in to_delete]))
|
||||
|
||||
if to_delete:
|
||||
dependencies = ModuleDependency.search([('module', 'in', to_delete)])
|
||||
ModuleDependency.delete(dependencies)
|
||||
Module.delete(to_delete)
|
||||
|
||||
Transaction().commit()
|
||||
|
||||
logger.info('Done')
|
|
@ -0,0 +1,37 @@
|
|||
#!/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')
|
36
config.yml
36
config.yml
|
@ -1,6 +1,7 @@
|
|||
---
|
||||
to_uninstall:
|
||||
- account_invoice_post_in_tree
|
||||
- account_cash_management
|
||||
- account_chart_speedup
|
||||
- account_invoice_type
|
||||
- account_invoice_data
|
||||
|
@ -340,6 +341,14 @@ before:
|
|||
version: 4.4
|
||||
query: DELETE from ir_export_line where export is null;
|
||||
|
||||
- comment: # upgrade ir.configuration
|
||||
version: 4.2
|
||||
query: update ir_configuration set language = 'es';
|
||||
|
||||
- comment: # alter table aeat_347_report_property column number
|
||||
version: 4.2
|
||||
query: alter table aeat_347_report_property alter column number TYPE varchar;
|
||||
|
||||
after:
|
||||
|
||||
- DELETE FROM ir_translation WHERE module = 'account_es_pyme';
|
||||
|
@ -399,7 +408,7 @@ after:
|
|||
version: 4.4
|
||||
query: DELETE FROM ir_model_data WHERE model = 'ir.property';
|
||||
|
||||
- comment: # drop purchase invoice line rel
|
||||
- comment: # Relation between purchase and invoice_lines must be deleted
|
||||
version: 4.4
|
||||
query: DROP TABLE if exists purchase_invoice_line_rel;
|
||||
|
||||
|
@ -407,10 +416,6 @@ after:
|
|||
version: 4.4
|
||||
query: UPDATE party_address_format SET format_ = REPLACE(format_, '${district}', '${subdivision}');
|
||||
|
||||
- comment: # Relation between purchase and invoice_lines must be deleted
|
||||
version: 4.4
|
||||
query: DROP TABLE purchase_invoice_line_rel;
|
||||
|
||||
- comment: # delete duplicated party configuration sequence
|
||||
version: 4.4
|
||||
query: DELETE FROM party_configuration_party_sequence where id = 2;
|
||||
|
@ -424,16 +429,31 @@ after:
|
|||
version: 4.7
|
||||
query: update ir_action_report set template_extension = 'jrxml' where report like '%jrxml';
|
||||
|
||||
- comment: # upgrade configuration models from ir_property
|
||||
- comment: # Delete unused users
|
||||
version: 4.8
|
||||
script: ./upgrades/after/migration_properties.py
|
||||
query: DELETE from res_user where login in ('user_cron_purchase_request', 'user_cron_internal_shipment');
|
||||
DELETE from ir_model_data where module = 'stock_supply' and model = 'res.user';
|
||||
|
||||
# - script: ./upgrades/after/update_taxes.py
|
||||
# - comment: # upgrade configuration models from ir_property
|
||||
# version: 4.8
|
||||
# script: ./upgrades/after/migration_properties.py
|
||||
|
||||
# - comment: # update taxes
|
||||
# version: 4.4
|
||||
# - script: ./upgrades/after/update_taxes.py
|
||||
|
||||
# - comment: # delete ir properties
|
||||
# version: 4.4
|
||||
# query: DELETE FROM ir_model_data WHERE model = 'ir.property';
|
||||
|
||||
# - comment: # delete not found modules in ir.module
|
||||
# version: 4.8
|
||||
# script: ./upgrades/after/delete_not_found_modules.py
|
||||
|
||||
# - comment: # sync model data
|
||||
# script: ./upgrades/after/sync_model_data.py
|
||||
|
||||
# extra scripts
|
||||
# - script: ./upgrades/after/convert_domain_rules.py
|
||||
# - tables: work_project
|
||||
# script: ./upgrades/after/migration_project_product.py
|
||||
|
|
Loading…
Reference in New Issue