mirror of
				https://github.com/brain-tec/account_ebics.git
				synced 2025-11-03 22:50:59 +00:00 
			
		
		
		
	add extra check on bank account in init cycle
This commit is contained in:
		@@ -240,6 +240,11 @@ class EbicsUserID(models.Model):
 | 
				
			|||||||
            bank, user, version=ebics_version)
 | 
					            bank, user, version=ebics_version)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Send the public electronic signature key to the bank.
 | 
					        # Send the public electronic signature key to the bank.
 | 
				
			||||||
 | 
					        ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id
 | 
				
			||||||
 | 
					        if not ebics_config_bank:
 | 
				
			||||||
 | 
					            raise UserError(_(
 | 
				
			||||||
 | 
					                "No bank defined for the financial journal "
 | 
				
			||||||
 | 
					                "of the EBICS Config"))
 | 
				
			||||||
        try:
 | 
					        try:
 | 
				
			||||||
            supported_versions = client.HEV()
 | 
					            supported_versions = client.HEV()
 | 
				
			||||||
            if ebics_version not in supported_versions:
 | 
					            if ebics_version not in supported_versions:
 | 
				
			||||||
@@ -288,8 +293,8 @@ class EbicsUserID(models.Model):
 | 
				
			|||||||
            self.ebics_config_id._update_order_number(OrderID)
 | 
					            self.ebics_config_id._update_order_number(OrderID)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Create an INI-letter which must be printed and sent to the bank.
 | 
					        # Create an INI-letter which must be printed and sent to the bank.
 | 
				
			||||||
        bank = self.ebics_config_id.journal_ids[0].bank_id
 | 
					        ebics_config_bank = self.ebics_config_id.journal_ids[0].bank_id
 | 
				
			||||||
        cc = bank.country.code
 | 
					        cc = ebics_config_bank.country.code
 | 
				
			||||||
        if cc in ['FR', 'DE']:
 | 
					        if cc in ['FR', 'DE']:
 | 
				
			||||||
            lang = cc
 | 
					            lang = cc
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
@@ -304,7 +309,7 @@ class EbicsUserID(models.Model):
 | 
				
			|||||||
            [self.ebics_config_id.ebics_host, 'ini_letter', fn_date]) + '.pdf'
 | 
					            [self.ebics_config_id.ebics_host, 'ini_letter', fn_date]) + '.pdf'
 | 
				
			||||||
        full_tmp_fn = os.path.normpath(tmp_dir + '/' + fn)
 | 
					        full_tmp_fn = os.path.normpath(tmp_dir + '/' + fn)
 | 
				
			||||||
        user.create_ini_letter(
 | 
					        user.create_ini_letter(
 | 
				
			||||||
            bankname=bank.name,
 | 
					            bankname=ebics_config_bank.name,
 | 
				
			||||||
            path=full_tmp_fn,
 | 
					            path=full_tmp_fn,
 | 
				
			||||||
            lang=lang)
 | 
					            lang=lang)
 | 
				
			||||||
        with open(full_tmp_fn, 'rb') as f:
 | 
					        with open(full_tmp_fn, 'rb') as f:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user