From e878021e63adb5db48e82d088a52e4891450c8c4 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 16 Nov 2016 20:04:25 +0100 Subject: [PATCH] Improve invoice line views Add related fields on invoice line --- account_usability/account.py | 10 ++- account_usability/account_view.xml | 97 ++++++++++++++++++++++++++++++ 2 files changed, 105 insertions(+), 2 deletions(-) diff --git a/account_usability/account.py b/account_usability/account.py index 82924f9..b664227 100644 --- a/account_usability/account.py +++ b/account_usability/account.py @@ -47,13 +47,19 @@ class AccountInvoiceLine(models.Model): # In the 'account' module, we have related stored field for: # company_id, partner_id, currency_id - type = fields.Selection( + invoice_type = fields.Selection( related='invoice_id.type', store=True, readonly=True) date_invoice = fields.Date( related='invoice_id.date_invoice', store=True, readonly=True) commercial_partner_id = fields.Many2one( - related='invoice_id.commercial_partner_id', + related='invoice_id.partner_id.commercial_partner_id', store=True, readonly=True) + state = fields.Selection( + related='invoice_id.state', store=True, readonly=True, + string='Invoice State') + invoice_number = fields.Char( + related='invoice_id.move_id.name', store=True, readonly=True, + string='Invoice Number') class AccountJournal(models.Model): diff --git a/account_usability/account_view.xml b/account_usability/account_view.xml index f76ed76..75d8f6b 100644 --- a/account_usability/account_view.xml +++ b/account_usability/account_view.xml @@ -41,6 +41,103 @@ + + + account_usability.invoice_line_tree + account.invoice.line + + + + + + + + + + + + + state == 'draft' + state == 'cancel' + 0 + 0 + + + + + + account_usability.invoice_line_search + account.invoice.line + + + + + + + + + + + + + + + + + + + + + + + + + + + + Customer Invoice Lines + account.invoice.line + tree,form + [('invoice_type', '=', 'out_invoice')] + {'show_invoice_fields': True} + + + + Customer Refund Lines + account.invoice.line + tree,form + [('invoice_type', '=', 'out_refund')] + {'show_invoice_fields': True} + + + + Supplier Invoice Lines + account.invoice.line + tree,form + [('invoice_type', '=', 'in_invoice')] + {'show_invoice_fields': True} + + + + Supplier Refund Lines + account.invoice.line + tree,form + [('invoice_type', '=', 'in_refund')] + {'show_invoice_fields': True} + + 200