From 84e9b1137e7117c674db34a2a51fed700d198fa9 Mon Sep 17 00:00:00 2001 From: tbe-odoo Date: Tue, 29 Aug 2017 11:48:03 +0200 Subject: [PATCH] [IMP] payment,website_payment: Change payment.option model name to payment.icon --- addons/payment/__manifest__.py | 2 +- addons/payment/data/payment_acquirer_data.xml | 102 +++++++++--------- ..._option_data.xml => payment_icon_data.xml} | 22 ++-- addons/payment/models/payment_acquirer.py | 22 ++-- addons/payment/security/ir.model.access.csv | 6 +- .../payment/static/src/less/payment_form.less | 2 +- addons/payment/views/payment_templates.xml | 20 ++-- addons/payment/views/payment_views.xml | 24 ++--- addons/website_payment/models/website.py | 8 +- .../views/website_payment_templates.xml | 8 +- 10 files changed, 108 insertions(+), 108 deletions(-) rename addons/payment/data/{payment_option_data.xml => payment_icon_data.xml} (68%) diff --git a/addons/payment/__manifest__.py b/addons/payment/__manifest__.py index 85a0a57fe61..79fa3cecc0f 100644 --- a/addons/payment/__manifest__.py +++ b/addons/payment/__manifest__.py @@ -9,7 +9,7 @@ 'depends': ['account'], 'data': [ 'data/account_data.xml', - 'data/payment_option_data.xml', + 'data/payment_icon_data.xml', 'data/payment_acquirer_data.xml', 'views/payment_views.xml', 'views/account_payment_views.xml', diff --git a/addons/payment/data/payment_acquirer_data.xml b/addons/payment/data/payment_acquirer_data.xml index cba3b516a0d..871ee7ef8e0 100644 --- a/addons/payment/data/payment_acquirer_data.xml +++ b/addons/payment/data/payment_acquirer_data.xml @@ -27,11 +27,11 @@ - + @@ -52,10 +52,10 @@ - + @@ -73,14 +73,14 @@ - + @@ -102,12 +102,12 @@ - + @@ -139,15 +139,15 @@ - + @@ -166,14 +166,14 @@ - + @@ -194,13 +194,13 @@ https://stripe.com/payments/payment-methods-guide https://support.goteamup.com/hc/en-us/articles/115002089349-Which-cards-and-payment-types-can-I-accept-with-Stripe- --> - + @@ -235,10 +235,10 @@ - + diff --git a/addons/payment/data/payment_option_data.xml b/addons/payment/data/payment_icon_data.xml similarity index 68% rename from addons/payment/data/payment_option_data.xml rename to addons/payment/data/payment_icon_data.xml index 49d351ddc83..4dc62d67e39 100644 --- a/addons/payment/data/payment_option_data.xml +++ b/addons/payment/data/payment_icon_data.xml @@ -1,56 +1,56 @@ - + VISA - + American Express - + Cirrus - + Diners Club International - + Diners Club International - + Discover - + JCB - + Maestro - + MasterCard - + UnionPay - + Bancontact diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index e415c2c21f5..b5444fdb35a 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -150,7 +150,7 @@ class PaymentAcquirer(models.Model): "resized as a 64x64px image, with aspect ratio preserved. " "Use this field anywhere a small image is required.") - payment_option_ids = fields.Many2many('payment.option', string='Supported Payment Option') + payment_icon_ids = fields.Many2many('payment.icon', string='Supported Payment Icons') prefered_payment_type = fields.Selection(selection=[('s2s','Server to server'), ('form', 'Form'), ('both', 'Both') @@ -355,7 +355,7 @@ class PaymentAcquirer(models.Model): return self.view_template_id.render(values, engine='ir.qweb') - def get_s2s_form_name(self): + def get_s2s_form_xml_id(self): if self.registration_view_template_id: model_data = self.env['ir.model.data'].search([('model', '=', 'ir.ui.view'), ('res_id', '=', self.registration_view_template_id.id)]) return ('%s.%s') % (model_data.module, model_data.name) @@ -400,23 +400,23 @@ class PaymentAcquirer(models.Model): 'context': context, } -class PaymentOption(models.Model): - _name = 'payment.option' - _description = 'Payment Option' +class PaymentIcon(models.Model): + _name = 'payment.icon' + _description = 'Payment Icon' name = fields.Char(string='Name') - acquirer_ids = fields.Many2many('payment.acquirer', string="Acquirers", help="List of Acquirers supporting this payment option.") + acquirer_ids = fields.Many2many('payment.acquirer', string="Acquirers", help="List of Acquirers supporting this payment icon.") image = fields.Binary( "Image", attachment=True, - help="This field holds the image used for this payment option, limited to 1024x1024px") + help="This field holds the image used for this payment icon, limited to 1024x1024px") image_medium = fields.Binary( "Medium-sized image", attachment=True, - help="Medium-sized image of this payment option. It is automatically " + help="Medium-sized image of this payment icon. It is automatically " "resized as a 128x128px image, with aspect ratio preserved. " "Use this field in form views or some kanban views.") image_small = fields.Binary( "Small-sized image", attachment=True, - help="Small-sized image of this payment option. It is automatically " + help="Small-sized image of this payment icon. It is automatically " "resized as a 64x64px image, with aspect ratio preserved. " "Use this field anywhere a small image is required.") @@ -430,14 +430,14 @@ class PaymentOption(models.Model): if 'image' in vals: vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30)) - return super(PaymentOption, self).create(vals) + return super(PaymentIcon, self).create(vals) @api.multi def write(self, vals): image_resize_images(vals) if 'image' in vals: vals['image_payment_form'] = image_resize_image(vals['image'], size=(45,30)) - return super(PaymentOption, self).write(vals) + return super(PaymentIcon, self).write(vals) class PaymentTransaction(models.Model): """ Transaction Model. Each specific acquirer can extend the model by adding diff --git a/addons/payment/security/ir.model.access.csv b/addons/payment/security/ir.model.access.csv index f1d86956349..2982f1ab0c0 100644 --- a/addons/payment/security/ir.model.access.csv +++ b/addons/payment/security/ir.model.access.csv @@ -9,6 +9,6 @@ payment_method_all,payment.token.all,model_payment_token,,1,0,0,0 payment_method_user,payment.token.user,model_payment_token,base.group_user,1,1,1,1 payment_method_portal,payment.token.portal,model_payment_token,base.group_portal,1,1,1,1 payment_method_system,payment.token.system,model_payment_token,base.group_system,1,1,1,1 -payment_option_all,payment.option.all,model_payment_option,,1,0,0,0 -payment_option_user,payment.option.user,model_payment_option,base.group_user,1,1,1,0 -payment_option_system,payment.option.system,model_payment_option,base.group_system,1,1,1,1 \ No newline at end of file +payment_icon_all,payment.icon.all,model_payment_icon,,1,0,0,0 +payment_icon_user,payment.icon.user,model_payment_icon,base.group_user,1,1,1,0 +payment_icon_system,payment.icon.system,model_payment_icon,base.group_system,1,1,1,1 \ No newline at end of file diff --git a/addons/payment/static/src/less/payment_form.less b/addons/payment/static/src/less/payment_form.less index 6ac08e221b1..b5aeb2e928e 100644 --- a/addons/payment/static/src/less/payment_form.less +++ b/addons/payment/static/src/less/payment_form.less @@ -34,7 +34,7 @@ padding: 1.14em !important; } - .payment_option_list { + .payment_icon_list { li { padding-left: 5px !important; padding-right: 0px !important; diff --git a/addons/payment/views/payment_templates.xml b/addons/payment/views/payment_templates.xml index 370eda3e768..4327939a7e3 100644 --- a/addons/payment/views/payment_templates.xml +++ b/addons/payment/views/payment_templates.xml @@ -50,16 +50,16 @@ -
    +
      - +
    • -
    • - and more + and more
    • @@ -68,7 +68,7 @@
      - +
      @@ -83,18 +83,18 @@ t-att-class="'hidden' if (acquirers_count==1 and pms_count==0) else ''" t-att-checked="acquirers_count==1 and pms_count==0" name="pm_id" t-attf-value="form_{{acq.id}}"/> - + -
        +
          - +
        • -
        • - and more + and more
        • diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml index caf505edbed..abd9da665cf 100644 --- a/addons/payment/views/payment_views.xml +++ b/addons/payment/views/payment_views.xml @@ -112,7 +112,7 @@
      - + @@ -378,12 +378,12 @@ parent='root_payment_menu' groups='base.group_no_one'/> - - - payment.option.form - payment.option + + + payment.icon.form + payment.icon -
      +
      @@ -401,21 +401,21 @@ - - Payment Options - payment.option + + Payment Icons + payment.icon form tree,form

      - Click to create a payment acquirer. + Click to create a payment icon.

      diff --git a/addons/website_payment/models/website.py b/addons/website_payment/models/website.py index 0bb533cd1c9..b6b67e60708 100644 --- a/addons/website_payment/models/website.py +++ b/addons/website_payment/models/website.py @@ -8,8 +8,8 @@ class Website(models.Model): _inherit = "website" @api.model - def payment_options(self): - """ This function returns the list of payment options which are supported by payment acquirers that are published + def payment_icons(self): + """ This function returns the list of payment icons which are supported by payment acquirers that are published """ - options = self.env['payment.option'].sudo().search([('acquirer_ids', '!=', False)]) - return [opt for opt in options if any(acq.website_published for acq in opt.acquirer_ids)] + icons = self.env['payment.icon'].sudo().search([('acquirer_ids', '!=', False)]) + return [icon for icon in icons if any(acq.website_published for acq in icon.acquirer_ids)] diff --git a/addons/website_payment/views/website_payment_templates.xml b/addons/website_payment/views/website_payment_templates.xml index 95d5d44cbf2..c7083c140e9 100644 --- a/addons/website_payment/views/website_payment_templates.xml +++ b/addons/website_payment/views/website_payment_templates.xml @@ -1,12 +1,12 @@ -