Files
bank-payment/account_payment_mode/models/account_payment_method.py
Alexis de Lattre 857c13b128 [ADD] acocunt_payment_mode: Start to port bank-payment to v9 (with a lot of improvements) during the Sorrento Code sprint 2016
Improvements include:

- full re-organisation of modules and big re-organisation of the code
- simplification of the code related to the fact that support for direct debit is now in t
he base module, not added by an optional module account_direct_debit (module was removed)
- new design of the wizard to select move lines to pay
- support for non-SEPA file transfer-
- support for German direct debit SEPA files (fixes bug #129)
- remove workflow of payment.order

- Finalise the wizard of selection of move lines to pay

  Add button "Add to payment/debit order" on invoice form view
  Started to integrate payment transfer in account_payment_order (not finished at all though)
  Various fixes/changes/improvements/...

- Update and re-enable demo data
- Move field bank_account_required from module account_payment_partner to account_payment_mode

  Make the mandate a required field on payment line when the payment method has mandate_required=True
  Make the bank account a required field on payment line when the payment method has bank_account_required=True

- Enable the payment methods by default on bank journals (including existing bank journals via post_install scripts)
2020-10-16 23:03:47 +02:00

38 lines
1.4 KiB
Python

# -*- coding: utf-8 -*-
# © 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class AccountPaymentMethod(models.Model):
_inherit = 'account.payment.method'
_rec_name = 'display_name'
code = fields.Char(
string='Code (Do Not Modify)',
help="This code is used in the code of the Odoo module that handle "
"this payment method. Therefore, if you change it, "
"the generation of the payment file may fail.")
active = fields.Boolean(string='Active', default=True)
bank_account_required = fields.Boolean(
string='Bank Account Required',
help="Activate this option if this payment method requires you to "
"know the bank account number of your customer or supplier.")
display_name = fields.Char(
compute='compute_display_name',
store=True, string='Display Name')
@api.multi
@api.depends('code', 'name', 'payment_type')
def compute_display_name(self):
for method in self:
method.display_name = u'[%s] %s (%s)' % (
method.code, method.name, method.payment_type)
_sql_constraints = [(
'code_payment_type_unique',
'unique(code, payment_type)',
'A payment method of the same type already exists with this code'
)]