33
44ATTESTATION_TEMPLATE_ID = os .getenv ('ATTESTATION_TEMPLATE_ID' )
55PRESTATION_TEMPLATE_ID = os .getenv ('PRESTATION_TEMPLATE_ID' )
6+ INVOICING_TEMPLATE_ID = os .getenv ('INVOICING_TEMPLATE_ID' )
7+
68CONVENTION_TEMPLATE_ID = os .getenv ('CONVENTION_TEMPLATE_ID' )
79DOCUMENTS_BY_BOT_ID = os .getenv ('DOCUMENTS_BY_BOT_ID' )
810PAYMENTS_TEMPLATE_ID = os .getenv ('PAYMENTS_TEMPLATE_ID' )
@@ -58,8 +60,13 @@ def __init__(self, google, teacher, year, month):
5860 self .year = year
5961 self .month = month
6062
61- file_id = PRESTATION_TEMPLATE_ID if teacher .get ('contract' ) else ATTESTATION_TEMPLATE_ID
62- name = f"{ year } -{ month } { 'Prestations' if teacher .get ('contract' ) else 'Attestation' } { teacher .get ('name' )} "
63+ if teacher .get ("Contract_Type__c" ) == "Volunteering" :
64+ file_id = ATTESTATION_TEMPLATE_ID
65+ elif teacher .get ("Contract_Type__c" ) == "Article 17" or teacher .get ("Contract_Type__c" ) == "Student Contract" :
66+ file_id = PRESTATION_TEMPLATE_ID
67+ elif teacher .get ("Contract_Type__c" ) == "Invoicing" :
68+ file_id = INVOICING_TEMPLATE_ID
69+ name = f"{ year } -{ month } Prestations { teacher .get ('name' )} "
6370 log_details = teacher .get ('name' )
6471 self .log_details = log_details
6572 self .document_id = self ._Document__copy_document (file_id , name , log_details )
@@ -76,7 +83,7 @@ def fill(self):
7683 {'replaceAllText' : {'containsText' : {'text' : '{ADDRESS}' }, 'replaceText' : self .teacher .get ('address' )}},
7784 {'replaceAllText' : {'containsText' : {'text' : '{TOTAL_HOURS}' }, 'replaceText' : f"{ self .teacher .get ('hours' )} h{ self .teacher .get ('minutes' )} " }},
7885 {'replaceAllText' : {'containsText' : {'text' : '{TOTAL_AMOUNT}' }, 'replaceText' : str (self .teacher .get ('total_amount' ))}},
79- {'replaceAllText' : {'containsText' : {'text' : '{DESCRIPTIONS_FR}' }, 'replaceText' : '\n ' .join (list (map (lambda x : x .get ('nice_name' ), self .teacher .get ('events' ))))}},
86+ {'replaceAllText' : {'containsText' : {'text' : '{DESCRIPTIONS_FR}' }, 'replaceText' : '\n ' .join (list (map (lambda x : x .get ('nice_name' )[ 4 :] , self .teacher .get ('events' ))))}},
8087 {'replaceAllText' : {'containsText' : {'text' : '{TOTAL_HOURS_SECOND_HOURS}' }, 'replaceText' : str (round (self .teacher .get ('total_amount' ) / self .teacher .get ('contract' ))) if self .teacher .get ('contract' ) > 0 else "0" }},
8188 {'replaceAllText' : {'containsText' : {'text' : '{TOTAL_HOURS_SECOND_MIN}' }, 'replaceText' : str (round (((self .teacher .get ('total_amount' ) / self .teacher .get ('contract' )) % 1 ) * 60 )) if self .teacher .get ('contract' ) > 0 else "0" }},
8289 {'replaceAllText' : {'containsText' : {'text' : '{SALARY}' }, 'replaceText' : str (self .teacher .get ('contract' ))}}
0 commit comments