diff --git a/project_maintenance/__init__.py b/project_maintenance/__init__.py
new file mode 100755
index 0000000..e23d082
--- /dev/null
+++ b/project_maintenance/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+
+from . import models
+from . import report
+
+
diff --git a/project_maintenance/__manifest__.py b/project_maintenance/__manifest__.py
new file mode 100755
index 0000000..9f13ef2
--- /dev/null
+++ b/project_maintenance/__manifest__.py
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+
+{
+ 'name': 'Project Maintanence',
+ 'summary': 'Projects Maintanence',
+ 'description': "",
+ 'version': '1.0',
+ 'license': 'LGPL-3',
+ 'category': 'Services/Project',
+ 'author': "SunArc Technologies",
+ 'website': "http://www.sunarctechnologies.com",
+ 'depends': [
+ 'base', 'project'
+ ],
+ 'data': [
+ 'security/ir.model.access.csv',
+ 'report/maintenance_report_views.xml',
+ 'views/maintenance_view.xml',
+ 'views/project_view.xml',
+ ],
+ 'auto_install': False,
+ 'installable': True,
+}
\ No newline at end of file
diff --git a/project_maintenance/models/__init__.py b/project_maintenance/models/__init__.py
new file mode 100755
index 0000000..46fa41f
--- /dev/null
+++ b/project_maintenance/models/__init__.py
@@ -0,0 +1,6 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import maintenance
+from . import project
+
diff --git a/project_maintenance/models/maintenance.py b/project_maintenance/models/maintenance.py
new file mode 100755
index 0000000..c3cddd5
--- /dev/null
+++ b/project_maintenance/models/maintenance.py
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+
+from odoo import api, fields, models, _
+
+class ProjectMainenenceType(models.Model):
+ _name = 'project.maintenance.type'
+ _description = "project Maintenance Type"
+
+ name = fields.Char('Maintenance Type', required=True, ondelete="restrict")
+ maintenance_ids = fields.One2many('project.maintenance', 'maintenance_type_id', string='Maintenance', copy=False)
+
+class ProjectMainenence(models.Model):
+ _name = 'project.maintenance'
+ _description = "project Maintenance"
+
+ name = fields.Char('Maintenance', required=True, ondelete="restrict")
+ maintenance_type_id = fields.Many2one('project.maintenance.type', 'Manintenance Type', required=True, readonly=True, ondelete='cascade')
+
+
+
+
diff --git a/project_maintenance/models/project.py b/project_maintenance/models/project.py
new file mode 100755
index 0000000..f39e3e1
--- /dev/null
+++ b/project_maintenance/models/project.py
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+
+from odoo import api, fields, models, _
+
+
+class Project(models.Model):
+ _inherit = 'project.project'
+
+ maintenance_ids = fields.One2many('project.maintenance.details', 'project_id', string='Maintenance', copy=False)
+
+
+class ProjectMainenenceDetails(models.Model):
+ _name = 'project.maintenance.details'
+ _description = "project Maintenance Details"
+
+ @api.depends('line_ids')
+ def _compute_amount(self):
+ for val in self:
+ total_cost = 0
+ for line in val.line_ids:
+ if line.cost:
+ total_cost += line.cost
+ val.total_amount = total_cost
+
+ project_id = fields.Many2one('project.project', 'Project', required=True, ondelete='cascade')
+ maintenance_type_id = fields.Many2one('project.maintenance.type', 'Maintenance Type', required=True)
+ currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, default=lambda self: self.env.company.currency_id)
+ total_amount = fields.Float("Total Amount", digits=(16, 2), compute='_compute_amount', store=True, currency_field='currency_id')
+ line_ids = fields.One2many('project.maintenance.lines', 'details_id', string='Maintenance Details', copy=False)
+
+class ProjectMainenencelines(models.Model):
+ _name = 'project.maintenance.lines'
+ _description = "project Maintenance Lines"
+
+ details_id = fields.Many2one('project.maintenance.details', 'Details', required=True, ondelete='cascade')
+ maintenance_id = fields.Many2one('project.maintenance', 'Maintenance', required=True)
+ currency_id = fields.Many2one('res.currency', string='Currency', readonly=True, default=lambda self: self.env.company.currency_id)
+ cost = fields.Float("Cost", digits=(16, 2), currency_field='currency_id')
diff --git a/project_maintenance/report/__init__.py b/project_maintenance/report/__init__.py
new file mode 100755
index 0000000..cfaf8e9
--- /dev/null
+++ b/project_maintenance/report/__init__.py
@@ -0,0 +1,4 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from . import maintenance_report
diff --git a/project_maintenance/report/maintenance_report.py b/project_maintenance/report/maintenance_report.py
new file mode 100755
index 0000000..7795752
--- /dev/null
+++ b/project_maintenance/report/maintenance_report.py
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models, tools
+
+
+class ReportProjectTaskUser(models.Model):
+ _name = "report.project.maintenance"
+ _description = "Project Maintenance Analysis"
+ _order = 'project_id'
+ _auto = False
+
+ project_id = fields.Many2one('project.project', string='Project', readonly=True)
+ maintenance_type_id = fields.Many2one('project.maintenance.type', string='Maintenance Type', readonly=True)
+ maintenance_id = fields.Many2one('project.maintenance', string='Maintenance', readonly=True)
+ cost = fields.Float("Cost", digits=(16, 2), readonly=True)
+ #total_amount = fields.Float("Total Cost", digits=(16, 2), readonly=True)
+ #nbr = fields.Integer('# of Maintenance', readonly=True)
+
+ def init(self):
+ '''Create the view'''
+ tools.drop_view_if_exists(self._cr, self._table)
+ self._cr.execute("""
+ CREATE OR REPLACE VIEW %s AS (
+ SELECT min(lines.id) as id,
+ pro.id as project_id,
+ details.maintenance_type_id as maintenance_type_id,
+ lines.maintenance_id as maintenance_id,
+ lines.cost as cost
+ from project_project pro
+ left join project_maintenance_details as details ON (pro.id = details.project_id)
+ left join project_maintenance_lines as lines ON (details.id = lines.details_id)
+ left join project_maintenance as main ON (main.id = details.maintenance_type_id)
+ group by pro.id, details.maintenance_type_id, lines.maintenance_id, lines.cost
+ )""" % (self._table,))
diff --git a/project_maintenance/report/maintenance_report_views.xml b/project_maintenance/report/maintenance_report_views.xml
new file mode 100755
index 0000000..97b44f8
--- /dev/null
+++ b/project_maintenance/report/maintenance_report_views.xml
@@ -0,0 +1,58 @@
+
+
+
+
+ report.project.maintenance.pivot
+ report.project.maintenance
+
+
+
+
+
+
+
+
+
+
+ report.project.maintenance.graph
+ report.project.maintenance
+
+
+
+
+
+
+
+
+
+
+
+ report.project.maintenance.search
+ report.project.maintenance
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Maintenance Analysis
+ report.project.maintenance
+ graph,pivot
+
+ {'group_by_no_leaf':1,'group_by':[]}
+
+
+
+
diff --git a/project_maintenance/security/ir.model.access.csv b/project_maintenance/security/ir.model.access.csv
new file mode 100755
index 0000000..830e848
--- /dev/null
+++ b/project_maintenance/security/ir.model.access.csv
@@ -0,0 +1,12 @@
+id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
+access_project_maintenance_type_puser,project.maintenance.type,model_project_maintenance_type,project.group_project_user,1,0,0,0
+access_project_maintenance_type_pmanager,project.maintenance.type,model_project_maintenance_type,project.group_project_manager,1,1,1,1
+access_project_maintenance_puser,project.maintenance,model_project_maintenance,project.group_project_user,1,0,0,0
+access_project_maintenance_pmanager,project.maintenance,model_project_maintenance,project.group_project_manager,1,1,1,1
+access_project_maintenance_details_puser,project.maintenance.details,model_project_maintenance_details,project.group_project_user,1,0,0,0
+access_project_maintenance_details_pmanager,project.maintenance.details,model_project_maintenance_details,project.group_project_manager,1,1,1,1
+access_project_maintenance_lines_puser,project.maintenance.lines,model_project_maintenance_lines,project.group_project_user,1,0,0,0
+access_project_maintenance_lines_pmanager,project.maintenance.lines,model_project_maintenance_lines,project.group_project_manager,1,1,1,1
+access_report_project_maintenance,report.project.maintenance,model_report_project_maintenance,project.group_project_manager,1,1,1,1
+
+
diff --git a/project_maintenance/views/maintenance_view.xml b/project_maintenance/views/maintenance_view.xml
new file mode 100644
index 0000000..1d16f06
--- /dev/null
+++ b/project_maintenance/views/maintenance_view.xml
@@ -0,0 +1,91 @@
+
+
+
+
+
+ project.maintenance.type.form
+ project.maintenance.type
+
+
+
+
+
+
+
+ project.maintenance.type.tree
+ project.maintenance.type
+
+
+
+
+
+
+
+
+
+ Maintenance Type
+ project.maintenance.type
+ tree,form
+
+
+
+
+
+
+
+
+
diff --git a/project_maintenance/views/project_view.xml b/project_maintenance/views/project_view.xml
new file mode 100644
index 0000000..b5158de
--- /dev/null
+++ b/project_maintenance/views/project_view.xml
@@ -0,0 +1,49 @@
+
+
+
+
+
+ project.project.maintenance.view.form
+ project.project
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+