mirror of
https://github.com/bringout/oca-ocb-accounting.git
synced 2026-04-23 23:22:07 +02:00
Initial commit: Accounting packages
This commit is contained in:
commit
4ef34c2317
2661 changed files with 1709616 additions and 0 deletions
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_account_journal_form" model="ir.ui.view">
|
||||
<field name="name">account.journal.form.inherit.payment</field>
|
||||
<field name="model">account.journal</field>
|
||||
<field name="inherit_id" ref="account.view_account_journal_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='inbound_payment_method_line_ids']//field[@name='payment_account_id']" position="after">
|
||||
<field name="payment_provider_state" invisible="1"/>
|
||||
<field name="code" invisible="1"/>
|
||||
<field name="payment_provider_id" options="{'no_open': True, 'no_create': True}" optional="hide" domain="[('code', '=', code)]"/>
|
||||
<button name="action_open_provider_form"
|
||||
type="object"
|
||||
string="SETUP"
|
||||
class="float-end btn-secondary"
|
||||
attrs="{'invisible': [('payment_provider_id', '=', False)]}"
|
||||
groups="base.group_system"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='inbound_payment_method_line_ids']/tree" position="attributes">
|
||||
<attribute name="decoration-muted">payment_provider_state == 'disabled'</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="account_invoice_view_form_inherit_payment" model="ir.ui.view">
|
||||
<field name="name">account.move.view.form.inherit.payment</field>
|
||||
<field name="model">account.move</field>
|
||||
<field name="inherit_id" ref="account.view_move_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<!--
|
||||
The user must capture/void the authorized transactions before registering a new payment.
|
||||
-->
|
||||
<xpath expr="//button[@id='account_invoice_payment_btn']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|', '|', '|', ('state', '!=', 'posted'), ('payment_state', 'not in', ('partial', 'not_paid')), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt')), ('authorized_transaction_ids', '!=', [])]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@id='account_invoice_payment_btn']" position="after">
|
||||
<field name="authorized_transaction_ids" invisible="1"/>
|
||||
<button name="payment_action_capture" type="object"
|
||||
groups="account.group_account_invoice"
|
||||
string="Capture Transaction" class="oe_highlight" data-hotkey="shift+g"
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
<button name="payment_action_void" type="object"
|
||||
groups="account.group_account_invoice"
|
||||
string="Void Transaction" data-hotkey="shift+v"
|
||||
confirm="Are you sure you want to void the authorized transaction? This action can't be undone."
|
||||
attrs="{'invisible': ['|', '|', ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund')), ('state', '!=', 'posted'), ('authorized_transaction_ids', '=', [])]}"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<field name="transaction_ids" invisible="1" />
|
||||
<button name="action_view_payment_transactions" type="object"
|
||||
class="oe_stat_button" icon="fa-money"
|
||||
string="Payment Transaction"
|
||||
attrs="{'invisible': [('transaction_ids', '=', [])]}" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<menuitem action="payment.action_payment_provider"
|
||||
id="payment_provider_menu"
|
||||
parent="account.root_payment_menu"
|
||||
sequence="10"/>
|
||||
<menuitem action="payment.action_payment_icon"
|
||||
id="payment_icon_menu"
|
||||
parent="account.root_payment_menu"
|
||||
groups="base.group_no_one"
|
||||
sequence="15"/>
|
||||
<menuitem action="payment.action_payment_token"
|
||||
id="payment_token_menu"
|
||||
parent="account.root_payment_menu"
|
||||
groups="base.group_no_one"
|
||||
sequence="20"/>
|
||||
<menuitem action="payment.action_payment_transaction"
|
||||
id="payment_transaction_menu"
|
||||
parent="account.root_payment_menu"
|
||||
groups="base.group_no_one"
|
||||
sequence="25"/>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_account_payment_form_inherit_payment" model="ir.ui.view">
|
||||
<field name="name">view.account.payment.form.inherit.payment</field>
|
||||
<field name="model">account.payment</field>
|
||||
<field name="inherit_id" ref="account.view_account_payment_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//header/button[@name='action_draft']" position="after">
|
||||
<field name="amount_available_for_refund" invisible="1"/>
|
||||
<button name="action_refund_wizard"
|
||||
type="object"
|
||||
string="Refund"
|
||||
groups="account.group_account_invoice"
|
||||
attrs="{'invisible': [('amount_available_for_refund', '<=', 0)]}"
|
||||
class="btn-secondary"/>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<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>
|
||||
</xpath>
|
||||
<xpath expr='//group[2]' position="inside">
|
||||
<field name="source_payment_id" attrs="{'invisible': [('source_payment_id', '=', False)]}"/>
|
||||
<field name="payment_transaction_id" groups="base.group_no_one" attrs="{'invisible': [('use_electronic_payment_method', '!=', True)]}"/>
|
||||
</xpath>
|
||||
<field name="payment_method_line_id" position="after">
|
||||
<field name="payment_method_code" invisible="1"/>
|
||||
<field name="suitable_payment_token_ids" invisible="1"/>
|
||||
<field name="use_electronic_payment_method" invisible="1"/>
|
||||
<field name="payment_token_id" options="{'no_create': True}"
|
||||
attrs="{'invisible': [('use_electronic_payment_method', '!=', True)], 'readonly': [('state', '!=', 'draft')]}"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,139 @@
|
|||
<odoo>
|
||||
<template id="portal_my_invoices_payment" name="Payment on My Invoices" inherit_id="account.portal_my_invoices">
|
||||
<xpath expr="//t[@t-call='portal.portal_table']/thead/tr/th[last()]" position="before">
|
||||
<th></th>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[last()]" position="before">
|
||||
<td class="text-center">
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider_code in ('none', 'custom'))"/>
|
||||
<a t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids or invoice.amount_paid < invoice.amount_total)"
|
||||
t-att-href="invoice.get_portal_url(anchor='portal_pay')" title="Pay Now" aria-label="Pay now" class="btn btn-sm btn-primary" role="button">
|
||||
<i class="fa fa-arrow-circle-right"/><span class='d-none d-md-inline'> Pay Now</span>
|
||||
</a>
|
||||
</td>
|
||||
</xpath>
|
||||
<xpath expr="//t[@t-foreach='invoices']/tr/td[hasclass('tx_status')]" position="replace">
|
||||
<t t-set="last_tx" t-value="invoice.get_portal_last_transaction()"/>
|
||||
<td class="tx_status text-center">
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and (last_tx.state not in ['pending', 'authorized'] or (last_tx.state == 'pending' and last_tx.provider_code in ('none', 'custom')))">
|
||||
<span class="badge rounded-pill text-bg-info"><i class="fa fa-fw fa-clock-o"></i><span class="d-none d-md-inline"> Waiting for Payment</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'authorized'">
|
||||
<span class="badge rounded-pill text-bg-primary"><i class="fa fa-fw fa-check"/><span class="d-none d-md-inline"> Authorized</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and last_tx.state == 'pending' and last_tx.provider_code not in ('none', 'custom')">
|
||||
<span class="badge rounded-pill text-bg-warning"><span class="d-none d-md-inline"> Pending</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state in ('paid', 'in_payment')">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Paid</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'posted' and invoice.payment_state == 'reversed'">
|
||||
<span class="badge rounded-pill text-bg-success"><i class="fa fa-fw fa-check"></i><span class="d-none d-md-inline"> Reversed</span></span>
|
||||
</t>
|
||||
<t t-if="invoice.state == 'cancel'">
|
||||
<span class="badge rounded-pill text-bg-danger"><i class="fa fa-fw fa-remove"></i><span class="d-none d-md-inline"> Cancelled</span></span>
|
||||
</t>
|
||||
</td>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_invoice_payment" name="Invoice Payment">
|
||||
<div class="row">
|
||||
<div class="modal fade" id="pay_with" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h3 class="modal-title">Pay with</h3>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div t-if="providers or tokens" id="payment_method" class="text-start col-md-13">
|
||||
<t t-call="payment.checkout"/>
|
||||
</div>
|
||||
<div t-else="" class="alert alert-warning">
|
||||
<strong>No suitable payment option could be found.</strong><br/>
|
||||
If you believe that it is an error, please contact the website administrator.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template id="portal_invoice_page_inherit_payment" name="Payment on My Invoices" inherit_id="account.portal_invoice_page">
|
||||
<xpath expr="//t[@t-call='portal.portal_record_sidebar']//div[hasclass('o_download_pdf')]" position="before">
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('pending', 'authorized'))"/>
|
||||
<t t-set="pending_manual_txs" t-value="tx_ids.filtered(lambda tx: tx.state == 'pending' and tx.provider_code in ('none', 'custom'))"/>
|
||||
<div class="d-grid">
|
||||
<a href="#" t-if="invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total and invoice.move_type == 'out_invoice' and (pending_manual_txs or not tx_ids or invoice.amount_paid < invoice.amount_total)"
|
||||
|
||||
class="btn btn-primary mb-2" data-bs-toggle="modal" data-bs-target="#pay_with">
|
||||
<i class="fa fa-fw fa-arrow-circle-right"/> Pay Now
|
||||
</a>
|
||||
<div t-if="tx_ids and not pending_manual_txs and not invoice.amount_residual and invoice.payment_state not in ('paid', 'in_payment')" class="alert alert-info py-1 mb-2" >
|
||||
<i class="fa fa-fw fa-check-circle"/> Pending
|
||||
</div>
|
||||
<div t-if="invoice.payment_state in ('paid', 'in_payment')" class="alert alert-success py-1 mb-2" >
|
||||
<i class="fa fa-fw fa-check-circle"/> Paid
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//div[@id='invoice_content']//div[hasclass('o_portal_html_view')]" position="before">
|
||||
<t t-set="tx" t-value="invoice.get_portal_last_transaction()"/>
|
||||
<div t-if="invoice.transaction_ids and invoice.amount_total and not success and not error and (invoice.payment_state != 'not_paid' or tx.state in ('pending', 'authorized'))"
|
||||
class="o_account_payment_tx_status"
|
||||
t-att-data-invoice-id="invoice.id">
|
||||
<t t-call="payment.transaction_status"/>
|
||||
</div>
|
||||
<t t-set="tx_ids" t-value="invoice.transaction_ids.filtered(lambda tx: tx.state in ('authorized', 'done'))"/>
|
||||
<div t-if="(invoice.amount_residual or not tx_ids) and invoice.state == 'posted' and invoice.payment_state in ('not_paid', 'partial') and invoice.amount_total" id="portal_pay">
|
||||
<t t-call="account_payment.portal_invoice_payment"/>
|
||||
</div>
|
||||
<div class="panel-body" t-if="existing_token">
|
||||
<div class="offset-lg-3 col-lg-6">
|
||||
<i class="fa fa-info"></i> You have credits card registered, you can log-in to be able to use them.
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_invoice_error" name="Invoice error display: payment errors"
|
||||
inherit_id="account.portal_invoice_error">
|
||||
<xpath expr="//t[@name='generic']" position="after">
|
||||
<t t-if="error == 'pay_invoice_invalid_doc'">
|
||||
There was an error processing your payment: invalid invoice.
|
||||
</t>
|
||||
<t t-if="error == 'pay_invoice_invalid_token'">
|
||||
There was en error processing your payment: invalid credit card ID.
|
||||
</t>
|
||||
<t t-if="error == 'pay_invoice_tx_fail'">
|
||||
There was an error processing your payment: transaction failed.<br />
|
||||
<t t-set="tx_id" t-value="invoice.get_portal_last_transaction()"/>
|
||||
<t t-if="tx_id and tx_id.state_message">
|
||||
<t t-esc="tx_id.state_message"/>
|
||||
</t>
|
||||
</t>
|
||||
<t t-if="error == 'pay_invoice_tx_token'">
|
||||
There was an error processing your payment: issue with credit card ID validation.
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<template id="portal_invoice_success" name="Invoice success display: payment success"
|
||||
inherit_id="account.portal_invoice_success">
|
||||
<xpath expr="//a[hasclass('close')]" position="after">
|
||||
<t t-if="success == 'pay_invoice'">
|
||||
<t t-set="payment_tx_id" t-value="invoice.get_portal_last_transaction()"/>
|
||||
<span t-if='payment_tx_id.provider_id.sudo().done_msg' t-out="payment_tx_id.provider_id.sudo().done_msg"/>
|
||||
<div t-if="payment_tx_id.provider_id.sudo().pending_msg and payment_tx_id.provider_code == 'custom' and invoice.ref">
|
||||
<b>Communication: </b><span t-esc='invoice.ref'/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="success == 'pay_invoice' and invoice.payment_state in ('paid', 'in_payment')">
|
||||
Done, your online payment has been successfully processed. Thank you for your order.
|
||||
</t>
|
||||
</xpath>
|
||||
</template>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="payment_provider_form" model="ir.ui.view">
|
||||
<field name="name">payment.provider.form</field>
|
||||
<field name="model">payment.provider</field>
|
||||
<field name="inherit_id" ref="payment.payment_provider_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="payment_followup" position="attributes">
|
||||
<attribute name="invisible">
|
||||
0
|
||||
</attribute>
|
||||
</group>
|
||||
<group name="payment_followup" position="inside">
|
||||
<field name="journal_id"
|
||||
context="{'default_type': 'bank'}"
|
||||
attrs="{'required': [('state', '!=', 'disabled'), ('code', 'not in', ['none', 'custom'])]}"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Include account-related values in payment checkout form to pass them to the client -->
|
||||
<template id="payment_checkout_inherit" inherit_id="payment.checkout">
|
||||
<xpath expr="//form[@name='o_payment_checkout']" position="attributes">
|
||||
<attribute name="t-att-data-invoice-id">invoice_id</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
<!-- Include account-related values in payment manage form to pass them to the client -->
|
||||
<template id="payment_manage_inherit" inherit_id="payment.manage">
|
||||
<xpath expr="//form[@name='o_payment_manage']" position="attributes">
|
||||
<attribute name="t-att-data-invoice-id">invoice_id</attribute>
|
||||
</xpath>
|
||||
</template>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
<?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="inherit_id" ref="payment.payment_transaction_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<button name="action_view_refunds" position="before">
|
||||
<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>
|
||||
<field name="reference" position="after">
|
||||
<field name="payment_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Loading…
Add table
Add a link
Reference in a new issue