diff options
| author | Jitendra Prajapati <jpr@openerp.com> | 2017-05-17 12:04:23 +0200 |
|---|---|---|
| committer | Thibault Delavallée <tde@odoo.com> | 2017-05-17 14:40:35 +0200 |
| commit | de5433f4154f7fbd9b496432637c7fd27eb7ced7 (patch) | |
| tree | 5689f4698e9efa494061be5117c8037eceeb7d10 | |
| parent | 327be89d0bf16dd339c69102d24ab5583fb33298 (diff) | |
[IMP] payment: improve usability of tx views
* add provider, related on acquirer_id.provider, in order to display
certain piece of information on tx depending on their provider;
* better tx form view and partner address display;
* remove unnecessary notebook on tx form view as it is not used;
* rename Payment Acquirers menu into Payment Methods, easier to
understand;
* acquirer kanban view improved to install / activate / configure them
depending on their state;
* be able to publish / unpublish acquirers without having to wait for
website_payment to add a button;
| -rw-r--r-- | addons/payment/models/payment_acquirer.py | 6 | ||||
| -rw-r--r-- | addons/payment/views/payment_views.xml | 33 | ||||
| -rw-r--r-- | addons/payment_paypal/views/payment_views.xml | 8 | ||||
| -rw-r--r-- | addons/website_payment/views/website_payment_view.xml | 4 |
4 files changed, 30 insertions, 21 deletions
diff --git a/addons/payment/models/payment_acquirer.py b/addons/payment/models/payment_acquirer.py index 8e0f8345284..9c8402d3d48 100644 --- a/addons/payment/models/payment_acquirer.py +++ b/addons/payment/models/payment_acquirer.py @@ -193,6 +193,11 @@ class PaymentAcquirer(models.Model): return super(PaymentAcquirer, self).write(vals) @api.multi + def toggle_website_published(self): + self.write({'website_published': not self.website_published}) + return True + + @api.multi def get_form_action_url(self): """ Returns the form action URL, for form-based acquirer implementations. """ if hasattr(self, '%s_get_form_action_url' % self.provider): @@ -405,6 +410,7 @@ class PaymentTransaction(models.Model): create_date = fields.Datetime('Creation Date', readonly=True) date_validate = fields.Datetime('Validation Date') acquirer_id = fields.Many2one('payment.acquirer', 'Acquirer', required=True) + provider = fields.Selection(string='Provider', related='acquirer_id.provider') type = fields.Selection([ ('server2server', 'Server To Server'), ('form', 'Form'), diff --git a/addons/payment/views/payment_views.xml b/addons/payment/views/payment_views.xml index bf703e89ece..1a3f60e47cb 100644 --- a/addons/payment/views/payment_views.xml +++ b/addons/payment/views/payment_views.xml @@ -30,13 +30,19 @@ <field name="module_id" invisible="1"/> <field name="module_state" invisible="1"/> <div class="oe_button_box" name="button_box" attrs="{'invisible': ['&', ('module_id', '!=', False), ('module_state', '!=', 'installed')]}"> + <button name="toggle_website_published" + class="oe_stat_button" + type="object" icon="fa-globe"> + <field name="website_published" widget="boolean_button" + options='{"terminology": {"string_true": "Published", "hover_false": "Publish"}}'/> + </button> <!-- transfer referenced here due to view inheritance issue in current master (post-saas-16) --> <button name="toggle_environment_value" attrs="{'invisible': ['|', ('environment', '=', 'test'), ('provider', '=', 'transfer')]}" class="oe_stat_button" type="object" icon="fa-play"> <div class="o_stat_info o_field_widget"> - <span class="text-success">Production</span> + <span class="text-success">Production</span> <span class="o_stat_text">Environment</span> </div> </button> @@ -141,10 +147,11 @@ <field name="provider"/> <field name="module_id"/> <field name="module_state"/> + <field name="website_published"/> <templates> <t t-name="kanban-box"> - <div class="oe_kanban_global_click"> - <t t-set="installed" t-value="!record.module_id.value || (record.module_id.value && record.module_state.raw_value === 'installed')"/> + <t t-set="installed" t-value="!record.module_id.value || (record.module_id.value && record.module_state.raw_value === 'installed')"/> + <div t-attf-class="oe_kanban_global_click #{installed and record.website_published.raw_value ? 'oe_kanban_color_5' : 'oe_kanban_color_white'}"> <div class="o_kanban_image"> <img type="open" t-att-src="kanban_image('payment.acquirer', 'image_small', record.id.value)"/> </div> @@ -157,7 +164,8 @@ <field name="environment" widget="label_selection" options="{'classes': {'test': 'warning', 'production': 'success'}}"/> </t> <button t-if="!installed" type="object" class="btn btn-default pull-right btn-sm" name="button_immediate_install">Install</button> - <button t-if="installed" type="edit" class="btn btn-primary pull-right btn-sm">Configure</button> + <button t-if="installed and !record.website_published.raw_value" type="edit" class="btn btn-primary pull-right btn-sm">Activate</button> + <button t-if="installed and record.website_published.raw_value" type="edit" class="btn btn-primary pull-right btn-sm">Configure</button> </div> </div> </t> @@ -195,13 +203,13 @@ </record> <record id="action_payment_acquirer" model="ir.actions.act_window"> - <field name="name">Payment Acquirers</field> + <field name="name">Payment Methods</field> <field name="res_model">payment.acquirer</field> <field name='view_type'>form</field> <field name='view_mode'>kanban,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 method. </p> </field> </record> @@ -232,11 +240,11 @@ <field name="amount"/> <field name="currency_id" options="{'no_open': True, 'no_create': True}"/> </div> - <field name="fees"/> - <field name="partner_id"/> - <label for="partner_details" string="Customer Details"/> + <field name="fees" readonly="1"/> + <label for="partner_id"/> <div> - <div name="partner_details" class="o_address_format"> + <field name="partner_id" context="{'show_address': 1}" options="{'always_reload': True}"/> + <div name="partner_details" class="o_address_format" attrs="{'invisible': [('partner_id', '!=', False)]}"> <field name="partner_name" placeholder="Name" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/> <field name="partner_address" placeholder="Address" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_street"/> <field name="partner_city" placeholder="City" attrs="{'readonly': [('partner_id', '!=', False)]}" class="o_address_city"/> @@ -249,8 +257,9 @@ </group> <group> <field name="acquirer_id"/> + <field name="provider" invisible="1"/> <field name="payment_token_id"/> - <field name="acquirer_reference"/> + <field name="acquirer_reference" readonly="1"/> <field name="create_date"/> <field name="date_validate"/> </group> @@ -258,8 +267,6 @@ <group string="Message"> <field name="state_message" nolabel="1"/> </group> - <notebook> - </notebook> </sheet> </form> </field> diff --git a/addons/payment_paypal/views/payment_views.xml b/addons/payment_paypal/views/payment_views.xml index 89288a41c4c..a1c4672f755 100644 --- a/addons/payment_paypal/views/payment_views.xml +++ b/addons/payment_paypal/views/payment_views.xml @@ -27,12 +27,8 @@ <field name="model">payment.transaction</field> <field name="inherit_id" ref="payment.transaction_form"/> <field name="arch" type="xml"> - <xpath expr='//notebook' position='inside'> - <page string="Paypal TX Details"> - <group> - <field name="paypal_txn_type"/> - </group> - </page> + <xpath expr="//field[@name='acquirer_reference']" position="after"> + <field name="paypal_txn_type" readonly="1" attrs="{'invisible': [('provider', '!=', 'paypal')]}"/> </xpath> </field> </record> diff --git a/addons/website_payment/views/website_payment_view.xml b/addons/website_payment/views/website_payment_view.xml index 086fb843045..d7510a6d24f 100644 --- a/addons/website_payment/views/website_payment_view.xml +++ b/addons/website_payment/views/website_payment_view.xml @@ -24,11 +24,11 @@ <field name="model">payment.acquirer</field> <field name="inherit_id" ref="payment.acquirer_form"/> <field name="arch" type="xml"> - <xpath expr="//div[@class='oe_button_box']/*[1]" position="before"> + <button name="toggle_website_published" position="replace"> <button class="oe_stat_button" name="website_publish_button" type="object" icon="fa-globe"> <field name="website_published" widget="website_button"/> </button> - </xpath> + </button> </field> </record> |
