Skip to content
Snippets Groups Projects
Commit 198c080b authored by Christophe Simonis's avatar Christophe Simonis
Browse files

[FIX] payment_paypal: do not compute field `paypal_url`

Since 85bcd6fd, the field `paypal_account`
has been removed. The field `paypal_url` cannot be computed correctly
anymore. Convert it to a dummy field.
parent c7a25033
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
from openerp import models, fields, api
import werkzeug.urls
from openerp import models, fields
class AccountInvoice(models.Model):
_inherit = 'account.invoice'
paypal_url = fields.Char('Paypal Url', compute='_compute_paypal_url')
@api.depends('type', 'number', 'company_id', 'currency_id')
def _compute_paypal_url(self):
for inv in self:
if inv.type == 'out_invoice' and inv.company_id.paypal_account:
params = {
"cmd": "_xclick",
"business": inv.company_id.paypal_account,
"item_name": "%s Invoice %s" % (inv.company_id.name, inv.number or ''),
"invoice": inv.number,
"amount": inv.residual,
"currency_code": inv.currency_id.name,
"button_subtype": "services",
"no_note": "1",
"bn": "Odoo_Invoice_PayNow_" + inv.currency_id.name,
}
inv.paypal_url = "https://www.paypal.com/cgi-bin/webscr?" + werkzeug.url_encode(params)
paypal_url = fields.Char('Paypal Url', store=False) # dummy field
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment