From 1e062af883c09e5bf3cfaccd6e53e93039076294 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 25 Jul 2017 18:12:05 +0200 Subject: [PATCH] Add wizard to mark all invoices as sent and add filter on invoices to send --- account_usability/__init__.py | 1 + account_usability/__openerp__.py | 5 ++- account_usability/account_view.xml | 22 ++++++++++++ account_usability/wizard/__init__.py | 3 ++ .../wizard/account_invoice_mark_sent.py | 23 ++++++++++++ .../wizard/account_invoice_mark_sent_view.xml | 36 +++++++++++++++++++ 6 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 account_usability/wizard/__init__.py create mode 100644 account_usability/wizard/account_invoice_mark_sent.py create mode 100644 account_usability/wizard/account_invoice_mark_sent_view.xml diff --git a/account_usability/__init__.py b/account_usability/__init__.py index c6b3892..8e65eba 100644 --- a/account_usability/__init__.py +++ b/account_usability/__init__.py @@ -1,3 +1,4 @@ # -*- encoding: utf-8 -*- from . import account +from . import wizard diff --git a/account_usability/__openerp__.py b/account_usability/__openerp__.py index 2637630..614cbb3 100644 --- a/account_usability/__openerp__.py +++ b/account_usability/__openerp__.py @@ -49,6 +49,9 @@ This module has been written by Alexis de Lattre from Akretion + + + + + @@ -61,6 +66,9 @@ + + + @@ -180,10 +188,24 @@ module --> 200 + + tree_account_move_line_quickadd,form,graph {'journal_show_code_only': True} + + usability.account.move.line.graph + account.move.line + + + + + pivot + + + + 200 diff --git a/account_usability/wizard/__init__.py b/account_usability/wizard/__init__.py new file mode 100644 index 0000000..553832c --- /dev/null +++ b/account_usability/wizard/__init__.py @@ -0,0 +1,3 @@ +# -*- encoding: utf-8 -*- + +from . import account_invoice_mark_sent diff --git a/account_usability/wizard/account_invoice_mark_sent.py b/account_usability/wizard/account_invoice_mark_sent.py new file mode 100644 index 0000000..06c2b43 --- /dev/null +++ b/account_usability/wizard/account_invoice_mark_sent.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# © 2017 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, api +import logging +logger = logging.getLogger(__name__) + + +class AccountInvoiceMarkSent(models.TransientModel): + _name = 'account.invoice.mark.sent' + _description = 'Mark invoices as sent' + + @api.multi + def run(self): + assert self.env.context.get('active_model') == 'account.invoice',\ + 'Source model must be invoices' + assert self.env.context.get('active_ids'), 'No invoices selected' + invoices = self.env['account.invoice'].browse( + self.env.context.get('active_ids')) + invoices.write({'sent': True}) + logger.info('Marking invoices with ID %s as sent', invoices.ids) + return diff --git a/account_usability/wizard/account_invoice_mark_sent_view.xml b/account_usability/wizard/account_invoice_mark_sent_view.xml new file mode 100644 index 0000000..f74ca2d --- /dev/null +++ b/account_usability/wizard/account_invoice_mark_sent_view.xml @@ -0,0 +1,36 @@ + + + + + + + + account.invoice.mark.sent.form + account.invoice.mark.sent + +
+

+ This wizard will mark as sent all the selected invoices. +

+
+
+
+
+
+ + + +
+