bzr revid: fp@fp-laptop-20101010191553-0qrlrxx367mmsytt
This commit is contained in:
fp 2010-10-10 21:15:53 +02:00
parent fdc908b2d6
commit 9ee997e7b7
2 changed files with 82 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<record id="view_invoice_customer" model="ir.ui.view">
<field name="name">account.invoice.customer.pay</field>
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<button name="invoice_open" position="after">
<button name="invoice_pay_customer" type="object" string="Payment" states="open" icon="gtk-go-forward"/>
</button>
</field>
</record>
<record id="view_invoice_supplier" model="ir.ui.view">
<field name="name">account.invoice.supplier.pay</field>
<field name="model">account.invoice</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<button name="invoice_open" position="after">
<button name="invoice_pay_customer" type="object" string="Pay Invoice" states="open" icon="gtk-go-forward"/>
</button>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,53 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# 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 <http://www.gnu.org/licenses/>.
#
##############################################################################
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()