mirror of
				https://github.com/brain-tec/account_ebics.git
				synced 2025-11-03 22:50:59 +00:00 
			
		
		
		
	[14.0][MIG]account_ebics
This commit is contained in:
		
							
								
								
									
										17
									
								
								account_ebics_oca_statement_import/README.rst
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								account_ebics_oca_statement_import/README.rst
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					.. image:: https://img.shields.io/badge/license-LGPL--3-blue.png
 | 
				
			||||||
 | 
					   :target: https://www.gnu.org/licenses/lgpl
 | 
				
			||||||
 | 
					   :alt: License: LGPL-3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					==========================================================
 | 
				
			||||||
 | 
					Deploy account_ebics module with OCA Bank Statement Import
 | 
				
			||||||
 | 
					==========================================================
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This module makes it possible to use OCA account_statement_import
 | 
				
			||||||
 | 
					in combination with 'account_ebics'.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					This module will be installed automatically when following modules are activated
 | 
				
			||||||
 | 
					on your odoo database :
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- account_ebics
 | 
				
			||||||
 | 
					- account_statement_import
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										1
									
								
								account_ebics_oca_statement_import/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								account_ebics_oca_statement_import/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					from . import wizards
 | 
				
			||||||
							
								
								
									
										17
									
								
								account_ebics_oca_statement_import/__manifest__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								account_ebics_oca_statement_import/__manifest__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					# Copyright 2020 Noviat.
 | 
				
			||||||
 | 
					# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    'name': 'account_ebics with OCA Bank Statement Imoort',
 | 
				
			||||||
 | 
					    'summary': "Use OCA Bank Statement Import with account_ebics",
 | 
				
			||||||
 | 
					    'version': '14.0.1.0.0',
 | 
				
			||||||
 | 
					    'author': 'Noviat',
 | 
				
			||||||
 | 
					    'category': 'Hidden',
 | 
				
			||||||
 | 
					    'license': 'LGPL-3',
 | 
				
			||||||
 | 
					    'depends': [
 | 
				
			||||||
 | 
					        'account_ebics',
 | 
				
			||||||
 | 
					        'account_statement_import',
 | 
				
			||||||
 | 
					    ],
 | 
				
			||||||
 | 
					    'installable': True,
 | 
				
			||||||
 | 
					    'auto_install': True,
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										
											BIN
										
									
								
								account_ebics_oca_statement_import/static/description/icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								account_ebics_oca_statement_import/static/description/icon.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 17 KiB  | 
							
								
								
									
										1
									
								
								account_ebics_oca_statement_import/wizards/__init__.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								account_ebics_oca_statement_import/wizards/__init__.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
				
			|||||||
 | 
					from . import account_statement_import
 | 
				
			||||||
@@ -0,0 +1,62 @@
 | 
				
			|||||||
 | 
					# Copyright 2009-2020 Noviat.
 | 
				
			||||||
 | 
					# License LGPL-3 or later (http://www.gnu.org/licenses/lpgl).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import logging
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from odoo import models, _
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					_logger = logging.getLogger(__name__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class AccountStatementImport(models.TransientModel):
 | 
				
			||||||
 | 
					    _inherit = 'account.statement.import'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _check_parsed_data(self, stmts_vals):
 | 
				
			||||||
 | 
					        """ Basic and structural verifications """
 | 
				
			||||||
 | 
					        if self.env.context.get('active_model') == 'ebics.file':
 | 
				
			||||||
 | 
					            message = False
 | 
				
			||||||
 | 
					            if len(stmts_vals) == 0:
 | 
				
			||||||
 | 
					                message = _("This file doesn't contain any statement.")
 | 
				
			||||||
 | 
					            if not message:
 | 
				
			||||||
 | 
					                no_st_line = True
 | 
				
			||||||
 | 
					                for vals in stmts_vals:
 | 
				
			||||||
 | 
					                    if vals['transactions'] and len(vals['transactions']) > 0:
 | 
				
			||||||
 | 
					                        no_st_line = False
 | 
				
			||||||
 | 
					                        break
 | 
				
			||||||
 | 
					                if no_st_line:
 | 
				
			||||||
 | 
					                    message = _('This file doesn\'t contain any transaction.')
 | 
				
			||||||
 | 
					                if message:
 | 
				
			||||||
 | 
					                    log_msg = _(
 | 
				
			||||||
 | 
					                        "Error detected while processing and EBICS File"
 | 
				
			||||||
 | 
					                    ) + ':\n' + message
 | 
				
			||||||
 | 
					                    _logger.warn(log_msg)
 | 
				
			||||||
 | 
					                    return
 | 
				
			||||||
 | 
					        super()._check_parsed_data(stmts_vals)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def _create_bank_statements(self, stmts_vals, result):
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        Return error message to ebics.file when handling empty camt.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        Remarks/TODO:
 | 
				
			||||||
 | 
					        We could add more info to the message (e.g. date, balance, ...)
 | 
				
			||||||
 | 
					        and write this to the ebics.file, note field.
 | 
				
			||||||
 | 
					        We could also create empty bank statement (in state done) to clearly
 | 
				
			||||||
 | 
					        show days without transactions via the bank statement list view.
 | 
				
			||||||
 | 
					        """
 | 
				
			||||||
 | 
					        if self.env.context.get('active_model') == 'ebics.file':
 | 
				
			||||||
 | 
					            transactions = False
 | 
				
			||||||
 | 
					            for st_vals in stmts_vals:
 | 
				
			||||||
 | 
					                if st_vals.get('transactions'):
 | 
				
			||||||
 | 
					                    transactions = True
 | 
				
			||||||
 | 
					                    break
 | 
				
			||||||
 | 
					            if not transactions:
 | 
				
			||||||
 | 
					                message = _('This file doesn\'t contain any transaction.')
 | 
				
			||||||
 | 
					                statement_ids = []
 | 
				
			||||||
 | 
					                notifications = {
 | 
				
			||||||
 | 
					                    'type': 'warning',
 | 
				
			||||||
 | 
					                    'message': message,
 | 
				
			||||||
 | 
					                    'details': ''
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                return st_line_ids, [notifications]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return super()._create_bank_statements(stmts_vals, result)
 | 
				
			||||||
		Reference in New Issue
	
	Block a user