@ -1,23 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import account_receipt_parser |
@ -1,91 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
############################################################################## |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# Copyright (C) 2009-TODAY Cybrosys Technologies(<http://www.cybrosys.com>). |
|||
# Author: Niyas Raphy(<http://www.cybrosys.com>) |
|||
# you can modify it under the terms of the GNU LESSER |
|||
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
|||
# |
|||
# It is forbidden to publish, distribute, sublicense, or sell copies |
|||
# of the Software or modified copies of the Software. |
|||
# |
|||
# This program is distributed in the hope that it will be useful, |
|||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
# GNU LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
|||
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
############################################################################## |
|||
import json |
|||
from odoo.report import report_sxw |
|||
from odoo.osv import osv |
|||
from odoo import api |
|||
from odoo.http import request |
|||
|
|||
|
|||
class AccountReceiptParser(report_sxw.rml_parse): |
|||
|
|||
def __init__(self, cr, uid, name, context=None): |
|||
super(AccountReceiptParser, self).__init__(cr, uid, name, context=context) |
|||
self.localcontext.update({ |
|||
'get_details': self.get_details, |
|||
'get_details_invoice': self.get_details_invoice, |
|||
}) |
|||
self.context = context |
|||
|
|||
@api.multi |
|||
def get_details_invoice(self, doc): |
|||
lines = [] |
|||
if doc.number: |
|||
acc_inv = request.env['account.invoice'] |
|||
acc_inv_rec = acc_inv.search([('number', '=', doc.number)]) |
|||
total_amount = acc_inv_rec.amount_total |
|||
if acc_inv_rec.state == 'draft': |
|||
balance_amount = total_amount |
|||
else: |
|||
balance_amount = acc_inv_rec.residual |
|||
paid = total_amount - balance_amount |
|||
vals = { |
|||
'total_amount': total_amount, |
|||
'balance_amount': balance_amount, |
|||
'paid': paid, |
|||
} |
|||
lines.append(vals) |
|||
else: |
|||
vals = { |
|||
'total_amount': doc.amount_total, |
|||
'balance_amount': doc.amount_total, |
|||
'paid': 0, |
|||
} |
|||
lines.append(vals) |
|||
return lines |
|||
|
|||
@api.multi |
|||
def get_details(self, doc): |
|||
lines = [] |
|||
if doc.number: |
|||
acc_inv = request.env['account.invoice'] |
|||
acc_inv_rec = acc_inv.search([('number', '=', doc.number)]) |
|||
d = json.loads(acc_inv_rec.payments_widget) |
|||
for payment in d['content']: |
|||
vals = { |
|||
'memo': payment['name'], |
|||
'amount': payment['amount'], |
|||
'method': payment['journal_name'], |
|||
'date': payment['date'], |
|||
} |
|||
lines.append(vals) |
|||
return lines |
|||
|
|||
|
|||
class PrintReport(osv.AbstractModel): |
|||
_name = 'report.payment_receipt_invoice.report_payment' |
|||
_inherit = 'report.abstract_report' |
|||
_template = 'payment_receipt_invoice.report_payment' |
|||
_wrapped_report_class = AccountReceiptParser |
|||
|
|||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 66 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 48 KiB |
After Width: | Height: | Size: 14 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 27 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 45 KiB |
@ -1,22 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<report |
|||
id="report_payment_receipt" |
|||
string="Payment Receipt" |
|||
model="account.invoice" |
|||
report_type="qweb-pdf" |
|||
file="payment_receipt_invoice.report_payment" |
|||
name="payment_receipt_invoice.report_payment" |
|||
/> |
|||
|
|||
<template id="report_payment"> |
|||
<t t-call="report.html_container"> |
|||
<t t-foreach="docs" t-as="doc"> |
|||
<t t-call="payment_receipt_invoice.report_payment_print" t-lang="doc.partner_id.lang"/> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
|
|||
</data> |
|||
</odoo> |
@ -1,82 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<template id="report_payment_print"> |
|||
<t t-call="report.html_container"> |
|||
<t t-set="doc" t-value="doc.with_context({'lang':doc.partner_id.lang})" /> |
|||
<t t-call="report.internal_layout"> |
|||
<div class="page" > |
|||
<t t-call="report.external_layout"> |
|||
<div class="header" style="text-align:center;"><h1><strong>Payment Receipt</strong></h1></div> |
|||
<div class="row mt32 mb32" style="text-align:center;"> |
|||
</div> |
|||
<div class="row mt32 mb32" > |
|||
<div class="col-xs-12" style="text-align:left;"> |
|||
<span style="float:left;"><strong>Partner:</strong><span t-field="doc.partner_id.name"/></span> |
|||
<span style="float:left; padding-left:50px;"><strong>Invoice Date:</strong><span t-field="doc.date_invoice"/></span> |
|||
<span style="float:left; padding-left:50px;"><strong>Due Date:</strong><span t-field="doc.date_due"/></span> |
|||
</div> |
|||
</div> |
|||
|
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr > |
|||
<th style="background-color:#9b9da0 !important;">INVOICE TOTAL</th> |
|||
<th style="background-color:#9b9da0 !important;">PAID</th> |
|||
<th style="background-color:#9b9da0 !important;">DUE</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-set="paid_amount" t-value='1'></t> |
|||
<t t-foreach="get_details_invoice(doc)" t-as="rec"> |
|||
<tr> |
|||
<td><span t-att-style="style" t-esc="rec['total_amount']"/></td> |
|||
<t t-set="paid_amount" t-value="rec['paid']"/> |
|||
<td><span t-att-style="style" t-esc="rec['paid']"/> </td> |
|||
<td><span t-att-style="style" t-esc="rec['balance_amount']"/></td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
<t t-if="paid_amount != 0"> |
|||
<div class="row mt32 mb32" style="text-align:center;"> |
|||
<div class="col-xs-12"> |
|||
<h3><strong>Payment Details</strong></h3> |
|||
</div> |
|||
</div> |
|||
<t t-if="doc.amount_total != doc.residual"> |
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr > |
|||
<th style="background-color:#9b9da0 !important;">MEMO</th> |
|||
<th style="background-color:#9b9da0 !important;">PAYMENT DATE</th> |
|||
<th style="background-color:#9b9da0 !important;">METHOD</th> |
|||
<th style="background-color:#9b9da0 !important;">AMOUNT</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody> |
|||
<t t-foreach="get_details(doc)" t-as="b"> |
|||
<tr> |
|||
<td> |
|||
<span t-att-style="style" t-esc="b['memo']"/> |
|||
</td> |
|||
<td> |
|||
<span t-att-style="style" t-esc="b['date']"/> |
|||
</td> |
|||
<td> |
|||
<span t-att-style="style" t-esc="b['method']"/> |
|||
</td> |
|||
<td> |
|||
<span t-att-style="style" t-esc="b['amount']"/> |
|||
</td> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
@ -0,0 +1,13 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<report |
|||
id="account_receipt" |
|||
model="account.payment" |
|||
string="Receipt" |
|||
report_type="qweb-pdf" |
|||
name="payment_receipt_invoice.report_receipt" |
|||
file="payment_receipt_invoice.report_receipt" |
|||
/> |
|||
</data> |
|||
</odoo> |
@ -0,0 +1,137 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<data> |
|||
<template id="report_receipt_document"> |
|||
<t t-call="report.external_layout"> |
|||
<t t-set="o" t-value="o.with_context({'lang':o.partner_id.lang})" /> |
|||
<div class="page"> |
|||
<br/> |
|||
<div class="header" style="text-align:center;"><h1><strong>Payment Receipt</strong></h1></div> |
|||
<div class="row mt32 mb32"> |
|||
<div name="partner_address" class="col-xs-3"> |
|||
<strong><span t-field="o.partner_type"/><span>:</span></strong> |
|||
<address t-field="o.partner_id" |
|||
t-options='{"widget": "contact", "fields": ["address", "name"], "no_marker": True}' /> |
|||
<span t-if="o.partner_id.vat">TIN: <span t-field="o.partner_id.vat"/></span> |
|||
</div> |
|||
<div class="col-xs-3 col-xs-offset-6"> |
|||
<t t-if="o.payment_date"> |
|||
<strong>Payment Date:</strong> |
|||
<p t-field="o.payment_date"/></t> |
|||
<t t-if="o.name"> |
|||
<strong>Reference NO:</strong> |
|||
<p t-field="o.name"/></t> |
|||
<t t-if="o.journal_id"> |
|||
<strong>Payment Method:</strong> |
|||
<p t-field="o.journal_id"/></t> |
|||
</div> |
|||
</div> |
|||
<table class="table table-condensed"> |
|||
<thead> |
|||
<tr style="background-color:#9b9da0 !important;"> |
|||
<th>Invoice No</th> |
|||
<th>Invoice Date</th> |
|||
<th class="text-right">Total Amount</th> |
|||
<th class="text-right">Payment Amount</th> |
|||
<th class="text-right">Balance</th> |
|||
</tr> |
|||
</thead> |
|||
<tbody class="payment_tbody"> |
|||
<tr t-foreach="o.invoice_ids" t-as="l"> |
|||
<td><span t-field="l.number"/></td> |
|||
<td><span t-field="l.date_invoice"/></td> |
|||
<td class="text-right"> |
|||
<span t-field="l.amount_total" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</td> |
|||
<td class="text-right"> |
|||
<t t-foreach="l.payment_move_line_ids" t-as="pm"> |
|||
<t t-if="pm.payment_id.id == o.id"> |
|||
<t t-if="l.type in ('out_invoice', 'in_refund')"> |
|||
<t t-foreach="pm.matched_debit_ids" t-as="md"> |
|||
<t t-foreach="l.move_id.line_ids" t-as="ln"> |
|||
<t t-if="md.debit_move_id.id == ln.id"> |
|||
<t t-if="md.debit_move_id.amount_currency == 0.0"> |
|||
<span t-field="md.amount" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</t> |
|||
<t t-if="md.debit_move_id.amount_currency != 0.0"> |
|||
<span t-esc="abs(md.debit_move_id.amount_currency)" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</t> |
|||
|
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
<t t-if="l.type in ('in_invoice', 'out_refund')"> |
|||
<t t-foreach="pm.matched_credit_ids" t-as="mc"> |
|||
<t t-foreach="l.move_id.line_ids" t-as="ln"> |
|||
<t t-if="mc.credit_move_id.id == ln.id"> |
|||
<t t-if="mc.credit_move_id.amount_currency == 0.0"> |
|||
<span t-field="mc.amount" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</t> |
|||
<t t-if="mc.credit_move_id.amount_currency != 0.0"> |
|||
<span t-esc="abs(mc.credit_move_id.amount_currency)" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</td> |
|||
<td class="text-right"> |
|||
<span t-field="l.residual" |
|||
t-options='{"widget": "monetary", "display_currency": l.currency_id}'/> |
|||
</td> |
|||
</tr> |
|||
<tr style="border-top:2px solid black !important;"> |
|||
<td colspan="3"> |
|||
<b><span>Total Receipt Amount:</span></b> |
|||
</td> |
|||
<td class="text-right"> |
|||
<b><span t-field="o.amount" |
|||
t-options='{"widget": "monetary", "display_currency": o.currency_id}'/></b> |
|||
</td> |
|||
<td/> |
|||
</tr> |
|||
<t t-if="o.currency_id != o.company_id.currency_id"> |
|||
<tr> |
|||
<t t-set="c_amount" t-value="0.0"/> |
|||
<t t-foreach="o.move_line_ids" t-as="x"> |
|||
<t t-if="x.credit == 0.0"> |
|||
<t t-set="c_amount" t-value="x.debit"/> |
|||
</t> |
|||
<t t-if="x.credit != 0.0"> |
|||
<t t-set="c_amount" t-value="x.credit"/> |
|||
</t> |
|||
</t> |
|||
<td colspan="3"> |
|||
<b><span>Total Receipt Amount in </span><span t-field="o.company_id.currency_id.name"/>:</b> |
|||
</td> |
|||
<td class="text-right"> |
|||
<b><span t-esc="c_amount" |
|||
t-options='{"widget": "monetary", "display_currency": o.company_id.currency_id}'/></b> |
|||
</td> |
|||
<td/> |
|||
</tr> |
|||
</t> |
|||
</tbody> |
|||
</table> |
|||
<p style="text-align:center;">Thank You For Doing Business With Us</p> |
|||
</div> |
|||
</t> |
|||
</template> |
|||
|
|||
<template id="report_receipt"> |
|||
<t t-call="report.html_container"> |
|||
<t t-foreach="docs" t-as="o"> |
|||
<t t-call="payment_receipt_invoice.report_receipt_document" t-lang="o.partner_id.lang"/> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</data> |
|||
</odoo> |