mirror of
https://github.com/OCA/bank-payment.git
synced 2025-02-02 10:37:31 +02:00
Add module account_banking_mandate_sale
Add option 'mandate_required' on payment orders Autoselect first valid mandate on customer invoice that have a payment mode 'mandate_required' = True Add option on select move lines to pay wizard to allow selection of litigation moves (unchecked by default), in order to integrate the feature of the module account_payment_blocking
This commit is contained in:
committed by
Enric Tobella
parent
a7b565a612
commit
7c34e39123
@@ -31,22 +31,26 @@ Usage
|
||||
|
||||
To use this module, see menu "Accounting > payment > SEPA direct debit mandates"
|
||||
|
||||
For further information, please visit:
|
||||
|
||||
* https://www.odoo.com/forum/help-1
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/173/9.0
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* no known issues
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/bank-payment/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
|
||||
`here <https://github.com/OCA/bank-payment/issues/new?body=module:%20account_banking_mandate%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/bank-payment/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed `feedback
|
||||
<https://github.com/OCA/
|
||||
bank-payment/issues/new?body=module:%20
|
||||
account_banking_mandate%0Aversion:%20
|
||||
9.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Credits
|
||||
=======
|
||||
@@ -54,11 +58,11 @@ Credits
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Alexis de Lattre
|
||||
* Alexis de Lattre <alexis.delattre@akretion.com>
|
||||
* Pedro M. Baeza
|
||||
* Alexandre Fayolle
|
||||
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
|
||||
* Sergio Teruel (Incaser) <sergio@incaser.es>
|
||||
* Stéphane Bidoul <stephane.bidoul@acsone.eu>
|
||||
* Sergio Teruel (Incaser) <sergio@incaser.es>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
],
|
||||
'data': [
|
||||
'views/account_banking_mandate_view.xml',
|
||||
'views/account_payment_mode.xml',
|
||||
'views/account_invoice_view.xml',
|
||||
'views/account_payment_line.xml',
|
||||
'views/res_partner_bank_view.xml',
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import account_banking_mandate
|
||||
from . import account_payment_mode
|
||||
from . import account_payment_order
|
||||
from . import account_invoice
|
||||
from . import res_partner_bank
|
||||
from . import account_payment_line
|
||||
|
||||
@@ -40,3 +40,17 @@ class AccountInvoice(models.Model):
|
||||
if invoice.type == 'out_invoice':
|
||||
vals['mandate_id'] = invoice.mandate_id.id
|
||||
return vals
|
||||
|
||||
@api.onchange('payment_mode_id')
|
||||
def payment_mode_change(self):
|
||||
"""Select by default the first valid mandate of the partner"""
|
||||
if (
|
||||
self.type in ('out_invoice', 'out_refund') and
|
||||
self.payment_mode_id.payment_type == 'inbound' and
|
||||
self.payment_mode_id.mandate_required and
|
||||
self.partner_id):
|
||||
mandates = self.env['account.banking.mandate'].search([
|
||||
('state', '=', 'valid'),
|
||||
('partner_id', '=', self.commercial_partner_id.id),
|
||||
])
|
||||
self.mandate_id = mandates[0]
|
||||
|
||||
14
account_banking_mandate/models/account_payment_mode.py
Normal file
14
account_banking_mandate/models/account_payment_mode.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- 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
|
||||
|
||||
|
||||
class AccountPaymentMode(models.Model):
|
||||
_inherit = "account.payment.mode"
|
||||
|
||||
mandate_required = fields.Boolean(
|
||||
string='Mandate Required',
|
||||
help="Activate this option is this payment mode requires your "
|
||||
"customer to sign a direct debit mandate with your company.")
|
||||
20
account_banking_mandate/models/account_payment_order.py
Normal file
20
account_banking_mandate/models/account_payment_order.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# -*- 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, api, _
|
||||
from openerp.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPaymentOrder(models.Model):
|
||||
_inherit = 'account.payment.order'
|
||||
|
||||
@api.multi
|
||||
def draft2open(self):
|
||||
for order in self:
|
||||
if order.payment_mode_id.mandate_required:
|
||||
for line in order.payment_line_ids:
|
||||
if not line.mandate_id:
|
||||
raise UserError(_(
|
||||
"Missing mandate in payment line %s") % line.name)
|
||||
return super(AccountPaymentOrder, self).draft2open()
|
||||
20
account_banking_mandate/views/account_payment_mode.xml
Normal file
20
account_banking_mandate/views/account_payment_mode.xml
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<record id="account_payment_mode_form" model="ir.ui.view">
|
||||
<field name="name">account_banking_mandate.account.payment.mode.form</field>
|
||||
<field name="model">account.payment.mode</field>
|
||||
<field name="inherit_id" ref="account_payment_order.account_payment_mode_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="payment_order_options" position="inside">
|
||||
<field name="mandate_required"
|
||||
attrs="{'invisible': [('payment_type', '!=', 'inbound')]}"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Reference in New Issue
Block a user