[ADD] portal_sale: integrate payment acquirer options in sale.order forms
bzr revid: odo@openerp.com-20121024131647-hfqgjpftwgygx976
This commit is contained in:
parent
20c81b5e2f
commit
21e48c3b96
|
@ -19,3 +19,4 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import portal_sale
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Business Applications
|
||||
# Copyright (c) 2012 OpenERP S.A. <http://openerp.com>
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from openerp.osv import osv, fields
|
||||
|
||||
class sale_order(osv.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
_payment_block_proxy = lambda self,*a,**kw: self._portal_payment_block(*a, **kw)
|
||||
|
||||
_columns = {
|
||||
'portal_payment_options': fields.function(_payment_block_proxy, type="html", string="Portal Payment Options"),
|
||||
}
|
||||
|
||||
def _portal_payment_block(self, cr, uid, ids, fieldname, arg, context=None):
|
||||
result = dict.fromkeys(ids, False)
|
||||
payment_acquirer = self.pool.get('portal.payment.acquirer')
|
||||
for this in self.browse(cr, uid, ids, context=context):
|
||||
if this.state != 'draft':
|
||||
result[this.id] = payment_acquirer.render_payment_block(cr, uid, this, this.name,
|
||||
this.pricelist_id.currency_id, this.amount_total, context=context)
|
||||
return result
|
|
@ -2,6 +2,18 @@
|
|||
<openerp>
|
||||
<data>
|
||||
|
||||
<record model="ir.ui.view" id="sale_order_form_payment">
|
||||
<field name="name">sale.order.form.payment</field>
|
||||
<field name="model">sale.order</field>
|
||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<notebook version="7.0" position="before">
|
||||
<field name="portal_payment_options"/>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!--
|
||||
Override the original action to set another help field and/or
|
||||
another context field, more suited for portal members
|
||||
|
|
Loading…
Reference in New Issue