[IMP] account_payment: payment order duplation, put header = internal on report

bzr revid: mra@mra-laptop-20100901060218-yd7lnn2l8ac2hpy4
This commit is contained in:
Mustufa Rangwala 2010-09-01 11:32:18 +05:30
parent 03694ad12a
commit 1b6a944e74
2 changed files with 18 additions and 10 deletions

View File

@ -141,6 +141,14 @@ class payment_order(osv.osv):
wf_service.trg_validate(uid, 'payment.order', id, 'done', cr)
return True
def copy(self, cr, uid, id, default={}, context=None):
default.update({
'state':'draft',
'line_ids': [],
'reference': self.pool.get('ir.sequence').get(cr, uid, 'payment.order')
})
return super(payment_order, self).copy(cr, uid, id, default, context=context)
payment_order()
class payment_line(osv.osv):

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@ -25,7 +25,7 @@ import pooler
from report import report_sxw
class payment_order(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(payment_order, self).__init__(cr, uid, name, context=context)
self.localcontext.update( {
@ -36,15 +36,15 @@ class payment_order(report_sxw.rml_parse):
'get_amount_total' : self._get_amount_total,
})
def _get_invoice_name(self,invoice_id):
def _get_invoice_name(self, invoice_id):
if invoice_id:
pool = pooler.get_pool(self.cr.dbname)
value_name = pool.get('account.invoice').name_get(self.cr, self.uid, [invoice_id])
if value_name:
return value_name[0][1]
return False
def _get_amount_total_in_currency(self,payment):
def _get_amount_total_in_currency(self, payment):
total = 0.0
if payment.line_ids:
currency_cmp = payment.line_ids[0].currency.id
@ -57,19 +57,19 @@ class payment_order(report_sxw.rml_parse):
return False
return total
def _get_amount_total(self,payment):
def _get_amount_total(self, payment):
total = 0.0
if not payment.line_ids:
return False
for line in payment.line_ids:
total += line.amount
return total
def _get_company_currency(self):
pool = pooler.get_pool(self.cr.dbname)
user = pool.get('res.users').browse(self.cr, self.uid, self.uid)
return user.company_id and user.company_id.currency_id and user.company_id.currency_id.name or False
return user.company_id and user.company_id.currency_id and user.company_id.currency_id.name or False
report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order,header=False)
report_sxw.report_sxw('report.payment.order', 'payment.order', 'addons/account_payment/report/payment_order.rml', parser=payment_order, header="internal")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: