@@ -653,77 +653,6 @@ def _l10n_it_fatturapa_post_migration_payment_data(env):
653
653
move .sudo ().message_post (body = message )
654
654
655
655
656
- def _l10n_it_fatturapa_post_migration_related_document_type (env ):
657
- env .cr .execute ("""
658
- SELECT invoice_id, invoice_line_id, type, name, date, code, cig, cup
659
- FROM fatturapa_related_document_type
660
- WHERE invoice_id IS NOT NULL OR invoice_line_id IS NOT NULL
661
- """ )
662
- rows = env .cr .fetchall ()
663
- invoice_map = {}
664
- for row in rows :
665
- invoice_id , invoice_line_id , document_type , name , date , code , cig , cup = row
666
- move_id = (
667
- invoice_id or env ["account.move.line" ].browse (invoice_line_id ).move_id .id
668
- )
669
- if move_id :
670
- invoice_map .setdefault (move_id , []).append (
671
- (document_type , name , date , code , cig , cup )
672
- )
673
-
674
- moves = env ["account.move" ].browse (invoice_map .keys ())
675
- out_moves = moves .filtered (lambda m : m .is_sale_document ())
676
- for move in out_moves :
677
- for index , (document_type , name , date , code , cig , cup ) in enumerate (
678
- invoice_map [move .id ], start = 1
679
- ):
680
- if index == 1 :
681
- if document_type == "order" :
682
- document_type = "purchase_order"
683
- elif document_type not in ["contract" , "agreement" ]:
684
- document_type = ""
685
- move .l10n_it_origin_document_type = document_type
686
- move .l10n_it_origin_document_name = name
687
- move .l10n_it_origin_document_date = date
688
- move .l10n_it_cig = cig
689
- move .l10n_it_cup = cup
690
- else :
691
- document_type_tags = Markup ('<ul class="mb-0">{}</ul>' ).format (
692
- Markup ().join (
693
- nl2br_enclose (" " .join (tag .split ()), "li" )
694
- for tag in [
695
- f"IdDocumento: { name } " ,
696
- f'Data: { date or "N/A" } ' ,
697
- f'CodiceCommessaConvenzione: { code or "N/A" } ' ,
698
- f'CodiceCIG: { cig or "N/A" } ' ,
699
- f'CodiceCUP: { cup or "N/A" } ' ,
700
- ]
701
- )
702
- )
703
- message = Markup ("{} {}<br/>{}" ).format (
704
- document_type , env ._ ("from XML file:" ), document_type_tags
705
- )
706
- move .sudo ().message_post (body = message )
707
- for move in moves - out_moves :
708
- for document_type , name , date , code , cig , cup in invoice_map [move .id ]:
709
- document_type_tags = Markup ('<ul class="mb-0">{}</ul>' ).format (
710
- Markup ().join (
711
- nl2br_enclose (" " .join (tag .split ()), "li" )
712
- for tag in [
713
- f"IdDocumento: { name } " ,
714
- f'Data: { date or "N/A" } ' ,
715
- f'CodiceCommessaConvenzione: { code or "N/A" } ' ,
716
- f'CodiceCIG: { cig or "N/A" } ' ,
717
- f'CodiceCUP: { cup or "N/A" } ' ,
718
- ]
719
- )
720
- )
721
- message = Markup ("{} {}<br/>{}" ).format (
722
- document_type , env ._ ("from XML file:" ), document_type_tags
723
- )
724
- move .sudo ().message_post (body = message )
725
-
726
-
727
656
def _l10n_it_fatturapa_post_migration (env ):
728
657
table = "res_partner"
729
658
rename_fields (
@@ -802,7 +731,6 @@ def _l10n_it_fatturapa_post_migration(env):
802
731
_l10n_it_fatturapa_post_migration_delivery_data (env )
803
732
_l10n_it_fatturapa_post_migration_vehicle_data (env )
804
733
_l10n_it_fatturapa_post_migration_payment_data (env )
805
- _l10n_it_fatturapa_post_migration_related_document_type (env )
806
734
807
735
808
736
def _l10n_it_fatturapa_in_pre_migration (env ):
@@ -1014,6 +942,10 @@ def _l10n_it_fiscalcode_post_migration(env):
1014
942
rename_fields (
1015
943
env , table , {"l10n_it_codice_fiscale" : "fiscalcode" }, condition = condition
1016
944
)
945
+ table = "res_company"
946
+ rename_fields (
947
+ env , table , {"l10n_it_codice_fiscale" : "fiscalcode" }, condition = condition
948
+ )
1017
949
1018
950
1019
951
def _l10n_it_ipa_post_migration (env ):
@@ -1045,6 +977,14 @@ def _l10n_it_rea_post_migration(env):
1045
977
},
1046
978
condition ,
1047
979
)
980
+ openupgrade .logged_query (
981
+ env .cr ,
982
+ """
983
+ UPDATE res_company
984
+ SET l10n_it_has_eco_index = 't'
985
+ WHERE l10n_it_eco_index_number IS NOT NULL
986
+ """ ,
987
+ )
1048
988
1049
989
1050
990
def _l10n_it_vat_payability_pre_migration (env ):
0 commit comments