Add wizard to mark all invoices as sent and add filter on invoices to send
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
# -*- encoding: utf-8 -*-
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
from . import account
|
from . import account
|
||||||
|
from . import wizard
|
||||||
|
|||||||
@@ -49,6 +49,9 @@ This module has been written by Alexis de Lattre from Akretion <alexis.delattre@
|
|||||||
'website': 'http://www.akretion.com',
|
'website': 'http://www.akretion.com',
|
||||||
'depends': ['account'],
|
'depends': ['account'],
|
||||||
'conflicts': ['account_invoice_overdue_filter'],
|
'conflicts': ['account_invoice_overdue_filter'],
|
||||||
'data': ['account_view.xml'],
|
'data': [
|
||||||
|
'account_view.xml',
|
||||||
|
'wizard/account_invoice_mark_sent_view.xml',
|
||||||
|
],
|
||||||
'installable': True,
|
'installable': True,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,6 +38,11 @@
|
|||||||
<field name="period_id" position="attributes">
|
<field name="period_id" position="attributes">
|
||||||
<attribute name="groups"></attribute>
|
<attribute name="groups"></attribute>
|
||||||
</field>
|
</field>
|
||||||
|
<!-- move sent field and make it visible -->
|
||||||
|
<field name="sent" position="replace"/>
|
||||||
|
<field name="move_id" position="after">
|
||||||
|
<field name="sent"/>
|
||||||
|
</field>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
@@ -61,6 +66,9 @@
|
|||||||
<filter name="unpaid" position="after">
|
<filter name="unpaid" position="after">
|
||||||
<filter name="overdue" string="Overdue"
|
<filter name="overdue" string="Overdue"
|
||||||
domain="[('state', '=', 'open'), ('date_due', '<', current_date)]"/>
|
domain="[('state', '=', 'open'), ('date_due', '<', current_date)]"/>
|
||||||
|
<separator/>
|
||||||
|
<filter name="to_send" string="To Send" domain="[('sent', '=', False), ('state', 'in', ('open', 'paid'))]"/>
|
||||||
|
<filter name="sent" string="Sent" domain="[('sent', '=', True)]"/>
|
||||||
</filter>
|
</filter>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
@@ -180,10 +188,24 @@ module -->
|
|||||||
<!-- model account.move.line / Journal Items -->
|
<!-- model account.move.line / Journal Items -->
|
||||||
<record id="account.action_account_moves_all_a" model="ir.actions.act_window">
|
<record id="account.action_account_moves_all_a" model="ir.actions.act_window">
|
||||||
<field name="limit">200</field>
|
<field name="limit">200</field>
|
||||||
|
<!-- add graph -->
|
||||||
|
<field name="view_mode">tree_account_move_line_quickadd,form,graph</field>
|
||||||
<!-- Win space, because there are already many columns -->
|
<!-- Win space, because there are already many columns -->
|
||||||
<field name="context">{'journal_show_code_only': True}</field>
|
<field name="context">{'journal_show_code_only': True}</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="account_move_line_graph" model="ir.ui.view">
|
||||||
|
<field name="name">usability.account.move.line.graph</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="inherit_id" ref="account.account_move_line_graph"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<graph position="attributes">
|
||||||
|
<!-- pivot by default instead of bar -->
|
||||||
|
<attribute name="type">pivot</attribute>
|
||||||
|
</graph>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- model account.move / Journal Entries -->
|
<!-- model account.move / Journal Entries -->
|
||||||
<record id="account.action_move_journal_line" model="ir.actions.act_window">
|
<record id="account.action_move_journal_line" model="ir.actions.act_window">
|
||||||
<field name="limit">200</field>
|
<field name="limit">200</field>
|
||||||
|
|||||||
3
account_usability/wizard/__init__.py
Normal file
3
account_usability/wizard/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
from . import account_invoice_mark_sent
|
||||||
23
account_usability/wizard/account_invoice_mark_sent.py
Normal file
23
account_usability/wizard/account_invoice_mark_sent.py
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# © 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
# 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
|
||||||
36
account_usability/wizard/account_invoice_mark_sent_view.xml
Normal file
36
account_usability/wizard/account_invoice_mark_sent_view.xml
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
© 2017 Akretion (Alexis de Lattre <alexis.delattre@akretion.com>)
|
||||||
|
The licence is in the file __openerp__.py
|
||||||
|
-->
|
||||||
|
|
||||||
|
<openerp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record id="account_invoice_mark_sent_form" model="ir.ui.view">
|
||||||
|
<field name="name">account.invoice.mark.sent.form</field>
|
||||||
|
<field name="model">account.invoice.mark.sent</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Mark invoices as sent">
|
||||||
|
<p>
|
||||||
|
This wizard will mark as sent all the selected invoices.
|
||||||
|
</p>
|
||||||
|
<footer>
|
||||||
|
<button type="object" name="run" string="Mark as Sent" class="oe_highlight"/>
|
||||||
|
<button special="cancel" string="Cancel" class="oe_link"/>
|
||||||
|
</footer>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<act_window id="account_invoice_mark_sent_action"
|
||||||
|
multi="True"
|
||||||
|
key2="client_action_multi"
|
||||||
|
name="Mark as Sent"
|
||||||
|
res_model="account.invoice.mark.sent"
|
||||||
|
src_model="account.invoice"
|
||||||
|
view_mode="form"
|
||||||
|
target="new" />
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</openerp>
|
||||||
Reference in New Issue
Block a user