query:UPDATE ir_translation SET lang = 'en' WHERE lang = 'en_US';UPDATE ir_translation SET lang = 'ca' WHERE lang = 'ca_ES';UPDATE ir_translation SET lang = 'es' WHERE lang = 'es_ES';UPDATE ir_translation SET lang = 'pt' WHERE lang = 'pt_PT';UPDATE ir_translation SET lang = 'de' WHERE lang = 'de_DE';UPDATE ir_translation SET lang = 'it' WHERE lang = 'it_IT';UPDATE ir_translation SET lang = 'fr' WHERE lang = 'fr_FR';
- comment:# rename configuration locale
version:4.2
query:UPDATE ir_configuration SET language = 'en' WHERE language = 'en_US';UPDATE ir_configuration SET language = 'ca' WHERE language = 'ca_ES';
query:DELETE FROM ir_module_module WHERE name IN ('webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
query:DELETE FROM ir_ui_view WHERE module IN ('webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
query:DELETE FROM ir_property where res like 'party.party,%' and SUBSTRING(res, POSITION(',' IN res) + 1)::integer not in (select id from party_party);
query:DELETE FROM ir_property where res like 'product.category,%' and SUBSTRING(res, POSITION(',' IN res) + 1)::integer not in (select id from product_category);
- comment:# delete product ir properties
version:4.4
query:DELETE FROM ir_property where res like 'product.template,%' and SUBSTRING(res, POSITION(',' IN res) + 1)::integer not in (select id from product_template);
query:DELETE FROM ir_property WHERE value LIKE 'account_tax_rule,%' AND SUBSTRING(value, POSITION(',' IN value) + 1)::integer not in (select id from account_tax_rule);
query:delete from ir_property where id in (select id from ir_property where res like 'account.journal%' and value like 'ir.sequence%' and split_part(res, ',', 2)::int not in (select id from account_journal));
query:delete from ir_property where id in (select id from ir_property where res like 'account.journal%' and value like 'account.account%' and split_part(res, ',', 2)::int not in (select id from account_journal));
- comment:# delete properties of stock_sequence without foreign key
version:4.7
query:delete from ir_property where id in (select id from ir_property where res like 'stock.configuration%' and value like 'ir.sequence%' and split_part(res, ',', 2)::int not in (select id from ir_sequence));
query:delete from ir_property where id in (select id from ir_property where res like 'party.party%' and value like 'account.account%' and split_part(value, ',', 2)::int not in (select id from account_account));
query:UPDATE ir_property SET res = null where field in (select id from ir_model_field where name = 'default_country') and res = 'party.configuration,1';
- comment:# Update to lower case email of web users
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module where name = 'account_es_pyme') where module = 'aeat_349' and fs_id like 'aeat_349_template%';
#
# - comment: # Rename model data aeat_349
# version: 4.6
# tables: ir_module_module
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module_module where name = 'account_es_pyme') where module = 'aeat_349' and fs_id like 'aeat_349_template%';
#
# - comment: # Rename model data aeat_303
# version: 4.6
# tables: ir_module
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module where name = 'account_es_pyme') where module = 'aeat_303' and fs_id like 'aeat_303_mapping_code_%_val%';
#
# - comment: # Rename model data aeat_303
# version: 4.6
# tables: ir_module_module
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module_module where name = 'account_es_pyme') where module = 'aeat_303' and fs_id like 'aeat_303_mapping_code_%_val%';
#
# - comment: # Rename model data aeat_340
# version: 4.6
# tables: ir_module
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module where name = 'account_es_pyme') where module = 'aeat_340' and fs_id like 'aeat_340_template_type_%';
#
# - comment: # Rename model data aeat_340
# version: 4.6
# tables: ir_module_module
# query: UPDATE ir_model_data set fs_id = fs_id || (select CASE WHEN state = 'installed' THEN '_pyme' ELSE '_normal' END FROM ir_module_module where name = 'account_es_pyme') where module = 'aeat_340' and fs_id like 'aeat_340_template_type_%';
- 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';
query:DELETE from ir_model_data where fs_id in ('journal_type_general', 'journal_type_revenue', 'journal_type_expense', 'journal_type_cash', 'journal_type_situation', 'journal_type_write_off', 'journal_type_statement');
- comment:# remove style option in ir.action.window
version:4.8
query:UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["style",""],', '') where fs_id like 'report_%' and model = 'ir.action.report';
UPDATE ir_model_data set values = REPLACE(fs_values, '["style",""],', '') where fs_id like 'report_%' and model = 'ir.action.report';
UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["style","company/header_A4.odt"],', '') where fs_id like 'report_%' and model = 'ir.action.report';
UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["style","company/header_A4.odt"],', '') where fs_id like 'report_%' and model = 'ir.action.report';
- comment:Remove lead_time field from stock_location_lead_time. The type was float in our patch in version 3.4 but now it's better to remove and let trytond recreate it as few people are using it.
version:5.2
fields:stock_location_lead_time.lead_time
query:ALTER TABLE stock_location_lead_time DROP COLUMN lead_time;
- comment:Remove lead_time field from production_lead_time. The type was float in our patch in version 3.4 but now it's better to remove and let trytond recreate it as few people are using it.
- comment:set type to null from ir.ui.view that is an inherit
version:5.4
query:update ir_ui_view set type = null from (select db_id from ir_model_data where module = 'account_bank_statement_payment' and fs_id = 'move_line_bank_statement_lines') as sub where id = sub.db_id;
query:DELETE FROM res_user WHERE login = 'user_send_summary';DELETE from ir_model_data where fs_id = 'user_send_summary' and module = 'brain' and model = 'res.user';
- comment:Delete user_cron_imap user
version:5.8
query:DELETE from res_user where login = 'user_cron_imap';DELETE from ir_model_data where fs_id = 'user_imap' and model = 'res.user';
- comment:Delete user_clean_execution_group_babi_admin group user
version:5.8
query:DELETE from "res_user-res_group" where id in (select db_id from ir_model_data where module = 'babi' and fs_id = 'user_clean_execution_group_babi_admin' and model = 'res.user-res.group');
DELETE from ir_model_data where module = 'babi' and fs_id = 'user_clean_execution_group_babi_admin' and model = 'res.user-res.group';
query:DELETE from ir_action_report where id in (select db_id from ir_model_data where module = 'sale_discount' and fs_id = 'report_sale') and module = 'sale_discount';
DELETE from ir_model_data where module = 'sale_discount' and fs_id = 'report_sale';
DELETE from ir_action_report where id in (select db_id from ir_model_data where module = 'purchase_discount' and fs_id = 'report_purchase') and module = 'purchase_discount';
DELETE from ir_model_data where module = 'purchase_discount' and fs_id = 'report_purchase';
DELETE from ir_action_report where id in (select db_id from ir_model_data where module = 'account_invoice_discount' and fs_id = 'report_invoice') and module = 'account_invoice_discount';
DELETE from ir_model_data where module = 'account_invoice_discount' and fs_id = 'report_invoice';
query:update electronic_mail_template set subject = regexp_replace(subject, 'record.code', 'record.number', 'g'), plain = regexp_replace(plain, 'record.code', 'record.number', 'g'), html = regexp_replace(html, 'record.code', 'record.number', 'g') where model in (select id from ir_model where model in ('account.invoice', 'sale.sale', 'purchase.purchase', 'stock.shipment.in', 'stock.shipment.out', 'stock.shipment.in'));
- comment:# change code to number electronic mail template
query:update ir_translation set value = regexp_replace(value, 'record.code', 'record.number', 'g') where res_id in (select id from electronic_mail_template where model in (select id from ir_model where model in ('account.invoice', 'sale.sale', 'purchase.purchase', 'stock.shipment.in', 'stock.shipment.out', 'stock.shipment.in'))) and name like 'electronic.mail.template,%';
query:update product_template set producible = true where id in(select p.template from "product_product-production_bom" pb, product_product p where pb.product=p.id)
- comment:# Set account in account bank statement journal. Get value from ir_propery and try find credit or debit account because in ir_model_field there is no available ID field
version:4.7
tables:"account_bank_statement_journal"
query:update account_bank_statement_journal set account = substring(sub.value, 17)::int from (select ip.value, ip.res from account_bank_statement_journal as absj left join account_journal as aj on absj.journal = aj.id inner join ir_property_backup as ip on ip.res = concat('account.journal,', aj.id) and ip.value like 'account.account,%') as sub where journal = substring(sub.res, 17)::int;
- comment:# Remove account_bank_reconciliation that the bank_reconcile is False in account
version:4.8
tables:"account_bank_reconciliation"
query:delete from account_bank_reconciliation where id in (select abr.id from account_bank_reconciliation as abr left join account_move_line as aml on abr.move_line = aml.id left join account_account as aa on aa.id = aml.account where aa.bank_reconcile = False);
- comment:We need this query before sync_model_data.py otherwise it fails
version:5.2
query:update ir_model_data set fs_values = REPLACE(fs_values, '["update_unit_price",true]', '["update_unit_price",false]') WHERE fs_values like '%["update_unit_price",true]%';
- comment:We need this query before sync_model_data.py otherwise it fails
version:5.2
query:update ir_model_data set values = REPLACE(values, '["update_unit_price",true]', '["update_unit_price",false]') WHERE values like '%["update_unit_price",true]%';
query:UPDATE product_price_list_line set formula = REPLACE(formula, 'product.list_price', 'product.list_price_used') where formula like '%product.list_price%';
query:DELETE FROM ir_model_data WHERE model='res.user' AND fs_id IN ('user_trigger', 'user_process_purchase', 'user_process_sale', 'user_post_clearing_moves', 'user_cron_trigger', 'user_send_modules', 'user_send_data', 'user_clean_executions');
query:UPDATE account_invoice_line SET currency = (SELECT currency FROM account_invoice WHERE id = account_invoice_line.invoice) WHERE invoice IS NOT NULL;
UPDATE account_invoice_line SET invoice_type = (SELECT type FROM account_invoice WHERE id = account_invoice_line.invoice) WHERE invoice_type IS NOT NULL;
UPDATE account_invoice_line SET party = (SELECT party FROM account_invoice WHERE id = account_invoice_line.invoice) WHERE party IS NOT NULL;
query:UPDATE product_template SET code = (SELECT code FROM product_product WHERE template = product_template.id AND product_template.unique_variant = True AND product_product.active = True) WHERE unique_variant = True;
- comment:Add lost and found location to warehouse location configuration
version:6.0
tables:stock_location
query:UPDATE stock_location SET lost_found_location = db_id FROM ir_model_data WHERE module = 'stock' and fs_id = 'location_lost_found' AND type = 'warehouse';