14 changed files with 839 additions and 3 deletions
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import statement_report |
@ -0,0 +1,54 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Aysha Shalin (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3. |
||||
|
# |
||||
|
# 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 (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
import json |
||||
|
from odoo import http |
||||
|
from odoo.http import content_disposition, request |
||||
|
from odoo.tools import html_escape |
||||
|
|
||||
|
|
||||
|
class XLSXReportController(http.Controller): |
||||
|
""" Controller for xlsx report """ |
||||
|
@http.route('/xlsx_report', type='http', auth='user', methods=['POST'], |
||||
|
csrf=False) |
||||
|
def get_report_xlsx(self, model, options, output_format, report_name): |
||||
|
""" Get xlsx report data """ |
||||
|
report_obj = request.env[model].sudo() |
||||
|
print("oo") |
||||
|
options = json.loads(options) |
||||
|
try: |
||||
|
if output_format == 'xlsx': |
||||
|
response = request.make_response( |
||||
|
None, headers=[ |
||||
|
('Content-Type', 'application/vnd.ms-excel'), |
||||
|
('Content-Disposition', content_disposition( |
||||
|
report_name + '.xlsx'))]) |
||||
|
report_obj.get_xlsx_report(options, response) |
||||
|
response.set_cookie('fileToken', 'dummy token') |
||||
|
return response |
||||
|
except Exception as event: |
||||
|
serialize = http.serialize_exception(event) |
||||
|
error = { |
||||
|
'code': 200, |
||||
|
'message': 'Odoo Server Error', |
||||
|
'data': serialize |
||||
|
} |
||||
|
return request.make_response(html_escape(json.dumps(error))) |
@ -0,0 +1,14 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Action for statement report --> |
||||
|
<record id="res_partner_action" model="ir.actions.report"> |
||||
|
<field name="name">Statement Report</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="report_type">qweb-pdf</field> |
||||
|
<field name="report_name">base_accounting_kit.res_partner_statement_report_template</field> |
||||
|
<field name="report_file">base_accounting_kit.res_partner_statement_report_template</field> |
||||
|
<field name="print_report_name">'Statement Report- %s' %(object.name)</field> |
||||
|
<field name="binding_model_id" ref="model_res_partner"/> |
||||
|
<field name="binding_type">report</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,76 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Statement report template --> |
||||
|
<template id="res_partner_statement_report_template"> |
||||
|
<t t-call="web.html_container"> |
||||
|
<t t-call="web.external_layout"> |
||||
|
<div page="page"> |
||||
|
<h3>Payment Statement Report</h3> |
||||
|
</div><br/> |
||||
|
<table border="0"> |
||||
|
<tr><t t-esc="customer"/></tr><br/><br/> |
||||
|
<tr><t t-if="street"> <t t-esc="street"/></t></tr><br/> |
||||
|
<tr><t t-if="street2"> <t t-esc="street2"/></t></tr><br/> |
||||
|
<tr><t t-if="city"> <t t-esc="city"/></t></tr><br/> |
||||
|
<tr><t t-if="state"> <t t-esc="state"/></t></tr><br/> |
||||
|
</table> |
||||
|
<br/><br/> |
||||
|
<table class="table" style="align-items: center;"> |
||||
|
<thead> |
||||
|
<tr> |
||||
|
<th>Date</th> |
||||
|
<th>Invoice/Bill Number</th> |
||||
|
<th>Due Date</th> |
||||
|
<th>Invoices/Debit</th> |
||||
|
<th>Balance</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<t t-foreach="my_data" t-as="line"> |
||||
|
<tr> |
||||
|
<td align="center"><t t-esc="line['invoice_date']"/></td> |
||||
|
<td align="center"><t t-esc="line['name']"/></td> |
||||
|
<td align="center"><t t-esc="line['invoice_date_due']"/></td> |
||||
|
<td align="center"> |
||||
|
<t t-esc="currency"/> |
||||
|
<t t-esc="line['sub_total']"/> |
||||
|
</td> |
||||
|
<td align="center"> |
||||
|
<t t-esc="currency"/> |
||||
|
<t t-esc="line['balance']"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</t> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
<br/> |
||||
|
<t t-if="total"> |
||||
|
<div class="clearfix" name="so_total_summary"> |
||||
|
<div id="total" class="row" name="total"> |
||||
|
<div t-attf-class="#{'col-6' if report_type != 'html' else 'col-sm-7 col-md-6'} ms-auto"> |
||||
|
<table class="table table-sm"> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td>Total Amount:</td> |
||||
|
<td> |
||||
|
<t t-esc="currency"/> |
||||
|
<t t-esc="total"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
<tr> |
||||
|
<td>Total Balance:</td> |
||||
|
<td> |
||||
|
<t t-esc="currency"/> |
||||
|
<t t-esc="balance"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |
After Width: | Height: | Size: 114 KiB |
After Width: | Height: | Size: 47 KiB |
After Width: | Height: | Size: 36 KiB |
@ -0,0 +1,16 @@ |
|||||
|
/** @odoo-module*/ |
||||
|
import {registry} from "@web/core/registry"; |
||||
|
import {download} from "@web/core/network/download"; |
||||
|
import { BlockUI, unblockUI } from "@web/core/ui/block_ui"; |
||||
|
// Action manager for xlsx report
|
||||
|
registry.category('ir.actions.report handlers').add('xlsx', async (action) => { |
||||
|
if (action.report_type === 'xlsx'){ |
||||
|
BlockUI; |
||||
|
await download({ |
||||
|
url : '/xlsx_report', |
||||
|
data : action.data, |
||||
|
error : (error) => self.call('crash_manager', 'rpc_error', error), |
||||
|
complete: () => unblockUI, |
||||
|
}); |
||||
|
} |
||||
|
}) |
@ -0,0 +1,93 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8" ?> |
||||
|
<odoo> |
||||
|
<!-- Customer and vendor statements --> |
||||
|
<record id="view_partner_form" model="ir.ui.view"> |
||||
|
<field name="name">res.partner.view.form.inherit.base.account.report |
||||
|
</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="base.view_partner_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//page[@name='sales_purchases']" position="after"> |
||||
|
<page name="customer_statement_page" |
||||
|
string="Customer Statement"> |
||||
|
<button name="action_print_pdf" type="object" |
||||
|
class="btn-secondary"> |
||||
|
Print PDF |
||||
|
</button> |
||||
|
<button name="action_print_xlsx" type="object" |
||||
|
class="btn-secondary"> |
||||
|
Print Excel |
||||
|
</button> |
||||
|
<button name="action_share_pdf" type="object" |
||||
|
class="btn-secondary"> |
||||
|
Sent PDF By Email |
||||
|
</button> |
||||
|
<button name="action_share_xlsx" type="object" |
||||
|
class="btn-secondary"> |
||||
|
Sent Excel By Email |
||||
|
</button> |
||||
|
<br/> |
||||
|
<br/> |
||||
|
<field name="customer_report_ids"> |
||||
|
<list create='false' delete="false"> |
||||
|
<field name="currency_id" column_invisible="1"/> |
||||
|
<field name="invoice_date" |
||||
|
string="Invoice Date"/> |
||||
|
<field name="name" string="Invoice No."/> |
||||
|
<field name="invoice_date_due"/> |
||||
|
<field name="amount_total_signed" |
||||
|
sum="Total Amount" string="Total Amount" |
||||
|
widget="monetary" |
||||
|
options="{'currency_field': 'currency_id'}"/> |
||||
|
<field name="amount_residual_signed" |
||||
|
string="Amount Due" widget="monetary" |
||||
|
options="{'currency_field': 'currency_id'}"/> |
||||
|
<field name="amount_residual" sum="Balance Due" |
||||
|
string="Balance" widget="monetary" |
||||
|
options="{'currency_field': 'currency_id'}"/> |
||||
|
</list> |
||||
|
</field> |
||||
|
</page> |
||||
|
<!-- <page name="supplier_statement"--> |
||||
|
<!-- string="Supplier Statement">--> |
||||
|
<!-- <button name="action_vendor_print_pdf" type="object"--> |
||||
|
<!-- class="btn-secondary">--> |
||||
|
<!-- Print PDF--> |
||||
|
<!-- </button>--> |
||||
|
<!-- <button name="action_vendor_print_xlsx" type="object"--> |
||||
|
<!-- class="btn-secondary">--> |
||||
|
<!-- Print Excel--> |
||||
|
<!-- </button>--> |
||||
|
<!-- <button name="action_vendor_share_pdf" type="object"--> |
||||
|
<!-- class="btn-secondary">--> |
||||
|
<!-- Sent PDF By Email--> |
||||
|
<!-- </button>--> |
||||
|
<!-- <button name="action_vendor_share_xlsx" type="object"--> |
||||
|
<!-- class="btn-secondary">--> |
||||
|
<!-- Sent Excel By Email--> |
||||
|
<!-- </button>--> |
||||
|
<!-- <br/>--> |
||||
|
<!-- <br/>--> |
||||
|
<!-- <field name="vendor_statement_ids">--> |
||||
|
<!-- <list create="false" delete="false">--> |
||||
|
<!-- <field name="currency_id" column_invisible="1"/>--> |
||||
|
<!-- <field name="invoice_date" string="Bill Date"/>--> |
||||
|
<!-- <field name="name" string="Bill No."/>--> |
||||
|
<!-- <field name="invoice_date_due"/>--> |
||||
|
<!-- <field name="amount_total_signed"--> |
||||
|
<!-- sum="Total Amount" string="Total Amount"--> |
||||
|
<!-- widget="monetary"--> |
||||
|
<!-- options="{'currency_field': 'currency_id'}"/>--> |
||||
|
<!-- <field name="amount_residual_signed"--> |
||||
|
<!-- string="Amount Due" widget="monetary"--> |
||||
|
<!-- options="{'currency_field': 'currency_id'}"/>--> |
||||
|
<!-- <field name="amount_residual" sum="Balance Due"--> |
||||
|
<!-- string="Balance" widget="monetary"--> |
||||
|
<!-- options="{'currency_field': 'currency_id'}"/>--> |
||||
|
<!-- </list>--> |
||||
|
<!-- </field>--> |
||||
|
<!-- </page>--> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
Loading…
Reference in new issue