diff --git a/invoice.odt b/invoice.odt new file mode 100644 index 0000000000..a437b590ef Binary files /dev/null and b/invoice.odt differ diff --git a/invoice.py b/invoice.py index 03ce7402c9..7155a1f564 100644 --- a/invoice.py +++ b/invoice.py @@ -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 = {} diff --git a/invoice.xml b/invoice.xml index 4046328951..987f13219b 100644 --- a/invoice.xml +++ b/invoice.xml @@ -243,6 +243,17 @@ + + Invoice + account.invoice + account.invoice + account_invoice/invoice.odt + + + form_print + account.invoice,0 + + Customer Invoice account.invoice.out_invoice diff --git a/setup.py b/setup.py index 5aba20bcbf..a981a3ee6f 100644 --- a/setup.py +++ b/setup.py @@ -32,6 +32,7 @@ setup(name='trytond-' + info['name'].lower(), ], package_data={ 'trytond.modules.' + info['name'].lower(): info.get('xml', []), + 'trytond.modules.' + info['name'].lower(): ['invoice.odt'], }, classifiers=[ 'Development Status :: 5 - Production/Stable',