@ -0,0 +1,46 @@ |
|||
.. 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 |
|||
|
|||
Create Expense From Task |
|||
======================= |
|||
This apps helps User to create multiple expense from project task and split the amount between assigns. |
|||
|
|||
Installation |
|||
============ |
|||
- Install our custom addon |
|||
|
|||
License |
|||
------- |
|||
GNU Affero General Public License v3.0 (AGPL v3) |
|||
(http://www.gnu.org/licenses/agpl-3.0-standalone.html) |
|||
|
|||
Company |
|||
------- |
|||
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
|||
|
|||
Credits |
|||
------- |
|||
Developer: (V18) Nivedhya T, 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,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 models |
|||
from . import wizards |
@ -0,0 +1,45 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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': "Create Expense From Task", |
|||
'version': "18.0.1.0.0", |
|||
'category': 'Services/Project', |
|||
'summary': 'User can create Expense from Task', |
|||
'description': "This apps helps User to create multiple expense " |
|||
"from project task and split the amount between assigns", |
|||
'author': 'Cybrosys Techno Solutions', |
|||
'company': 'Cybrosys Techno Solutions', |
|||
'maintainer': 'Cybrosys Techno Solutions', |
|||
'website': 'https://www.cybrosys.com', |
|||
'depends': ['base', 'hr_expense', 'project'], |
|||
'data': [ |
|||
'security/ir.model.access.csv', |
|||
'views/hr_expense_views.xml', |
|||
'views/project_task_views.xml', |
|||
'wizards/expense_amount_views.xml', |
|||
], |
|||
'images': ['static/description/banner.jpg'], |
|||
'license': 'AGPL-3', |
|||
'installable': True, |
|||
'auto_install': False, |
|||
'application': False, |
|||
} |
@ -0,0 +1,6 @@ |
|||
## Module <create_expense_from_task_odoo> |
|||
|
|||
#### 11.10.2024 |
|||
#### Version 18.0.1.0.0 |
|||
#### ADD |
|||
- Initial commit for Create Expense From Task |
@ -0,0 +1,23 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 hr_expense |
|||
from . import project_task |
@ -0,0 +1,36 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 fields, models |
|||
|
|||
|
|||
class HrExpense(models.Model): |
|||
""" |
|||
Inherit HrExpense model extends the hr.expense model in the Odoo framework. |
|||
It adds two Many2one fields - project_id and task_id - which are used to |
|||
associate a project and a task with an expense record. |
|||
""" |
|||
_inherit = 'hr.expense' |
|||
|
|||
project_id = fields.Many2one('project.project', |
|||
help='The project associated with this record.') |
|||
task_id = fields.Many2one('project.task', |
|||
help='The task associated with this record.') |
@ -0,0 +1,63 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 models |
|||
|
|||
|
|||
class InheritProjectTask(models.Model): |
|||
""" |
|||
InheritProjectTask model extends the project.task model in the Odoo |
|||
framework. It adds two methods - create_task_expense() and smart_expense() |
|||
- which are used as button actions to create expense records associated |
|||
with a task and display existing expense records related to a task, |
|||
respectively. |
|||
""" |
|||
_inherit = 'project.task' |
|||
|
|||
def action_create_task_expense(self): |
|||
"""Expense Button which will go to Expense Wizard Form where he add |
|||
the total amount of expense and also pass the value through context""" |
|||
return { |
|||
'name': 'Create Expense Wizard', |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'expense.amount', |
|||
'view_mode': 'form', |
|||
'target': 'new', |
|||
'context': { |
|||
'default_task_id': self.id, |
|||
'default_project_id': self.project_id.id, |
|||
'default_name': self.name, |
|||
'default_employee_name_id': [ |
|||
(6, 0, self.user_ids.mapped('employee_ids').ids)] |
|||
}, |
|||
} |
|||
|
|||
def smart_expense(self): |
|||
""" Smart Button of Expense which will redirect to Current Expense |
|||
Records""" |
|||
expense_ids = self.env['hr.expense'].search([('task_id', '=', self.id)]).ids |
|||
return { |
|||
'type': 'ir.actions.act_window', |
|||
'res_model': 'hr.expense', |
|||
'domain': [('id', 'in', expense_ids)], |
|||
'view_mode': 'list,form', |
|||
'target': 'current', |
|||
} |
|
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: 167 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: 49 KiB |
After Width: | Height: | Size: 98 KiB |
After Width: | Height: | Size: 94 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 112 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 119 KiB |
After Width: | Height: | Size: 120 KiB |
After Width: | Height: | Size: 52 KiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 76 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 90 KiB |
After Width: | Height: | Size: 10 KiB |
@ -0,0 +1,15 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- Inherited hr_expense to add fields--> |
|||
<record id="hr_expense_view_form" model="ir.ui.view"> |
|||
<field name="name">hr.expense.view.form.inherit.create.expense.from.task.odoo</field> |
|||
<field name="model">hr.expense</field> |
|||
<field name="inherit_id" ref="hr_expense.hr_expense_view_form"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//field[@name='date']" position="after"> |
|||
<field name="project_id"/> |
|||
<field name="task_id"/> |
|||
</xpath> |
|||
</field> |
|||
</record> |
|||
</odoo> |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Inherited Project.Task Form to add button and smart button--> |
|||
<record id="project_task_view_form" model="ir.ui.view"> |
|||
<field name="name">project.task.view.form.inherit.create.expense.from.task.odoo</field> |
|||
<field name="model">project.task</field> |
|||
<field name="inherit_id" ref="project.view_task_form2"/> |
|||
<field name="arch" type="xml"> |
|||
<xpath expr="//header" position="inside"> |
|||
<button name="action_create_task_expense" string="Create Expense" |
|||
type="object" |
|||
class="oe_highlight"/> |
|||
</xpath> |
|||
<div name="button_box" position="inside"> |
|||
<button name="smart_expense" string="Expense" type="object" |
|||
icon="fa-pencil-square-o" |
|||
class="oe_stat_button"> |
|||
</button> |
|||
</div> |
|||
</field> |
|||
</record> |
|||
</odoo> |
|||
|
@ -0,0 +1,22 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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_amount |
@ -0,0 +1,58 @@ |
|||
# -*- coding: utf-8 -*- |
|||
################################################################################ |
|||
# |
|||
# Cybrosys Technologies Pvt. Ltd. |
|||
# |
|||
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). |
|||
# Author: Cybrosys Techno Solutions(<https://www.cybrosys.com>) |
|||
# |
|||
# 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 fields, models |
|||
|
|||
|
|||
class ExpenseAmount(models.TransientModel): |
|||
"""This wizards is used for creating expense records. |
|||
It allows users to specify the service name, the employee names associated with |
|||
the record, and the total amount for the record. |
|||
""" |
|||
_name = 'expense.amount' |
|||
_description = "Expense Amount for Creating Expense Records" |
|||
|
|||
product_id = fields.Many2one('product.product', string="Service Name", |
|||
domain=[('type', '=', 'service')], |
|||
help="The product associated with the record") |
|||
employee_name_ids = fields.Many2many('hr.employee', string="Employee Name", |
|||
help="The employees associated with " |
|||
"this record." |
|||
) |
|||
total_amount = fields.Float(string="Total Amount", help="The total amount " |
|||
"for this record.") |
|||
|
|||
def action_create_expense(self): |
|||
"""Expense Creation if they are many assigned the amount is split |
|||
blw them""" |
|||
expense_ids = [] |
|||
count = len(self.employee_name_ids) |
|||
for employee in self.employee_name_ids: |
|||
expense = self.env['hr.expense'].create([{ |
|||
'employee_id': employee.id, |
|||
'date': fields.Date.today(), |
|||
'name': self._context.get('default_name'), |
|||
'project_id': self._context.get('default_project_id'), |
|||
'total_amount': self.total_amount / count, |
|||
'product_id': self.product_id.id, |
|||
}]) |
|||
expense_ids.append(expense.id) |
|||
return expense_ids |
@ -0,0 +1,23 @@ |
|||
<?xml version="1.0" encoding="UTF-8" ?> |
|||
<odoo> |
|||
<!-- Define the view for the expense amount form --> |
|||
<record id="expense_amount_view_form" model="ir.ui.view"> |
|||
<field name="name">expense.amount.view.form</field> |
|||
<field name="model">expense.amount</field> |
|||
<field name="arch" type="xml"> |
|||
<form string="Expense Report"> |
|||
<group> |
|||
<field name="product_id"/> |
|||
<field name="employee_name_ids" widget="many2many_tags"/> |
|||
<field name="total_amount"/> |
|||
</group> |
|||
<footer> |
|||
<button name="action_create_expense" |
|||
string="Generate Expense" type="object" |
|||
class="btn-primary"/> |
|||
<button special="cancel" string="Cancel"/> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
</odoo> |