mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Copy payment mode and mandate from invoice to refund
Run dos2unix on the few files that had DOS carriage return
This commit is contained in:
committed by
Enric Tobella
parent
b576dc375e
commit
a7b565a612
@@ -1,5 +1,3 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# © 2014 Compassion CH - Cyril Sester <csester@compassion.ch>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -25,3 +25,18 @@ class AccountInvoice(models.Model):
|
||||
if invoice.type in ('out_invoice', 'out_refund'):
|
||||
res['mandate_id'] = invoice.mandate_id.id or False
|
||||
return res
|
||||
|
||||
# If a customer pays via direct debit, it's refunds should
|
||||
# be deducted form the next debit by default. The module
|
||||
# account_payment_partner copies payment_mode_id from invoice
|
||||
# to refund, and we also need to copy mandate from invoice to refund
|
||||
@api.model
|
||||
def _prepare_refund(
|
||||
self, invoice, date_invoice=None, date=None, description=None,
|
||||
journal_id=None):
|
||||
vals = super(AccountInvoice, self)._prepare_refund(
|
||||
invoice, date_invoice=date_invoice, date=date,
|
||||
description=description, journal_id=journal_id)
|
||||
if invoice.type == 'out_invoice':
|
||||
vals['mandate_id'] = invoice.mandate_id.id
|
||||
return vals
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
<field name="inherit_id" ref="account_payment_partner.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="partner_bank_id" position="after">
|
||||
<field name="mandate_id" domain="[('partner_id', '=', commercial_partner_id), ('state', '=', 'valid')]" attrs="{'invisible': [('type', '=', 'out_refund')]}"/>
|
||||
<field name="mandate_id"
|
||||
domain="[('partner_id', '=', commercial_partner_id), ('state', '=', 'valid')]"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user