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.
 
 
 
 
 

46 lines
2.0 KiB

# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2018-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# Author: Fasluca(<faslu@cybrosys.in>)
# you can modify it under the terms of the GNU AFFERO
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details.
#
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
# GENERAL PUBLIC LICENSE (AGPL v3) along with this program.
# If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from odoo import models, api, _
class AccountJournal(models.Model):
_inherit = "account.journal"
@api.one
@api.depends('outbound_payment_method_ids')
def _compute_check_printing_payment_method_selected(self):
self.check_printing_payment_method_selected = any(
pm.code in ['check_printing', 'pdc'] for pm in self.outbound_payment_method_ids)
@api.model
def _enable_pdc_on_bank_journals(self):
""" Enables check printing payment method and add a check sequence on bank journals.
Called upon module installation via data file.
"""
pdcin = self.env.ref('account_pdc.account_payment_method_pdc_in')
pdcout = self.env.ref('account_pdc.account_payment_method_pdc_out')
bank_journals = self.search([('type', '=', 'bank')])
for bank_journal in bank_journals:
# bank_journal._create_check_sequence()
bank_journal.write({
'inbound_payment_method_ids': [(4, pdcin.id, None)],
'outbound_payment_method_ids': [(4, pdcout.id, None)],
})