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.
34 lines
1.5 KiB
Python
34 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields, api, _
|
|
|
|
|
|
class AccountPayment(models.Model):
|
|
_inherit = "account.payment"
|
|
# _inherits = {'account.move': 'move_id'}
|
|
# _inherit = ['mail.thread', 'mail.activity.mixin']
|
|
# _description = "Payments"
|
|
# _order = "date desc, name desc"
|
|
# _check_company_auto = True
|
|
|
|
# destination_account_id = fields.Many2one(
|
|
# comodel_name='account.account',
|
|
# string='Destination Account',
|
|
# store=True, readonly=False,
|
|
# compute='_compute_destination_account_id',
|
|
# domain="[('account_type', 'in', ('asset_receivable', 'liability_payable'))]",
|
|
# check_company=True)
|
|
available_payment_method_ids = fields.Many2many('account.payment.method',
|
|
compute='_compute_payment_method_fields')
|
|
hide_payment_method = fields.Boolean(
|
|
compute='_compute_payment_method_fields',
|
|
help="Technical field used to hide the payment method if the selected journal has only one available which is 'manual'")
|
|
|
|
def _compute_payment_method_fields(self):
|
|
for pay in self:
|
|
if pay.payment_type == 'inbound':
|
|
pay.available_payment_method_ids = pay.journal_id.inbound_payment_method_ids
|
|
else:
|
|
pay.available_payment_method_ids = pay.journal_id.outbound_payment_method_ids
|
|
|
|
pay.hide_payment_method = len(
|
|
pay.available_payment_method_ids) == 1 and pay.available_payment_method_ids.code == 'manual' |