Files
odoo_source/addons/payment/views/payment_transaction_views.xml
T
Demesmaeker e0233a1010 [IMP] payment(_adyen): allow to refund confirmed transactions
Before this commit, it was not possible to refund a payment from Odoo.
Users had to go through the payment acquirer's backend and update the
payment accordingly in Odoo.

With this commit, refunds are made available in Odoo directly from the
payment form, for acquirers that support them. Acquirer can either only
support full refunds or also support partial refunds.

As of now, the only acquirer allowing refunds is Adyen, with partial
refund support.

task-2527891

closes odoo/odoo#70881

Related: odoo/upgrade#2689
Related: odoo/enterprise#19829
Signed-off-by: Antoine Vandevenne (anv) <AntoineVDV@users.noreply.github.com>
2021-08-23 10:54:17 +00:00

165 lines
8.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="payment_transaction_form" model="ir.ui.view">
<field name="name">payment.transaction.form</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<form string="Payment Transactions" create="false" edit="false">
<header>
<button type="object" name="action_capture" states="authorized" string="Capture Transaction" class="oe_highlight"/>
<button type="object" name="action_void" states="authorized" string="Void Transaction"
confirm="Are you sure you want to void the authorized transaction? This action can't be undone."/>
<field name="state" widget="statusbar"/>
</header>
<sheet>
<div class="oe_button_box" name="button_box">
<button name="action_view_invoices" type="object"
class="oe_stat_button" icon="fa-money"
attrs="{'invisible': [('invoices_count', '=', 0)]}">
<field name="invoices_count" widget="statinfo" string="Invoice(s)"/>
</button>
<button name="action_view_refunds"
type="object"
class="oe_stat_button"
icon="fa-money"
attrs="{'invisible': [('refunds_count', '=', 0)]}">
<field name="refunds_count" widget="statinfo" string="Refunds"/>
</button>
</div>
<group>
<group name="transaction_details">
<field name="reference"/>
<field name="payment_id"/>
<field name="source_transaction_id"
attrs="{'invisible': [('source_transaction_id', '=', False)]}"/>
<field name="amount"/>
<field name="fees" attrs="{'invisible': [('fees', '=', 0.0)]}"/>
<field name="currency_id" invisible="1"/>
<field name="acquirer_id"/>
<field name="company_id" groups="base.group_multi_company"/>
<!-- Used by some acquirer-specific views -->
<field name="provider" invisible="1"/>
<field name="acquirer_reference"/>
<field name="token_id" attrs="{'invisible': [('token_id', '=', False)]}"/>
<field name="create_date"/>
<field name="last_state_change"/>
</group>
<group name="transaction_partner">
<field name="partner_id" widget="res_partner_many2one"/>
<label for="partner_address" string="Address"/>
<div class="o_address_format">
<field name="partner_address" placeholder="Address" class="o_address_street"/>
<field name="partner_city" placeholder="City" class="o_address_city"/>
<field name="partner_state_id" placeholder="State" class="o_address_state" options="{'no_open': True}"/>
<field name="partner_zip" placeholder="ZIP" class="o_address_zip"/>
<field name="partner_country_id" placeholder="Country" class="o_address_country" options="{'no_open': True}"/>
</div>
<field name="partner_email" widget="email"/>
<field name="partner_phone" widget="phone"/>
<field name="partner_lang"/>
</group>
</group>
<group string="Message" attrs="{'invisible': [('state_message', '=', False)]}">
<field name="state_message" nolabel="1"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="payment_transaction_list" model="ir.ui.view">
<field name="name">payment.transaction.list</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<tree string="Payment Transactions" create="false">
<field name="reference"/>
<field name="create_date"/>
<field name="acquirer_id"/>
<field name="partner_id"/>
<field name="partner_name"/>
<!-- Needed to display the currency of the amounts -->
<field name="currency_id" invisible="1"/>
<field name="amount"/>
<field name="fees"/>
<field name="state"/>
<field name="company_id" groups="base.group_multi_company" optional="show"/>
</tree>
</field>
</record>
<record id="payment_transaction_kanban" model="ir.ui.view">
<field name="name">payment.transaction.kanban</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile" create="false">
<templates>
<t t-name="kanban-box">
<div t-attf-class="oe_kanban_content oe_kanban_global_click">
<div class="row">
<div class="col-6">
<strong><field name="reference"/></strong>
</div>
<div class="col-6">
<span><field name="partner_name"/></span>
</div>
<div class="col-6">
<span class="float-right">
<field name="amount"/>
<field name="currency_id" invisible="1"/>
</span>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="payment_transaction_search" model="ir.ui.view">
<field name="name">payment.transaction.search</field>
<field name="model">payment.transaction</field>
<field name="arch" type="xml">
<search>
<field name="reference"/>
<field name="acquirer_id"/>
<field name="partner_id"/>
<field name="partner_name"/>
<group expand="1" string="Group By">
<filter string="Acquirer" name="acquirer_id" context="{'group_by': 'acquirer_id'}"/>
<filter string="Partner" name="partner_id" context="{'group_by': 'partner_id'}"/>
<filter string="Status" name="state" context="{'group_by': 'state'}"/>
<filter string="Company" name="company" context="{'group_by': 'company_id'}" groups="base.group_multi_company"/>
</group>
</search>
</field>
</record>
<record id="action_payment_transaction" model="ir.actions.act_window">
<field name="name">Payment Transactions</field>
<field name="res_model">payment.transaction</field>
<field name="view_mode">tree,kanban,form</field>
<field name="help" type="html">
<p class="o_view_nocontent_neutral_face">
There are no transactions to show
</p>
</field>
</record>
<record id="action_payment_transaction_linked_to_token" model="ir.actions.act_window">
<field name="name">Payment Transactions Linked To Token</field>
<field name="res_model">payment.transaction</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('token_id','=', active_id)]</field>
<field name="context">{'create': False}</field>
</record>
<menuitem action="action_payment_transaction"
id="payment_transaction_menu"
parent="account.root_payment_menu"
groups="base.group_no_one"
sequence="20"/>
</odoo>