[FIX] payment, website_sale: back port of cb9d798
This commit is contained in:
parent
e1b1f24516
commit
a430e2c8c5
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
import openerp
|
||||||
from openerp.osv import osv, fields
|
from openerp.osv import osv, fields
|
||||||
from openerp.tools import float_round, float_repr
|
from openerp.tools import float_round, float_repr
|
||||||
from openerp.tools.translate import _
|
from openerp.tools.translate import _
|
||||||
|
@ -457,7 +458,7 @@ class PaymentTransaction(osv.Model):
|
||||||
def get_next_reference(self, cr, uid, reference, context=None):
|
def get_next_reference(self, cr, uid, reference, context=None):
|
||||||
ref_suffix = 1
|
ref_suffix = 1
|
||||||
init_ref = reference
|
init_ref = reference
|
||||||
while self.pool['payment.transaction'].search_count(cr, uid, [('reference', '=', reference)], context=context):
|
while self.pool['payment.transaction'].search_count(cr, openerp.SUPERUSER_ID, [('reference', '=', reference)], context=context):
|
||||||
reference = init_ref + '-' + str(ref_suffix)
|
reference = init_ref + '-' + str(ref_suffix)
|
||||||
ref_suffix += 1
|
ref_suffix += 1
|
||||||
return reference
|
return reference
|
||||||
|
|
|
@ -730,12 +730,11 @@ class website_sale(http.Controller):
|
||||||
tx = request.website.sale_get_transaction()
|
tx = request.website.sale_get_transaction()
|
||||||
if tx:
|
if tx:
|
||||||
tx_id = tx.id
|
tx_id = tx.id
|
||||||
if tx.reference != order.name:
|
if tx.sale_order_id.id != order.id or tx.state in ['error', 'cancel'] or tx.acquirer_id.id != acquirer_id:
|
||||||
tx = False
|
tx = False
|
||||||
tx_id = False
|
tx_id = False
|
||||||
elif tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
|
elif tx.state == 'draft': # button cliked but no more info -> rewrite on tx or create a new one ?
|
||||||
tx.write({
|
tx.write({
|
||||||
'acquirer_id': acquirer_id,
|
|
||||||
'amount': order.amount_total,
|
'amount': order.amount_total,
|
||||||
})
|
})
|
||||||
if not tx:
|
if not tx:
|
||||||
|
|
Loading…
Reference in New Issue