# -*- 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 . # ############################################################################## from osv import osv from tools.translate import _ class invoice(osv.osv): _inherit = 'account.invoice' def invoice_pay_customer(self, cr, uid, ids, context=None): 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': 'current', '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() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: