@ -0,0 +1,45 @@ |
|||
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg |
|||
:target: https://www.gnu.org/licenses/agpl-3.0-standalone.html |
|||
:alt: License: AGPL-3 |
|||
|
|||
Employee Expense Report |
|||
======================= |
|||
The administrator has the ability to view the expense reports of any employee they choose, while regular users can only access and view their own expense reports. |
|||
|
|||
License |
|||
------- |
|||
General Public License, Version 3 (AGPL v3). |
|||
(https://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
Developer: V16 Anfas Faisal K, |
|||
V17 Gayathri V, |
|||
V18 Manasa T P, |
|||
Contact: odoo@cybrosys.com |
|||
|
|||
Contacts |
|||
-------- |
|||
* Mail Contact : odoo@cybrosys.com |
|||
* Website : https://cybrosys.com |
|||
|
|||
Bug Tracker |
|||
----------- |
|||
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. |
|||
|
|||
Maintainer |
|||
========== |
|||
.. image:: https://cybrosys.com/images/logo.png |
|||
:target: https://cybrosys.com |
|||
|
|||
This module is maintained by Cybrosys Technologies. |
|||
|
|||
For support and more information, please visit `Our Website <https://cybrosys.com/>`__ |
|||
|
|||
Further information |
|||
=================== |
|||
HTML Description: `<static/description/index.html>`__ |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Manasa T P (odoo@cybrosys.info) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import wizard |
@ -0,0 +1,49 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Manasa T P (odoo@cybrosys.info) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
{ |
|||
'name': "Employee Expense Report", |
|||
'version': "18.0.1.0.0", |
|||
'category': 'Human Resources', |
|||
'summary': 'The administrator has the ability to view the expense reports ' |
|||
'of any employee they choose, while regular users can only ' |
|||
'access and view their own expense reports.', |
|||
'description': "This apps helps Admin to print multiples employee " |
|||
"expense reports with custom dates and the print" |
|||
"the report of the current status like to submit, " |
|||
"submitted, approved, paid, refused, all, etc.", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['hr_expense'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'report/expense_report_filter_reports.xml', |
|||
'report/expense_report_filter_templates.xml', |
|||
'wizard/expense_report_filter_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,7 @@ |
|||
## Module <expense_report_odoo> |
|||
|
|||
#### 16.11.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
|
|||
- Initial commit for Employee Expense Report |
@ -0,0 +1,11 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<odoo> |
|||
<!-- Report Function in Expense --> |
|||
<record id="action_expense_request_report" model="ir.actions.report"> |
|||
<field name="name">Expense Report</field> |
|||
<field name="model">expense.report.filter</field> |
|||
<field name="report_type">qweb-pdf</field> |
|||
<field name="report_name">expense_report_odoo.report_expense_report_details</field> |
|||
<field name="report_file">expense_report_odoo.report_expense_report_details</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,129 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Report Template--> |
|||
<template id="report_expense_report_details"> |
|||
<t t-call="web.html_container"> |
|||
<t t-foreach="emp_name" t-as="emp"> |
|||
<t t-call="web.external_layout"> |
|||
<div class="page"> |
|||
<div class="text-center"> |
|||
<h1> |
|||
<u>Expense Report</u> |
|||
</h1> |
|||
</div> |
|||
<div class="oe_structure"/> |
|||
<div> |
|||
<p> |
|||
<b>Employee Name:</b> |
|||
<span t-esc="emp"/> |
|||
</p> |
|||
<t t-if="from_date"> |
|||
<p> |
|||
<b>Date from :</b> |
|||
<span t-esc="datetime.datetime.strptime(from_date, '%Y-%m-%d').strftime('%d-%m-%Y')"/> |
|||
</p> |
|||
</t> |
|||
<t t-if="to_date"> |
|||
<p> |
|||
<b>Date to :</b> |
|||
<span t-esc="datetime.datetime.strptime(to_date, '%Y-%m-%d').strftime('%d-%m-%Y')"/> |
|||
</p> |
|||
</t> |
|||
</div> |
|||
<style> |
|||
table { |
|||
width: 100%; |
|||
border: 1px solid black; |
|||
border-collapse: collapse; |
|||
} |
|||
th, td { |
|||
border: 1px solid black; |
|||
padding: 8px; |
|||
max-width:250px; |
|||
text-align:center; |
|||
} |
|||
</style> |
|||
<table> |
|||
<thead> |
|||
<tr> |
|||
<th>SR.No</th> |
|||
<th>Employee name</th> |
|||
<th style="min-width:120px;">Date</th> |
|||
<th>Description</th> |
|||
<th style="min-width:120px;">Unit Price</th> |
|||
<th>Quantity</th> |
|||
<th style="min-width:120px;">Total</th> |
|||
<th style="min-width:120px;">Status</th> |
|||
</tr> |
|||
</thead> |
|||
<t t-set="i" t-value="1"/> |
|||
<t t-set="total_expense" t-value="0"/> |
|||
<t t-foreach="data_pdf" t-as="data"> |
|||
<t t-if="data.get('t3', False) == emp"> |
|||
<tr> |
|||
<td> |
|||
<t t-esc="i"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="data.get('t3', False)"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="datetime.datetime.strptime(data.get('date', False), '%Y-%m-%d').strftime('%d-%m-%Y')"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="data.get('name', False)"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="data.get('t4', False)"/> |
|||
<t t-esc="data.get('price_unit', False)"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="data.get('quantity', False)"/> |
|||
</td> |
|||
<td> |
|||
<t t-esc="data.get('t4', False)"/> |
|||
<t t-esc="data.get('total_amount', False)"/> |
|||
</td> |
|||
<td> |
|||
<t t-if="data.get('state', False) == 'draft'"> |
|||
To Report |
|||
</t> |
|||
<t t-if="data.get('state', False) == 'reported'"> |
|||
To Submit |
|||
</t> |
|||
<t t-if="data.get('state', False) == 'submitted'"> |
|||
Submitted |
|||
</t> |
|||
<t t-if="data.get('state', False) == 'approved'"> |
|||
Approved |
|||
</t> |
|||
<t t-if="data.get('state', False) == 'done'"> |
|||
Done |
|||
</t> |
|||
<t t-if="data.get('state', False) == 'refused'"> |
|||
Refused |
|||
</t> |
|||
</td> |
|||
</tr> |
|||
<t t-if="data.get('total_amount', False)"> |
|||
<t t-set="total_expense" |
|||
t-value="total_expense + data['total_amount']"/> |
|||
</t> |
|||
<t t-set="i" t-value="i+1"/> |
|||
</t> |
|||
</t> |
|||
</table> |
|||
<br/> |
|||
<div> |
|||
<strong>Total Expense:</strong> |
|||
<t t-if="data and 't4' in data"> |
|||
<t t-esc="data.get('t4', False)"/> |
|||
</t> |
|||
<t t-esc="'{:.2f}'.format(total_expense)"/> |
|||
</div> |
|||
</div> |
|||
</t> |
|||
</t> |
|||
</t> |
|||
</template> |
|||
</odoo> |
|
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 194 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 141 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 50 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 730 KiB |
After Width: | Height: | Size: 43 KiB |
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Manasa T P (odoo@cybrosys.info) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from . import expense_report_filter |
@ -0,0 +1,111 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2023-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Manasa T P (odoo@cybrosys.info) |
|||
# |
|||
# You can modify it under the terms of the GNU AFFERO |
|||
# GENERAL PUBLIC LICENSE (AGPL 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 AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. |
|||
# |
|||
# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE |
|||
# (AGPL v3) along with this program. |
|||
# If not, see <http://www.gnu.org/licenses/>. |
|||
# |
|||
################################################################################ |
|||
from odoo import api, fields, models, _ |
|||
from odoo.exceptions import ValidationError |
|||
|
|||
|
|||
class ExpenseReportFilter(models.TransientModel): |
|||
_name = 'expense.report.filter' |
|||
_description = 'Expense Report Wizard' |
|||
|
|||
from_date = fields.Date(string='Start Date', |
|||
help="The start date for the expense period") |
|||
to_date = fields.Date(string='End Date', |
|||
help="The end date for the expense period") |
|||
employee_name_ids = fields.Many2many('hr.employee', |
|||
string="Employee Name", |
|||
default=lambda self: [ |
|||
(4, self.env.user.employee_id.id)], |
|||
help="The employees associated with " |
|||
"the expenses") |
|||
state = fields.Selection([ |
|||
('draft', 'To Report'), |
|||
('reported', 'To Submit'), |
|||
('submitted', 'Submitted'), |
|||
('approved', 'Approved'), |
|||
('done', 'Done'), |
|||
('refused', 'Refused') |
|||
], string='Status', copy=False, index=True, default='draft', |
|||
help="The current status of the expense report") |
|||
|
|||
@api.model |
|||
def create(self, vals): |
|||
"""This method ensures that an employee_name_ids field is |
|||
set when creating an ExpenseWizard record, unless the |
|||
current user has the 'base.group_system' security group.""" |
|||
if not vals.get('employee_name_ids') and not self.env.user.has_group( |
|||
'base.group_system'): |
|||
vals['employee_name_ids'] = [(4, self.env.user.employee_id.id)] |
|||
return super().create(vals) |
|||
|
|||
def action_expense_report(self): |
|||
"""This method ensures that generates a report of expenses based on |
|||
various filters and the Values are passed |
|||
to the Report Template""" |
|||
query = """Select hr_expense.date,hr_expense.product_id, |
|||
hr_expense.name,hr_expense.employee_id, |
|||
hr_expense.price_unit,hr_expense.quantity, |
|||
hr_expense.currency_id, |
|||
hr_expense.total_amount,hr_expense.state,pl.name as t2,ep.name as |
|||
t3,currency.symbol as t4 from hr_expense LEFT JOIN product_product |
|||
pd ON pd.id = hr_expense.product_id left join product_template |
|||
pl on pl.id = pd.product_tmpl_id |
|||
left join hr_employee ep on ep.id = hr_expense.employee_id |
|||
left join res_currency currency ON currency.id = hr_expense.currency_id |
|||
where 1=1""" |
|||
params = [] |
|||
if self.from_date: |
|||
query += " AND date >= %s" |
|||
params.append(self.from_date) |
|||
if self.to_date: |
|||
if self.from_date and self.to_date < self.from_date: |
|||
raise ValidationError(_("End date cannot be before start date")) |
|||
query += " AND date <= %s" |
|||
params.append(self.to_date) |
|||
if self.employee_name_ids: |
|||
employee_ids = tuple(self.employee_name_ids.ids) |
|||
if len(employee_ids) > 1: |
|||
query += " AND employee_id IN %s" |
|||
params.append(employee_ids) |
|||
else: |
|||
query += " AND employee_id = %s" |
|||
params.append(employee_ids[0]) |
|||
emp_name = self.employee_name_ids.mapped('name') |
|||
else: |
|||
all_employees = self.env['hr.employee'].search([]) |
|||
query += " AND employee_id IN %s" |
|||
params.append(tuple(all_employees.ids)) |
|||
emp_name = all_employees.mapped('name') |
|||
if self.state: |
|||
query += " AND state = %s" |
|||
params.append(self.state) |
|||
exe = self.env.cr.execute(query, params) |
|||
data = { |
|||
'model_id': self.id, |
|||
'from_date': self.from_date, |
|||
'to_date': self.to_date, |
|||
'emp_name': emp_name, |
|||
'state': self.state, |
|||
'data_pdf': self.env.cr.dictfetchall() |
|||
} |
|||
return self.env.ref('expense_report_odoo.action_expense_request_report') \ |
|||
.report_action(None, data=data) |
@ -0,0 +1,36 @@ |
|||
<?xml version="1.0" encoding="utf-8" ?> |
|||
<odoo> |
|||
<!-- Define the view for the expense report filter form --> |
|||
<record id="expense_report_filter_view_form" model="ir.ui.view"> |
|||
<field name="name">expense.report.filter.view.form</field> |
|||
<field name="model">expense.report.filter</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Expense Report"> |
|||
<group> |
|||
<field name="from_date"/> |
|||
<field name="to_date"/> |
|||
<field name="employee_name_ids" widget="many2many_tags" groups="hr_expense.group_hr_expense_manager"/> |
|||
<field name="state"/> |
|||
</group> |
|||
<footer> |
|||
<button name="action_expense_report" string="Generate Report" type="object" class="btn-primary"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
<!-- Define the action for the expense wizards form --> |
|||
<record id="expense_report_filter_action" model="ir.actions.act_window"> |
|||
<field name="name">Expense Report</field> |
|||
<field name="type">ir.actions.act_window</field> |
|||
<field name="res_model">expense.report.filter</field> |
|||
<field name="view_mode">form</field> |
|||
<field name="view_id" ref="expense_report_filter_view_form"/> |
|||
<field name="target">new</field> |
|||
</record> |
|||
<!-- Add a menu item to access the expense report --> |
|||
<menuitem id="expense_report_filter_menu" |
|||
name="Expense Report" |
|||
parent="hr_expense.menu_hr_expense_root" |
|||
action="expense_report_filter_action" |
|||
sequence="15"/> |
|||
</odoo> |