[IMP] payment: acquirer from view

- Split credentials from technical configuation moved to technical feature.
- Fix website_published button
This commit is contained in:
Antony Lesuisse
2015-08-04 21:34:13 +02:00
parent 83f968da5b
commit a7dee722cc
10 changed files with 64 additions and 53 deletions
+8 -5
View File
@@ -62,7 +62,7 @@ class PaymentAcquirer(osv.Model):
'name': fields.char('Name', required=True, translate=True),
'provider': fields.selection(_provider_selection, string='Provider', required=True),
'company_id': fields.many2one('res.company', 'Company', required=True),
'pre_msg': fields.html('Message', translate=True,
'pre_msg': fields.html('Help Message', translate=True,
help='Message displayed to explain and help the payment process.'),
'post_msg': fields.html('Thanks Message', help='Message displayed after having done the payment process.'),
'validation': fields.selection(
@@ -81,15 +81,15 @@ class PaymentAcquirer(osv.Model):
help="Make this payment acquirer available (Customer invoices, etc.)"),
'auto_confirm': fields.selection(
[('none', 'No automatic confirmation'),
('at_pay_confirm', 'At payment confirmation'),
('at_pay_now', 'At payment')],
('at_pay_confirm', 'At payment with acquirer confirmation'),
('at_pay_now', 'At payment no acquirer confirmation needed')],
string='Order Confirmation', required=True),
'pending_msg': fields.html('Pending Message', translate=True, help='Message displayed, if order is in pending state after having done the payment process.'),
'done_msg': fields.html('Done Message', translate=True, help='Message displayed, if order is done successfully after having done the payment process.'),
'cancel_msg': fields.html('Cancel Message', translate=True, help='Message displayed, if order is cancel during the payment process.'),
'error_msg': fields.html('Error Message', translate=True, help='Message displayed, if error is occur during the payment process.'),
# Fees
'fees_active': fields.boolean('Compute fees'),
'fees_active': fields.boolean('Add Extra Fees'),
'fees_dom_fixed': fields.float('Fixed domestic fees'),
'fees_dom_var': fields.float('Variable domestic fees (in percents)'),
'fees_int_fixed': fields.float('Fixed international fees'),
@@ -100,7 +100,7 @@ class PaymentAcquirer(osv.Model):
_defaults = {
'company_id': lambda self, cr, uid, obj, ctx=None: self.pool['res.users'].browse(cr, uid, uid).company_id.id,
'environment': 'test',
'validation': 'automatic',
'validation': 'manual',
'website_published': False,
'auto_confirm': 'at_pay_confirm',
'pending_msg': '<i>Pending,</i> Your online payment has been successfully processed. But your order is not validated yet.',
@@ -351,6 +351,9 @@ class PaymentAcquirer(osv.Model):
html_block = '\n'.join(filter(None, html_forms))
return self._wrap_payment_block(cr, uid, html_block, amount, currency_id, context=context)
def website_publish_button(self, cr, uid, ids, context=None):
for i in self.browse(cr, uid, ids, context=context):
i.website_published = not i.website_published
class PaymentTransaction(osv.Model):
""" Transaction Model. Each specific acquirer can extend the model by adding
+7
View File
@@ -7,6 +7,9 @@ class AccountPaymentConfig(osv.TransientModel):
_inherit = 'account.config.settings'
_columns = {
'module_payment_transfer': fields.boolean(
'Wire Transfer',
help='-It installs the module payment_transfer.'),
'module_payment_paypal': fields.boolean(
'Paypal',
help='-It installs the module payment_paypal.'),
@@ -23,3 +26,7 @@ class AccountPaymentConfig(osv.TransientModel):
'Authorize.Net',
help='-It installs the module payment_authorize.'),
}
_defaults = {
'module_payment_transfer': True
}
+27 -28
View File
@@ -2,6 +2,8 @@
<openerp>
<data>
<!-- Acquirer -->
<menuitem
name='Payments'
id='root_payment_menu'
@@ -14,49 +16,44 @@
<form string="Payment Acquirer">
<sheet>
<div class="oe_button_box" name="button_box">
<button class="oe_stat_button" name="website_publish_button"
type="object" icon="fa-globe">
<button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe">
<field name="website_published" widget="website_button"/>
</button>
</div>
<group name="acquirer_base">
<group>
<group name="acquirer_left">
<field name="name"/>
<field name="provider"/>
<field name="company_id"/>
<field name="environment"/>
<field name="validation"/>
<field name="auto_confirm"/>
<field name="environment" groups="base.group_no_one"/>
</group>
<group>
<field name="fees_active"/>
<field name="fees_dom_fixed"
attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_dom_var"
attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_fixed"
attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_var"
attrs="{'invisible': [('fees_active', '=', False)]}"/>
<group name="acquirer_right">
<field name="provider"/>
<field name="company_id" groups="base.group_multi_company" options='{"no_open":True}'/>
</group>
</group>
<notebook>
<page string="Message">
<page string="Credentials">
<group name="acquirer">
</group>
</page>
<page string="Messages">
<group>
<field name="pre_msg"/>
<field name="post_msg"/>
</group>
</page>
<page string="Status">
<group>
<field name="pending_msg"/>
<field name="done_msg"/>
<field name="cancel_msg"/>
<field name="error_msg"/>
</group>
</page>
<page string="Configuration">
<group name="acquirer_display">
<page string="Configuration" groups="base.group_no_one">
<group name="acquirer_config">
<field name="validation"/>
<field name="auto_confirm"/>
<field name="fees_active"/>
<field name="fees_dom_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_dom_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_fixed" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<field name="fees_int_var" attrs="{'invisible': [('fees_active', '=', False)]}"/>
<label for="view_template_id"/>
<div>
<field name="view_template_id" nolabel="1"/>
@@ -77,7 +74,7 @@
</ul>
</div>
</div>
<field name="registration_view_template_id"/>
<field name="registration_view_template_id"/>
</group>
</page>
</notebook>
@@ -127,6 +124,8 @@
parent='root_payment_menu'
sequence='10' />
<!-- Transactions -->
<record id="transaction_form" model="ir.ui.view">
<field name="name">payment.transaction.form</field>
<field name="model">payment.transaction</field>
@@ -211,7 +210,8 @@
parent='root_payment_menu'
sequence='20' />
<!-- Payment Methods -->
<!-- Methods -->
<record model='ir.ui.view' id='payment_method_tree_view'>
<field name='name'>payment.method.tree</field>
<field name='model'>payment.method</field>
@@ -226,7 +226,6 @@
</field>
</record>
<record model='ir.actions.act_window' id='payment_method_act'>
<field name='name'>Saved Payment Data</field>
<field name='res_model'>payment.method</field>
+5 -1
View File
@@ -8,10 +8,14 @@
<field name="inherit_id" ref="account.view_account_config_settings"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='payment_acquirer']" position="inside">
<div name="configure_payments_button" invisible="1">
<div name="configure_payments_button">
<button name='%(payment.action_payment_acquirer)d' type="action"
string="Configure payment acquiring methods" class="oe_link"/>
</div>
<div>
<field name="module_payment_transfer" class="oe_inline"/>
<label for="module_payment_transfer"/>
</div>
<div>
<field name="module_payment_paypal" class="oe_inline"/>
<label for="module_payment_paypal"/>
@@ -7,11 +7,12 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'adyen')]}">
<field name="adyen_merchant_account"/>
<field name="adyen_skin_code"/>
<field name="adyen_skin_hmac_key"/>
<a colspan="2" href="https://www.adyen.com/home/payment-services/online-payments" target="_blank">How to configure your Adyen account?</a>
</group>
</xpath>
</field>
@@ -5,10 +5,11 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'authorize')]}">
<field name="authorize_login"/>
<field name="authorize_transaction_key" password="True"/>
<a colspan="2" href="http://welcome.authorize.net/about_authorizenet/" target="_blank">How to configure your Authorize.Net account (look for Getting Started Guide) ?</a>
</group>
</xpath>
</field>
@@ -7,10 +7,11 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'buckaroo')]}">
<field name="brq_websitekey"/>
<field name="brq_secretkey"/>
<a colspan="2" href="http://www.buckaroo-payments.com/business/customers/online-payment/" target="_blank">How to configure your Buckaroo account?</a>
</group>
</xpath>
</field>
@@ -7,7 +7,7 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'ogone')]}">
<field name="ogone_pspid"/>
<field name="ogone_userid"/>
@@ -15,6 +15,7 @@
<field name="ogone_shakey_in"/>
<field name="ogone_shakey_out"/>
<field name="ogone_alias_usage"/>
<a colspan="2" href="http://payment-services.ingenico.com/int/en/ogone/support/guides/user%20guides/test-account-creation" target="_blank">How to configure your Ogone account?</a>
</group>
</xpath>
</field>
@@ -7,21 +7,15 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'paypal')]}">
<group>
<group>
<field name="paypal_email_account"/>
<field name="paypal_seller_account"/>
<field name="paypal_use_ipn"/>
<field name="paypal_api_enabled"
invisible="1"/> <!-- WIP in saas-3 -->
<field name="paypal_api_username"
invisible="1"/> <!-- WIP in saas-3 -->
<field name="paypal_api_password"
invisible="1"/> <!-- WIP in saas-3 -->
</group>
</group>
<field name="paypal_email_account"/>
<field name="paypal_seller_account"/>
<field name="paypal_use_ipn"/>
<field name="paypal_api_enabled" invisible="1"/>
<field name="paypal_api_username" invisible="1"/>
<field name="paypal_api_password" invisible="1"/>
<a colspan="2" href="https://www.paypal.com/in/cgi-bin/webscr?cmd=xpt/Marketing/general/how-to-set-up-a-paypal-account-outside" target="_blank">How to configure your paypal account?</a>
</group>
</xpath>
</field>
@@ -7,7 +7,7 @@
<field name="model">payment.acquirer</field>
<field name="inherit_id" ref="payment.acquirer_form"/>
<field name="arch" type="xml">
<xpath expr='//group[@name="acquirer_display"]' position='after'>
<xpath expr='//group[@name="acquirer"]' position='after'>
<group attrs="{'invisible': [('provider', '!=', 'sips')]}">
<field name="sips_secret"/>
<field name="sips_merchant_id"/>