From 8d48920ccfe67e282e0dde38fd1626554f288c2c Mon Sep 17 00:00:00 2001 From: "uco (Open ERP)" Date: Wed, 11 Aug 2010 13:57:53 +0530 Subject: [PATCH] [IMP,FIX] point_of_sale: Improved field name. Fixed error in Invoice report. bzr revid: uco@tinyerp.com-20100811082753-9nw9rdlz28dz67rz --- addons/point_of_sale/pos.py | 2 +- addons/point_of_sale/report/pos_invoice.py | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/addons/point_of_sale/pos.py b/addons/point_of_sale/pos.py index 39d3a294bc7..09865f668a9 100644 --- a/addons/point_of_sale/pos.py +++ b/addons/point_of_sale/pos.py @@ -291,7 +291,7 @@ class pos_order(osv.osv): 'sale_manager': fields.many2one('res.users', 'Salesman Manager'), 'amount_tax': fields.function(_amount_all, method=True, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'), 'amount_total': fields.function(_amount_total, method=True, string='Total'), - 'amount_paid': fields.function(_amount_all, 'Paid', states={'draft': [('readonly', False)]}, readonly=True, method=True, digits_compute=dp.get_precision('Point Of Sale'), multi='all'), + 'amount_paid': fields.function(_amount_all, string='Paid', states={'draft': [('readonly', False)]}, readonly=True, method=True, digits_compute=dp.get_precision('Point Of Sale'), multi='all'), 'amount_return': fields.function(_amount_all, 'Returned', method=True, digits_compute=dp.get_precision('Point Of Sale'), multi='all'), 'lines': fields.one2many('pos.order.line', 'order_id', 'Order Lines', states={'draft': [('readonly', False)]}, readonly=True), 'price_type': fields.selection([ diff --git a/addons/point_of_sale/report/pos_invoice.py b/addons/point_of_sale/report/pos_invoice.py index ddbc8e817b3..649eb727f0c 100644 --- a/addons/point_of_sale/report/pos_invoice.py +++ b/addons/point_of_sale/report/pos_invoice.py @@ -34,19 +34,19 @@ class pos_invoice(report_sxw.rml_parse): }) - def set_context(self, order, data, ids, report_type=None): - super(pos_invoice, self).set_context(order, data, ids, report_type) + def set_context(self, objects, data, ids, report_type=None): + super(pos_invoice, self).set_context(objects, data, ids, report_type) iids = [] nids = [] + for order in objects: + order.write({'nb_print': order.nb_print + 1}) - 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) + 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) data['ids'] = nids self.datas = data self.ids = nids