Files
bank-payment/account_banking_sepa_direct_debit/models/account_payment_mode.py
Alexis de Lattre bee3093841 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

This port to v9 is not finished... there is still a lot of work:
- finish the code of account_payment_order/wizard/account_payment_line_create.py
- port account_banking_payment_transfer and integrate it inside account_payment_order
- fix bugs
- clean-up code, remove dead code
- test in several complex scenarios
2016-04-30 01:46:34 +02:00

41 lines
1.6 KiB
Python

# -*- coding: utf-8 -*-
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api, _
from .common import is_sepa_creditor_identifier_valid
from openerp.exceptions import ValidationError
class AccountPaymentMode(models.Model):
_inherit = 'account.payment.mode'
sepa_creditor_identifier = fields.Char(
string='SEPA Creditor Identifier', size=35,
help="Enter the Creditor Identifier that has been attributed to your "
"company to make SEPA Direct Debits. If not defined, "
"SEPA Creditor Identifier from company will be used.\n"
"This identifier is composed of :\n"
"- your country ISO code (2 letters)\n"
"- a 2-digits checkum\n"
"- a 3-letters business code\n"
"- a country-specific identifier")
def _sepa_type_get(self):
res = super(AccountPaymentMode, self)._sepa_type_get()
if not res:
if self.type.code and self.type.code.startswith('pain.008'):
res = 'sepa_direct_debit'
return res
@api.multi
@api.constrains('sepa_creditor_identifier')
def _check_sepa_creditor_identifier(self):
for payment_mode in self:
if payment_mode.sepa_creditor_identifier:
if not is_sepa_creditor_identifier_valid(
payment_mode.sepa_creditor_identifier):
raise ValidationError(
_("The SEPA Creditor Identifier '%s' is invalid.")
% payment_mode.sepa_creditor_identifier)