Add invoice report
This commit is contained in:
1 parent
7a00940975
commit
348183b968
4 files changed
+26
-2
No files matched your search
BIN
Binary file not shown.
+14
-2
@@ -5,6 +5,7 @@ import datetime
|
||||
import mx.DateTime
|
||||
from decimal import Decimal
|
||||
from trytond.netsvc import LocalService
|
||||
from trytond.report import Report
|
||||
|
||||
_STATES = {
|
||||
'readonly': "state != 'draft'",
|
||||
@@ -176,11 +177,12 @@ class Invoice(OSV):
|
||||
company = fields.Many2One('company.company', 'Company', required=True,
|
||||
states=_STATES)
|
||||
type = fields.Selection([
|
||||
('out_invoice', 'Customer Invoice'),
|
||||
('out_invoice', 'Invoice'),
|
||||
('in_invoice', 'Supplier Invoice'),
|
||||
('out_refund', 'Customer Refund'),
|
||||
('out_refund', 'Refund'),
|
||||
('in_refund', 'Supplier Refund'),
|
||||
], 'Type', select=1, on_change=['type'], required=True, states=_STATES)
|
||||
type_name = fields.Function('get_type_name', type='char', string='Type')
|
||||
number = fields.Char('Number', size=None, readonly=True, select=1)
|
||||
reference = fields.Char('Reference', size=None)
|
||||
description = fields.Char('Description', size=None, states=_STATES)
|
||||
@@ -325,6 +327,16 @@ class Invoice(OSV):
|
||||
res['payment_term'], context=context)[0]
|
||||
return res
|
||||
|
||||
def get_type_name(self, cursor, user, ids, name, arg, context=None):
|
||||
res = {}
|
||||
type2name = {}
|
||||
for type, name in self.fields_get(cursor, user, fields_names=['type'],
|
||||
context=context)['type']['selection']:
|
||||
type2name[type] = name
|
||||
for invoice in self.browse(cursor, user, ids, context=context):
|
||||
res[invoice.id] = type2name[invoice.type]
|
||||
return res
|
||||
|
||||
def get_untaxed_amount(self, cursor, user, ids, name, arg, context=None):
|
||||
currency_obj = self.pool.get('account.currency')
|
||||
res = {}
|
||||
|
||||
+11
@@ -243,6 +243,17 @@
|
||||
</record>
|
||||
<menuitem parent="menu_invoices" action="act_invoice_form"
|
||||
id="menu_invoice_form"/>
|
||||
<record model="ir.action.report" id="report_invoice">
|
||||
<field name="name">Invoice</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="report_name">account.invoice</field>
|
||||
<field name="report">account_invoice/invoice.odt</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="report_invoice_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
<field name="model">account.invoice,0</field>
|
||||
<field name="action" ref="report_invoice"/>
|
||||
</record>
|
||||
<record model="ir.sequence.type" id="sequence_type_account_invoice_out_invoice">
|
||||
<field name="name">Customer Invoice</field>
|
||||
<field name="code">account.invoice.out_invoice</field>
|
||||
|
||||
Reference in new issue
Block a user