2010-01-18 08:38:26 +00:00
|
|
|
# -*- encoding: utf-8 -*-
|
2008-06-16 11:00:21 +00:00
|
|
|
##############################################################################
|
2010-01-18 08:38:26 +00:00
|
|
|
#
|
2009-10-14 11:15:34 +00:00
|
|
|
# OpenERP, Open Source Management Solution
|
2010-01-18 08:38:26 +00:00
|
|
|
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
|
|
|
# $Id$
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is free software: you can redistribute it and/or modify
|
2010-01-18 08:38:26 +00:00
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2008-11-03 19:18:56 +00:00
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
2010-01-18 08:38:26 +00:00
|
|
|
# GNU General Public License for more details.
|
2008-06-16 11:00:21 +00:00
|
|
|
#
|
2010-01-18 08:38:26 +00:00
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2008-08-24 14:45:43 +00:00
|
|
|
#
|
|
|
|
##############################################################################
|
|
|
|
|
|
|
|
import time
|
|
|
|
from report import report_sxw
|
2009-06-16 08:31:39 +00:00
|
|
|
from osv import osv
|
|
|
|
from tools.translate import _
|
2008-08-24 14:45:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
class pos_invoice(report_sxw.rml_parse):
|
2009-06-16 08:31:39 +00:00
|
|
|
|
2008-08-24 14:45:43 +00:00
|
|
|
def __init__(self, cr, uid, name, context):
|
2010-01-18 08:38:26 +00:00
|
|
|
super(pos_invoice, self).__init__(cr, uid, name, context)
|
2008-08-24 14:45:43 +00:00
|
|
|
self.localcontext.update({
|
|
|
|
'time': time,
|
|
|
|
})
|
2010-04-13 09:01:28 +00:00
|
|
|
|
2009-06-16 08:31:39 +00:00
|
|
|
|
2010-06-18 13:00:16 +00:00
|
|
|
def set_context(self, order, data, ids, report_type=None):
|
|
|
|
super(pos_invoice, self).set_context(order, data, ids, report_type)
|
2008-08-24 14:45:43 +00:00
|
|
|
iids = []
|
|
|
|
nids = []
|
2009-06-16 08:31:39 +00:00
|
|
|
|
|
|
|
|
2010-06-18 13:00:16 +00:00
|
|
|
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)
|
2008-08-24 14:45:43 +00:00
|
|
|
data['ids'] = nids
|
|
|
|
self.datas = data
|
|
|
|
self.ids = nids
|
|
|
|
self.objects = iids
|
|
|
|
self.localcontext['data'] = data
|
|
|
|
self.localcontext['objects'] = iids
|
|
|
|
|
2009-06-17 13:32:24 +00:00
|
|
|
report_sxw.report_sxw('report.pos.invoice', 'pos.order', 'addons/account/report/invoice.rml', parser= pos_invoice)
|
2008-07-23 14:41:47 +00:00
|
|
|
|