Files
odoo_source/addons/payment/wizards/payment_capture_wizard_views.xml
T
Demesmaeker 7f2ae9ed5b [IMP] payment(_adyen): allow partial capture
Before this commit, it was not possible to partially capture a
transaction from Odoo, and doing so in the provider backend would often
result in a full capture in Odoo when capture was supported.

With this commit, partial captures are made available in Odoo directly
from the sales order or invoice, for providers that support them.
Provider can either only support full capture or also support partial
ones. It also optionally managed the automatic void of the remaining
amount at the user request when multiple captures are supported by the
provider.

As of now, the only acquirer allowing partial capture is Adyen.

task-2728768

closes odoo/odoo#87251

Related: odoo/enterprise#35205
Related: odoo/documentation#2063
Signed-off-by: Antoine Vandevenne (anv) <anv@odoo.com>
2023-03-09 10:51:29 +01:00

59 lines
3.2 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="payment_capture_wizard_view_form" model="ir.ui.view">
<field name="name">payment.capture.wizard.form</field>
<field name="model">payment.capture.wizard</field>
<field name="arch" type="xml">
<form string="Capture">
<field name="transaction_ids" invisible="1"/>
<field name="is_amount_to_capture_valid" invisible="1"/>
<field name="currency_id" invisible="1"/>
<field name="support_partial_capture" invisible="1"/>
<field name="has_draft_children" invisible="1"/>
<field name="has_remaining_amount" invisible="1"/>
<div id="alert_draft_capture_tx"
role="alert"
class="alert alert-warning"
attrs="{'invisible': [('has_draft_children', '=', False)]}">
<strong>Warning!</strong> There is a partial capture pending. Please wait a
moment for it to be processed. Check your payment provider configuration if
the capture is still pending after a few minutes.
</div>
<group name="readonly_fields">
<field name="authorized_amount"/>
<field name="captured_amount"
attrs="{'invisible': [('captured_amount', '&lt;=', 0)]}"/>
<field name="voided_amount"
attrs="{'invisible': [('voided_amount', '&lt;=', 0)]}"/>
</group>
<hr/>
<group name="input_fields">
<label for="amount_to_capture" class="oe_inline"/>
<div class="o_row">
<field name="amount_to_capture"
class="oe_inline"
attrs="{'readonly': [('support_partial_capture', '=', 'full_only')]}"/>
<i class="fa fa-info-circle oe_inline"
attrs="{'invisible': [('support_partial_capture', '!=', 'full_only')]}"
title="Some of the transactions you intend to capture can only be captured in full. Handle the transactions individually to capture a partial amount."/>
</div>
<field name="void_remaining_amount" attrs="{'readonly': [('has_remaining_amount', '=', False)]}"/>
</group>
<div id="alert_amount_to_capture_above_authorized_amount"
role="alert"
class="alert alert-warning mb-2"
attrs="{'invisible': [('is_amount_to_capture_valid', '=', True)]}">
<strong>Warning!</strong> You can not capture a negative amount nor more
than <field name='available_amount' class='oe_inline' widget='monetary'/>.
</div>
<footer>
<button string="Capture" type="object" name="action_capture" class="btn-primary"/>
<button string="Close" special="cancel" class="btn-secondary"/>
</footer>
</form>
</field>
</record>
</odoo>