[FIX] account: filters on invoices and bills
- Removed 'Invoices' and 'Credit Notes' filters. - Removed inherited view of filters to remove the 'Not Draft' filter. - Renamed 'Not Paid' to 'Open' filter. - Added new filter 'Paid'. - When click on 'Invoices/Bills' or 'Credit Notes' link of 'View' column from 'Customer Invoices' and 'Vendor Bills' dashboard, it should be open invoices with a specific domain instead of default filters. Co-authored-by: Nicolas Martinelli <nim@odoo.com> opw-1817236
This commit is contained in:
committed by
Nicolas Martinelli
parent
6f614c3254
commit
03645bc51f
@@ -346,12 +346,13 @@ class account_journal(models.Model):
|
||||
ctx.update({
|
||||
'journal_type': self.type,
|
||||
'default_journal_id': self.id,
|
||||
'search_default_journal_id': self.id,
|
||||
'default_type': invoice_type,
|
||||
'type': invoice_type
|
||||
})
|
||||
|
||||
[action] = self.env.ref('account.%s' % action_name).read()
|
||||
if not self.env.context.get('use_domain'):
|
||||
ctx['search_default_journal_id'] = self.id
|
||||
action['context'] = ctx
|
||||
action['domain'] = self._context.get('use_domain', [])
|
||||
account_invoice_filter = self.env.ref('account.view_account_invoice_filter', False)
|
||||
|
||||
@@ -528,10 +528,8 @@
|
||||
<field name="number" string="Invoice" filter_domain="['|','|','|', ('number','ilike',self), ('origin','ilike',self), ('reference', 'ilike', self), ('partner_id', 'child_of', self)]"/>
|
||||
<field name="journal_id" />
|
||||
<filter name="draft" string="Draft" domain="[('state','=','draft')]"/>
|
||||
<filter name="invoices" string="Invoices" domain="['&', ('state','in',['draft','open','paid']),('type','in',('out_invoice','in_invoice'))]"/>
|
||||
<filter name="refunds" string="Credit Notes" domain="['&', ('state','in',['draft','open','paid']),('type','in',('out_refund','in_refund'))]"/>
|
||||
<separator/>
|
||||
<filter name="unpaid" string="Not Paid" domain="[('state','=','open')]"/>
|
||||
<filter name="unpaid" string="Open" domain="[('state', '=', 'open')]"/>
|
||||
<filter name="paid" string="Paid" domain="[('state', '=', 'paid')]"/>
|
||||
<filter name="late" string="Overdue" domain="['&', ('date_due', '<', time.strftime('%%Y-%%m-%%d')), ('state', '=', 'open')]" help="Overdue invoices, maturity date passed"/>
|
||||
<separator/>
|
||||
<field name="partner_id" operator="child_of"/>
|
||||
@@ -563,33 +561,25 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- TODO: remove in master -->
|
||||
<record id="view_account_invoice_filter_inherit_invoices" model="ir.ui.view">
|
||||
<field name="name">account.invoice.select.invoices</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="inherit_id" ref="view_account_invoice_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="filter[@name='invoices']" position="attributes">
|
||||
<attribute name="string">Not Draft</attribute>
|
||||
</xpath>
|
||||
<filter name="refunds" position="replace"/>
|
||||
</data>
|
||||
<data/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- TODO: remove in master -->
|
||||
<record id="view_account_invoice_filter_inherit_credit_notes" model="ir.ui.view">
|
||||
<field name="name">account.invoice.select.credit.notes</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="mode">primary</field>
|
||||
<field name="inherit_id" ref="view_account_invoice_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="filter[@name='refunds']" position="attributes">
|
||||
<attribute name="string">Not Draft</attribute>
|
||||
</xpath>
|
||||
<filter name="invoices" position="replace"/>
|
||||
</data>
|
||||
<data/>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -660,7 +650,7 @@
|
||||
<field eval="False" name="view_id"/>
|
||||
<field name="domain">[('type','=','out_invoice')]</field>
|
||||
<field name="context">{'type':'out_invoice', 'journal_type': 'sale'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter_inherit_invoices"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a customer invoice.
|
||||
@@ -701,7 +691,7 @@
|
||||
<field eval="False" name="view_id"/>
|
||||
<field name="domain">[('type','=','out_refund')]</field>
|
||||
<field name="context">{'default_type': 'out_refund', 'type': 'out_refund', 'journal_type': 'sale'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter_inherit_credit_notes"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to create a credit note.
|
||||
@@ -739,7 +729,7 @@
|
||||
<field eval="False" name="view_id"/>
|
||||
<field name="domain">[('type','=','in_invoice')]</field>
|
||||
<field name="context">{'default_type': 'in_invoice', 'type': 'in_invoice', 'journal_type': 'purchase'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter_inherit_invoices"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to record a new vendor bill.
|
||||
@@ -775,7 +765,7 @@
|
||||
<field eval="False" name="view_id"/>
|
||||
<field name="domain">[('type','=','in_refund')]</field>
|
||||
<field name="context">{'default_type': 'in_refund', 'type': 'in_refund', 'journal_type': 'purchase'}</field>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter_inherit_credit_notes"/>
|
||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||
<field name="help" type="html">
|
||||
<p class="oe_view_nocontent_create">
|
||||
Click to record a new vendor credit note.
|
||||
|
||||
@@ -117,16 +117,12 @@
|
||||
<span>View</span>
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="open_action" context="{'use_domain': [('type','in',('out_invoice','in_invoice'))]}">
|
||||
<span t-if="journal_type == 'sale'">Invoices</span>
|
||||
<span t-if="journal_type == 'purchase'">Bills</span>
|
||||
</a>
|
||||
<a t-if="journal_type == 'sale'" type="object" name="open_action" context="{'use_domain': [('type', '=', 'out_invoice')]}">Invoices</a>
|
||||
<a t-if="journal_type == 'purchase'" type="object" name="open_action" context="{'use_domain': [('type', '=', 'in_invoice')]}">Bills</a>
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="open_action" context="{'use_domain': [('type','in',('out_refund','in_refund'))], 'invoice_type': 'refund'}">
|
||||
<span t-if="journal_type == 'sale'">Credit Notes</span>
|
||||
<span t-if="journal_type == 'purchase'">Credit Notes</span>
|
||||
</a>
|
||||
<a t-if="journal_type == 'sale'" type="object" name="open_action" context="{'use_domain': [('type', '=', 'out_refund')], 'invoice_type': 'refund'}">Credit Notes</a>
|
||||
<a t-if="journal_type == 'purchase'" type="object" name="open_action" context="{'use_domain': [('type', '=', 'in_refund')], 'invoice_type': 'refund'}">Credit Notes</a>
|
||||
</div>
|
||||
<div>
|
||||
<a type="object" name="action_open_reconcile">Payments Matching</a>
|
||||
|
||||
Reference in New Issue
Block a user