Add wizard to select several invoices at once and add them to payment order

Fix bug in groupby on bank payment lines
This commit is contained in:
Alexis de Lattre
2016-06-06 18:53:55 +02:00
parent 8ebdcd0200
commit 4e548dacef
10 changed files with 119 additions and 26 deletions

View File

@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
from . import account_payment_line_create
from . import account_invoice_payment_line_multi

View File

@@ -0,0 +1,20 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion (<http://www.akretion.com>)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import models, api
class AccountInvoicePaymentLineMulti(models.TransientModel):
_name = 'account.invoice.payment.line.multi'
_description = 'Create payment lines from invoice tree view'
@api.multi
def run(self):
self.ensure_one()
assert self._context['active_model'] == 'account.invoice',\
'Active model should be account.invoice'
invoices = self.env['account.invoice'].browse(
self._context['active_ids'])
action = invoices.create_account_payment_line()
return action

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
© 2016 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
-->
<odoo>
<data>
<record id="account_invoice_payment_line_multi_form" model="ir.ui.view">
<field name="name">account_invoice_payment_line_multi.form</field>
<field name="model">account.invoice.payment.line.multi</field>
<field name="arch" type="xml">
<form string="Create Payment Lines">
<p>This wizard will create payment lines for the selected invoices:</p>
<ul>
<li>if there are existing draft payment orders for the payment modes of the invoices, the payment lines will be added to those payment orders</li>
<li>otherwise, new payment orders will be created (one per payment mode).</li>
</ul>
<footer>
<button type="object" name="run" string="Create" class="oe_highlight"/>
<button special="cancel" string="Cancel" class="oe_link"/>
</footer>
</form>
</field>
</record>
</data>
</odoo>