Add company header on invoice
Print only invoice of the same company
This commit is contained in:
1 parent
348183b968
commit
4723d21a78
2 files changed
+30
No files matched your search
+29
@@ -1160,6 +1160,35 @@ class InvoiceTax(OSV):
|
||||
InvoiceTax()
|
||||
|
||||
|
||||
class InvoiceReport(Report):
|
||||
_name = 'account.invoice'
|
||||
|
||||
def _get_objects(self, cursor, user_id, ids, model, datas, context):
|
||||
invoice_obj = self.pool.get('account.invoice')
|
||||
user_obj = self.pool.get('res.user')
|
||||
user = user_obj.browse(cursor, user_id, user_id, context)
|
||||
context = context.copy()
|
||||
if 'language' in context:
|
||||
del context['language']
|
||||
invoice_ids = invoice_obj.search(cursor, user_id, [
|
||||
('id', 'in', ids),
|
||||
('company', '=', user.company.id),
|
||||
], context=context)
|
||||
return invoice_obj.browse(cursor, user_id, invoice_ids, context=context)
|
||||
|
||||
def parse(self, cursor, user_id, report, objects, datas, context):
|
||||
user_obj = self.pool.get('res.user')
|
||||
user = user_obj.browse(cursor, user_id, user_id, context)
|
||||
if context is None:
|
||||
context = {}
|
||||
context = context.copy()
|
||||
context['company'] = user.company
|
||||
return super(InvoiceReport, self).parse(cursor, user_id, report, objects,
|
||||
datas, context)
|
||||
|
||||
InvoiceReport()
|
||||
|
||||
|
||||
class Address(OSV):
|
||||
_name = 'partner.address'
|
||||
invoice = fields.Boolean('Invoice')
|
||||
|
||||
@@ -248,6 +248,7 @@
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="report_name">account.invoice</field>
|
||||
<field name="report">account_invoice/invoice.odt</field>
|
||||
<field name="style">company/header_A4.odt</field>
|
||||
</record>
|
||||
<record model="ir.action.keyword" id="report_invoice_keyword">
|
||||
<field name="keyword">form_print</field>
|
||||
|
||||
Reference in new issue
Block a user