You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

82 lines
4.6 KiB
Python

# -*- coding: utf-8 -*-
from odoo import api, Command, fields, models, _
class AccountJournal(models.Model):
_inherit = "account.journal"
# _description = "Journal"
# _order = 'sequence, type, code'
# _inherit = ['mail.thread', 'mail.activity.mixin']
# _check_company_auto = True
# _rec_names_search = ['name', 'code']
payment_debit_account_id = fields.Many2one(
comodel_name='account.account', check_company=True, copy=False, ondelete='restrict',
help="Incoming payments entries triggered by invoices/refunds will be posted on the Outstanding Receipts Account "
"and displayed as blue lines in the bank reconciliation widget. During the reconciliation process, concerned "
"transactions will be reconciled with entries on the Outstanding Receipts Account instead of the "
"receivable account.", string='Outstanding Receipts Account',
domain=lambda self: "[('deprecated', '=', False), ('company_id', '=', company_id), \
('account_type', 'not in', ('receivable', 'payable')), ('id', '=', default_account_id)]")
payment_credit_account_id = fields.Many2one(
comodel_name='account.account', check_company=True, copy=False, ondelete='restrict',
help="Outgoing payments entries triggered by bills/credit notes will be posted on the Outstanding Payments Account "
"and displayed as blue lines in the bank reconciliation widget. During the reconciliation process, concerned "
"transactions will be reconciled with entries on the Outstanding Payments Account instead of the "
"payable account.", string='Outstanding Payments Account',
domain=lambda self: "[('deprecated', '=', False), ('company_id', '=', company_id), \
('account_type', 'not in', ('receivable', 'payable')), ('id', '=', default_account_id)]")
inbound_payment_method_ids = fields.Many2many(
comodel_name='account.payment.method',
relation='account_journal_inbound_payment_method_rel',
column1='journal_id',
column2='inbound_payment_method',
domain=[('payment_type', '=', 'inbound')],
string='Inbound Payment Methods',
compute='_compute_inbound_payment_method_ids',
store=True,
readonly=False,
help="Manual: Get paid by cash, check or any other method outside of Odoo.\n"
"Electronic: Get paid automatically through a payment acquirer by requesting a transaction"
" on a card saved by the customer when buying or subscribing online (payment token).\n"
"Batch Deposit: Encase several customer checks at once by generating a batch deposit to"
" submit to your bank. When encoding the bank statement in Odoo,you are suggested to"
" reconcile the transaction with the batch deposit. Enable this option from the settings."
)
outbound_payment_method_ids = fields.Many2many(
comodel_name='account.payment.method',
relation='account_journal_outbound_payment_method_rel',
column1='journal_id',
column2='outbound_payment_method',
domain=[('payment_type', '=', 'outbound')],
string='Outbound Payment Methods',
compute='_compute_outbound_payment_method_ids',
store=True,
readonly=False,
help="Manual:Pay bill by cash or any other method outside of Odoo.\n"
"Check:Pay bill by check and print it from Odoo.\n"
"SEPA Credit Transfer: Pay bill from a SEPA Credit Transfer file you submit to your"
" bank. Enable this option from the settings."
)
# def _default_inbound_payment_methods(self):
# return self.env.ref('account.account_payment_method_manual_in')
#
# def _default_outbound_payment_methods(self):
# return self.env.ref('account.account_payment_method_manual_out')
@api.depends('type')
def _compute_inbound_payment_method_ids(self):
for journal in self:
if journal.type in ('bank', 'cash'):
journal.inbound_payment_method_ids = self._default_inbound_payment_methods()
else:
journal.inbound_payment_method_ids = False
@api.depends('type')
def _compute_outbound_payment_method_ids(self):
for journal in self:
if journal.type in ('bank', 'cash'):
journal.outbound_payment_method_ids = self._default_outbound_payment_methods()
else:
journal.outbound_payment_method_ids = False