-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.yml
1356 lines (1178 loc) · 72.8 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---
to_uninstall:
- account_invoice_post_in_tree
- account_cash_management
- account_chart_speedup
- account_invoice_3_discounts
- account_invoice_data
- account_invoice_consecutive
- account_invoice_post_in_tree
- account_invoice_prevent_duplicates
- account_move_draft
- 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_bank_statement_csb43
- account_reconcile_different_party
- account_statement_of_account
- account_payment_type_move
- aeat_340
- aeat_303_es
- aeat_349_es
- analytic_account_asset
- asset_guarantee
- asset_estate
- asterisk
- audit_log
- base_external_mapping
- brain
- dbcopy
- calendar
- calendar_classification
- calendar_scheduling
- calendar_todo
- commission_party
- commission_invoice_posted2draft
- country_zip_es
- csv_import
- guarantee
- quality_control_trigger
- party_asterisk
- party_credit_limit
- party_vcarddav
- party_merge
- party_search
- party_social_contact
- product_configuration
- product_barcode
- product_code_unique
- product_review
- product_search_code
- product_template_form_quantity # Deprecated at 7.2 - Replace with product_quantity
- product_qty # Deprecated at 7.2 - Replace with product_quantity
- production_cost_distribution
- production_quality_control_trigger_lot
- production_package
- project_state_by_buttons
- project_auto_timesheet
- project_asterisk
- project_current_effort
- project_menu_tree_remove
- project_unittest
- project_unittest
- product_price_list_category
- production_origin # Remove in upgrade to 6.0
- purchase_incoterm
- purchase_product_supplier
- sale_3_discounts
- sale_external_price
- sale_fedicom
- sale_incoterm
- sale_invoices_paid
- sale_shipments_done
- shine
- stock_inventory_expected_quantity
- stock_lot_expiry
- stock_picking_box
- stock_update_planned_date
- stock_quality_control_trigger_shipment_in
- stock_reservation
- stock_supply_production_warehouse
- stock_quality_control_trigger_lot
- webdav
- stock_lot_quantity
- product_price_list_table # Deprecated at 6.4
- account_invoice_sale_relation # Deprecated at 6.8 - Replace with account_invoice_line_origin
- account_invoice_line_search_by_shipment # Deprecated at 6.8 - Replace with account_invoice_line_origin
- account_invoice_search_by_purchase # Deprecated at 6.8 - Replace with account_invoice_line_origin
- dbcopy # Deprecated at 6.4
- account_invoice_origin_reference # Deprecated at 6.4. Replace with account_invoice_line_origin
- stock_shipment_in_return_childs # Deprecated at 6.4
- stock_lot_csv # Deprecated at 6.4
- stock_move_warehouse # Deprecated at 6.4
- activity_category # Deprecated at 6.4
- account_journal_company # Deprecated at 6.4
- sale_supply_drop_shipment_manual # Deprecated at 6.4
- purchase_contract # Deprecated at 6.4
- purchase_lot_cost # Deprecated at 6.4
- product_sale_line_relation # Deprecated at 6.8
- party_communication # Deprecated at 6.8
- account_invoice_post_wizard # Deprecated at 6.8
- account_payment_es:7.4 # Deprecated at 7.4. moved to account_es module
# TODO: Add to uninstall to upgrades to v6.4
# - account_invoice_prevent_duplicates
before:
# - tables: ir_model_data
# version: 3.2
# query: ALTER TABLE ir_model_data ADD COLUMN fs_values TEXT;
- comment: Remove all existing sessions to force new logins
query: DELETE FROM ir_session;
- version: 5.2
query:
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 AND module <> 'farm';
DELETE FROM ir_model_data WHERE model='stock.location' AND fs_id LIKE '%transit%';
DELETE FROM ir_ui_view where module = '%sale%milestone%';
- comment: Remove name from account journal period
version: 4.8
tables: account_journal_period
query: ALTER TABLE account_journal_period DROP COLUMN IF EXISTS name;
- comment: drop constraint, new ones applied on module
version: 5.1
tables: account_account
query: ALTER TABLE account_account DROP CONSTRAINT IF EXISTS account_account_code_uniq;
- comment: # copy to migrate default values, must be dropped
version: 4.8
query: CREATE TABLE if not exists ir_property_backup as (select * from ir_property)
- comment: #Adapat fields from stock_lot_expiry to stock_lot_sled
fields: product_template.life_time
version: 4.8
query: ALTER TABLE product_template rename column life_time to shelf_life_time;
- comment: #Adapat fields from stock_lot_expiry to stock_lot_sled
fields: product_template.expiry_time
version: 4.8
query: ALTER TABLE product_template rename column expiry_time to expiration_time;
- comment: #Adapat fields from stock_lot_expiry to stock_lot_sled
fields: stock_lot.life_date
version: 4.8
query: ALTER TABLE stock_lot RENAME COLUMN life_date TO shelf_life_expiration_date;
- comment: #Adapat fields from stock_lot_expiry to stock_lot_sled
fields: stock_lot.expiry_date
version: 4.8
query: ALTER TABLE stock_lot RENAME COLUMN expiry_date TO expiration_date;
- comment: # Tax migration from new tax rules. on 4.7
tables: aeat_347_record
version: 5.2
query: create table if not exists mapping_taxes as select
a.*,
t.template as parent_template,
t.name
from (
select
t.id as tax_id,
t.name as tax_name,
t.parent as tax_parent,
t.include_347,
t.recargo_equivalencia,
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 and t.recargo_equivalencia=false
UNION ALL
select
t.id as tax_id,
t.name as tax_name,
t.parent as tax_parent,
t.include_347,
t.recargo_equivalencia,
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 and t.recargo_equivalencia=false
UNION ALL
select
t.id as tax_id,
t.name as tax_name,
t.parent as tax_parent,
t.include_347,
t.recargo_equivalencia,
i.fs_id,
i.db_id as template_id,
rtrim(rtrim(rtrim(split_part(i.fs_id, '+',2),'_child'), 'iva'), '_re')
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 = true and t.recargo_equivalencia=true
UNION ALL
select
t.id as tax_id,
t.name as tax_name,
t.parent as tax_parent,
t.include_347,
t.recargo_equivalencia,
i.fs_id,
i.db_id as template_id,
rtrim(rtrim(rtrim(split_part(i.fs_id, '+',1),'_child'), 'iva'), '_re')
from
ir_model_data i,
account_tax_template tt,
account_tax t
where tt.id = t.template and
i.model='account.tax.template' and
i.module='account_es' and
i.db_id = tt.id and
t.parent is not null and fs_id like '%+re%iva_child'
) as a,
account_tax t
where a.tax_parent = t.id
- comment: remove deferral value in ir_model_data
version: 4.0
query: UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["deferral", false], ', '') where fs_values ilike '%["deferral", false],%' and module = 'account_es';
UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["deferral", true], ', '') where fs_values ilike '%["deferral", true],%' and module = 'account_es';
UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["deferral",true],', '') where fs_values ilike '%["deferral",true],%' and module = 'account_es';
UPDATE ir_model_data set fs_values = REPLACE(fs_values, '["deferral",false],', '') where fs_values ilike '%["deferral",false],%' and module = 'account_es';
- tables: stock_location
version: 4.0
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
version: 6.0
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
version: 6.0
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
version: 4.0
query: ALTER TABLE shipment_work RENAME COLUMN project TO work_project
- fields: sale_sale.project
version: 4.0
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: babi introduces the company field with NOT NULL to babi_report_execution so we drop all data to ensure the constraint can be added
version: 4.2
tables: babi_report_execution
query: DELETE FROM babi_report_execution;
- 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
tables: account_tax_rule
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
tables: account_journal
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
tables: 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));
- comment: # delete properties of party and account without foreign key
version: 4.7
tables: account_account
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));
- 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
tables: account_account_template
query: ALTER TABLE account_account_template DROP CONSTRAINT if exists "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: # 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;
- 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
tables: aeat_347_report_property
query: ALTER table aeat_347_report_property alter column number TYPE varchar(5);
- comment: # alter table aeat_303_report column previous_declaration_receipt
version: 4.2
tables: aeat_303_report
query: ALTER TABLE aeat_303_report ALTER COLUMN previous_declaration_receipt TYPE VARCHAR(13);
- comment: # remove deprecated journal type ir.model.data
version: 5.0
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: # Delete unused crons
version: 4.8
query: DELETE from ir_cron where function in ('generate_requests', 'generate_internal_shipment');
DELETE from ir_model_data where module = 'stock_supply' and model = 'ir.cron';
- comment: # Delete unused crons
version: 5.2
query: ALTER TABLE ir_cron DROP CONSTRAINT ir_cron_user_fkey;
- comment: # Delete unused crons
version: 5.4
fields: ir_cron.function
query: DELETE from ir_cron where function in ('cron_post_clearing_moves');
DELETE from ir_cron where function in ('trigger_time');
- comment: # Delete unused crons
version: 5.4
query:
DELETE from ir_model_data where fs_id = 'cron_post_clearing_moves' and model = 'ir.cron';
DELETE FROM res_user WHERE login IN ('user_cron_post_clearing_moves');
DELETE FROM ir_model_data WHERE model='res.user' AND fs_id IN ('user_post_clearing_moves');
DELETE from ir_model_data where fs_id = 'cron_trigger_time' and model = 'ir.cron';
DELETE FROM res_user WHERE login IN ('user_cron_trigger');
DELETE FROM ir_model_data WHERE model='res.user' AND fs_id IN ('user_trigger');
DELETE FROM res_user WHERE login IN ('user_cron_internal_esale');
DELETE FROM ir_model_data WHERE model='res.user' AND fs_id IN ('user_cron_internal_esale');
- comment: # Delete unused crons esale
version: 5.4
query:
DELETE FROM ir_model_data where fs_id = 'cron_esale_import_order' and model = 'ir.cron';
DELETE FROM ir_model_data where fs_id = 'cron_esale_export_state' and model = 'ir.cron';
DELETE FROM res_user where id in (select db_id from ir_model_data where model = 'res.user' and module = 'esale' and fs_id = 'user_esale');
DELETE FROM ir_model_data where model = 'res.user' and module = 'esale' and fs_id = 'user_esale';
- comment: # Remove error translations
version: 5.1
query: DELETE FROM "ir_translation" WHERE "type" = 'error';
- comment: # Remove src_md5 from ir_translation
version: 5.1
query: ALTER TABLE "ir_translation" DROP CONSTRAINT if exists "ir_translation_translation_md5_uniq";
- comment: # Remove src_md5 from ir_translation
version: 5.1
query: ALTER TABLE "ir_translation" DROP COLUMN if exists "src_md5";
- comment: # Rename account_category from product, if migrating from 4.0 or higher thtows error because accounts_category already exists
version: 4.0
query: ALTER TABLE product_template RENAME column account_category TO accounts_category;
- comment: # Change cast of month on account_invoice_payment_term_line
version: 4.0
fields: account_invoice_payment_term_line.month
query: ALTER TABLE account_invoice_payment_term_line ALTER COLUMN month TYPE INTEGER USING month::INT
- comment: # Change cast of weekday on account_invoice_payment_term_line
version: 4.0
fields: account_invoice_payment_term_line.weekday
query: ALTER TABLE account_invoice_payment_term_line ALTER COLUMN weekday TYPE INTEGER USING weekday::INT
- comment: # Set Second Currency of account_Account null if it's equal of company currency
version: 4.8
tables: account_account
query: update account_account set second_currency = null where second_currency=(select currency from company_company where id=company)
- 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.
version: 5.2
fields: production_lead_time.lead_time
query: ALTER TABLE production_lead_time DROP COLUMN lead_time;
- script: ./upgrades/before/remove_deprecated_taxes.py
version: 5.2
- comment: replace account_payment_sepa_message from TEXT to BYTEA
version: 5.4
tables: account_payment_sepa_message
query: ALTER TABLE account_payment_sepa_message ALTER COLUMN message TYPE BYTEA USING message::BYTEA;
- comment: # Delete unused users
version: 4.8
query: 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';
DELETE FROM ir_model_data WHERE module = 'res' AND model = 'res.user' AND fs_id IN ('user_trigger', 'user_cron_trigger');
- comment: # Upgrade 5.6
version: 5.6
tables: sale_amendment_line
query: ALTER TABLE sale_amendment_line DROP CONSTRAINT sale_amendment_line_shipment_party_fkey;
- comment: Delete nantic_connection users which were removed in 5.4 branch
version: 5.4
query: DELETE FROM res_user WHERE login IN ('user_cron_send_data', 'user_cron_send_modules', 'user_send_modules', 'user_send_data');
DELETE FROM ir_model_data WHERE model='res.user' AND fs_id IN ('user_cron_send_data', 'user_cron_send_modules', 'user_send_modules', 'user_send_data');
- 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;
# From 5.4 to 5.6
# https://discuss.tryton.org/t/migration-from-5-4-to-5-6/2303
#
#
# From 5.6 to 5.8
# https://discuss.tryton.org/t/migration-from-5-6-to-5-8/3341
#
# From 5.8 to 6.0
# https://discuss.tryton.org/t/migration-from-5-8-to-6-0/3603
- comment: before update, add access on field
version: 5.8
query: ALTER TABLE ir_model_field ADD COLUMN IF NOT EXISTS "access" BOOLEAN;
- comment: Delete unused users
version: 5.8
query: DELETE FROM res_user WHERE login IN ('user_trigger', 'user_cron_purchase_request', 'user_cron_internal_shipment', 'user_cron_production_request', 'user_cron_trigger', 'user_cron_process_purchase', 'user_cron_process_sale', 'user_cron_post_clearing_moves', 'user_send_modules', 'user_send_data', 'user_clean_executions', 'user_cron_deactivate_lots_without_stock');
- comment: Delete unused users
version: 5.8
query: DELETE FROM ir_model_data WHERE fs_id IN ('user_clean_executions', 'user_deactivate_lots_without_stock');
- comment: Before update, the foreign key of shipment_party of sale amendment must be recreated
version: 5.8
tables: sale_amendment_line
query: ALTER TABLE sale_amendment_line DROP CONSTRAINT sale_amendment_line_shipment_party_fkey;
- comment: Remove user_send_summary user (brain)
version: 5.8
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';
- comment: Delete sale_discount, purchase_discount and account_invoice_discount reports
version: 5.8
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';
- comment: Replace sale_customer_product to sale_product_customer
version: 5.4
tables: sale_product_customer
query: ALTER TABLE sale_product_customer rename column product to template;
- comment: ir.cron set hour 0 where is 24
fields: ir_cron.hour
version: 5.4
query: UPDATE ir_cron set hour = 0 where hour = 24;
- comment: rename contact to invoice_contact
version: 5.6
fields: account_invoice.contact
tables: account_invoice
query: ALTER table account_invoice rename contact to invoice_contact;
- comment: rename contact to invoice_contact
version: 5.6
fields: sale_sale.contact
tables: sale_sale
query: ALTER table sale_sale rename contact to invoice_contact;
- comment: replace sequence_type_lot from stock_lot_sequence to sequence_type_stock_lot from stock_lot module
version: 6.4
fields: ir_sequence.sequence_type
query: update ir_sequence set sequence_type = (select db_id from ir_model_data where module = 'stock_lot' and fs_id = 'sequence_type_stock_lot') where sequence_type = (select db_id from ir_model_data where module = 'stock_lot_sequence' and fs_id = 'sequence_type_lot');
update ir_sequence set sequence_type = (select db_id from ir_model_data where module = 'farm' and fs_id = 'sequence_type_lot') where sequence_type = (select db_id from ir_model_data where module = 'farm' and fs_id = 'sequence_type_lot');
- comment: remove domain act_window employee_leave module
version: 6.0
query: update ir_model_data set fs_values = '[["name","Employee Leave Summary"],["res_model","employee.leave.summary"]]' where fs_id = 'act_employee_leave_summary';
update ir_model_data set fs_values = '[["name","Employee Entitlement"],["res_model","employee.leave.entitlement"]]' where fs_id = 'act_employee_leave_entitlement';
update ir_action_act_window set domain = null where id = (select db_id from ir_model_data where fs_id = 'act_employee_leave_entitlement');
update ir_action_act_window set domain = null where id = (select db_id from ir_model_data where fs_id = 'act_employee_leave_summary');
- comment: upgrade incoterm 2020
version: 6.0
query: delete from ir_model_data where module = 'incoterm' and fs_id = 'incoterm_2010';
- comment: fix currency, invoice_type and party on invoice line
version: 6.0
tables: account_invoice_line
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 AND invoice 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 AND invoice IS NOT NULL;
- comment: drop constraint product_product_code_uniq
version: 6.0
tables: product_product
query: ALTER TABLE product_product DROP CONSTRAINT IF EXISTS product_product_code_uniq;
- comment: force load locales
version: 6.4
query: delete from ir_translation where name = 'account.configuration,default_product_account_expense' and lang in ('ca', 'es');
delete from ir_translation where name = 'account.configuration,default_product_account_revenue' and lang in ('ca', 'es');
- comment: company_bank with MultiValue - 072070
version: 6.4
tables: party_party-company_company
query: ALTER TABLE "party_party-company_company" DROP CONSTRAINT IF EXISTS "party_party-company_company_company_party_uniq";
ALTER TABLE "party_party-company_company" RENAME TO "party_party-bank_account-company";ALTER TABLE "party_party-company_company_id_seq" RENAME TO "party_party-bank_account-company_id_seq";
ALTER TABLE "party_party-bank_account-company" RENAME COLUMN receivable_bank_account TO receivable_company_bank_account;
ALTER TABLE "party_party-bank_account-company" RENAME COLUMN payable_bank_account TO payable_company_bank_account;
- comment: Migration incoterm nantic to core
version: 6.4
tables: incoterm
query: alter table incoterm rename to incoterm_incoterm;alter table incoterm_id_seq rename to incoterm_incoterm_id_seq;
alter table incoterm_incoterm drop column active;
update ir_model_data set model = 'incoterm.incoterm' where module = 'incoterm' and model = 'incoterm';
update ir_model_data set fs_id = 'incoterm_exw_2010' where fs_id = 'incoterm_exw' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_fca_2010' where fs_id = 'incoterm_fca' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_cpt_2010' where fs_id = 'incoterm_cpt' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_cip_2010' where fs_id = 'incoterm_cip' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_dap_2010' where fs_id = 'incoterm_dap' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_dpu_2020' where fs_id = 'incoterm_dpu' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_ddp_2010' where fs_id = 'incoterm_ddp' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_fas_2010' where fs_id = 'incoterm_fas' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_fob_2010' where fs_id = 'incoterm_fob' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_cfr_2010' where fs_id = 'incoterm_cfr' and module = 'incoterm';
update ir_model_data set fs_id = 'incoterm_cif_2010' where fs_id = 'incoterm_cif' and module = 'incoterm';
delete from ir_action_act_window where id in (select db_id from ir_model_data where module = 'incoterm' and model = 'ir.action.act_window');
delete from ir_action_act_window_view where id in (select db_id from ir_model_data where module = 'incoterm' and model = 'ir.action.act_window.view');
delete from ir_ui_menu where id in (select db_id from ir_model_data where module = 'incoterm' and model = 'ir.ui.menu');
delete from ir_ui_view where id in (select db_id from ir_model_data where module = 'incoterm' and model = 'ir.ui.view');
delete from ir_model_data where module = 'incoterm' and model in ('act_incoterm_form', 'ir.action.act_window', 'ir.action.act_window.view', 'ir.ui.menu', 'ir.ui.view');
delete from ir_translation where module in ('incoterm', 'sale_incoterm', 'purchase_incoterm');
- comment: Allow upgrade issue11198 before run script. Note this is linked to another 'after' script that can be found searching for issue11198 in this file.
version: 6.4
fields: bank_account_number.number_compact
query: ALTER TABLE bank_account_number RENAME number_compact TO number_compact2;
- comment: Allow upgrade issue11198 before run script. Note this is linked to another 'after' script that can be found searching for issue11198 in this file.
version: 6.4
fields: bank_account_number.account
query: ALTER TABLE bank_account_number RENAME account TO account2;
- comment: uninstall stock_update_planned_date
version: 5.8
fields: ir_cron.method
query: delete from ir_cron where method like '%update_planned_date%';
- comment: rename ir.model.data fs_id
version: 6.8
query: update ir_model_data set fs_id = replace(fs_id, ' ', '') where fs_id in ('es_pyg_normal_49400 ', 'es_2021_pyg_normal_49400 ') and module = 'account_financial_statement_es';
- comment: set company to null to allow insert data from account.journal_miscellaneous and account.journal_currency_exchange
version: 6.8
fields: ir_sequence.company
query: update ir_sequence set company = null where id in (select db_id from ir_model_data where fs_id = 'sequence_account_journal' and model = 'ir.sequence');
- comment: Remove translations for non-existing modules as this is required for the foreign key added
version: 7.2
query: DELETE FROM ir_translation WHERE module NOT IN (SELECT name FROM ir_module);
DELETE FROM ir_translation WHERE module in ('account_invoice_3_discounts', 'sale_3_discounts', 'sale_external_price', 'stock_lot_quantity', 'account_invoice_post_wizard', 'party_communication', 'product_sale_line_relation', 'base_external_mapping', 'brain', 'asterisk', 'dbcopy', 'commission_party', 'commission_invoice_posted2draft', 'csv_import', 'quality_control_trigger', 'party_asterisk', 'party_search', 'party_social_contact', 'product_code_unique', 'product_review', 'product_template_form_quantity', 'product_qty', 'product_search_code', 'production_quality_control_trigger_lot', 'production_package', 'project_menu_tree_remove', 'purchase_incoterm', 'purchase_product_supplier', 'shine', 'stock_picking_box', 'stock_update_planned_date', 'stock_lot_quantity_location', 'stock_reservation', 'stock_supply_production_warehouse', 'webdav', 'account_invoice_sale_relation', 'account_invoice_line_search_by_shipment', 'account_invoice_search_by_purchase', 'production_split');
# TODO: There are more steps to implement on the migration from 6.8 to 7.0
- comment: https://discuss.tryton.org/t/migration-from-6-8-to-7-0/6265
version: 7.0
fields: account_payment.account
query:
UPDATE account_payment SET account = null WHERE line IS NOT NULL;
- comment: https://discuss.tryton.org/t/migration-from-7-0-to-7-2/7163
version: 7.2
query:
UPDATE ir_ui_view SET model = null WHERE model = '';
UPDATE ir_action_act_window SET res_model = null WHERE res_model = '';
UPDATE ir_action_wizard SET model = null WHERE model = '';
UPDATE ir_action_report SET model = null WHERE model = '';
UPDATE ir_action_report SET module = null WHERE module = '';
- comment: Remove ui_view_tree_width for non-existing field/model pairs
version: 7.2
query:
DELETE FROM ir_ui_view_tree_width WHERE (field, model) NOT IN (SELECT f.name, m.model FROM ir_model m, ir_model_field f WHERE m.id=f.model);
DELETE from ir_ui_view_tree_width where field in ('discount1', 'discount2', 'discount3');
- comment: UPDATE ir_action_act_window's context_model if the model does not exist
version: 7.2
query:
UPDATE ir_action_act_window SET context_model=NULL WHERE context_model NOT IN (SELECT model FROM ir_model);
- comment: Remove ir_model_data records for no longer existing modules
version: 7.2
query:
DELETE FROM ir_model_data WHERE module NOT IN (SELECT name FROM ir_module);
- comment: ir_ui_view payment_process_start_form set type form and remove inherit
version: 7.0
query: UPDATE ir_ui_view SET type = 'form', inherit = null where name = 'payment_process_start_form' and module = 'account_payment_es';
UPDATE ir_model_data set fs_values = '[["model","account.payment.process.start"],["name","payment_process_start_form"],["type","form"]]', values = '[["model","account.payment.process.start"],["name","payment_process_start_form"],["type","form"]]' where module = 'account_payment_es' and fs_id = 'payment_process_start_view_form' and fs_values like '%inherit%';
- comment: rename constraint bank_account_number_number_iban_active_exclude in case has party_company module activated
version: 7.0
tables: party_company_rel bank_account_number
query:
ALTER TABLE bank_account_number DROP CONSTRAINT if exists bank_account_number_number_iban_exclude;
ALTER TABLE bank_account_number ADD CONSTRAINT bank_account_number_number_iban_active_exclude CHECK (type::text <> 'x'::text);
- comment: Rename supply_on_sale because 6.8 is multivalue patch and not required to migrate data
version: 7.2
fields: product_template.supply_on_sale
query: ALTER TABLE product_template RENAME COLUMN supply_on_sale TO _temp_supply_on_sale;
- comment: Rename supply_on_sale because 6.8 is multivalue patch and not required to migrate data
version: 7.2
fields: product_template__history.supply_on_sale
query: ALTER TABLE product_template__history RENAME COLUMN supply_on_sale TO _temp_supply_on_sale;
- comment: Remove ir_ui_view_search related to model that not exist
query: DELETE from ir_ui_view_search where model not in (select model from ir_model);
- comment: replace party identifiers to eu_vat
tables: party_identifier
query: update party_identifier set code = concat('ES', code), type = 'eu_vat' where type = 'es_dni';
- comment: drop constraint imap_server_account_uniq
version: 6.8
tables: imap_server
query: ALTER TABLE imap_server DROP CONSTRAINT IF EXISTS imap_server_account_uniq;
- comment: Rename stock_configuration_product_template_form_quantity from product_quantity
version: 7.2
tables: stock_configuration_product_template_form_quantity
query: ALTER TABLE stock_configuration_product_template_form_quantity RENAME TO stock_configuration_product_quantity;
- comment: drop oldest constraint
version: 7.2
tables: imap_server
query: ALTER TABLE imap_server DROP CONSTRAINT IF EXISTS imap_server_account_uniq;
after:
- comment: Remove include_347 from party
version: 5.1
tables: party_party
query: ALTER TABLE party_party DROP COLUMN IF EXISTS include_347;
- comment: Remove include_347 from account_tax_rule
version: 5.1
tables: account_tax_rule
query: ALTER TABLE account_tax_rule DROP COLUMN IF EXISTS include_347;
- comment: Remove include_347 from account_tax_rule_template
version: 5.1
tables: account_tax_rule_template
query: ALTER TABLE account_tax_rule_template DROP COLUMN IF EXISTS include_347;
- DELETE FROM ir_translation WHERE module = 'account_es_pyme';
- comment: -> Change sign on account_tax_line
version: 3.8 # TODO: check i 3.8 needs.
query: update account_tax_line set amount=amount*-1 where type = 'tax' and tax in (select id from account_tax where name ilike '%(2)%');
- comment: # translations fuzzy to false
version: 5.2
query: UPDATE ir_translation set fuzzy = false where fuzzy = true and res_id = -1;
- comment: -> 4.8
version: 4.8
tables: aeat_303_mapping-account_tax_code
query: delete from "aeat_303_mapping-account_tax_code"
- commnet: -> 4.8
version: 4.8
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
version: 5.2
tables: res_user_login_attempt
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
version: 5.2
tables: account_move_reconciliation
query: UPDATE account_move_reconciliation SET date=create_date WHERE date IS NULL;
- tables: account_move_reconciliation
version: 5.2
query: ALTER TABLE account_move_reconciliation ALTER COLUMN date SET NOT NULL;
- tables: contract
version: 5.2
query: UPDATE contract SET first_invoice_date=start_period_date WHERE first_invoice_date IS NULL;
- tables: asset
version: 5.2
query: ALTER TABLE asset ALTER COLUMN company SET NOT NULL;
- tables: timesheet_line
version: 5.2
query: ALTER TABLE timesheet_line ALTER COLUMN duration SET NOT NULL;
- tables: stock_shipment_in_return
version: 5.2
query: ALTER TABLE stock_shipment_in_return ALTER COLUMN supplier SET NOT NULL;
- tables: contract
version: 5.2
query: ALTER TABLE contract ALTER COLUMN first_invoice_date SET NOT NULL;
- tables: asset
version: 5.2
query: UPDATE asset SET company = 1 WHERE company IS NULL;
- comment: Drop category column
version: 5.2
fields: product_template.category
query: ALTER TABLE product_template DROP COLUMN category;
- tables: country_zip
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
version: 4.0
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: # Set product as producible
version: 4.7
tables: "product_product-production_bom"
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: # deprecated model
version: 4.7
query: DELETE from ir_model_data where model = 'account.journal.type'
- 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 and customer_reference != '';
- 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);