diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index f7899376ed4..ff875331361 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -123,7 +123,7 @@ class PaymentAcquirer(osv.Model): _defaults = { 'company_id': lambda self, cr, uid, obj, ctx=None: self.pool['res.users'].browse(cr, uid, uid).company_id.id, - 'environment': 'prod', + 'environment': 'test', 'website_published': False, 'auto_confirm': 'at_pay_confirm', 'pending_msg': 'Pending, Your online payment has been successfully processed. But your order is not validated yet.', @@ -308,6 +308,13 @@ class PaymentAcquirer(osv.Model): return method(cr, uid, id, data, context=context) return True + def toggle_enviroment_value(self, cr, uid, ids, context=None): + acquirers = self.browse(cr, uid, ids, context=context) + prod_ids = [acquirer.id for acquirer in acquirers if acquirer.environment == 'prod'] + test_ids = [acquirer.id for acquirer in acquirers if acquirer.environment == 'test'] + self.write(cr, uid, prod_ids, {'environment': 'test'}, context=context) + self.write(cr, uid, test_ids, {'environment': 'prod'}, context=context) + class PaymentTransaction(osv.Model): """ Transaction Model. Each specific acquirer can extend the model by adding diff --git a/addons/payment/views/payment_acquirer.xml b/addons/payment/views/payment_acquirer.xml index d1817c42aa8..f680bf92602 100644 --- a/addons/payment/views/payment_acquirer.xml +++ b/addons/payment/views/payment_acquirer.xml @@ -23,8 +23,21 @@ payment.acquirer + + + + Production + Environment + + + + + Test + Environment + + @@ -37,7 +50,6 @@ -