From 0b69bad9968ce2650f6dffd7df703cd33e7f38af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 22 Jan 2014 18:57:02 +0100 Subject: [PATCH 01/21] [RENAME] payment_acquirer_* -> payment_ * bzr revid: tde@openerp.com-20140122175702-1h1e51z4njt4s70w --- .../{payment_acquirer => payment}/__init__.py | 0 .../__openerp__.py | 0 .../doc/changelog.rst | 0 .../doc/index.rst | 0 .../models/__init__.py | 0 .../models/payment_acquirer.py | 4 ++-- .../security/ir.model.access.csv | 0 .../static/description/icon.png | Bin .../tests/__init__.py | 0 .../tests/common.py | 0 .../views/payment_acquirer.xml | 0 .../__init__.py | 0 .../__openerp__.py | 0 .../controllers/__init__.py | 0 .../controllers/main.py | 0 .../data/adyen.xml | 0 .../doc/changelog.rst | 0 .../doc/index.rst | 0 .../models/__init__.py | 0 .../models/adyen.py | 4 ++-- .../static/description/icon.png | Bin .../static/src/img/adyen_icon.png | Bin .../static/src/img/logo.png | Bin .../tests/__init__.py | 0 .../tests/test_adyen.py | 20 +++++++++--------- .../views/adyen.xml | 2 +- .../views/payment_acquirer.xml | 0 .../__init__.py | 0 .../__openerp__.py | 0 .../controllers/__init__.py | 0 .../controllers/main.py | 0 .../data/__init__.py | 0 .../data/ogone.py | 0 .../data/ogone.xml | 0 .../doc/changelog.rst | 0 .../doc/index.rst | 0 .../models/__init__.py | 0 .../models/ogone.py | 6 +++--- .../static/description/icon.png | Bin .../static/src/img/ogone_icon.png | Bin .../tests/__init__.py | 0 .../tests/test_ogone.py | 10 ++++----- .../views/ogone.xml | 2 +- .../views/payment_acquirer.xml | 0 .../__init__.py | 0 .../__openerp__.py | 0 .../controllers/__init__.py | 0 .../controllers/main.py | 0 .../data/paypal.xml | 0 .../doc/changelog.rst | 0 .../doc/index.rst | 0 .../models/__init__.py | 0 .../models/paypal.py | 8 +++---- .../static/description/icon.png | Bin .../static/src/img/paypal_icon.png | Bin .../static/src/img/paypal_logo.png | Bin .../tests/__init__.py | 0 .../tests/test_paypal.py | 11 +++++----- .../views/payment_acquirer.xml | 0 .../views/paypal.xml | 2 +- .../__init__.py | 0 .../__openerp__.py | 0 .../controllers/__init__.py | 0 .../controllers/main.py | 0 .../data/transfer.xml | 0 .../doc/changelog.rst | 0 .../doc/index.rst | 0 .../models/__init__.py | 0 .../models/payment_acquirer.py | 2 +- .../static/description/icon.png | Bin .../static/src/img/transfer_icon.png | Bin .../views/transfer.xml | 2 +- addons/website_sale/__openerp__.py | 2 +- 73 files changed, 37 insertions(+), 38 deletions(-) rename addons/{payment_acquirer => payment}/__init__.py (100%) rename addons/{payment_acquirer => payment}/__openerp__.py (100%) rename addons/{payment_acquirer => payment}/doc/changelog.rst (100%) rename addons/{payment_acquirer => payment}/doc/index.rst (100%) rename addons/{payment_acquirer => payment}/models/__init__.py (100%) rename addons/{payment_acquirer => payment}/models/payment_acquirer.py (99%) rename addons/{payment_acquirer => payment}/security/ir.model.access.csv (100%) rename addons/{payment_acquirer => payment}/static/description/icon.png (100%) rename addons/{payment_acquirer => payment}/tests/__init__.py (100%) rename addons/{payment_acquirer => payment}/tests/common.py (100%) rename addons/{payment_acquirer => payment}/views/payment_acquirer.xml (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/__init__.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/__openerp__.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/controllers/__init__.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/controllers/main.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/data/adyen.xml (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/doc/changelog.rst (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/doc/index.rst (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/models/__init__.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/models/adyen.py (97%) rename addons/{payment_acquirer_adyen => payment_adyen}/static/description/icon.png (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/static/src/img/adyen_icon.png (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/static/src/img/logo.png (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/tests/__init__.py (100%) rename addons/{payment_acquirer_adyen => payment_adyen}/tests/test_adyen.py (83%) rename addons/{payment_acquirer_adyen => payment_adyen}/views/adyen.xml (94%) rename addons/{payment_acquirer_adyen => payment_adyen}/views/payment_acquirer.xml (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/__init__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/__openerp__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/controllers/__init__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/controllers/main.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/data/__init__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/data/ogone.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/data/ogone.xml (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/doc/changelog.rst (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/doc/index.rst (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/models/__init__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/models/ogone.py (98%) rename addons/{payment_acquirer_ogone => payment_ogone}/static/description/icon.png (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/static/src/img/ogone_icon.png (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/tests/__init__.py (100%) rename addons/{payment_acquirer_ogone => payment_ogone}/tests/test_ogone.py (95%) rename addons/{payment_acquirer_ogone => payment_ogone}/views/ogone.xml (96%) rename addons/{payment_acquirer_ogone => payment_ogone}/views/payment_acquirer.xml (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/__init__.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/__openerp__.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/controllers/__init__.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/controllers/main.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/data/paypal.xml (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/doc/changelog.rst (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/doc/index.rst (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/models/__init__.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/models/paypal.py (97%) rename addons/{payment_acquirer_paypal => payment_paypal}/static/description/icon.png (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/static/src/img/paypal_icon.png (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/static/src/img/paypal_logo.png (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/tests/__init__.py (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/tests/test_paypal.py (95%) rename addons/{payment_acquirer_paypal => payment_paypal}/views/payment_acquirer.xml (100%) rename addons/{payment_acquirer_paypal => payment_paypal}/views/paypal.xml (95%) rename addons/{payment_acquirer_transfer => payment_transfer}/__init__.py (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/__openerp__.py (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/controllers/__init__.py (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/controllers/main.py (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/data/transfer.xml (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/doc/changelog.rst (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/doc/index.rst (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/models/__init__.py (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/models/payment_acquirer.py (95%) rename addons/{payment_acquirer_transfer => payment_transfer}/static/description/icon.png (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/static/src/img/transfer_icon.png (100%) rename addons/{payment_acquirer_transfer => payment_transfer}/views/transfer.xml (89%) diff --git a/addons/payment_acquirer/__init__.py b/addons/payment/__init__.py similarity index 100% rename from addons/payment_acquirer/__init__.py rename to addons/payment/__init__.py diff --git a/addons/payment_acquirer/__openerp__.py b/addons/payment/__openerp__.py similarity index 100% rename from addons/payment_acquirer/__openerp__.py rename to addons/payment/__openerp__.py diff --git a/addons/payment_acquirer/doc/changelog.rst b/addons/payment/doc/changelog.rst similarity index 100% rename from addons/payment_acquirer/doc/changelog.rst rename to addons/payment/doc/changelog.rst diff --git a/addons/payment_acquirer/doc/index.rst b/addons/payment/doc/index.rst similarity index 100% rename from addons/payment_acquirer/doc/index.rst rename to addons/payment/doc/index.rst diff --git a/addons/payment_acquirer/models/__init__.py b/addons/payment/models/__init__.py similarity index 100% rename from addons/payment_acquirer/models/__init__.py rename to addons/payment/models/__init__.py diff --git a/addons/payment_acquirer/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py similarity index 99% rename from addons/payment_acquirer/models/payment_acquirer.py rename to addons/payment/models/payment_acquirer.py index 3bf18b64be0..1a7afc3031d 100644 --- a/addons/payment_acquirer/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -28,8 +28,8 @@ class PaymentAcquirer(osv.Model): to have required fields that depend on a specific acquirer. Each acquirer has a link to an ir.ui.view record that is a template of - a button used to display the payment form. See examples in ``payment_acquirer_ogone`` - and ``payment_acquirer_paypal`` modules. + a button used to display the payment form. See examples in ``payment_ogone`` + and ``payment_paypal`` modules. Methods that should be added in an acquirer-specific implementation: diff --git a/addons/payment_acquirer/security/ir.model.access.csv b/addons/payment/security/ir.model.access.csv similarity index 100% rename from addons/payment_acquirer/security/ir.model.access.csv rename to addons/payment/security/ir.model.access.csv diff --git a/addons/payment_acquirer/static/description/icon.png b/addons/payment/static/description/icon.png similarity index 100% rename from addons/payment_acquirer/static/description/icon.png rename to addons/payment/static/description/icon.png diff --git a/addons/payment_acquirer/tests/__init__.py b/addons/payment/tests/__init__.py similarity index 100% rename from addons/payment_acquirer/tests/__init__.py rename to addons/payment/tests/__init__.py diff --git a/addons/payment_acquirer/tests/common.py b/addons/payment/tests/common.py similarity index 100% rename from addons/payment_acquirer/tests/common.py rename to addons/payment/tests/common.py diff --git a/addons/payment_acquirer/views/payment_acquirer.xml b/addons/payment/views/payment_acquirer.xml similarity index 100% rename from addons/payment_acquirer/views/payment_acquirer.xml rename to addons/payment/views/payment_acquirer.xml diff --git a/addons/payment_acquirer_adyen/__init__.py b/addons/payment_adyen/__init__.py similarity index 100% rename from addons/payment_acquirer_adyen/__init__.py rename to addons/payment_adyen/__init__.py diff --git a/addons/payment_acquirer_adyen/__openerp__.py b/addons/payment_adyen/__openerp__.py similarity index 100% rename from addons/payment_acquirer_adyen/__openerp__.py rename to addons/payment_adyen/__openerp__.py diff --git a/addons/payment_acquirer_adyen/controllers/__init__.py b/addons/payment_adyen/controllers/__init__.py similarity index 100% rename from addons/payment_acquirer_adyen/controllers/__init__.py rename to addons/payment_adyen/controllers/__init__.py diff --git a/addons/payment_acquirer_adyen/controllers/main.py b/addons/payment_adyen/controllers/main.py similarity index 100% rename from addons/payment_acquirer_adyen/controllers/main.py rename to addons/payment_adyen/controllers/main.py diff --git a/addons/payment_acquirer_adyen/data/adyen.xml b/addons/payment_adyen/data/adyen.xml similarity index 100% rename from addons/payment_acquirer_adyen/data/adyen.xml rename to addons/payment_adyen/data/adyen.xml diff --git a/addons/payment_acquirer_adyen/doc/changelog.rst b/addons/payment_adyen/doc/changelog.rst similarity index 100% rename from addons/payment_acquirer_adyen/doc/changelog.rst rename to addons/payment_adyen/doc/changelog.rst diff --git a/addons/payment_acquirer_adyen/doc/index.rst b/addons/payment_adyen/doc/index.rst similarity index 100% rename from addons/payment_acquirer_adyen/doc/index.rst rename to addons/payment_adyen/doc/index.rst diff --git a/addons/payment_acquirer_adyen/models/__init__.py b/addons/payment_adyen/models/__init__.py similarity index 100% rename from addons/payment_acquirer_adyen/models/__init__.py rename to addons/payment_adyen/models/__init__.py diff --git a/addons/payment_acquirer_adyen/models/adyen.py b/addons/payment_adyen/models/adyen.py similarity index 97% rename from addons/payment_acquirer_adyen/models/adyen.py rename to addons/payment_adyen/models/adyen.py index 761381d415c..80103f50dae 100644 --- a/addons/payment_acquirer_adyen/models/adyen.py +++ b/addons/payment_adyen/models/adyen.py @@ -10,8 +10,8 @@ import hmac import logging import urlparse -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer_adyen.controllers.main import AdyenController +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment_adyen.controllers.main import AdyenController from openerp.osv import osv, fields from openerp.tools import float_round diff --git a/addons/payment_acquirer_adyen/static/description/icon.png b/addons/payment_adyen/static/description/icon.png similarity index 100% rename from addons/payment_acquirer_adyen/static/description/icon.png rename to addons/payment_adyen/static/description/icon.png diff --git a/addons/payment_acquirer_adyen/static/src/img/adyen_icon.png b/addons/payment_adyen/static/src/img/adyen_icon.png similarity index 100% rename from addons/payment_acquirer_adyen/static/src/img/adyen_icon.png rename to addons/payment_adyen/static/src/img/adyen_icon.png diff --git a/addons/payment_acquirer_adyen/static/src/img/logo.png b/addons/payment_adyen/static/src/img/logo.png similarity index 100% rename from addons/payment_acquirer_adyen/static/src/img/logo.png rename to addons/payment_adyen/static/src/img/logo.png diff --git a/addons/payment_acquirer_adyen/tests/__init__.py b/addons/payment_adyen/tests/__init__.py similarity index 100% rename from addons/payment_acquirer_adyen/tests/__init__.py rename to addons/payment_adyen/tests/__init__.py diff --git a/addons/payment_acquirer_adyen/tests/test_adyen.py b/addons/payment_adyen/tests/test_adyen.py similarity index 83% rename from addons/payment_acquirer_adyen/tests/test_adyen.py rename to addons/payment_adyen/tests/test_adyen.py index 14b5f8fd5e5..c071e682a3d 100644 --- a/addons/payment_acquirer_adyen/tests/test_adyen.py +++ b/addons/payment_adyen/tests/test_adyen.py @@ -3,9 +3,9 @@ from lxml import objectify import urlparse -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer.tests.common import PaymentAcquirerCommon -from openerp.addons.payment_acquirer_adyen.controllers.main import AdyenController +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment.tests.common import PaymentAcquirerCommon +from openerp.addons.payment_adyen.controllers.main import AdyenController from openerp.osv.orm import except_orm from openerp.tools import mute_logger @@ -18,7 +18,7 @@ class AdyenCommon(PaymentAcquirerCommon): self.base_url = self.registry('ir.config_parameter').get_param(cr, uid, 'web.base.url') # get the adyen account - model, self.adyen_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_acquirer_adyen', 'payment_acquirer_adyen') + model, self.adyen_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_adyen', 'payment_acquirer_adyen') # some CC (always use expiration date 06 / 2016, cvc 737, cid 7373 (amex)) self.amex = (('370000000000002', '7373')) @@ -84,12 +84,12 @@ class AdyenForm(AdyenCommon): 'adyen: wrong value for input %s: received %s instead of %s' % (form_input.get('name'), form_input.get('value'), form_values[form_input.get('name')]) ) - @mute_logger('openerp.addons.payment_acquirer_paypal.models.paypal', 'ValidationError') - def test_20_paypal_form_management(self): - cr, uid, context = self.cr, self.uid, {} - # be sure not to do stupid things - adyen = self.payment_acquirer.browse(self.cr, self.uid, self.adyen_id, None) - self.assertEqual(adyen.env, 'test', 'test without test env') + # @mute_logger('openerp.addons.payment_adyen.models.adyen', 'ValidationError') + # def test_20_paypal_form_management(self): + # cr, uid, context = self.cr, self.uid, {} + # # be sure not to do stupid things + # adyen = self.payment_acquirer.browse(self.cr, self.uid, self.adyen_id, None) + # self.assertEqual(adyen.env, 'test', 'test without test env') # {'authResult': u'AUTHORISED', # 'merchantReference': u'SO014', diff --git a/addons/payment_acquirer_adyen/views/adyen.xml b/addons/payment_adyen/views/adyen.xml similarity index 94% rename from addons/payment_acquirer_adyen/views/adyen.xml rename to addons/payment_adyen/views/adyen.xml index 5fcd7c8eb80..7f61a93b120 100644 --- a/addons/payment_acquirer_adyen/views/adyen.xml +++ b/addons/payment_adyen/views/adyen.xml @@ -22,7 +22,7 @@ diff --git a/addons/payment_acquirer_adyen/views/payment_acquirer.xml b/addons/payment_adyen/views/payment_acquirer.xml similarity index 100% rename from addons/payment_acquirer_adyen/views/payment_acquirer.xml rename to addons/payment_adyen/views/payment_acquirer.xml diff --git a/addons/payment_acquirer_ogone/__init__.py b/addons/payment_ogone/__init__.py similarity index 100% rename from addons/payment_acquirer_ogone/__init__.py rename to addons/payment_ogone/__init__.py diff --git a/addons/payment_acquirer_ogone/__openerp__.py b/addons/payment_ogone/__openerp__.py similarity index 100% rename from addons/payment_acquirer_ogone/__openerp__.py rename to addons/payment_ogone/__openerp__.py diff --git a/addons/payment_acquirer_ogone/controllers/__init__.py b/addons/payment_ogone/controllers/__init__.py similarity index 100% rename from addons/payment_acquirer_ogone/controllers/__init__.py rename to addons/payment_ogone/controllers/__init__.py diff --git a/addons/payment_acquirer_ogone/controllers/main.py b/addons/payment_ogone/controllers/main.py similarity index 100% rename from addons/payment_acquirer_ogone/controllers/main.py rename to addons/payment_ogone/controllers/main.py diff --git a/addons/payment_acquirer_ogone/data/__init__.py b/addons/payment_ogone/data/__init__.py similarity index 100% rename from addons/payment_acquirer_ogone/data/__init__.py rename to addons/payment_ogone/data/__init__.py diff --git a/addons/payment_acquirer_ogone/data/ogone.py b/addons/payment_ogone/data/ogone.py similarity index 100% rename from addons/payment_acquirer_ogone/data/ogone.py rename to addons/payment_ogone/data/ogone.py diff --git a/addons/payment_acquirer_ogone/data/ogone.xml b/addons/payment_ogone/data/ogone.xml similarity index 100% rename from addons/payment_acquirer_ogone/data/ogone.xml rename to addons/payment_ogone/data/ogone.xml diff --git a/addons/payment_acquirer_ogone/doc/changelog.rst b/addons/payment_ogone/doc/changelog.rst similarity index 100% rename from addons/payment_acquirer_ogone/doc/changelog.rst rename to addons/payment_ogone/doc/changelog.rst diff --git a/addons/payment_acquirer_ogone/doc/index.rst b/addons/payment_ogone/doc/index.rst similarity index 100% rename from addons/payment_acquirer_ogone/doc/index.rst rename to addons/payment_ogone/doc/index.rst diff --git a/addons/payment_acquirer_ogone/models/__init__.py b/addons/payment_ogone/models/__init__.py similarity index 100% rename from addons/payment_acquirer_ogone/models/__init__.py rename to addons/payment_ogone/models/__init__.py diff --git a/addons/payment_acquirer_ogone/models/ogone.py b/addons/payment_ogone/models/ogone.py similarity index 98% rename from addons/payment_acquirer_ogone/models/ogone.py rename to addons/payment_ogone/models/ogone.py index 17726beefd6..1cbd3a53666 100644 --- a/addons/payment_acquirer_ogone/models/ogone.py +++ b/addons/payment_ogone/models/ogone.py @@ -9,9 +9,9 @@ from urllib import urlencode import urllib2 import urlparse -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer_ogone.controllers.main import OgoneController -from openerp.addons.payment_acquirer_ogone.data import ogone +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment_ogone.controllers.main import OgoneController +from openerp.addons.payment_ogone.data import ogone from openerp.osv import osv, fields from openerp.tools import float_round from openerp.tools.float_utils import float_compare diff --git a/addons/payment_acquirer_ogone/static/description/icon.png b/addons/payment_ogone/static/description/icon.png similarity index 100% rename from addons/payment_acquirer_ogone/static/description/icon.png rename to addons/payment_ogone/static/description/icon.png diff --git a/addons/payment_acquirer_ogone/static/src/img/ogone_icon.png b/addons/payment_ogone/static/src/img/ogone_icon.png similarity index 100% rename from addons/payment_acquirer_ogone/static/src/img/ogone_icon.png rename to addons/payment_ogone/static/src/img/ogone_icon.png diff --git a/addons/payment_acquirer_ogone/tests/__init__.py b/addons/payment_ogone/tests/__init__.py similarity index 100% rename from addons/payment_acquirer_ogone/tests/__init__.py rename to addons/payment_ogone/tests/__init__.py diff --git a/addons/payment_acquirer_ogone/tests/test_ogone.py b/addons/payment_ogone/tests/test_ogone.py similarity index 95% rename from addons/payment_acquirer_ogone/tests/test_ogone.py rename to addons/payment_ogone/tests/test_ogone.py index be1f534ea74..cc76dd4eed6 100644 --- a/addons/payment_acquirer_ogone/tests/test_ogone.py +++ b/addons/payment_ogone/tests/test_ogone.py @@ -4,9 +4,9 @@ from lxml import objectify import time import urlparse -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer.tests.common import PaymentAcquirerCommon -from openerp.addons.payment_acquirer_ogone.controllers.main import OgoneController +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment.tests.common import PaymentAcquirerCommon +from openerp.addons.payment_ogone.controllers.main import OgoneController from openerp.tools import mute_logger @@ -18,7 +18,7 @@ class OgonePayment(PaymentAcquirerCommon): self.base_url = self.registry('ir.config_parameter').get_param(cr, uid, 'web.base.url') # get the adyen account - model, self.ogone_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_acquirer_ogone', 'payment_acquirer_ogone') + model, self.ogone_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_ogone', 'payment_acquirer_ogone') def test_10_ogone_form_render(self): cr, uid, context = self.cr, self.uid, {} @@ -105,7 +105,7 @@ class OgonePayment(PaymentAcquirerCommon): 'ogone: wrong value for form input %s: received %s instead of %s' % (form_input.get('name'), form_input.get('value'), form_values[form_input.get('name')]) ) - @mute_logger('openerp.addons.payment_acquirer_ogone.models.ogone', 'ValidationError') + @mute_logger('openerp.addons.payment_ogone.models.ogone', 'ValidationError') def test_20_ogone_form_management(self): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid thing diff --git a/addons/payment_acquirer_ogone/views/ogone.xml b/addons/payment_ogone/views/ogone.xml similarity index 96% rename from addons/payment_acquirer_ogone/views/ogone.xml rename to addons/payment_ogone/views/ogone.xml index df26cce9528..03e4523f9a8 100644 --- a/addons/payment_acquirer_ogone/views/ogone.xml +++ b/addons/payment_ogone/views/ogone.xml @@ -43,7 +43,7 @@ diff --git a/addons/payment_acquirer_ogone/views/payment_acquirer.xml b/addons/payment_ogone/views/payment_acquirer.xml similarity index 100% rename from addons/payment_acquirer_ogone/views/payment_acquirer.xml rename to addons/payment_ogone/views/payment_acquirer.xml diff --git a/addons/payment_acquirer_paypal/__init__.py b/addons/payment_paypal/__init__.py similarity index 100% rename from addons/payment_acquirer_paypal/__init__.py rename to addons/payment_paypal/__init__.py diff --git a/addons/payment_acquirer_paypal/__openerp__.py b/addons/payment_paypal/__openerp__.py similarity index 100% rename from addons/payment_acquirer_paypal/__openerp__.py rename to addons/payment_paypal/__openerp__.py diff --git a/addons/payment_acquirer_paypal/controllers/__init__.py b/addons/payment_paypal/controllers/__init__.py similarity index 100% rename from addons/payment_acquirer_paypal/controllers/__init__.py rename to addons/payment_paypal/controllers/__init__.py diff --git a/addons/payment_acquirer_paypal/controllers/main.py b/addons/payment_paypal/controllers/main.py similarity index 100% rename from addons/payment_acquirer_paypal/controllers/main.py rename to addons/payment_paypal/controllers/main.py diff --git a/addons/payment_acquirer_paypal/data/paypal.xml b/addons/payment_paypal/data/paypal.xml similarity index 100% rename from addons/payment_acquirer_paypal/data/paypal.xml rename to addons/payment_paypal/data/paypal.xml diff --git a/addons/payment_acquirer_paypal/doc/changelog.rst b/addons/payment_paypal/doc/changelog.rst similarity index 100% rename from addons/payment_acquirer_paypal/doc/changelog.rst rename to addons/payment_paypal/doc/changelog.rst diff --git a/addons/payment_acquirer_paypal/doc/index.rst b/addons/payment_paypal/doc/index.rst similarity index 100% rename from addons/payment_acquirer_paypal/doc/index.rst rename to addons/payment_paypal/doc/index.rst diff --git a/addons/payment_acquirer_paypal/models/__init__.py b/addons/payment_paypal/models/__init__.py similarity index 100% rename from addons/payment_acquirer_paypal/models/__init__.py rename to addons/payment_paypal/models/__init__.py diff --git a/addons/payment_acquirer_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py similarity index 97% rename from addons/payment_acquirer_paypal/models/paypal.py rename to addons/payment_paypal/models/paypal.py index 32e17711bef..42605275179 100644 --- a/addons/payment_acquirer_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -10,8 +10,8 @@ import urlparse import urllib import urllib2 -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer_paypal.controllers.main import PaypalController +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment_paypal.controllers.main import PaypalController from openerp.osv import osv, fields from openerp.tools.float_utils import float_compare @@ -25,8 +25,8 @@ class AcquirerPaypal(osv.Model): """ Paypal URLS """ if env == 'prod': return { - 'paypal_form_url': 'https://www.sandbox.paypal.com/cgi-bin/webscr', - 'paypal_rest_url': 'https://api.sandbox.paypal.com/v1/oauth2/token', + 'paypal_form_url': 'https://www.paypal.com/cgi-bin/webscr', + 'paypal_rest_url': 'https://api.paypal.com/v1/oauth2/token', } else: return { diff --git a/addons/payment_acquirer_paypal/static/description/icon.png b/addons/payment_paypal/static/description/icon.png similarity index 100% rename from addons/payment_acquirer_paypal/static/description/icon.png rename to addons/payment_paypal/static/description/icon.png diff --git a/addons/payment_acquirer_paypal/static/src/img/paypal_icon.png b/addons/payment_paypal/static/src/img/paypal_icon.png similarity index 100% rename from addons/payment_acquirer_paypal/static/src/img/paypal_icon.png rename to addons/payment_paypal/static/src/img/paypal_icon.png diff --git a/addons/payment_acquirer_paypal/static/src/img/paypal_logo.png b/addons/payment_paypal/static/src/img/paypal_logo.png similarity index 100% rename from addons/payment_acquirer_paypal/static/src/img/paypal_logo.png rename to addons/payment_paypal/static/src/img/paypal_logo.png diff --git a/addons/payment_acquirer_paypal/tests/__init__.py b/addons/payment_paypal/tests/__init__.py similarity index 100% rename from addons/payment_acquirer_paypal/tests/__init__.py rename to addons/payment_paypal/tests/__init__.py diff --git a/addons/payment_acquirer_paypal/tests/test_paypal.py b/addons/payment_paypal/tests/test_paypal.py similarity index 95% rename from addons/payment_acquirer_paypal/tests/test_paypal.py rename to addons/payment_paypal/tests/test_paypal.py index 00dbe869e14..01f40ddd094 100644 --- a/addons/payment_acquirer_paypal/tests/test_paypal.py +++ b/addons/payment_paypal/tests/test_paypal.py @@ -1,9 +1,8 @@ # -*- coding: utf-8 -*- -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError -from openerp.addons.payment_acquirer.tests.common import PaymentAcquirerCommon -from openerp.addons.payment_acquirer_paypal.controllers.main import PaypalController -from openerp.osv.orm import except_orm +from openerp.addons.payment.models.payment_acquirer import ValidationError +from openerp.addons.payment.tests.common import PaymentAcquirerCommon +from openerp.addons.payment_paypal.controllers.main import PaypalController from openerp.tools import mute_logger from lxml import objectify @@ -18,7 +17,7 @@ class PaypalCommon(PaymentAcquirerCommon): self.base_url = self.registry('ir.config_parameter').get_param(cr, uid, 'web.base.url') # get the paypal account - model, self.paypal_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_acquirer_paypal', 'payment_acquirer_paypal') + model, self.paypal_id = self.registry('ir.model.data').get_object_reference(cr, uid, 'payment_paypal', 'payment_acquirer_paypal') # tde+seller@openerp.com - tde+buyer@openerp.com - tde+buyer-it@openerp.com # some CC @@ -152,7 +151,7 @@ class PaypalForm(PaypalCommon): self.assertEqual(form_input.get('value'), '1.56', 'paypal: wrong computed fees') self.assertTrue(handling_found, 'paypal: fees_active did not add handling input in rendered form') - @mute_logger('openerp.addons.payment_acquirer_paypal.models.paypal', 'ValidationError') + @mute_logger('openerp.addons.payment_paypal.models.paypal', 'ValidationError') def test_20_paypal_form_management(self): cr, uid, context = self.cr, self.uid, {} # be sure not to do stupid things diff --git a/addons/payment_acquirer_paypal/views/payment_acquirer.xml b/addons/payment_paypal/views/payment_acquirer.xml similarity index 100% rename from addons/payment_acquirer_paypal/views/payment_acquirer.xml rename to addons/payment_paypal/views/payment_acquirer.xml diff --git a/addons/payment_acquirer_paypal/views/paypal.xml b/addons/payment_paypal/views/paypal.xml similarity index 95% rename from addons/payment_acquirer_paypal/views/paypal.xml rename to addons/payment_paypal/views/paypal.xml index 631d3832274..225ba40ee3a 100644 --- a/addons/payment_acquirer_paypal/views/paypal.xml +++ b/addons/payment_paypal/views/paypal.xml @@ -33,7 +33,7 @@ diff --git a/addons/payment_acquirer_transfer/__init__.py b/addons/payment_transfer/__init__.py similarity index 100% rename from addons/payment_acquirer_transfer/__init__.py rename to addons/payment_transfer/__init__.py diff --git a/addons/payment_acquirer_transfer/__openerp__.py b/addons/payment_transfer/__openerp__.py similarity index 100% rename from addons/payment_acquirer_transfer/__openerp__.py rename to addons/payment_transfer/__openerp__.py diff --git a/addons/payment_acquirer_transfer/controllers/__init__.py b/addons/payment_transfer/controllers/__init__.py similarity index 100% rename from addons/payment_acquirer_transfer/controllers/__init__.py rename to addons/payment_transfer/controllers/__init__.py diff --git a/addons/payment_acquirer_transfer/controllers/main.py b/addons/payment_transfer/controllers/main.py similarity index 100% rename from addons/payment_acquirer_transfer/controllers/main.py rename to addons/payment_transfer/controllers/main.py diff --git a/addons/payment_acquirer_transfer/data/transfer.xml b/addons/payment_transfer/data/transfer.xml similarity index 100% rename from addons/payment_acquirer_transfer/data/transfer.xml rename to addons/payment_transfer/data/transfer.xml diff --git a/addons/payment_acquirer_transfer/doc/changelog.rst b/addons/payment_transfer/doc/changelog.rst similarity index 100% rename from addons/payment_acquirer_transfer/doc/changelog.rst rename to addons/payment_transfer/doc/changelog.rst diff --git a/addons/payment_acquirer_transfer/doc/index.rst b/addons/payment_transfer/doc/index.rst similarity index 100% rename from addons/payment_acquirer_transfer/doc/index.rst rename to addons/payment_transfer/doc/index.rst diff --git a/addons/payment_acquirer_transfer/models/__init__.py b/addons/payment_transfer/models/__init__.py similarity index 100% rename from addons/payment_acquirer_transfer/models/__init__.py rename to addons/payment_transfer/models/__init__.py diff --git a/addons/payment_acquirer_transfer/models/payment_acquirer.py b/addons/payment_transfer/models/payment_acquirer.py similarity index 95% rename from addons/payment_acquirer_transfer/models/payment_acquirer.py rename to addons/payment_transfer/models/payment_acquirer.py index 2f72214e4e6..01f0f25f740 100644 --- a/addons/payment_acquirer_transfer/models/payment_acquirer.py +++ b/addons/payment_transfer/models/payment_acquirer.py @@ -1,6 +1,6 @@ # -*- coding: utf-'8' "-*-" -from openerp.addons.payment_acquirer.models.payment_acquirer import ValidationError +from openerp.addons.payment.models.payment_acquirer import ValidationError from openerp.osv import osv from openerp.tools.float_utils import float_compare diff --git a/addons/payment_acquirer_transfer/static/description/icon.png b/addons/payment_transfer/static/description/icon.png similarity index 100% rename from addons/payment_acquirer_transfer/static/description/icon.png rename to addons/payment_transfer/static/description/icon.png diff --git a/addons/payment_acquirer_transfer/static/src/img/transfer_icon.png b/addons/payment_transfer/static/src/img/transfer_icon.png similarity index 100% rename from addons/payment_acquirer_transfer/static/src/img/transfer_icon.png rename to addons/payment_transfer/static/src/img/transfer_icon.png diff --git a/addons/payment_acquirer_transfer/views/transfer.xml b/addons/payment_transfer/views/transfer.xml similarity index 89% rename from addons/payment_acquirer_transfer/views/transfer.xml rename to addons/payment_transfer/views/transfer.xml index f9829759340..01de4a28934 100644 --- a/addons/payment_acquirer_transfer/views/transfer.xml +++ b/addons/payment_transfer/views/transfer.xml @@ -13,7 +13,7 @@ diff --git a/addons/website_sale/__openerp__.py b/addons/website_sale/__openerp__.py index 08257226777..b367fcc0bfc 100644 --- a/addons/website_sale/__openerp__.py +++ b/addons/website_sale/__openerp__.py @@ -9,7 +9,7 @@ OpenERP E-Commerce """, 'author': 'OpenERP SA', - 'depends': ['website', 'sale', 'payment_acquirer'], + 'depends': ['website', 'sale', 'payment'], 'data': [ 'data/website_sale_data.xml', 'views/website_sale.xml', From 44cff7f383dc3a2a84772048fcfa284fd3fc1f88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 22 Jan 2014 19:42:56 +0100 Subject: [PATCH 02/21] [FIX] payment_*: fixed openerp.py file bzr revid: tde@openerp.com-20140122184256-ojcz0f1vxwoj2aw0 --- addons/payment_adyen/__openerp__.py | 2 +- addons/payment_ogone/__openerp__.py | 2 +- addons/payment_paypal/__openerp__.py | 2 +- addons/payment_transfer/__openerp__.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/addons/payment_adyen/__openerp__.py b/addons/payment_adyen/__openerp__.py index e2344c88406..14a9f5d50e2 100644 --- a/addons/payment_adyen/__openerp__.py +++ b/addons/payment_adyen/__openerp__.py @@ -7,7 +7,7 @@ 'version': '1.0', 'description': """Adyen Payment Acquirer""", 'author': 'OpenERP SA', - 'depends': ['payment_acquirer'], + 'depends': ['payment'], 'data': [ 'views/adyen.xml', 'views/payment_acquirer.xml', diff --git a/addons/payment_ogone/__openerp__.py b/addons/payment_ogone/__openerp__.py index 2c7b5076981..6b4411da7f4 100644 --- a/addons/payment_ogone/__openerp__.py +++ b/addons/payment_ogone/__openerp__.py @@ -7,7 +7,7 @@ 'version': '1.0', 'description': """Ogone Payment Acquirer""", 'author': 'OpenERP SA', - 'depends': ['payment_acquirer'], + 'depends': ['payment'], 'data': [ 'views/ogone.xml', 'views/payment_acquirer.xml', diff --git a/addons/payment_paypal/__openerp__.py b/addons/payment_paypal/__openerp__.py index d7ba75d0a7b..d2341b5bae8 100644 --- a/addons/payment_paypal/__openerp__.py +++ b/addons/payment_paypal/__openerp__.py @@ -7,7 +7,7 @@ 'version': '1.0', 'description': """Paypal Payment Acquirer""", 'author': 'OpenERP SA', - 'depends': ['payment_acquirer'], + 'depends': ['payment'], 'data': [ 'views/paypal.xml', 'views/payment_acquirer.xml', diff --git a/addons/payment_transfer/__openerp__.py b/addons/payment_transfer/__openerp__.py index 07b3f55b273..f8c36b4f365 100644 --- a/addons/payment_transfer/__openerp__.py +++ b/addons/payment_transfer/__openerp__.py @@ -7,7 +7,7 @@ 'version': '1.0', 'description': """Transfer Payment Acquirer""", 'author': 'OpenERP SA', - 'depends': ['payment_acquirer'], + 'depends': ['payment'], 'data': [ 'views/transfer.xml', 'data/transfer.xml', From 7445a207f058d27aaf20b10bbb3cc8ea06e8c65a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 22 Jan 2014 19:52:04 +0100 Subject: [PATCH 03/21] [FIX] payment_*: fixed references to payment_acquirer -> payment bzr revid: tde@openerp.com-20140122185204-y0mievmfnm3jfkn1 --- addons/payment_adyen/views/payment_acquirer.xml | 4 ++-- addons/payment_ogone/views/payment_acquirer.xml | 4 ++-- addons/payment_paypal/views/payment_acquirer.xml | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/payment_adyen/views/payment_acquirer.xml b/addons/payment_adyen/views/payment_acquirer.xml index 663cf1efe74..1510a110c43 100644 --- a/addons/payment_adyen/views/payment_acquirer.xml +++ b/addons/payment_adyen/views/payment_acquirer.xml @@ -5,7 +5,7 @@ acquirer.form.adyen payment.acquirer - + @@ -20,7 +20,7 @@ acquirer.transaction.form.adyen payment.transaction - + diff --git a/addons/payment_ogone/views/payment_acquirer.xml b/addons/payment_ogone/views/payment_acquirer.xml index 8a64f801dce..accce4d70d2 100644 --- a/addons/payment_ogone/views/payment_acquirer.xml +++ b/addons/payment_ogone/views/payment_acquirer.xml @@ -5,7 +5,7 @@ acquirer.form.ogone payment.acquirer - + @@ -22,7 +22,7 @@ acquirer.transaction.form.ogone payment.transaction - + diff --git a/addons/payment_paypal/views/payment_acquirer.xml b/addons/payment_paypal/views/payment_acquirer.xml index 0c00ee37261..badd958d5e2 100644 --- a/addons/payment_paypal/views/payment_acquirer.xml +++ b/addons/payment_paypal/views/payment_acquirer.xml @@ -5,7 +5,7 @@ acquirer.form.paypal payment.acquirer - + @@ -29,7 +29,7 @@ acquirer.transaction.form.paypal payment.transaction - + From 2e7b5991b7a8614429dd97bced864cd4dfb63f37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 22 Jan 2014 20:00:22 +0100 Subject: [PATCH 04/21] [REF] portal, portal_sale, payment: refactored old acquirer in portal now based on the new implementation of payment. [REM] portal: removed acquirer model, views and implementation [REF] portal_sale: now using payment rendering methods [IMP] payment: added render_payment_block, taken from old acquirer, that renders all portal_published acquirers. bzr revid: tde@openerp.com-20140122190022-lef4b3o1tpcua3vx --- addons/payment/models/payment_acquirer.py | 36 ++++++- addons/portal/__init__.py | 1 - addons/portal/__openerp__.py | 1 - addons/portal/acquirer.py | 108 --------------------- addons/portal/acquirer_view.xml | 65 ------------- addons/portal/portal_data.xml | 16 --- addons/portal/security/ir.model.access.csv | 2 - addons/portal_sale/__openerp__.py | 2 +- addons/portal_sale/portal_sale.py | 12 ++- addons/portal_sale/res_config_view.xml | 2 - 10 files changed, 42 insertions(+), 203 deletions(-) delete mode 100644 addons/portal/acquirer.py delete mode 100644 addons/portal/acquirer_view.xml diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 1a7afc3031d..39e8624b359 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -3,7 +3,8 @@ import logging from openerp.osv import osv, fields -from openerp.tools import float_round +from openerp.tools import float_round, float_repr +from openerp.tools.translate import _ _logger = logging.getLogger(__name__) @@ -185,7 +186,7 @@ class PaymentAcquirer(osv.Model): - acquirer: the payment.acquirer browse record - user: the current user browse record - - currency: currency browse record + - currency_id: id of the transaction currency - amount: amount of the transaction - reference: reference of the transaction - partner: the current partner browse record, if any (not necessarily set) @@ -253,6 +254,37 @@ class PaymentAcquirer(osv.Model): # because render accepts view ids but not qweb -> need to use the xml_id return self.pool['ir.ui.view'].render(cr, uid, acquirer.view_template_id.xml_id, qweb_context, engine='ir.qweb', context=context) + def _wrap_payment_block(self, cr, uid, html_block, amount, currency_id, context=None): + payment_header = _('Pay safely online') + amount_str = float_repr(amount, self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')) + currency = self.pool['res.currency'].browse(cr, uid, currency_id, context=context) + currency_str = currency.symbol or currency.name + amount = u"%s %s" % ((currency_str, amount_str) if currency.position == 'before' else (amount_str, currency_str)) + result = """
+
+
%s
+ %s +
+ %%s +
""" % (amount, payment_header) + return result % html_block + + 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): + html_forms = [] + # TDE FIXME: change this domain, see with CHM about 'dynamic/static' acquirer + acquirer_ids = self.search(cr, uid, [('portal_published', '=', True), ('name', '!=', 'transfer')], context=context) + for acquirer_id in acquirer_ids: + button = self.render( + cr, uid, acquirer_id, + reference, amount, currency_id, + tx_id, partner_id, partner_values, tx_values, + context) + html_forms.append(button) + if not html_forms: + return '' + html_block = '\n'.join(filter(None, html_forms)) + return self._wrap_payment_block(cr, uid, html_block, amount, currency_id, context=context) + class PaymentTransaction(osv.Model): """ Transaction Model. Each specific acquirer can extend the model by adding diff --git a/addons/portal/__init__.py b/addons/portal/__init__.py index 1f60accc83d..3e3f8dfdd0e 100644 --- a/addons/portal/__init__.py +++ b/addons/portal/__init__.py @@ -24,6 +24,5 @@ import mail_thread import mail_mail import mail_message import wizard -import acquirer # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/portal/__openerp__.py b/addons/portal/__openerp__.py index c747409207a..2ee81218f82 100644 --- a/addons/portal/__openerp__.py +++ b/addons/portal/__openerp__.py @@ -47,7 +47,6 @@ very handy when used in combination with the module 'share'. 'portal_view.xml', 'wizard/portal_wizard_view.xml', 'wizard/share_wizard_view.xml', - 'acquirer_view.xml', 'security/ir.model.access.csv', ], 'demo': ['portal_demo.xml'], diff --git a/addons/portal/acquirer.py b/addons/portal/acquirer.py deleted file mode 100644 index 9c18b597a1b..00000000000 --- a/addons/portal/acquirer.py +++ /dev/null @@ -1,108 +0,0 @@ -# -*- coding: utf-8 -*- -############################################################################## -# -# OpenERP, Open Source Business Applications -# Copyright (c) 2012-TODAY OpenERP S.A. -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import logging -from urllib import quote as quote - -from openerp.osv import osv, fields -from openerp.tools.translate import _ -from openerp.tools import float_repr - -_logger = logging.getLogger(__name__) -try: - from mako.template import Template as MakoTemplate -except ImportError: - _logger.warning("payment_acquirer: mako templates not available, payment acquirer will not work!") - - -class acquirer(osv.Model): - _name = 'portal.payment.acquirer' - _description = 'Online Payment Acquirer' - - _columns = { - 'name': fields.char('Name', required=True), - 'form_template': fields.text('Payment form template (HTML)', translate=True, required=True), - 'visible': fields.boolean('Visible', help="Make this payment acquirer available in portal forms (Customer invoices, etc.)"), - } - - _defaults = { - 'visible': True, - } - - def render(self, cr, uid, id, object, reference, currency, amount, context=None, **kwargs): - """ Renders the form template of the given acquirer as a mako template """ - if not isinstance(id, (int,long)): - id = id[0] - this = self.browse(cr, uid, id) - if context is None: - context = {} - try: - i18n_kind = _(object._description) # may fail to translate, but at least we try - result = MakoTemplate(this.form_template).render_unicode(object=object, - reference=reference, - currency=currency, - amount=amount, - kind=i18n_kind, - quote=quote, - # context kw would clash with mako internals - ctx=context, - format_exceptions=True) - return result.strip() - except Exception: - _logger.exception("failed to render mako template value for payment.acquirer %s: %r", this.name, this.form_template) - return - - def _wrap_payment_block(self, cr, uid, html_block, amount, currency, context=None): - if not html_block: - link = '#action=account.action_account_config' - payment_header = _('You can finish the configuration in the Bank&Cash settings') % link - amount = _('No online payment acquirers configured') - group_ids = self.pool.get('res.users').browse(cr, uid, uid, context=context).groups_id - if any(group.is_portal for group in group_ids): - return '' - else: - payment_header = _('Pay safely online') - amount_str = float_repr(amount, self.pool.get('decimal.precision').precision_get(cr, uid, 'Account')) - currency_str = currency.symbol or currency.name - amount = u"%s %s" % ((currency_str, amount_str) if currency.position == 'before' else (amount_str, currency_str)) - result = """
-
-
%s
- %s -
- %%s -
""" % (amount, payment_header) - return result % html_block - - def render_payment_block(self, cr, uid, object, reference, currency, amount, context=None, **kwargs): - """ Renders all visible payment acquirer forms for the given rendering context, and - return them wrapped in an appropriate HTML block, ready for direct inclusion - in an OpenERP v7 form view """ - acquirer_ids = self.search(cr, uid, [('visible', '=', True)]) - if not acquirer_ids: - return - html_forms = [] - for this in self.browse(cr, uid, acquirer_ids): - content = this.render(object, reference, currency, amount, context=context, **kwargs) - if content: - html_forms.append(content) - html_block = '\n'.join(filter(None,html_forms)) - return self._wrap_payment_block(cr, uid, html_block, amount, currency, context=context) diff --git a/addons/portal/acquirer_view.xml b/addons/portal/acquirer_view.xml deleted file mode 100644 index 53e0591009e..00000000000 --- a/addons/portal/acquirer_view.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - portal.payment.acquirer - -
- -
-
- -
-

- This is an HTML form template to submit a payment through this acquirer. - The template will be rendered with Mako, so it may use Mako expressions. - The Mako evaluation context provides: -

    -
  • reference: the reference number of the document to pay
  • -
  • kind: the kind of document on which the payment form is rendered (translated to user language, e.g. "Invoice")
  • -
  • currency: the currency record in which the document is issued (e.g. currency.name could be EUR)
  • -
  • amount: the total amount to pay, as a float
  • -
  • object: the document on which the payment form is rendered (usually an invoice or sales order record)
  • -
  • quote(): a method to quote special string character to make them suitable for inclusion in a URL
  • -
  • cr: the current database cursor
  • -
  • uid: the current user id
  • -
  • ctx: the current context dictionary
  • -
- If the template renders to an empty result in a certain context it will be ignored, as if it was inactive. -

-
- -
-
-
-
-
- - portal.payment.acquirer - - - - - - - - - portal.payment.acquirer - - - - - - - - - - Payment Acquirers - portal.payment.acquirer - - - -
-
diff --git a/addons/portal/portal_data.xml b/addons/portal/portal_data.xml index 3fec4d7e1ee..a9388ff1045 100644 --- a/addons/portal/portal_data.xml +++ b/addons/portal/portal_data.xml @@ -76,22 +76,6 @@
- - Paypal - - - - - - - - -% endif - ]]> - - diff --git a/addons/portal/security/ir.model.access.csv b/addons/portal/security/ir.model.access.csv index 7676f0a9d2b..1ec8d4d0be2 100644 --- a/addons/portal/security/ir.model.access.csv +++ b/addons/portal/security/ir.model.access.csv @@ -3,6 +3,4 @@ access_mail_message_portal,mail.message.portal,mail.model_mail_message,base.grou access_mail_mail_portal,mail.mail.portal,mail.model_mail_mail,base.group_portal,1,1,1,0 access_mail_notification_portal,mail.notification.portal,mail.model_mail_notification,base.group_portal,1,1,1,0 access_mail_followers_portal,mail.followers.portal,mail.model_mail_followers,base.group_portal,1,1,0,0 -access_acquirer,portal.payment.acquirer,portal.model_portal_payment_acquirer,,1,0,0,0 -access_acquirer_all,portal.payment.acquirer,portal.model_portal_payment_acquirer,base.group_system,1,1,1,1 access_ir_attachment_group_portal,ir.attachment group_portal,base.model_ir_attachment,base.group_portal,1,0,1,0 \ No newline at end of file diff --git a/addons/portal_sale/__openerp__.py b/addons/portal_sale/__openerp__.py index b8ce9165283..ec3f4651119 100644 --- a/addons/portal_sale/__openerp__.py +++ b/addons/portal_sale/__openerp__.py @@ -44,7 +44,7 @@ pay online on their Sale Orders and Invoices that are not paid yet. Paypal is in by default, you simply need to configure a Paypal account in the Accounting/Invoicing settings. """, 'author': 'OpenERP SA', - 'depends': ['sale','portal'], + 'depends': ['sale', 'portal', 'payment'], 'data': [ 'security/portal_security.xml', 'portal_sale_view.xml', diff --git a/addons/portal_sale/portal_sale.py b/addons/portal_sale/portal_sale.py index 11314704745..23bb36bd353 100644 --- a/addons/portal_sale/portal_sale.py +++ b/addons/portal_sale/portal_sale.py @@ -34,11 +34,12 @@ class sale_order(osv.Model): def _portal_payment_block(self, cr, uid, ids, fieldname, arg, context=None): result = dict.fromkeys(ids, False) - payment_acquirer = self.pool.get('portal.payment.acquirer') + payment_acquirer = self.pool['payment.acquirer'] for this in self.browse(cr, uid, ids, context=context): if this.state not in ('draft', 'cancel') and not this.invoiced: - result[this.id] = payment_acquirer.render_payment_block(cr, uid, this, this.name, - this.pricelist_id.currency_id, this.amount_total, context=context) + 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) return result def action_quotation_send(self, cr, uid, ids, context=None): @@ -87,8 +88,9 @@ class account_invoice(osv.Model): payment_acquirer = self.pool.get('portal.payment.acquirer') for this in self.browse(cr, uid, ids, context=context): 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, this.number, - this.currency_id, this.residual, context=context) + 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) return result def action_invoice_sent(self, cr, uid, ids, context=None): diff --git a/addons/portal_sale/res_config_view.xml b/addons/portal_sale/res_config_view.xml index ce33a1a1a72..50664a43d36 100644 --- a/addons/portal_sale/res_config_view.xml +++ b/addons/portal_sale/res_config_view.xml @@ -11,8 +11,6 @@
From 72d7a19d0fb5256ec297b529d1d5c276a4bae226 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 23 Jan 2014 10:17:07 +0100 Subject: [PATCH 05/21] [FIX] website_payment: fixed openerp.py: payment_acquirer -> payment bzr revid: tde@openerp.com-20140123091707-ozqxm49j9o24ptuc --- addons/website_payment/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/website_payment/__openerp__.py b/addons/website_payment/__openerp__.py index e85803182de..d2ee280e8bf 100644 --- a/addons/website_payment/__openerp__.py +++ b/addons/website_payment/__openerp__.py @@ -9,7 +9,7 @@ 'author': 'OpenERP SA', 'depends': [ 'website', - 'payment_acquirer', + 'payment', ], 'data': [ 'views/website_payment_templates.xml', From 4ae6b9010fe5d20beaf21537481e34aa93d82ec4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Thu, 23 Jan 2014 11:05:09 +0100 Subject: [PATCH 06/21] [IMP] payment_acquirer_paypal: misc improvements - paypal_email_id -> paypal_email_Account, to avoid confusion with a m2o field - paypal_seller_id -> paypal_seller_account, to avoid confusion with a m2o field - api-related fields now hidden, because WIP for saas-4 bzr revid: tde@openerp.com-20140123100509-z8wgrj8fswk4wjq2 --- addons/payment_paypal/data/paypal.xml | 4 ++-- addons/payment_paypal/models/paypal.py | 14 +++++++------- addons/payment_paypal/views/payment_acquirer.xml | 11 ++++++----- addons/payment_paypal/views/paypal.xml | 2 +- 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/addons/payment_paypal/data/paypal.xml b/addons/payment_paypal/data/paypal.xml index d764c20edbd..fdf59ce967e 100644 --- a/addons/payment_paypal/data/paypal.xml +++ b/addons/payment_paypal/data/paypal.xml @@ -8,8 +8,8 @@ test You will be redirected to the Paypal website after cliking on the payment button.

]]>
- dummy - dummy + dummy + dummy dummy dummy
diff --git a/addons/payment_paypal/models/paypal.py b/addons/payment_paypal/models/paypal.py index 42605275179..e3d58ffbc12 100644 --- a/addons/payment_paypal/models/paypal.py +++ b/addons/payment_paypal/models/paypal.py @@ -35,8 +35,8 @@ class AcquirerPaypal(osv.Model): } _columns = { - 'paypal_email_id': fields.char('Email ID', required_if_provider='paypal'), - 'paypal_seller_id': fields.char('Seller ID', required_if_provider='paypal'), + 'paypal_email_account': fields.char('Paypal Email ID', required_if_provider='paypal'), + 'paypal_seller_account': fields.char('Paypal Seller ID', required_if_provider='paypal'), 'paypal_use_ipn': fields.boolean('Use IPN'), # Server 2 server 'paypal_api_enabled': fields.boolean('Use Rest API'), @@ -82,7 +82,7 @@ class AcquirerPaypal(osv.Model): paypal_tx_values = dict(tx_values) paypal_tx_values.update({ 'cmd': '_xclick', - 'business': acquirer.paypal_email_id, + 'business': acquirer.paypal_email_account, 'item_name': tx_values['reference'], 'item_number': tx_values['reference'], 'amount': tx_values['amount'], @@ -193,10 +193,10 @@ class TxPaypal(osv.Model): if tx.partner_reference and data.get('payer_id') != tx.partner_reference: invalid_parameters.append(('payer_id', data.get('payer_id'), tx.partner_reference)) # check seller - if data.get('receiver_email') != tx.acquirer_id.paypal_email_id: - invalid_parameters.append(('receiver_email', data.get('receiver_email'), tx.acquirer_id.paypal_email_id)) - if data.get('receiver_id') != tx.acquirer_id.paypal_seller_id: - invalid_parameters.append(('receiver_id', data.get('receiver_id'), tx.acquirer_id.paypal_seller_id)) + if data.get('receiver_email') != tx.acquirer_id.paypal_email_account: + invalid_parameters.append(('receiver_email', data.get('receiver_email'), tx.acquirer_id.paypal_email_account)) + if data.get('receiver_id') != tx.acquirer_id.paypal_seller_account: + invalid_parameters.append(('receiver_id', data.get('receiver_id'), tx.acquirer_id.paypal_seller_account)) return invalid_parameters diff --git a/addons/payment_paypal/views/payment_acquirer.xml b/addons/payment_paypal/views/payment_acquirer.xml index badd958d5e2..835d96f42e9 100644 --- a/addons/payment_paypal/views/payment_acquirer.xml +++ b/addons/payment_paypal/views/payment_acquirer.xml @@ -11,14 +11,15 @@ - - + + - + + invisible="1"/> + invisible="1"/> diff --git a/addons/payment_paypal/views/paypal.xml b/addons/payment_paypal/views/paypal.xml index 225ba40ee3a..b93d37c3c94 100644 --- a/addons/payment_paypal/views/paypal.xml +++ b/addons/payment_paypal/views/paypal.xml @@ -3,7 +3,7 @@