This commit is contained in:
?ngel ?lvarez 2019-02-09 07:31:40 +01:00
parent 2fb1377351
commit 4856fc5087
5 changed files with 66 additions and 6 deletions

View File

@ -50,6 +50,14 @@ with Transaction().start(dbname, 0, context=context) as transaction:
actions = ActWindow.search([])
for action in actions:
# if action.id in (427, 428):
# conteinue
if action.domain and 'null' in action.domain:
action.domain = action.domain.replace('null', "None")
if action.context and 'true' in action.context:
action.context = action.context.replace('true', "True")
print "action:", action.id, action.domain
if action.domain:
domain = action.domain.replace('null', 'None').replace(
'true', 'True').replace('false', 'False')

View File

@ -41,9 +41,12 @@ with Transaction().start(dbname, 0, context=context):
])
for company in Company.search([]):
with Transaction().set_context(company=company.id):
print("Company ID %s" % company.id)
print "Company ID %s" % company.id
for model in models:
ToSave = pool.get(model.model)
try:
ToSave = pool.get(model.model)
except:
continue
toSave = ToSave(1)
for field in Field.search([('model', '=', model)]):
if field.name in ['id', 'create_uid', 'create_date', 'write_uid', 'write_date']:
@ -53,20 +56,20 @@ with Transaction().start(dbname, 0, context=context):
results = cursor.fetchone()
if results:
value = results[5]
if not value:
continue
if field.ttype in ['many2many', 'one2many']:
continue
elif field.ttype == 'many2one':
elif field.ttype == 'many2one' and value:
model, _id = value.split(',')
ValueModel = pool.get(model)
valueModel = ValueModel(_id)
setattr(toSave, field.name, valueModel)
else:
if value.startswith(','):
if value and value.startswith(','):
setattr(toSave, field.name, value.split(',')[1])
else:
setattr(toSave, field.name, value)
print model.model, toSave._save_values
toSave.save()
Transaction().commit()

View File

@ -44,6 +44,7 @@ with Transaction().start(dbname, 1, context=context) as transaction:
Company = pool.get('company.company')
cursor = Transaction().connection.cursor()
cursor.execute('select * from mapping_taxes')
domain = []
child_companies = Company.search([('parent', '!=', None)])

5
check
View File

@ -3,6 +3,8 @@ import sys
dbname = sys.argv[1]
config_file = sys.argv[2]
dbname2 = sys.argv[3]
from trytond.config import config as CONFIG
CONFIG.update_etc(config_file)
@ -84,6 +86,9 @@ def download_fields_view_get():
to_yaml(r, log_file)
def check_data():
'''
Test that all records can be read

View File

@ -19,6 +19,8 @@ to_uninstall:
- account_bank_statement_csb43
- account_statement_of_account
- asset_attribute
- account_payment_bank
- account_payment_type_move
- aeat_340
- aeat_303_es
- aeat_349_es
@ -31,6 +33,7 @@ to_uninstall:
- calendar_scheduling
- calendar_todo
- dbcopy
- guarantee
- party_vcarddav
- party_merge
- product_configuration
@ -322,6 +325,46 @@ before:
version: 4.8
query: update ir_translation set type = 'report' where type = 'jasper';
- comment: # update sale customer_reference to sale reference (sale_reference)
fields: sale_sale.customer_reference
version: 4.8
query: update sale_sale set reference = customer_reference where customer_reference is not null;
- comment: # uninstall account_es_pyme and install account_es
version: 4.6
where: SELECT count(*) FROM ir_model_data WHERE fs_id = 'es_pymes';
query: UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'base_pymes_', 'base_') where fs_id like 'base_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'baser_pymes_', 'baser_') where fs_id like 'baser_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'cuota_pymes_', 'cuota_') where fs_id like 'cuota_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'cuotar_pymes_', 'cuotar_') where fs_id like 'cuotar_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'cuotas_pymes_', 'cuotas_') where fs_id like 'cuotas_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'es_balance_pymes', 'es_balance_normal') where fs_id like 'es_balance_pymes%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'es_pyg_pymes', 'es_pyg_normal') where fs_id like 'es_pyg_pymes%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'es_pymes', 'es') where fs_id = 'es_pymes' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'fp_pymes_', 'fp_') where fs_id like 'fp_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'fptt_pymes_', 'fptt_') where fs_id like 'fptt_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'igic_pymes_', 'igic_') where fs_id like 'igic_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'irpf_pymes_', 'irpf_') where fs_id like '%irpf_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'ispc_pymes', 'ispc') where fs_id = 'ispc_pymes' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'irpf_pymes_', 'irpf_') where fs_id like 'irpf_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'iva_pymes_', 'iva_') where fs_id like '%iva_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 're_pymes_', 're_') where fs_id like '%re_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'pgc_pymes_', 'pgc_') where fs_id like 'pgc_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'recc_pymes', 'recc') where fs_id like 'recc_pymes%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'suplido_pymes_', 'suplido_') where fs_id like 'suplido_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'bases_pymes_', 'bases_') where fs_id like 'bases_pymes_%' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'vat_code_chart_pymes_root', 'vat_code_chart_root') where fs_id = 'vat_code_chart_pymes_root' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'tax_group_both_pymes', 'tax_group_both') where fs_id = 'tax_group_both_pymes' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'tax_group_purchase_pymes', 'tax_group_purchase') where fs_id = 'tax_group_purchase_pymes' and module = 'account_es_pyme';
UPDATE ir_model_data set fs_id = REPLACE(fs_id, 'tax_group_sale_pymes', 'tax_group_sale') where fs_id = 'tax_group_sale_pymes' and module = 'account_es_pyme';
UPDATE ir_model_data SET module = 'account_es' WHERE module = 'account_es_pyme';
UPDATE ir_translation set module = 'account_es' where module = 'account_es_pyme';
UPDATE ir_ui_view set module = 'account_es' where module = 'account_es_pyme';
UPDATE ir_model_field set module = 'account_es' where module = 'account_es_pyme';
UPDATE ir_module set state = 'not activated' where name = 'account_es_pyme';
UPDATE ir_module set state = 'activated' where name = 'account_es';
DELETE from ir_module_dependency where name = 'account_es_pyme';
- comment: # delete ir.export.line that has not export value trytond-issue6551
version: 4.4
query: DELETE from ir_export_line where export is null;