mirror of
https://github.com/NaN-tic/tryton-upgrades.git
synced 2023-12-14 03:32:55 +01:00
437 lines
19 KiB
YAML
437 lines
19 KiB
YAML
---
|
|
to_uninstall:
|
|
- account_invoice_post_in_tree
|
|
- account_cash_management
|
|
- account_chart_speedup
|
|
- account_invoice_type
|
|
- account_invoice_data
|
|
- account_invoice_post_in_tree
|
|
- account_move_party_required
|
|
- account_payment_bank
|
|
- account_payment_es_csb_19
|
|
- account_payment_es_csb_32
|
|
- account_payment_es_csb_34
|
|
- account_payment_es_csb_34_01
|
|
- account_payment_es_csb_34_1_la_caixa
|
|
- account_payment_es_csb_34_11
|
|
- account_payment_es_csb_58
|
|
- account_payment_type_move
|
|
- account_statement_of_account
|
|
- asset_attribute
|
|
- aeat_340
|
|
- aeat_303_es
|
|
- aeat_349_es
|
|
- analytic_account_move
|
|
- asset_guarantee
|
|
- asset_estate
|
|
- audit_log
|
|
- calendar
|
|
- calendar_classification
|
|
- calendar_scheduling
|
|
- calendar_todo
|
|
- dbcopy
|
|
- guarantee
|
|
- party_vcarddav
|
|
- party_merge
|
|
- product_configuration
|
|
- project_auto_timesheet
|
|
- project_asterisk
|
|
- project_current_effort
|
|
- project_unittest
|
|
- project_unittest
|
|
- product_price_list_category
|
|
- sale_invoices_paid
|
|
- sale_shipments_done
|
|
- stock_delivery_note_valued_jreport
|
|
- stock_picking_box
|
|
- webdav
|
|
|
|
to_install:
|
|
- account_move_draft
|
|
- account_invoice_line_description
|
|
- party_identifier
|
|
- account_invoice_company_currency
|
|
- electronic_mail
|
|
- html_report
|
|
|
|
before:
|
|
|
|
# - tables: ir_model_data
|
|
# version: 3.2
|
|
# query: ALTER TABLE ir_model_data ADD COLUMN fs_values TEXT;
|
|
|
|
- UPDATE ir_model_data SET module = 'aeat_303' WHERE module = 'aeat_303_es';
|
|
- UPDATE ir_model_data SET module = 'aeat_349' WHERE module = 'aeat_349_es';
|
|
- UPDATE ir_translation SET module = 'aeat_303' WHERE module = 'aeat_303_es';
|
|
- UPDATE ir_translation SET module = 'aeat_349' WHERE module = 'aeat_349_es';
|
|
- DELETE from ir_ui_view where module = '';
|
|
- DELETE from ir_ui_view where data = '' and module = 'account_payment_type';
|
|
- UPDATE ir_ui_view SET type = NULL WHERE inherit IS NOT NULL AND type IS NOT NULL;
|
|
- DELETE FROM ir_model_data WHERE model='stock.location' AND fs_id LIKE '%transit%'
|
|
- DELETE FROM ir_ui_view where module = '%sale%milestone%'
|
|
|
|
- comment: # Tax migration from new tax rules. on 4.7
|
|
tables: aeat_347_record
|
|
version: 4.8
|
|
query: create table mapping_taxes as select
|
|
t.id as tax_id,
|
|
t.name as tax_name,
|
|
t.parent as tax_parent,
|
|
t.include_347,
|
|
i.fs_id,
|
|
i.db_id as template_id,
|
|
split_part(i.fs_id, '+',1)
|
|
from
|
|
ir_model_data i,
|
|
account_tax_template tt,
|
|
account_tax t
|
|
where
|
|
tt.id = t.template and
|
|
db_id = tt.id and
|
|
model='account.tax.template' and module='account_es' and
|
|
tt.parent is not null and fs_id like '%_child'
|
|
and t.include_347 = true
|
|
UNION ALL
|
|
select
|
|
t.id as tax_id,
|
|
t.name as tax_name,
|
|
t.parent as tax_parent,
|
|
t.include_347,
|
|
i.fs_id,
|
|
i.db_id as template_id,
|
|
rtrim(rtrim(rtrim(split_part(i.fs_id, '+',2),'_child'), 'iva'), 'irpf')
|
|
from
|
|
ir_model_data i,
|
|
account_tax_template tt,
|
|
account_tax t
|
|
where
|
|
tt.id = t.template and
|
|
i.db_id = tt.id and
|
|
model='account.tax.template' and module='account_es' and
|
|
tt.parent is not null and fs_id like '%_child'
|
|
and t.include_347 = false
|
|
|
|
- comment: -> 4.0
|
|
query: ALTER TABLE res_user_login_attempt ALTER COLUMN login TYPE VARCHAR(512);
|
|
- tables: stock_location
|
|
query: INSERT INTO stock_location (name, code, type, create_uid, create_date, "right", "left") VALUES ('Migration Drop Shipment', 'DROPMIGRATION', 'drop', 0, '2016-10-04 00:00:00', 0, 0);
|
|
- comment: # Rename table name - 3.6 migration
|
|
tables: account_financial_statement
|
|
query:
|
|
ALTER TABLE account_financial_statement_report_line_account
|
|
RENAME TO account_financial_statement_rep_lin_acco
|
|
- tables: account_financial_statement
|
|
query:
|
|
ALTER TABLE account_financial_statement_report_line_account_id_seq
|
|
RENAME TO account_financial_statement_rep_lin_acco_id_seq
|
|
|
|
# - comment: # [SQL]: Change tax sign for credit note (must be run before update)
|
|
# tables: account_tax_template
|
|
# version: 4.0
|
|
# query:
|
|
# UPDATE account_tax_template
|
|
# SET
|
|
# credit_note_base_sign = credit_note_base_sign * -1,
|
|
# credit_note_tax_sign = credit_note_tax_sign * -1;
|
|
|
|
- tables: account_tax
|
|
version: 4.0
|
|
query:
|
|
UPDATE account_tax
|
|
SET
|
|
credit_note_base_sign = credit_note_base_sign * -1,
|
|
credit_note_tax_sign = credit_note_tax_sign * -1;
|
|
|
|
- comment: # [SQL]: Fix amount second currency with 3.4 -> 3.6
|
|
version: 3.6
|
|
tables: account_move_line
|
|
query:
|
|
UPDATE account_move_line
|
|
SET
|
|
amount_second_currency = (amount_second_currency * -1)
|
|
WHERE amount_second_currency IS NOT NULL
|
|
AND SIGN(amount_second_currency) != SIGN(debit - credit)
|
|
- tables: shipment_work
|
|
query: ALTER TABLE shipment_work RENAME COLUMN project TO work_project
|
|
- fields: sale_sale.project
|
|
query: ALTER TABLE sale_sale RENAME COLUMN project TO work_project
|
|
|
|
- comment: # change PYSON context menu
|
|
version: 4.0
|
|
tables: babi_report
|
|
query: "UPDATE ir_action_act_window SET domain = '[[\"parent\", \"=\", null]]', context = '{\"babi_tree_view\": true}' WHERE context like '%babi%'"
|
|
|
|
- comment: # set domain to null in account bank statement
|
|
version: 4.0
|
|
query: UPDATE ir_action_act_window SET domain = null where id in (SELECT db_id FROM ir_model_data where fs_id = 'act_account_bank_statement');
|
|
- comment: # set domain to null in account bank statement line
|
|
version: 4.0
|
|
query: UPDATE ir_action_act_window SET domain = null where id in (SELECT db_id FROM ir_model_data where fs_id = 'act_account_bank_statement_line');
|
|
|
|
- comment: # set update_unit_price to false
|
|
version: 4.0
|
|
query: update account_tax_template set update_unit_price = false where id = (select db_id from ir_model_data where fs_id = 'iva_reagp_compras_12_1');
|
|
|
|
- comment: # rename locale languages
|
|
version: 4.2
|
|
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';
|
|
|
|
- comment: # delete modules
|
|
version: 4.4
|
|
tables: ir_module
|
|
query: DELETE FROM ir_module WHERE name IN ('webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
|
|
- comment: # delete modules
|
|
tables: ir_module_module
|
|
version: 4.4
|
|
query: DELETE FROM ir_module_module WHERE name IN ('webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
|
|
|
|
- comment: # delete modules views
|
|
version: 4.4
|
|
query: DELETE FROM ir_ui_view WHERE module IN ('webdav', 'calendar', 'calendar_todo', 'calendar_scheduling', 'calendar_classification', 'party_vcarddav');
|
|
|
|
- comment: # update format address
|
|
tables: party_address_format
|
|
version: 4.4
|
|
query: UPDATE party_address_format SET format_ = REPLACE(format_, '${district}', '${subdivision}');
|
|
|
|
- comment: # remove wrong proprties
|
|
version: 4.4
|
|
query: delete from ir_property where res like 'party.party,None';
|
|
|
|
- comment: # delete party ir properties
|
|
version: 4.4
|
|
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);
|
|
|
|
- comment: # delete product category ir properties
|
|
version: 4.4
|
|
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);
|
|
|
|
- comment: # delete account_tax_rule ir properties
|
|
version: 4.4
|
|
query: DELETE FROM ir_property where value like 'account_tax_rule,None';
|
|
|
|
- comment: # delete account_tax_rule ir properties
|
|
version: 4.4
|
|
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);
|
|
|
|
- comment: # delete properties of account_journal without foreign key
|
|
version: 4.7
|
|
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));
|
|
|
|
- comment: # delete properties of account_journal without foreign key
|
|
version: 4.7
|
|
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));
|
|
|
|
- comment: # delete default properties
|
|
version: 4.7
|
|
query: delete from ir_property where res is null;
|
|
|
|
# - comment: # drop ir properties in case account_asset is installed
|
|
# version: 4.4
|
|
# script: TODO https://bugs.tryton.org/issue6395
|
|
|
|
- comment: # update default_country ir_property
|
|
version: 4.4
|
|
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
|
|
version: 4.6
|
|
tables: web_user
|
|
query: UPDATE web_user SET email = LOWER(email);
|
|
|
|
# account_es and aeat
|
|
- comment: # add new column in code_uniq constrain when upgrade
|
|
version: 4.6
|
|
query: ALTER TABLE account_account_template DROP CONSTRAINT "account_account_template_code_uniq";
|
|
|
|
# - comment: # Rename model data aeat_349
|
|
# 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_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: # Add exceptional parent language (must be run before update
|
|
version: 4.8
|
|
tables: ir_lang
|
|
query: ALTER TABLE ir_lang ADD parent varchar;
|
|
|
|
- comment: # delete register with type 'jasper' on core modules
|
|
version: 4.8
|
|
query: delete from ir_translation where module in ('account_invoice', 'sale', 'stock', 'purchase') and type = 'jasper';
|
|
- comment: # update jasper translations to report type
|
|
version: 4.8
|
|
query: update ir_translation set type = 'report' where type = 'jasper';
|
|
|
|
- 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;
|
|
|
|
- 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;
|
|
|
|
- comment: # alter table aeat_347_report_property column number
|
|
version: 4.2
|
|
query: alter table aeat_347_report_property alter column number TYPE varchar;
|
|
|
|
- comment: # remove deprecated journal type ir.model.data
|
|
version: 4.8
|
|
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: # upgrade account products. Warning: required account_product_migration field in product.template and acounting field in product.category (custom module)
|
|
# version: 5.0
|
|
# script: ./upgrades/before/migration_account_category.py
|
|
|
|
after:
|
|
|
|
- DELETE FROM ir_translation WHERE module = 'account_es_pyme';
|
|
- tables: aeat_303_mapping-account_tax_code
|
|
query: delete from "aeat_303_mapping-account_tax_code"
|
|
- tables: aeat_303_mapping
|
|
query: delete from aeat_303_mapping ;
|
|
- comment: -> 4.7
|
|
version: 4.7
|
|
tables: account_tax_template
|
|
query: update account_tax_template set update_unit_price = false where update_unit_price
|
|
- comment: -> 4.7
|
|
version: 4.7
|
|
tables: account_tax
|
|
query: update account_tax set update_unit_price = false where update_unit_price
|
|
- comment: -> 4.0
|
|
version: 4.0
|
|
query: UPDATE account_move_reconciliation SET date=create_date::DATE WHERE date IS NULL;
|
|
- comment: # Change login's length
|
|
query: ALTER TABLE res_user_login_attempt ALTER COLUMN login TYPE character varying(512);
|
|
- comment: # Mark all categories as accounting type
|
|
version: 4.0
|
|
tables: product_category
|
|
query: UPDATE product_category SET accounting = True;
|
|
- comment: # Set reconciliation date
|
|
tables: account_move_reconciliation
|
|
query: UPDATE account_move_reconciliation SET date=create_date WHERE date IS NULL;
|
|
- tables: account_move_reconciliation
|
|
query: ALTER TABLE account_move_reconciliation ALTER COLUMN date SET NOT NULL;
|
|
- tables: contract
|
|
query: UPDATE contract SET first_invoice_date=start_period_date WHERE first_invoice_date IS NULL;
|
|
- tables: asset
|
|
query: ALTER TABLE asset ALTER COLUMN company SET NOT NULL;
|
|
- tables: timesheet_line
|
|
query: ALTER TABLE timesheet_line ALTER COLUMN duration SET NOT NULL;
|
|
- tables: stock_shipment_in_return
|
|
query: ALTER TABLE stock_shipment_in_return ALTER COLUMN supplier SET NOT NULL;
|
|
- tables: contract
|
|
query: ALTER TABLE contract ALTER COLUMN first_invoice_date SET NOT NULL;
|
|
- tables: asset
|
|
query: UPDATE asset SET company = 1 WHERE company IS NULL;
|
|
- comment: Drop category column
|
|
fields: product_template.category
|
|
query: ALTER TABLE product_template DROP COLUMN category;
|
|
- tables: country_zip
|
|
version: 4.0
|
|
query: update country_zip set country = (select id from country_country where code = 'ES') where country_zip is null;
|
|
version: 4.0
|
|
- tables: electronic_mail_template
|
|
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
|
|
version: 4.0
|
|
tables: 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,%';
|
|
|
|
- comment: # After property migration old model data should be cleared:
|
|
version: 4.4
|
|
query: DELETE FROM ir_model_data WHERE model = 'ir.property';
|
|
|
|
- comment: # Relation between purchase and invoice_lines must be deleted
|
|
version: 4.4
|
|
query: DROP TABLE if exists purchase_invoice_line_rel;
|
|
|
|
- comment: # Update address formats
|
|
version: 4.4
|
|
query: UPDATE party_address_format SET format_ = REPLACE(format_, '${district}', '${subdivision}');
|
|
|
|
- comment: # delete duplicated party configuration sequence
|
|
version: 4.4
|
|
query: DELETE FROM party_configuration_party_sequence where id = 2;
|
|
|
|
- comment: # migration from sale_opportunity module to core.
|
|
tables: opportunity_sale_rel
|
|
version: 4.7
|
|
query: update sale_sale s set origin = 'sale.opportunity,'|| o.opportunity from opportunity_sale_rel o where s.id = o.sale
|
|
|
|
- comment: # update template extension jasper reports
|
|
version: 4.7
|
|
query: update ir_action_report set template_extension = 'jrxml' where report like '%jrxml';
|
|
|
|
- comment: # Delete unused users
|
|
version: 4.8
|
|
query: DELETE from res_user where login in ('user_cron_purchase_request', 'user_cron_internal_shipment', 'user_cron_production_request');
|
|
DELETE from ir_model_data where module = 'stock_supply' and model = 'res.user';
|
|
DELETE from ir_model_data where module = 'stock_supply_production' and model = 'res.user';
|
|
|
|
# - 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
|
|
# - tables: project_work
|
|
# script: ./upgrades/after/purchase_work.py
|
|
# - tables: shipment_work
|
|
# script: ./upgrades/after/migration_shipment_work.py
|
|
# - tables: account_invoice_milestone
|
|
# script: ./upgrades/after/milestone_migration.py
|