Employee it declaration Module
This commit is contained in:
parent
533577f1a8
commit
4061ba226f
|
|
@ -0,0 +1,114 @@
|
|||
from odoo import models, fields, api, _
|
||||
from odoo.exceptions import ValidationError
|
||||
from datetime import date, datetime, time
|
||||
|
||||
class ITTaxStatementWizard(models.TransientModel):
|
||||
_name = 'it.tax.statement.wizard'
|
||||
_description = 'Generate IT Tax Statement'
|
||||
|
||||
def _period_line_id_domain(self):
|
||||
pass
|
||||
|
||||
employee_id = fields.Many2one('hr.employee', required=True, default=lambda self: self.env.user.employee_id.id)
|
||||
emp_doj = fields.Date(related='employee_id.doj', store=True)
|
||||
contract_id = fields.Many2one('hr.contract',related='employee_id.contract_id')
|
||||
|
||||
period_id = fields.Many2one('payroll.period', required=True)
|
||||
period_line = fields.Many2one('payroll.period.line')
|
||||
tax_regime = fields.Selection([
|
||||
('new', 'New Regime'),
|
||||
('old', 'Old Regime')
|
||||
], string="Tax Regime", required=True, default='new')
|
||||
|
||||
def action_generate_report(self):
|
||||
# declaration = self.env['emp.it.declaration'].search([
|
||||
# ('employee_id', '=', self.employee_id.id),
|
||||
# ('period_id', '=', self.period_id.id)
|
||||
# ], limit=1)
|
||||
#
|
||||
# if not declaration:
|
||||
# raise ValidationError("No IT Declaration found for the selected employee and period.")
|
||||
|
||||
# Prepare data for the report
|
||||
report_data = self._prepare_income_tax_data()
|
||||
|
||||
# Return the report action
|
||||
return {
|
||||
'type': 'ir.actions.report',
|
||||
'report_name': 'employee_it_declaration.income_tax_statement_report',
|
||||
'report_type': 'qweb-pdf',
|
||||
'data': {'model': 'it.tax.statement.wizard', 'ids': self.ids, 'report_data': report_data},
|
||||
'context': {'active_model': 'it.tax.statement.wizard', 'active_id': self.id},
|
||||
}
|
||||
# return self.env.ref('your_module_name.action_report_it_tax_statement').report_action(declaration)
|
||||
|
||||
def _prepare_income_tax_data(self):
|
||||
# Get fiscal year (April to March)
|
||||
today = date.today()
|
||||
if today.month >= 4:
|
||||
fiscal_year_start = date(today.year, 4, 1)
|
||||
fiscal_year_end = date(today.year + 1, 3, 31)
|
||||
else:
|
||||
fiscal_year_start = date(today.year - 1, 4, 1)
|
||||
fiscal_year_end = date(today.year, 3, 31)
|
||||
|
||||
fiscal_year_str = f"{fiscal_year_start.year}-{fiscal_year_end.year}"
|
||||
|
||||
# Get company information
|
||||
company = self.env.company
|
||||
company_address = ', '.join(filter(None, [
|
||||
company.street,
|
||||
company.street2,
|
||||
company.city,
|
||||
company.state_id.name,
|
||||
company.country_id.name,
|
||||
company.zip
|
||||
]))
|
||||
|
||||
# Get PAN and TAN (assuming they're stored in company)
|
||||
pan_number = company.pan_number if hasattr(company, 'pan_number') else 'PAN1234567'
|
||||
tan_number = company.tan_number if hasattr(company, 'tan_number') else 'TAN1234567'
|
||||
|
||||
# Prepare report data
|
||||
data = {
|
||||
'company_name': company.name,
|
||||
'company_address': company_address,
|
||||
'pan_number': pan_number,
|
||||
'tan_number': tan_number,
|
||||
'assessment_year': fiscal_year_end.year + 1,
|
||||
'financial_year': fiscal_year_str,
|
||||
'date': today.strftime('%d/%m/%Y'),
|
||||
|
||||
# Income details (simplified - you would query actual data)
|
||||
'salary_income': 1200000.00,
|
||||
'house_property_income': 300000.00,
|
||||
'business_income': 500000.00,
|
||||
'capital_gains': 200000.00,
|
||||
'other_income': 100000.00,
|
||||
'total_income': 2300000.00,
|
||||
|
||||
# Deductions
|
||||
'section_80c': 150000.00,
|
||||
'section_80d': 50000.00,
|
||||
'section_80g': 10000.00,
|
||||
'other_deductions': 30000.00,
|
||||
'total_deductions': 240000.00,
|
||||
|
||||
# Tax computation
|
||||
'taxable_income': 2060000.00,
|
||||
'tax_payable': 450000.00,
|
||||
'tax_paid': 400000.00,
|
||||
'balance_tax': 50000.00,
|
||||
|
||||
# Additional details
|
||||
'bank_name': 'State Bank of India',
|
||||
'account_number': '1234567890',
|
||||
'ifsc_code': 'SBIN0001234',
|
||||
|
||||
# For employee reports (if needed)
|
||||
'employee_name': 'John Doe',
|
||||
'employee_pan': 'ABCDE1234F',
|
||||
'employee_address': '123, Main Street, Bangalore, Karnataka - 560001',
|
||||
}
|
||||
|
||||
return {'data': data}
|
||||
|
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<template id="income_tax_statement_report">
|
||||
<t t-call="web.external_layout">
|
||||
<main class="page">
|
||||
<t t-set="data" t-value="report_data['data']"/>
|
||||
<div>
|
||||
<!-- Header -->
|
||||
<div class="row text-center" style="margin-bottom: 20px; page-break-inside: avoid;">
|
||||
<h2>INCOME TAX STATEMENT</h2>
|
||||
<h4>Assessment Year: <span t-esc="data.get('assessment_year')"/></h4>
|
||||
<h4>Financial Year: <span t-esc="data.get('financial_year')"/></h4>
|
||||
</div>
|
||||
|
||||
<!-- Company Information -->
|
||||
<div class="row" style="margin-bottom: 20px; page-break-inside: avoid;">
|
||||
<div class="col-md-6">
|
||||
<strong>Company Name:</strong> <span t-esc="data.get('company_name')"/><br/>
|
||||
<strong>Address:</strong> <span t-esc="data.get('company_address')"/><br/>
|
||||
<strong>PAN:</strong> <span t-esc="data.get('pan_number')"/><br/>
|
||||
<strong>TAN:</strong> <span t-esc="data.get('tan_number')"/><br/>
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<strong>Date:</strong> <span t-esc="data.get('date')"/><br/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Income Details -->
|
||||
<div class="row" style="margin-bottom: 20px;">
|
||||
<h4>Income Details</h4>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Particulars</th>
|
||||
<th class="text-right">Amount (₹)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Income from Salary</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('salary_income', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Income from House Property</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('house_property_income', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Income from Business/Profession</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('business_income', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Capital Gains</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('capital_gains', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Income from Other Sources</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('other_income', 0))"/>
|
||||
</tr>
|
||||
<tr style="font-weight: bold;">
|
||||
<td>Total Income</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('total_income', 0))"/>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Deductions -->
|
||||
<div class="row" style="margin-bottom: 20px; page-break-inside: avoid;">
|
||||
<h4>Deductions Under Chapter VI-A</h4>
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Section</th>
|
||||
<th>Particulars</th>
|
||||
<th class="text-right">Amount (₹)</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>80C</td>
|
||||
<td>Life Insurance, PF, PPF, etc.</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('section_80c', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>80D</td>
|
||||
<td>Medical Insurance Premium</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('section_80d', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>80G</td>
|
||||
<td>Donations to Charitable Institutions</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('section_80g', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Others</td>
|
||||
<td>Other Deductions</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('other_deductions', 0))"/>
|
||||
</tr>
|
||||
<tr style="font-weight: bold;">
|
||||
<td colspan="2">Total Deductions</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('total_deductions', 0))"/>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<!-- Tax Computation -->
|
||||
<div class="row" style="margin-bottom: 20px; page-break-inside: avoid;">
|
||||
<h4>Tax Computation</h4>
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Total Income</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('total_income', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Less: Deductions</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('total_deductions', 0))"/>
|
||||
</tr>
|
||||
<tr style="font-weight: bold;">
|
||||
<td>Taxable Income</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('taxable_income', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Tax Payable</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('tax_payable', 0))"/>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Less: Tax Paid (Advance/Self-assessment)</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('tax_paid', 0))"/>
|
||||
</tr>
|
||||
<tr style="font-weight: bold;">
|
||||
<td>Balance Tax Payable</td>
|
||||
<td class="text-right" t-esc="'{:,.2f}'.format(data.get('balance_tax', 0))"/>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</main>
|
||||
</t>
|
||||
</template>
|
||||
</odoo>
|
||||
Loading…
Reference in New Issue