[IMP] account: Add a payment receipt report that can be sent by mail
- create a report for payment to print a receipt. Simple report with the amount received and name of the partner header of the company
- add a new action in action menu for print receipt
- add a new button action menu to send the receipt by email : STRING of the button = Send Receipt
- default template of payment receipt like sales
- add chatter history same as sales object
- this report use for both ('customer payment' & 'vendor payment)
This commit is contained in:
committed by
Yannick Tivisse
parent
d7bca63e36
commit
e9e2e0cbb5
@@ -63,6 +63,8 @@ You could use this simplified accounting in case you work with an (external) acc
|
||||
'views/res_config_view.xml',
|
||||
'views/web_planner_data.xml',
|
||||
'views/account_journal_dashboard_view.xml',
|
||||
'report/account_report_payment_receipt_templates.xml',
|
||||
'data/payment_receipt_data.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/account_demo.xml',
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
|
||||
<record id="account_payment_action" model="ir.values">
|
||||
<field name="model_id" ref="account.model_account_payment" />
|
||||
<field name="name">Print Receipt</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.report.xml,' +str(ref('action_report_payment_receipt'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.payment</field>
|
||||
</record>
|
||||
|
||||
<!--Email template -->
|
||||
<record id="mail_template_data_payment_receipt" model="mail.template">
|
||||
<field name="name">Payment Receipt - Send by Email</field>
|
||||
<field name="subject">${object.company_id.name} Payment Receipt (Ref ${object.name or 'n/a' })</field>
|
||||
<field name="partner_to">${object.partner_id.id}</field>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="auto_delete" eval="True"/>
|
||||
<field name="report_template" ref="account.action_report_payment_receipt"/>
|
||||
<field name="report_name">${(object.name or '').replace('/','-')}</field>
|
||||
<field name="lang">${object.partner_id.lang}</field>
|
||||
<field name="body_html" type="xml">
|
||||
<p>Dear ${object.partner_id.name},</p>
|
||||
<p>Thank you for your payment.<br />Here is your payment receipt <strong>${(object.name or '').replace('/','-')}</strong> amounting to <strong>${object.amount} ${object.currency_id.name}</strong> from ${object.company_id.name}.</p>
|
||||
<p>If you have any questions, please do not hesitate to contact us.</p>
|
||||
<p>Best regards,
|
||||
% if user and user.signature:
|
||||
${user.signature | safe}
|
||||
% endif
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Send Receipt By Email"
|
||||
res_model="mail.compose.message"
|
||||
src_model="account.payment"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_relate"
|
||||
id="account_send_payment_receipt_by_email_action"
|
||||
context="{
|
||||
'default_model': 'account.payment',
|
||||
'mail_post_autofollow': True,
|
||||
'default_composition_mode': 'comment',
|
||||
'default_use_template': True,
|
||||
'default_res_id': active_id,
|
||||
'default_template_id': ref('account.mail_template_data_payment_receipt'),
|
||||
}"
|
||||
/>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -170,7 +170,7 @@ class account_register_payments(models.TransientModel):
|
||||
|
||||
class account_payment(models.Model):
|
||||
_name = "account.payment"
|
||||
_inherit = 'account.abstract.payment'
|
||||
_inherit = ['mail.thread', 'account.abstract.payment']
|
||||
_description = "Payments"
|
||||
_order = "payment_date desc, name desc"
|
||||
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<template id="report_payment_receipt">
|
||||
<t t-call="report.html_container">
|
||||
<t t-foreach="docs" t-as="o">
|
||||
<t t-call="report.external_layout">
|
||||
<div class="page">
|
||||
<h3><strong>Payment Receipt: <span t-field="o.name"/></strong></h3>
|
||||
<div class="row mt64">
|
||||
<div class="col-xs-6" t-if="o.payment_date">
|
||||
<strong>Payment Date: </strong> <span t-field="o.payment_date"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-xs-6" t-if="o.partner_type">
|
||||
<t t-if="o.partner_type == 'customer'">
|
||||
<strong>Customer: </strong>
|
||||
</t>
|
||||
<t t-if="o.partner_type == 'supplier'">
|
||||
<strong>Vendor: </strong>
|
||||
</t><span t-field="o.partner_id"/>
|
||||
</div>
|
||||
<div class="col-xs-6" t-if="o.payment_method_id">
|
||||
<strong>Payment Method: </strong><span t-field="o.payment_method_id.name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row mb64">
|
||||
<div class="col-xs-6" t-if="o.amount">
|
||||
<strong>Payment Amount: </strong><span t-field="o.amount" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/>
|
||||
</div>
|
||||
<div class="col-xs-6" t-if="o.communication">
|
||||
<strong>Memo: </strong><span t-field="o.communication"/>
|
||||
</div>
|
||||
</div>
|
||||
<table class="table table-condensed">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Invoice Date</th>
|
||||
<th>Invoice Number</th>
|
||||
<th class="text-right">Original Amount</th>
|
||||
<th class="text-right">Amount Paid</th>
|
||||
<th class="text-right">Balance</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr t-foreach="o.invoice_ids" t-as="inv">
|
||||
<td><span t-field="inv.date_invoice"/></td>
|
||||
<td><span t-field="inv.number"/></td>
|
||||
<td class="text-right"><span t-field="inv.amount_total"/></td>
|
||||
<td class="text-right"><span t-esc="inv.amount_total - inv.residual" t-options="{'widget': 'monetary', 'display_currency': o.currency_id}"/></td>
|
||||
<td class="text-right"><span t-field="inv.residual"/></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
@@ -117,6 +117,10 @@
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<div class="oe_chatter">
|
||||
<field name="message_follower_ids" widget="mail_followers" groups="base.group_user"/>
|
||||
<field name="message_ids" widget="mail_thread"/>
|
||||
</div>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -110,5 +110,15 @@
|
||||
file="account.report_partnerledger"
|
||||
/>
|
||||
|
||||
<report
|
||||
id="action_report_payment_receipt"
|
||||
model="account.payment"
|
||||
string="Print Receipt"
|
||||
report_type="qweb-pdf"
|
||||
name="account.report_payment_receipt"
|
||||
file="account.report_payment_receipt"
|
||||
menu="False"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user