Files
bank-payment/account_banking_pain_base/models/account_payment_order.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

56 lines
2.2 KiB
Python

# -*- coding: utf-8 -*-
# © 2013-2016 Akretion - Alexis de Lattre <alexis.delattre@akretion.com>
# © 2014 Serv. Tecnol. Avanzados - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, fields, api
class AccountPaymentOrder(models.Model):
_inherit = 'account.payment.order'
sepa = fields.Boolean(
compute='compute_sepa', readonly=True,
string="SEPA Payment")
charge_bearer = fields.Selection([
('SLEV', 'Following Service Level'),
('SHAR', 'Shared'),
('CRED', 'Borne by Creditor'),
('DEBT', 'Borne by Debtor')], string='Charge Bearer',
default='SLEV',
help="Following service level : transaction charges are to be "
"applied following the rules agreed in the service level "
"and/or scheme (SEPA Core messages must use this). Shared : "
"transaction charges on the debtor side are to be borne by "
"the debtor, transaction charges on the creditor side are to "
"be borne by the creditor. Borne by creditor : all "
"transaction charges are to be borne by the creditor. Borne "
"by debtor : all transaction charges are to be borne by the "
"debtor.")
batch_booking = fields.Boolean(
string='Batch Booking',
help="If true, the bank statement will display only one debit "
"line for all the wire transfers of the SEPA XML file ; if "
"false, the bank statement will display one debit line per wire "
"transfer of the SEPA XML file.")
@api.multi
@api.depends(
'company_partner_bank_id.acc_type',
'payment_line_ids.currency_id',
'payment_line_ids.partner_bank_id.acc_type')
def compute_sepa(self):
eur = self.env.ref('base.EUR')
for order in self:
sepa = True
if order.company_partner_bank_id.acc_type != 'iban':
sepa = False
for pline in order.payment_line_ids:
if pline.currency_id != eur:
sepa = False
break
if pline.partner_bank_id.acc_type != 'iban':
sepa = False
break
self.sepa = sepa