From a9bc853ddc4133504f331d1a56f288f436c81942 Mon Sep 17 00:00:00 2001
From: ced <>
Date: Tue, 15 May 2007 09:33:33 +0000
Subject: [PATCH] ACCOUNT: improve invoice type and add all invoice menu
bzr revid: ced-32d849fa3cffd0135798d7d0ffdd723270dbc7b1
---
addons/account/account_invoice_view.xml | 14 +++++++++-----
addons/account/invoice.py | 8 ++++++--
2 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index 6f15a00d229..1cbb895965d 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -270,11 +270,6 @@
-
- account.invoice
- form
-
-
@@ -411,5 +406,14 @@
+
+ account.invoice
+ form
+ tree,form
+
+ {'type':'out_invoice'}
+
+
+
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index 662bf4c5336..3910dde8231 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -85,6 +85,10 @@ class account_invoice(osv.osv):
raise osv.except_osv('No Analytic Journal !', "You have to define an analytic journal of type '%s' !" % (tt,))
return result[0]
+ def _get_type(self, cr, uid, context={}):
+ type = context.get('type', 'out_invoice')
+ return type
+
_name = "account.invoice"
_description = 'Invoice'
_order = "number"
@@ -96,7 +100,7 @@ class account_invoice(osv.osv):
('in_invoice','Supplier Invoice'),
('out_refund','Customer Refund'),
('in_refund','Supplier Refund'),
- ],'Type', readonly=True, states={'draft':[('readonly', False)]}, select=True),
+ ],'Type', readonly=True, select=True),
'number': fields.char('Invoice Number', size=32, readonly=True),
'reference': fields.char('Invoice Reference', size=64),
@@ -136,7 +140,7 @@ class account_invoice(osv.osv):
'check_total': fields.float('Total', digits=(16,2)),
}
_defaults = {
- 'type': lambda *a: 'out_invoice',
+ 'type': _get_type,
'date_invoice': lambda *a: time.strftime('%Y-%m-%d'),
'state': lambda *a: 'draft',
'journal_id': _get_journal,