You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							66 lines
						
					
					
						
							2.7 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							66 lines
						
					
					
						
							2.7 KiB
						
					
					
				| # -*- coding: utf-8 -*- | |
| ############################################################################# | |
| # | |
| #    Cybrosys Technologies Pvt. Ltd. | |
| # | |
| #    Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) | |
| #    Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) | |
| # | |
| #    You can modify it under the terms of the GNU LESSER | |
| #    GENERAL PUBLIC LICENSE (LGPL v3), Version 3. | |
| # | |
| #    This program is distributed in the hope that it will be useful, | |
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |
| #    GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. | |
| # | |
| #    You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE | |
| #    (LGPL v3) along with this program. | |
| #    If not, see <http://www.gnu.org/licenses/>. | |
| # | |
| ############################################################################# | |
| from odoo import models, _ | |
| 
 | |
| 
 | |
| class AccountJournal(models.Model): | |
|     """Module inherited for adding the reconcile method in the account | |
|     journal""" | |
|     _inherit = "account.journal" | |
| 
 | |
|     def action_open_reconcile(self): | |
|         """Function to open reconciliation view for bank statements | |
|         belonging to this journal""" | |
|         if self.type in ['bank', 'cash']: | |
|             # Open reconciliation view for bank statements belonging | |
|             # to this journal | |
|             bank_stmt = self.env['account.bank.statement'].search( | |
|                 [('journal_id', 'in', self.ids)]).mapped('line_ids') | |
|             return { | |
|                 'type': 'ir.actions.client', | |
|                 'tag': 'bank_statement_reconciliation_view', | |
|                 'context': {'statement_line_ids': bank_stmt.ids, | |
|                             'company_ids': self.mapped('company_id').ids}, | |
|             } | |
|         else: | |
|             # Open reconciliation view for customers/suppliers | |
|             action_context = {'show_mode_selector': False, | |
|                               'company_ids': self.mapped('company_id').ids} | |
|             if self.type == 'sale': | |
|                 action_context.update({'mode': 'customers'}) | |
|             elif self.type == 'purchase': | |
|                 action_context.update({'mode': 'suppliers'}) | |
|             return { | |
|                 'type': 'ir.actions.client', | |
|                 'tag': 'manual_reconciliation_view', | |
|                 'context': action_context, | |
|             } | |
| 
 | |
|     def create_cash_statement(self): | |
|         """for redirecting in to bank statement lines""" | |
|         return { | |
|             'name': _("Statements"), | |
|             'type': 'ir.actions.act_window', | |
|             'res_model': 'account.bank.statement.line', | |
|             'view_mode': 'list,form', | |
|             'context': {'default_journal_id': self.id}, | |
|         }
 | |
| 
 |