diff --git a/account_usability/__init__.py b/account_usability/__init__.py index 0b72ffe..be026e1 100644 --- a/account_usability/__init__.py +++ b/account_usability/__init__.py @@ -2,3 +2,4 @@ from . import account from . import partner +from . import wizard diff --git a/account_usability/__manifest__.py b/account_usability/__manifest__.py index 8413f22..94b247e 100644 --- a/account_usability/__manifest__.py +++ b/account_usability/__manifest__.py @@ -33,6 +33,7 @@ This module has been written by Alexis de Lattre from Akretion not useful to have the info 2 times # In the end, I think it's better to just put nothing (we could write - # the name of the statement which has the account number, but it doesn't - # bring any useful info to the accountant) + # the name of the statement which has the account number, but it + # doesn't bring any useful info to the accountant) # The only "good" thing to do would be to have a sequence per # statement line and write it in this 'ref' field # But that would required an additionnal field on statement lines 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..baee066 --- /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 +import logging +logger = logging.getLogger(__name__) + + +class AccountInvoiceMarkSent(models.TransientModel): + _name = 'account.invoice.mark.sent' + _description = 'Mark invoices as sent' + + 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'].search([ + ('id', 'in', self.env.context.get('active_ids')), + ('state', 'in', ('open', 'paid'))]) + 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..edbd7af --- /dev/null +++ b/account_usability/wizard/account_invoice_mark_sent_view.xml @@ -0,0 +1,35 @@ + + + + + + + account.invoice.mark.sent.form + account.invoice.mark.sent + +
+

+ This wizard will mark as sent all the selected invoices in open or paid state. +

+
+
+
+
+
+ + + +