[FIX] point_of_sale: invoice report should use the account.invoice object

bzr revid: olt@tinyerp.com-20090616083139-ab7k5446kmwtzz59
This commit is contained in:
Olivier Laurent
2009-06-16 10:31:39 +02:00
parent c134bc89e3
commit ce3a161ec0
2 changed files with 12 additions and 7 deletions
+1 -1
View File
@@ -17,7 +17,7 @@
model="pos.order"
name="pos.invoice"
auto="False"
rml="point_of_sale/report/pos_invoice.rml"
rml="account/report/invoice.rml"
/>
<report
+11 -6
View File
@@ -22,22 +22,29 @@
import time
from report import report_sxw
from osv import osv
from tools.translate import _
class pos_invoice(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(pos_invoice, self).__init__(cr, uid, name, context)
self.localcontext.update({
'time': time,
})
def set_context(self, objects, data, ids, report_type = None):
super(pos_invoice, self).set_context(objects, data, ids, report_type)
def preprocess(self, objects, data, ids):
super(pos_invoice, self).preprocess(objects, data, ids)
iids = []
nids = []
for order in objects:
order.write({'nb_print': order.nb_print + 1})
if order.invoice_id and order.invoice_id not in iids:
if not order.invoice_id:
raise osv.except_osv(_('Error !'), _('Please create an invoice for this sale.'))
iids.append(order.invoice_id)
nids.append(order.invoice_id.id)
self.cr.commit()
@@ -48,7 +55,5 @@ class pos_invoice(report_sxw.rml_parse):
self.localcontext['data'] = data
self.localcontext['objects'] = iids
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'account/report/invoice.rml', parser= pos_invoice)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/point_of_sale/report/pos_invoice.rml', parser= pos_invoice)