[IMP] payment.acquirer: code simplification/cleanup
bzr revid: odo@openerp.com-20121026130304-p1tp8pkruj60dbv2
This commit is contained in:
parent
9cfe9b6112
commit
75629866d2
|
@ -40,7 +40,7 @@ class acquirer(osv.Model):
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Name', required=True),
|
'name': fields.char('Name', required=True),
|
||||||
'form_template': fields.text('Payment form template (HTML)', translate=True),
|
'form_template': fields.text('Payment form template (HTML)', translate=True, required=True),
|
||||||
'visible': fields.boolean('Visible', help="Whether this payment acquirer is currently displayed in portal forms"),
|
'visible': fields.boolean('Visible', help="Whether this payment acquirer is currently displayed in portal forms"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,8 +57,7 @@ class acquirer(osv.Model):
|
||||||
context = {}
|
context = {}
|
||||||
try:
|
try:
|
||||||
i18n_kind = _(object._description) # may fail to translate, but at least we try
|
i18n_kind = _(object._description) # may fail to translate, but at least we try
|
||||||
template = ustr(this.form_template)
|
result = MakoTemplate(this.form_template).render_unicode(object=object,
|
||||||
result = MakoTemplate(template).render_unicode(object=object,
|
|
||||||
reference=reference,
|
reference=reference,
|
||||||
currency=currency,
|
currency=currency,
|
||||||
amount=amount,
|
amount=amount,
|
||||||
|
@ -67,12 +66,9 @@ class acquirer(osv.Model):
|
||||||
# context kw would clash with mako internals
|
# context kw would clash with mako internals
|
||||||
ctx=context,
|
ctx=context,
|
||||||
format_exceptions=True)
|
format_exceptions=True)
|
||||||
result = result.strip()
|
return result.strip()
|
||||||
if result == u'False':
|
|
||||||
result = u''
|
|
||||||
return result
|
|
||||||
except Exception:
|
except Exception:
|
||||||
_logger.exception("failed to render mako template value for payment.acquirer %s: %r", this.name, template)
|
_logger.exception("failed to render mako template value for payment.acquirer %s: %r", this.name, this.form_template)
|
||||||
return
|
return
|
||||||
|
|
||||||
def _wrap_payment_block(self, cr, uid, html_block, amount, currency, context=None):
|
def _wrap_payment_block(self, cr, uid, html_block, amount, currency, context=None):
|
||||||
|
|
Loading…
Reference in New Issue