mirror of
				https://github.com/brain-tec/account_ebics.git
				synced 2025-11-04 15:10:34 +00:00 
			
		
		
		
	[FIX] stack trace when OE camt parser discards a transaction line
The Odoo Enterprise CAMT parser may drop transactions during import e.g. in case of duplicates or when a 0.00 amount transaction is added to give some banking information via the CAMT file. This PR fixes a stack trace that occurs when that happens.
This commit is contained in:
		@@ -256,14 +256,18 @@ class EbicsFile(models.Model):
 | 
				
			|||||||
            errors = []
 | 
					            errors = []
 | 
				
			||||||
            warnings = []
 | 
					            warnings = []
 | 
				
			||||||
            for notif in notifications:
 | 
					            for notif in notifications:
 | 
				
			||||||
                if isinstance(notif, dict) and notif["type"] == "error":
 | 
					                if isinstance(notif, dict):
 | 
				
			||||||
 | 
					                    if notif.get("type") == "error":
 | 
				
			||||||
                        error_cnt += 1
 | 
					                        error_cnt += 1
 | 
				
			||||||
                        parts = [notif[k] for k in notif if k in ("message", "details")]
 | 
					                        parts = [notif[k] for k in notif if k in ("message", "details")]
 | 
				
			||||||
                    errors.append("\n".join(parts))
 | 
					                        errors.append("\n".join(parts) + "\n")
 | 
				
			||||||
                elif isinstance(notif, dict) and notif["type"] == "warning":
 | 
					                    elif notif.get("type") == "warning":
 | 
				
			||||||
                        warning_cnt += 1
 | 
					                        warning_cnt += 1
 | 
				
			||||||
                        parts = [notif[k] for k in notif if k in ("message", "details")]
 | 
					                        parts = [notif[k] for k in notif if k in ("message", "details")]
 | 
				
			||||||
                    warnings.append("\n".join(parts))
 | 
					                        warnings.append("\n".join(parts) + "\n")
 | 
				
			||||||
 | 
					                    else:
 | 
				
			||||||
 | 
					                        warning_cnt += 1
 | 
				
			||||||
 | 
					                        warnings.append(": ".join([*next(iter(notif.items()))]) + "\n")
 | 
				
			||||||
                elif isinstance(notif, str):
 | 
					                elif isinstance(notif, str):
 | 
				
			||||||
                    warning_cnt += 1
 | 
					                    warning_cnt += 1
 | 
				
			||||||
                    warnings.append(notif + "\n")
 | 
					                    warnings.append(notif + "\n")
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user