From 9ee997e7b75c4dfac0440378999aedcd9954da84 Mon Sep 17 00:00:00 2001 From: fp Date: Sun, 10 Oct 2010 21:15:53 +0200 Subject: [PATCH] add bzr revid: fp@fp-laptop-20101010191553-0qrlrxx367mmsytt --- .../account_voucher_pay_invoice.xml | 29 ++++++++++ addons/account_voucher/invoice.py | 53 +++++++++++++++++++ 2 files changed, 82 insertions(+) create mode 100644 addons/account_voucher/account_voucher_pay_invoice.xml create mode 100644 addons/account_voucher/invoice.py diff --git a/addons/account_voucher/account_voucher_pay_invoice.xml b/addons/account_voucher/account_voucher_pay_invoice.xml new file mode 100644 index 00000000000..f4ebf0e3eb1 --- /dev/null +++ b/addons/account_voucher/account_voucher_pay_invoice.xml @@ -0,0 +1,29 @@ + + + + + account.invoice.customer.pay + account.invoice + form + + + + + + + + account.invoice.supplier.pay + account.invoice + form + + + + + + + + diff --git a/addons/account_voucher/invoice.py b/addons/account_voucher/invoice.py new file mode 100644 index 00000000000..694a165f354 --- /dev/null +++ b/addons/account_voucher/invoice.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as +# published by the Free Software Foundation, either version 3 of the +# License, or (at your option) any later version. +# +# 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 +# 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 . +# +############################################################################## + +import netsvc +from osv import fields, osv +from tools.translate import _ + +class invoice(osv.osv): + _inherit = 'account.invoice' + def invoice_pay_customer(self, cr, uid, ids, context={}): + print context + if not ids: return [] + inv = self.browse(cr, uid, ids[0], context=context) + return { + 'name':_("Pay Invoice"), + 'view_mode': 'form', + 'view_id': False, + 'view_type': 'form', + 'res_model': 'account.voucher', + 'type': 'ir.actions.act_window', + 'nodestroy': True, + 'target': 'new', + 'domain': '[]', + 'context': { + 'default_partner_id': inv.partner_id.id, + 'default_amount': inv.residual, + 'default_name':inv.name, + 'close_after_process': True, + 'invoice_type':inv.type, + 'invoice_id':inv.id, + 'default_type': inv.type in ('out_invoice','out_refund') and 'receipt' or 'payment' + } + } + +invoice()