[FIX] payment,portal_sale: display payment acquirers of the company of the sale order/invoice

bzr revid: dle@openerp.com-20140306105514-lp0lu6jq955aofv4
This commit is contained in:
Denis Ledoux 2014-03-06 11:55:14 +01:00
parent 6a1e65b561
commit 78c3646747
2 changed files with 7 additions and 4 deletions

View File

@ -275,9 +275,12 @@ class PaymentAcquirer(osv.Model):
</div>""" % (amount, payment_header)
return result % html_block.decode("utf-8")
def render_payment_block(self, cr, uid, reference, amount, currency_id, tx_id=None, partner_id=False, partner_values=None, tx_values=None, context=None):
def render_payment_block(self, cr, uid, reference, amount, currency_id, tx_id=None, partner_id=False, partner_values=None, tx_values=None, company_id=None, context=None):
html_forms = []
acquirer_ids = self.search(cr, uid, [('website_published', '=', True), ('validation', '=', 'automatic')], context=context)
domain = [('website_published', '=', True), ('validation', '=', 'automatic')]
if company_id:
domain.append(('company_id', '=', company_id))
acquirer_ids = self.search(cr, uid, domain, context=context)
for acquirer_id in acquirer_ids:
button = self.render(
cr, uid, acquirer_id,

View File

@ -39,7 +39,7 @@ class sale_order(osv.Model):
if this.state not in ('draft', 'cancel') and not this.invoiced:
result[this.id] = payment_acquirer.render_payment_block(
cr, uid, this.name, this.amount_total, this.pricelist_id.currency_id.id,
partner_id=this.partner_id.id, context=context)
partner_id=this.partner_id.id, company_id=this.company_id.id, context=context)
return result
def action_quotation_send(self, cr, uid, ids, context=None):
@ -90,7 +90,7 @@ class account_invoice(osv.Model):
if this.type == 'out_invoice' and this.state not in ('draft', 'done') and not this.reconciled:
result[this.id] = payment_acquirer.render_payment_block(
cr, uid, this.number, this.residual, this.currency_id.id,
partner_id=this.partner_id.id, context=context)
partner_id=this.partner_id.id, company_id=this.company_id.id, context=context)
return result
def action_invoice_sent(self, cr, uid, ids, context=None):