ACCOUNT: improve invoice type and add all invoice menu

bzr revid: ced-32d849fa3cffd0135798d7d0ffdd723270dbc7b1
This commit is contained in:
ced
2007-05-15 09:33:33 +00:00
parent 92ca447180
commit a9bc853ddc
2 changed files with 15 additions and 7 deletions
+9 -5
View File
@@ -270,11 +270,6 @@
</field>
</record>
<record model="ir.actions.act_window" id="action_invoice_form">
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_id" ref="invoice_form"/>
</record>
<menuitem name="Financial Management/Invoices" sequence="6"/>
<record model="ir.actions.act_window" id="action_invoice_tree1">
@@ -411,5 +406,14 @@
</record>
<menuitem name="Financial Management/Invoices/Suppliers Refund/Opened" id="menu_action_invoice_tree13" action="action_invoice_tree13"/>
<record model="ir.actions.act_window" id="action_invoice_tree">
<field name="res_model">account.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="invoice_tree"/>
<field name="context">{'type':'out_invoice'}</field>
</record>
<menuitem name="Financial Management/Invoices/All invoices" id="menu_action_invoice_tree" action="action_invoice_tree"/>
</data>
</terp>
+6 -2
View File
@@ -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,