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.
		
		
		
		
		
			
		
			
				
					
					
						
							48 lines
						
					
					
						
							1.8 KiB
						
					
					
				
			
		
		
		
			
			
			
		
		
	
	
							48 lines
						
					
					
						
							1.8 KiB
						
					
					
				
								# -*- coding: utf-8 -*-
							 | 
						|
								#############################################################################
							 | 
						|
								#
							 | 
						|
								#    Cybrosys Technologies Pvt. Ltd.
							 | 
						|
								#
							 | 
						|
								#    Copyright (C) 2019-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 api, models, fields, _
							 | 
						|
								
							 | 
						|
								
							 | 
						|
								class CashFlow(models.Model):
							 | 
						|
								    _inherit = 'account.account'
							 | 
						|
								
							 | 
						|
								    def _domain_cash_flow_type(self):
							 | 
						|
								        cash_flow_id = self.env.ref(
							 | 
						|
								            'base_accounting_kit.account_financial_report_cash_flow0')
							 | 
						|
								        if cash_flow_id:
							 | 
						|
								            return [('parent_id.id', '=', cash_flow_id.id)]
							 | 
						|
								
							 | 
						|
								    cash_flow_type = fields.Many2one(
							 | 
						|
								        'account.financial.report', string="Cash Flow type",
							 | 
						|
								        domain=_domain_cash_flow_type)
							 | 
						|
								
							 | 
						|
								    @api.onchange('cash_flow_type')
							 | 
						|
								    def onchange_cash_flow_type(self):
							 | 
						|
								        for rec in self.cash_flow_type:
							 | 
						|
								            # update new record
							 | 
						|
								            rec.write({
							 | 
						|
								                'account_ids': [(4, self._origin.id)]
							 | 
						|
								            })
							 | 
						|
								        if self._origin.cash_flow_type.ids:
							 | 
						|
								            for rec in self._origin.cash_flow_type:
							 | 
						|
								                # remove old record
							 | 
						|
								                rec.write({'account_ids': [(3, self._origin.id)]})
							 | 
						|
								
							 |