[IMP] payment,website_payment: Change payment.option model name to payment.icon

This commit is contained in:
tbe-odoo
2017-08-29 11:48:03 +02:00
parent efea6babbe
commit 84e9b1137e
10 changed files with 108 additions and 108 deletions
+1 -1
View File
@@ -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',
+51 -51
View File
@@ -27,11 +27,11 @@
</ul>
</field>
<!-- https://www.buckaroo-payments.com/products/payment-methods/ -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_bancontact"),
ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_visa"),
ref("payment.payment_option_cc_american_express")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_bancontact"),
ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_visa"),
ref("payment.payment_icon_cc_american_express")])]'/>
</record>
<record id="payment_acquirer_ogone" model="payment.acquirer">
@@ -52,10 +52,10 @@
</ul>
</field>
<!-- https://payment-services.ingenico.com/~/media/files/130806_product_sheet_ingenico_collect_en.ashx?la=en -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_bancontact"),
ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_bancontact"),
ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
<record id="payment_acquirer_adyen" model="payment.acquirer">
@@ -73,14 +73,14 @@
</ul>
</field>
<!-- https://www.adyen.com/payment-methods -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_bancontact"),
ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_visa"),
ref("payment.payment_option_cc_discover"),
ref("payment.payment_option_cc_diners_club_intl"),
ref("payment.payment_option_cc_jcb"),
ref("payment.payment_option_cc_unionpay")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_bancontact"),
ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_visa"),
ref("payment.payment_icon_cc_discover"),
ref("payment.payment_icon_cc_diners_club_intl"),
ref("payment.payment_icon_cc_jcb"),
ref("payment.payment_icon_cc_unionpay")])]'/>
</record>
<record id="payment_acquirer_authorize" model="payment.acquirer">
@@ -102,12 +102,12 @@
</ul>
</field>
<!-- https://www.authorize.net/solutions/merchantsolutions/onlinemerchantaccount/ -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_discover"),
ref("payment.payment_option_cc_diners_club_intl"),
ref("payment.payment_option_cc_jcb"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_discover"),
ref("payment.payment_icon_cc_diners_club_intl"),
ref("payment.payment_icon_cc_jcb"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
<record id="payment_acquirer_transfer" model="payment.acquirer">
@@ -139,15 +139,15 @@
</ul>
</field>
<!-- http://sips.worldline.com/en-us/home/features/payment-types-and-acquirers.html -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_discover"),
ref("payment.payment_option_cc_diners_club_intl"),
ref("payment.payment_option_cc_jcb"),
ref("payment.payment_option_cc_american_express"),
ref("payment.payment_option_cc_bancontact"),
ref("payment.payment_option_cc_unionpay"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_discover"),
ref("payment.payment_icon_cc_diners_club_intl"),
ref("payment.payment_icon_cc_jcb"),
ref("payment.payment_icon_cc_american_express"),
ref("payment.payment_icon_cc_bancontact"),
ref("payment.payment_icon_cc_unionpay"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
<record id="payment_acquirer_paypal" model="payment.acquirer">
@@ -166,14 +166,14 @@
</ul>
</field>
<!-- https://www.paypal.com/us/selfhelp/article/Which-credit-cards-can-I-accept-with-PayPal-Merchant-Services-FAQ1525#business -->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_discover"),
ref("payment.payment_option_cc_diners_club_intl"),
ref("payment.payment_option_cc_jcb"),
ref("payment.payment_option_cc_american_express"),
ref("payment.payment_option_cc_unionpay"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_discover"),
ref("payment.payment_icon_cc_diners_club_intl"),
ref("payment.payment_icon_cc_jcb"),
ref("payment.payment_icon_cc_american_express"),
ref("payment.payment_icon_cc_unionpay"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
<record id="payment_acquirer_stripe" model="payment.acquirer">
@@ -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-
-->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_discover"),
ref("payment.payment_option_cc_diners_club_intl"),
ref("payment.payment_option_cc_jcb"),
ref("payment.payment_option_cc_american_express"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_discover"),
ref("payment.payment_icon_cc_diners_club_intl"),
ref("payment.payment_icon_cc_jcb"),
ref("payment.payment_icon_cc_american_express"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
<record id="payment_acquirer_custom" model="payment.acquirer">
@@ -235,10 +235,10 @@
<!-- https://www.payumoney.com/selfcare.html?userType=seller
> Banks & Cards > What options do you have in the Credit Card payment?
-->
<field name="payment_option_ids" eval='[(6, 0, [ref("payment.payment_option_cc_maestro"),
ref("payment.payment_option_cc_mastercard"),
ref("payment.payment_option_cc_american_express"),
ref("payment.payment_option_cc_visa")])]'/>
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_maestro"),
ref("payment.payment_icon_cc_mastercard"),
ref("payment.payment_icon_cc_american_express"),
ref("payment.payment_icon_cc_visa")])]'/>
</record>
</odoo>
@@ -1,56 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="payment_option_cc_visa" model="payment.option">
<record id="payment_icon_cc_visa" model="payment.icon">
<field name="name">VISA</field>
<field name="image" type="base64" file="payment/static/img/visa.png"/>
</record>
<record id="payment_option_cc_american_express" model="payment.option">
<record id="payment_icon_cc_american_express" model="payment.icon">
<field name="name">American Express</field>
<field name="image" type="base64" file="payment/static/img/american_express.png"/>
</record>
<record id="payment_option_cc_cirrus" model="payment.option">
<record id="payment_icon_cc_cirrus" model="payment.icon">
<field name="name">Cirrus</field>
<field name="image" type="base64" file="payment/static/img/cirrus.png"/>
</record>
<record id="payment_option_cc_diners_club_intl" model="payment.option">
<record id="payment_icon_cc_diners_club_intl" model="payment.icon">
<field name="name">Diners Club International</field>
<field name="image" type="base64" file="payment/static/img/diners_club_intl.png"/>
</record>
<record id="payment_option_cc_diners_club_intl" model="payment.option">
<record id="payment_icon_cc_diners_club_intl" model="payment.icon">
<field name="name">Diners Club International</field>
<field name="image" type="base64" file="payment/static/img/diners_club_intl.png"/>
</record>
<record id="payment_option_cc_discover" model="payment.option">
<record id="payment_icon_cc_discover" model="payment.icon">
<field name="name">Discover</field>
<field name="image" type="base64" file="payment/static/img/discover.png"/>
</record>
<record id="payment_option_cc_jcb" model="payment.option">
<record id="payment_icon_cc_jcb" model="payment.icon">
<field name="name">JCB</field>
<field name="image" type="base64" file="payment/static/img/jcb.png"/>
</record>
<record id="payment_option_cc_maestro" model="payment.option">
<record id="payment_icon_cc_maestro" model="payment.icon">
<field name="name">Maestro</field>
<field name="image" type="base64" file="payment/static/img/maestro.png"/>
</record>
<record id="payment_option_cc_mastercard" model="payment.option">
<record id="payment_icon_cc_mastercard" model="payment.icon">
<field name="name">MasterCard</field>
<field name="image" type="base64" file="payment/static/img/mastercard.png"/>
</record>
<record id="payment_option_cc_unionpay" model="payment.option">
<record id="payment_icon_cc_unionpay" model="payment.icon">
<field name="name">UnionPay</field>
<field name="image" type="base64" file="payment/static/img/unionpay.png"/>
</record>
<record id="payment_option_cc_bancontact" model="payment.option">
<record id="payment_icon_cc_bancontact" model="payment.icon">
<field name="name">Bancontact</field>
<field name="image" type="base64" file="payment/static/img/bancontact.png"/>
</record>
+11 -11
View File
@@ -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
+3 -3
View File
@@ -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
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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
9 payment_method_user payment.token.user model_payment_token base.group_user 1 1 1 1
10 payment_method_portal payment.token.portal model_payment_token base.group_portal 1 1 1 1
11 payment_method_system payment.token.system model_payment_token base.group_system 1 1 1 1
12 payment_option_all payment_icon_all payment.option.all payment.icon.all model_payment_option model_payment_icon 1 0 0 0
13 payment_option_user payment_icon_user payment.option.user payment.icon.user model_payment_option model_payment_icon base.group_user 1 1 1 0
14 payment_option_system payment_icon_system payment.option.system payment.icon.system model_payment_option model_payment_icon base.group_system 1 1 1 1
@@ -34,7 +34,7 @@
padding: 1.14em !important;
}
.payment_option_list {
.payment_icon_list {
li {
padding-left: 5px !important;
padding-right: 0px !important;
+10 -10
View File
@@ -50,16 +50,16 @@
</t>
<span class="payment_option_name" t-esc="acq.name"/>
</label>
<ul class="pull-right list-inline payment_option_list">
<ul class="pull-right list-inline payment_icon_list">
<t t-set="i" t-value="0"/>
<t t-foreach="acq.payment_option_ids" t-as="pm_option">
<t t-foreach="acq.payment_icon_ids" t-as="pm_icon">
<li t-if="i &lt; 3">
<span t-field="pm_option.image_payment_form"
<span t-field="pm_icon.image_payment_form"
t-options='{"widget": "image", "alt-field": "name"}' />
</li>
<li t-if="i==3" style="display:block;">
<span class="pull-right more_option text-info">
<a href="#" data-toggle="tooltip" t-att-title="', '.join([opt.name for opt in acq.payment_option_ids[3:]])">and more</a>
<a href="#" data-toggle="tooltip" t-att-title="', '.join([opt.name for opt in acq.payment_icon_ids[3:]])">and more</a>
</span>
</li>
<t t-set="i" t-value="i+1"/>
@@ -68,7 +68,7 @@
</div>
<div t-attf-id="o_payment_add_token_acq_{{acq.id}}" t-attf-class="panel-footer {{'hidden' if (len(s2s_acquirers)&gt;1 and len(pms)==0 and s2s_acquirers[0]!=acq) else 'hidden' if len(pms)&gt;0 else ''}}">
<div class="clearfix">
<t t-call="{{acq.sudo().get_s2s_form_name()}}">
<t t-call="{{acq.sudo().get_s2s_form_xml_id()}}">
<t t-set="id" t-value="acq.id"/>
</t>
</div>
@@ -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}}"/>
<span class="payment_option_name" t-esc="acq.name"/>
<span class="payment_icon_name" t-esc="acq.name"/>
</label>
<ul class="pull-right list-inline payment_option_list">
<ul class="pull-right list-inline payment_icon_list">
<t t-set="i" t-value="0"/>
<t t-foreach="acq.payment_option_ids" t-as="pm_option">
<t t-foreach="acq.payment_icon_ids" t-as="pm_icon">
<li t-if="i &lt; 3">
<span t-field="pm_option.image_payment_form"
<span t-field="pm_icon.image_payment_form"
t-options='{"widget": "image", "alt-field": "name"}' />
</li>
<li t-if="i==3" style="display:block;">
<span class="pull-right more_option text-info">
<a href="#" data-toggle="tooltip" t-att-title="', '.join([opt.name for opt in acq.payment_option_ids[3:]])">and more</a>
<a href="#" data-toggle="tooltip" t-att-title="', '.join([opt.name for opt in acq.payment_icon_ids[3:]])">and more</a>
</span>
</li>
<t t-set="i" t-value="i+1"/>
+12 -12
View File
@@ -112,7 +112,7 @@
</div>
</div>
<field name="registration_view_template_id" groups="base.group_no_one"/>
<field name="payment_option_ids" widget="many2many_tags"/>
<field name="payment_icon_ids" widget="many2many_tags"/>
<field name="prefered_payment_type"/>
</group>
</page>
@@ -378,12 +378,12 @@
parent='root_payment_menu'
groups='base.group_no_one'/>
<!-- Payment options -->
<record model="ir.ui.view" id="payment_option_form_view">
<field name="name">payment.option.form</field>
<field name="model">payment.option</field>
<!-- Payment icons -->
<record model="ir.ui.view" id="payment_icon_form_view">
<field name="name">payment.icon.form</field>
<field name="model">payment.icon</field>
<field name="arch" type="xml">
<form string="Payment Option">
<form string="Payment Icon">
<sheet>
<field name="image" widget="image" class="oe_avatar" options='{"preview_image": "image_medium"}'/>
<div class="oe_title">
@@ -401,21 +401,21 @@
</field>
</record>
<record id="action_payment_option" model="ir.actions.act_window">
<field name="name">Payment Options</field>
<field name="res_model">payment.option</field>
<record id="action_payment_icon" model="ir.actions.act_window">
<field name="name">Payment Icons</field>
<field name="res_model">payment.icon</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Click to create a payment acquirer.
Click to create a payment icon.
</p>
</field>
</record>
<menuitem
action="action_payment_option"
id="payment_option_menu"
action="action_payment_icon"
id="payment_icon_menu"
parent="root_payment_menu"/>
</data>
</odoo>
+4 -4
View File
@@ -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)]
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="header_footer_custom_payment" inherit_id="website.footer_default" customize_show="True" active="False" name="Payment Options">
<template id="header_footer_custom_payment" inherit_id="website.footer_default" customize_show="True" active="False" name="Payment Icons">
<xpath expr="//div[@id='info']" position="inside">
<h4 class="payment_method_title">Payment Options</h4>
<h4 class="payment_method_title">Payment Icons</h4>
<ul class="payment_method_list list-inline">
<t t-foreach="request.website.payment_options()" t-as="option">
<t t-foreach="request.website.payment_icons()" t-as="icon">
<li>
<span t-field="option.image_small" t-options='{"widget": "image", "alt-field": "name"}' />
<span t-field="icon.image_small" t-options='{"widget": "image", "alt-field": "name"}' />
</li>
</t>
</ul>