From 78c364674723e80dbd1bfb59a3cd86bb1c3ec1d5 Mon Sep 17 00:00:00 2001 From: Denis Ledoux Date: Thu, 6 Mar 2014 11:55:14 +0100 Subject: [PATCH] [FIX] payment,portal_sale: display payment acquirers of the company of the sale order/invoice bzr revid: dle@openerp.com-20140306105514-lp0lu6jq955aofv4 --- addons/payment/models/payment_acquirer.py | 7 +++++-- addons/portal_sale/portal_sale.py | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 1a60bc13700..9ad77b3c4cf 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -275,9 +275,12 @@ class PaymentAcquirer(osv.Model): """ % (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, diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py index 85bd70a35d4..aef730ab0a2 100644 --- a/addons/portal_sale/portal_sale.py +++ b/addons/portal_sale/portal_sale.py @@ -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):