summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan Demaret Rivarola <jde@odoo.com>2019-07-11 15:31:19 +0000
committerDamien Bouvy <dbo@odoo.com>2019-08-16 15:52:39 +0000
commite01d559f9d558ac0a2600cc18efbd011efd26114 (patch)
treeac9895353a549c16d1d4fd645da4ab3be3e164d3
parentd72117dcd072105ea10552c70a4b423cc6575a3c (diff)
[IMP] payment: support SEPA Direct Debit acquirer
The purpose of this commit is to expose SEPA Direct Debit acquirer to the Odoo community edition. The dedicated module, though, is restricted to the enterprise edition. Minor changes in following modules: - base: added ir.module.module record - payment: - added data to expose the new payment acquirer. - added 'to_buy' field to track whether the payment acquirer is restricted to enterprise users. - allow multi word payment acquirer name. It was breaking on the first underscore. task-1870363 closes odoo/odoo#26427
-rw-r--r--addons/payment/data/payment_acquirer_data.xml13
-rw-r--r--addons/payment/models/payment_acquirer.py3
-rw-r--r--addons/payment/static/src/js/payment_processing.js2
-rw-r--r--addons/payment/views/payment_views.xml12
-rw-r--r--odoo/addons/base/data/ir_module_module.xml10
-rw-r--r--odoo/addons/base/static/img/icons/payment_sepa_direct_debit.pngbin0 -> 2675 bytes
6 files changed, 36 insertions, 4 deletions
diff --git a/addons/payment/data/payment_acquirer_data.xml b/addons/payment/data/payment_acquirer_data.xml
index 233baf64501..f956de72633 100644
--- a/addons/payment/data/payment_acquirer_data.xml
+++ b/addons/payment/data/payment_acquirer_data.xml
@@ -279,4 +279,17 @@
<!-- https://intl.alipay.com/ihome/home/about/buy.htm?topic=paymentMethods -->
<field name="payment_icon_ids" eval='[(6, 0, [ref("payment.payment_icon_cc_jcb"),ref("payment.payment_icon_cc_mastercard"),ref("payment.payment_icon_cc_western_union"),ref("payment.payment_icon_cc_webmoney"),ref("payment.payment_icon_cc_visa")])]'/>
</record>
+
+ <record id="payment.payment_acquirer_sepa_direct_debit" model="payment.acquirer">
+ <field name="name">SEPA Direct Debit</field>
+ <field name="view_template_id" ref="default_acquirer_button"/>
+ <field name="image_128" type="base64" file="base/static/img/icons/payment_sepa_direct_debit.png"/>
+ <field name="module_id" ref="base.module_payment_sepa_direct_debit"/>
+ <field name="description" type="html">
+ <p>
+ SEPA Direct Debit is a Europe-wide Direct Debit system that allows merchants to collect Euro-denominated payments from accounts in the 34 SEPA countries and associated territories.
+ </p>
+ </field>
+ </record>
+
</odoo>
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py
index 31df0df1cd8..f9d703972d8 100644
--- a/addons/payment/models/payment_acquirer.py
+++ b/addons/payment/models/payment_acquirer.py
@@ -154,6 +154,7 @@ class PaymentAcquirer(models.Model):
# TDE FIXME: remove that brol
module_id = fields.Many2one('ir.module.module', string='Corresponding Module')
module_state = fields.Selection(selection=ir_module.STATES, string='Installation State', related='module_id.state', store=True)
+ module_to_buy = fields.Boolean(string='Odoo Enterprise Module', related='module_id.to_buy', readonly=True, store=False)
image_128 = fields.Image("Image", max_width=128, max_height=128)
@@ -271,7 +272,7 @@ class PaymentAcquirer(models.Model):
# If the trigger comes from the chart template wizard, the modules are already installed.
acquirer_modules = self.env['ir.module.module'].search(
[('name', 'like', 'payment_%'), ('state', 'in', ('to install', 'installed'))])
- acquirer_names = [a.name.split('_')[1] for a in acquirer_modules]
+ acquirer_names = [a.name.split('_', 1)[1] for a in acquirer_modules]
# Search for acquirers having no journal
company = company or self.env.company
diff --git a/addons/payment/static/src/js/payment_processing.js b/addons/payment/static/src/js/payment_processing.js
index 361cc3dbf4c..53b688be06a 100644
--- a/addons/payment/static/src/js/payment_processing.js
+++ b/addons/payment/static/src/js/payment_processing.js
@@ -71,7 +71,7 @@ odoo.define('payment.processing', function (require) {
'tx_error': [],
};
- if (transactions.length > 0 && transactions[0].acquirer_provider == 'transfer') {
+ if (transactions.length > 0 && ['transfer', 'sepa_direct_debit'].indexOf(transactions[0].acquirer_provider) >= 0) {
window.location = transactions[0].return_url;
return;
}
diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml
index f4c4cfc7c05..54264fd2d43 100644
--- a/addons/payment/views/payment_views.xml
+++ b/addons/payment/views/payment_views.xml
@@ -20,12 +20,14 @@
<sheet>
<field name="module_id" invisible="1"/>
<field name="module_state" invisible="1"/>
+ <field name="module_to_buy" invisible="1"/>
<field name="inbound_payment_method_ids" invisible="1"/>
<field name="image_128" widget="image" class="oe_avatar"/>
<div class="oe_title">
<h1><field name="name" placeholder="Name"/></h1>
<div attrs="{'invisible': ['|', ('module_state', '=', 'installed'), ('module_id', '=', False)]}">
- <button type="object" class="btn btn-primary" name="button_immediate_install" string="Install"/>
+ <a attrs="{'invisible': [('module_to_buy', '=', False)]}" href="https://odoo.com/pricing?utm_source=db&amp;utm_medium=module" class="btn btn-info" role="button">Upgrade</a>
+ <button attrs="{'invisible': [('module_to_buy', '=', True)]}" type="object" class="btn btn-primary" name="button_immediate_install" string="Install"/>
</div>
</div>
<div attrs="{'invisible': ['|', ('module_state', '=', 'installed'), ('module_id', '=', False)]}">
@@ -104,10 +106,12 @@
<field name="provider"/>
<field name="module_id"/>
<field name="module_state"/>
+ <field name="module_to_buy"/>
<field name="color"/>
<templates>
<t t-name="kanban-box">
<t t-set="installed" t-value="!record.module_id.value || (record.module_id.value &amp;&amp; record.module_state.raw_value === 'installed')"/>
+ <t t-set="to_buy" t-value="record.module_to_buy.raw_value === true"/>
<div t-attf-class="oe_kanban_global_click #{kanban_color(record.color.raw_value)}">
<div class="o_kanban_image">
<img type="open" t-att-src="kanban_image('payment.acquirer', 'image_128', record.id.raw_value)" alt="Acquirer"/>
@@ -120,7 +124,11 @@
<t t-if="installed">
<field name="state" widget="label_selection" options="{'classes': {'enabled': 'success', 'test': 'warning', 'disabled' : 'danger'}}"/>
</t>
- <button t-if="!installed and !selection_mode" type="object" class="btn btn-secondary float-right" name="button_immediate_install">Install</button>
+ <button t-if="!installed and !selection_mode and !to_buy" type="object" class="btn btn-secondary float-right" name="button_immediate_install">Install</button>
+ <t t-if="!installed and to_buy">
+ <button href="https://odoo.com/pricing?utm_source=db&amp;utm_medium=module" class="btn btn-info btn-sm float_right">Upgrade</button>
+ <span class="badge badge-primary oe_inline o_enterprise_label">Enterprise</span>
+ </t>
<button t-if="installed and record.state.raw_value == 'disabled' and !selection_mode" type="edit" class="btn btn-primary float-right">Activate</button>
<button t-if="installed and record.state.raw_value in ['enabled', 'test'] and !selection_mode" type="edit" class="btn btn-primary float-right">Configure</button>
</div>
diff --git a/odoo/addons/base/data/ir_module_module.xml b/odoo/addons/base/data/ir_module_module.xml
index 7579260be25..058a7880b3a 100644
--- a/odoo/addons/base/data/ir_module_module.xml
+++ b/odoo/addons/base/data/ir_module_module.xml
@@ -245,5 +245,15 @@
<field name="icon">/base/static/img/icons/website_twitter_wall.png</field>
</record>
+ <record model="ir.module.module" id="base.module_payment_sepa_direct_debit">
+ <field name="name">payment_sepa_direct_debit</field>
+ <field name="shortdesc">Sepa Direct Debit Payment Acquirer</field>
+ <field name="summary">Checkout with SEPA Direct Debit</field>
+ <field name="category_id" ref="base.module_category_accounting_invoicing"/>
+ <field name="license">OEEL-1</field>
+ <field name="author">Odoo S.A.</field>
+ <field name="to_buy" eval="True"/>
+ <field name="icon">/base/static/img/icons/payment_sepa_direct_debit.png</field>
+ </record>
</data>
</odoo>
diff --git a/odoo/addons/base/static/img/icons/payment_sepa_direct_debit.png b/odoo/addons/base/static/img/icons/payment_sepa_direct_debit.png
new file mode 100644
index 00000000000..aec41dd1658
--- /dev/null
+++ b/odoo/addons/base/static/img/icons/payment_sepa_direct_debit.png
Binary files differ