Browse Source

[PEP8] make the code comply with PEP8

pull/1/head
houssine 6 years ago
parent
commit
2c9a31e57e
  1. 32
      easy_my_coop_online_payment/controllers/main.py

32
easy_my_coop_online_payment/controllers/main.py

@ -1,17 +1,13 @@
# -*- coding: utf-8 -*-
# import datetime
# import re
import werkzeug
import werkzeug.urls
from openerp import http, SUPERUSER_ID
from openerp import http
from openerp.http import request
from openerp.tools.translate import _
from openerp.addons.easy_my_coop.controllers.main import WebsiteSubscription
from openerp.addons.website_payment.controllers.main import website_payment
class SubscriptionOnlinePayment(WebsiteSubscription):
def fill_values(self, values, is_company, load_from_user=False):
@ -36,10 +32,14 @@ class SubscriptionOnlinePayment(WebsiteSubscription):
class SubscriptionWebsitePayment(website_payment):
@http.route(['/website_payment/transaction'], type='json', auth="public", website=True)
@http.route(['/website_payment/transaction'],
type='json',
auth="public", website=True)
def transaction(self, reference, amount, currency_id, acquirer_id):
inv_obj = request.env['account.invoice']
partner_id = request.env.user.partner_id.id if request.env.user.partner_id != request.website.partner_id else False
capital_release_request = request.env['account.invoice'].sudo().search([('release_capital_request','=',True),('number','=',reference)])
capital_release_request = inv_obj.sudo().search([('release_capital_request', '=', True),
('number', '=', reference)])
values = {
'acquirer_id': int(acquirer_id),
@ -58,7 +58,9 @@ class SubscriptionWebsitePayment(website_payment):
request.session['website_payment_tx_id'] = tx.id
return tx.id
@http.route(['/website_payment/confirm'], type='http', auth='public', website=True)
@http.route(['/website_payment/confirm'],
type='http',
auth='public', website=True)
def confirm(self, **kw):
tx_id = request.session.pop('website_payment_tx_id', False)
if tx_id:
@ -69,8 +71,11 @@ class SubscriptionWebsitePayment(website_payment):
else:
return request.redirect('/my/home')
@http.route(['/website_payment/pay'], type='http', auth='public', website=True)
def pay(self, reference='', amount=False, currency_id=None, acquirer_id=None, **kw):
@http.route(['/website_payment/pay'],
type='http',
auth='public', website=True)
def pay(self, reference='', amount=False, currency_id=None,
acquirer_id=None, **kw):
env = request.env
user = env.user.sudo()
@ -88,7 +93,10 @@ class SubscriptionWebsitePayment(website_payment):
reference = request.env['payment.transaction'].get_next_reference(reference)
partner_id = user.partner_id.id if user.partner_id.id != request.website.partner_id.id else False
capital_release_request = request.env['account.invoice'].sudo().search([('release_capital_request','=',True),('number','=',reference)])
capital_release_request = request.env['account.invoice'].sudo().search(
[('release_capital_request', '=', True),
('number', '=', reference)]
)
if len(capital_release_request) > 0:
partner_id = capital_release_request.partner_id.id

Loading…
Cancel
Save