Browse Source

[ADD] Initial Commit

pull/81/head
SHEREEF PT 8 years ago
parent
commit
e66a4f8008
  1. 23
      fleet_report/__init__.py
  2. 43
      fleet_report/__openerp__.py
  3. 23
      fleet_report/report/__init__.py
  4. 89
      fleet_report/report/fleet_contract_report.xml
  5. 128
      fleet_report/report/fleet_report.xml
  6. 116
      fleet_report/report/fleet_report_parser.py
  7. 22
      fleet_report/report/report.xml
  8. BIN
      fleet_report/static/description/banner .jpg
  9. BIN
      fleet_report/static/description/cybro_logo.png
  10. BIN
      fleet_report/static/description/icon .png
  11. 86
      fleet_report/static/description/index.html
  12. BIN
      fleet_report/static/description/pic1.png
  13. BIN
      fleet_report/static/description/pic_2.png
  14. BIN
      fleet_report/static/description/pic_3.png
  15. BIN
      fleet_report/static/description/pic_5.png
  16. BIN
      fleet_report/static/description/pic_6.png

23
fleet_report/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
import report

43
fleet_report/__openerp__.py

@ -0,0 +1,43 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
{
'name': "Fleet Reports",
'version': '9.0.1.0.0',
'summary': """Provide PDF report of fleet and Contracts """,
'author': "Cybrosys Techno Solutions",
'company': "https://www.cybrosys.com",
'website': "https://www.cybrosys.com",
'category': 'Human Resources',
'depends': ['base', 'fleet'],
'data': [
'report/report.xml',
'report/fleet_contract_report.xml',
'report/fleet_report.xml',
],
'images': ['static/description/banner.jpg'],
'license': 'LGPL-3',
'installable': True,
'auto_install': False,
'application': False,
}

23
fleet_report/report/__init__.py

@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
from . import fleet_report_parser

89
fleet_report/report/fleet_contract_report.xml

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_vehicle_contract">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="doc">
<div class="page" >
<t t-call="report.external_layout">
<div class="header" style="text-align:left;"><strong><h1><a>Vehicle Contract :</a><a t-field="doc.name"/></h1></strong></div>
<div style="text-align:left;"><strong><h2>Contract details</h2></strong></div>
<div style="text-align:left;"><strong><p><a>Vehicle:</a><a t-field="doc.vehicle_id.name"/></p></strong></div>
<div style="text-align:left;"><strong><p><a>Type:</a><a t-field="doc.cost_subtype_id.name"/></p></strong></div>
<div style="text-align:left;"><strong><p><a>Activation Cost:</a><a t-field="doc.amount"/></p></strong></div>
<div style="text-align:left;"><strong><p><a>Recurring Cost Amount:</a><a t-field="doc.cost_generated"/></p></strong></div>
<br/>
<div style="text-align:left;"><strong><h2>Odometer details</h2></strong></div>
<div style="text-align:left;"><strong><p><a>Odometer Value</a><a t-field="doc.odometer"/></p></strong></div>
<br/>
<br/>
<table width="100%" style="margin-left:50px;margin-top:5px;border: None solid black;">
<tr>
<td style="width:50px;height:25px;" ><span>Invoice Date: </span><span t-att-style="style" t-esc="doc.date"/></td>
<td style="width:50px;height:25px;" ><span>Contract Start Date : </span><span t-att-style="style" t-esc="doc.start_date"/></td>
<td style="width:50px;height:25px;" ><span>Contract Expiration Date: </span><span t-att-style="style" t-esc="doc.expiration_date"/></td>
</tr>
<tr>
<td style="width:50px;height:25px;" ><span>Vendor : </span><span t-att-style="style" t-esc="doc.insurer_id.name"/></td>
<td style="width:50px;height:25px;" ><span>Contractor : </span><span t-att-style="style" t-esc="doc.purchaser_id.name"/></td>
<td style="width:50px;height:25px;" ><span>Contract Reference : </span><span t-att-style="style" t-esc="doc.ins_ref"/></td>
</tr>
</table>
<t t-set="s" t-value="0"/>
<table class="table table-condensed">
<thead>
<tr >
<th style="background-color:#9b9da0 !important;">Service </th>
<th style="background-color:#9b9da0 !important;">Indicative Cost</th>
</tr>
</thead>
<tbody class="sale_tbody">
<t t-foreach="doc.cost_ids" t-as="l">
<tr t-if="l.cost_subtype_id">
<td>
<span t-esc="l.cost_subtype_id.name"/>
</td>
<td class="text-right">
<span t-esc="l.amount"/>
<t t-set="s" t-value="s+l.amount"/>
</td>
</tr>
</t>
</tbody>
</table>
<div class="row" name="total">
<div class="col-xs-4 pull-right">
<table class="table table-condensed">
<tr class="border-black">
<td><strong>Total</strong></td>
<td class="text-right">
<span t-esc="s"/>
</td>
</tr>
</table>
</div>
</div>
<table>
<tr>
<td colspan="3" rowspan="3">Terms And Conditions :</td>
</tr>
</table>
<table>
<tr>
<td colspan="3" rowspan="3" class="text-right">
<span t-esc="doc.notes"/>
</td>
</tr>
</table>
</t>
</div>
<p style="page-break-after:always"></p>
</t>
</t>
</template>
</data>
</openerp>

128
fleet_report/report/fleet_report.xml

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<template id="report_fleet">
<t t-call="report.html_container">
<div class="page">
<t t-call="report.external_layout">
<!--<t t-call="report.external_layout">-->
<t t-foreach="docs" t-as="doc">
<t t-set="doc2" t-value="contract_details(doc.id)"/>
<t t-set="doc3" t-value="cost_details(doc.id)"/>
<t t-set="doc4" t-value="odoometer_details(doc.id)"/>
<div class="header" style="text-align:left;"><strong><h1><a>Vehicle:</a><a t-field="doc.name"/></h1></strong></div>
<div style="text-align:left;"><strong><h3><a>Driver:</a><a t-field="doc.driver_id.name"/></h3></strong></div>
<div style="text-align:left;"><strong><h3><a>Location:</a><a t-field="doc.location"/></h3></strong></div>
<t t-if="doc2">
<div style="text-align:left;"><strong><h2>Contracts</h2></strong></div>
<br/>
<br/>
<table class="table table-condensed" style="page-break-inside: avoid;">
<thead>
<tr style="page-break-inside: avoid;" >
<th style="background-color:#9b9da0 !important;">Start Date </th>
<th style="background-color:#9b9da0 !important;">End Date </th>
<th style="background-color:#9b9da0 !important;">Type </th>
<th style="background-color:#9b9da0 !important;">Vendor </th>
<th style="background-color:#9b9da0 !important;">Status</th>
</tr>
</thead>
<tbody>
<t t-if="doc2">
<t t-foreach="doc2" t-as="d">
<tr style="page-break-inside: avoid;">
<td>
<span t-att-style="style" t-esc="d['date']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['date_closed']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['type']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['vendor']"/>
</td>
<td>
<t t-if ="d['state'] =='open'">In Progress</t>
<t t-if ="d['state'] =='toclose'">To Close</t>
<t t-if ="d['state'] =='closed'">Terminated</t>
</td>
</tr>
</t>
</t>
</tbody>
</table>
</t>
<t t-if="doc3">
<div style="text-align:left;"><strong><h2>Costs Details</h2></strong></div>
<table class="table table-condensed" style="page-break-inside: avoid;">
<thead>
<tr style="page-break-inside: avoid;">
<th style="background-color:#9b9da0 !important;">Type </th>
<th style="background-color:#9b9da0 !important;">Total Price </th>
<th style="background-color:#9b9da0 !important;">Date </th>
</tr>
</thead>
<tbody>
<t t-if="doc3">
<t t-foreach="doc3" t-as="d">
<tr style="page-break-inside: avoid;">
<td>
<span t-att-style="style" t-esc="d['type']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['price']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['date']"/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
</t>
<t t-if="doc4">
<div style="text-align:left;"><strong><h2>Odometer details</h2></strong></div>
<table class="table table-condensed">
<thead>
<tr >
<th style="background-color:#9b9da0 !important;">Date </th>
<th style="background-color:#9b9da0 !important;">Value </th>
<th style="background-color:#9b9da0 !important;">Unit </th>
</tr>
</thead>
<tbody>
<t t-if="doc4">
<t t-foreach="doc4" t-as="d">
<tr style="page-break-inside:avoid;">
<td>
<span t-att-style="style" t-esc="d['date']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['value']"/>
</td>
<td>
<span t-att-style="style" t-esc="d['unit']"/>
</td>
</tr>
</t>
</t>
</tbody>
</table>
</t>
</t>
<!--</t>-->
</t>
</div>
</t>
</template>
</data>
</openerp>

116
fleet_report/report/fleet_report_parser.py

@ -0,0 +1,116 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Cybrosys Technologies Pvt. Ltd.
# Copyright (C) 2017-TODAY Cybrosys Technologies(<https://www.cybrosys.com>).
# you can modify it under the terms of the GNU LESSER
# GENERAL PUBLIC LICENSE (LGPL v3), Version 3.
#
# It is forbidden to publish, distribute, sublicense, or sell copies
# of the Software or modified copies of the Software.
#
# 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
# GENERAL PUBLIC LICENSE (LGPL v3) along with this program.
# If not, see <https://www.gnu.org/licenses/>.
#
##############################################################################
from openerp.report import report_sxw
from openerp.osv import osv
class FleetParser(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context=None):
super(FleetParser, self).__init__(cr, uid, name, context=context)
self.localcontext.update({
'contract_details': self.contract_details,
'cost_details': self.cost_details,
'odoometer_details': self.odoometer_details,
# 'service_details': self.service_details,
})
self.context = context
def contract_details(self, d):
contract = []
obj_contract = self.pool.get('fleet.vehicle.log.contract').search(self.cr, self.uid, [('vehicle_id', '=', d)])
if obj_contract:
for obj in obj_contract:
obj_cont = self.pool.get('fleet.vehicle.log.contract').browse(self.cr, self.uid, obj, context=None)
vals = {
'vendor': obj_cont.insurer_id.name,
'date': obj_cont.start_date,
'date_closed': obj_cont.expiration_date,
'state': obj_cont.state,
'type':obj_cont.cost_subtype_id.name,
}
contract.append(vals)
return contract
def cost_details(self, d):
contract = []
obj_contract = self.pool.get('fleet.vehicle.cost').search(self.cr, self.uid,
[('vehicle_id', '=', d)])
if obj_contract:
for obj in obj_contract:
obj_cont = self.pool.get('fleet.vehicle.cost').browse(self.cr, self.uid, obj, context=None)
vals = {
'price': obj_cont.amount,
'type': obj_cont.cost_subtype_id.name,
'date': obj_cont.date,
}
contract.append(vals)
return contract
def odoometer_details(self, d):
contract = []
obj_contract = self.pool.get('fleet.vehicle.odometer').search(self.cr, self.uid,
[('vehicle_id', '=', d)])
if obj_contract:
for obj in obj_contract:
obj_cont = self.pool.get('fleet.vehicle.odometer').browse(self.cr, self.uid, obj, context=None)
vals = {
'date': obj_cont.date,
'value': obj_cont.value,
'unit': obj_cont.unit,
}
contract.append(vals)
return contract
#
# def service_details(self, d):
# contract = []
#
# obj_contract = self.pool.get('fleet.vehicle.log.services').search(self.cr, self.uid,
# [('vehicle_id', '=', d)])
# if obj_contract:
# for obj in obj_contract:
# obj_cont = self.pool.get('fleet.vehicle.log.services').browse(self.cr, self.uid, obj, context=None)
# vals = {
# 'type': obj_cont.cost_subtype_id.name,
# 'value': obj_cont.value,
# 'unit': obj_cont.unit,
#
# }
# contract.append(vals)
#
# return contract
class PrintReport(osv.AbstractModel):
_name = 'report.fleet_report.report_fleet'
_inherit = 'report.abstract_report'
_template = 'fleet_report.report_fleet'
_wrapped_report_class = FleetParser

22
fleet_report/report/report.xml

@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- QWeb Reports -->
<report
id="action_report_contract"
model="fleet.vehicle.log.contract"
string="Vehicle Contract Report"
report_type="qweb-pdf"
name="fleet_report.report_vehicle_contract"
file="fleet_report.report_vehicle_contract"
/>
<report
id="action_report_fleet"
model="fleet.vehicle"
string="fleet Report"
report_type="qweb-pdf"
name="fleet_report.report_fleet"
file="fleet_report.report_fleet"
/>
</data>
</openerp>

BIN
fleet_report/static/description/banner .jpg

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

BIN
fleet_report/static/description/cybro_logo.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
fleet_report/static/description/icon .png

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

86
fleet_report/static/description/index.html

@ -0,0 +1,86 @@
<section class="oe_container">
<div class="oe_row oe_spaced">
<h2 class="oe_slogan">Fleet Reports</h2>
<h4 class="oe_slogan">Author : Cybrosys Techno Solutions , www.cybrosys.com</h4>
</div>
</section>
<section class="oe_container oe_dark">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Fleet Report</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="pic1.png">
</div>
</div>
<center>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="pic_2.png">
</div>
</div>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="pic_3.png">
</div>
</div>
<div class="oe_span12">
<p class="oe_mt32">
The Above Pdf gives the details Of Each vehicles Odometer reading,Costs and also Service details.
</p>
</div>
</center>
</div>
</div>
</section>
<section class="oe_container">
<div class="oe_row oe_spaced">
<h3 class="oe_slogan">Fleet Contract Report</h3>
<div class="oe_row oe_spaced">
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="pic_5.png">
</div>
</div>
<center>
<div class="oe_span12">
<div class="oe_row_img oe_centered">
<img class="oe_picture oe_screenshot" src="pic_6.png">
</div>
</div>
</center>
</div>
</div>
</section>
<section class="oe_container_oe_dark">
<h2 class="oe_slogan" style="margin-top:20px;" >Need Any Help?</h2>
<div class="oe_slogan" style="margin-top:10px !important;">
<div>
<a class="btn btn-primary btn-lg mt8"
style="color: #FFFFFF !important;border-radius: 0;" href="https://www.cybrosys.com"><i
class="fa fa-envelope"></i> Email </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/contact/"><i
class="fa fa-phone"></i> Contact Us </a> <a
class="btn btn-primary btn-lg mt8" style="color: #FFFFFF !important;border-radius: 0;"
href="https://www.cybrosys.com/odoo-customization-and-installation/"><i
class="fa fa-check-square"></i> Request Customization </a>
</div>
<br>
<img src="cybro_logo.png" style="width: 190px; margin-bottom: 20px;" class="center-block">
<div>
<a href="https://twitter.com/cybrosys" target="_blank"><i class="fa fa-2x fa-twitter" style="color:white;background: #00a0d1;width:35px;"></i></a></td>
<a href="https://www.linkedin.com/company/cybrosys-technologies-pvt-ltd" target="_blank"><i class="fa fa-2x fa-linkedin" style="color:white;background: #31a3d6;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://www.facebook.com/cybrosystechnologies" target="_blank"><i class="fa fa-2x fa-facebook" style="color:white;background: #3b5998;width:35px;padding-left: 8px;"></i></a></td>
<a href="https://plus.google.com/106641282743045431892/about" target="_blank"><i class="fa fa-2x fa-google-plus" style="color:white;background: #c53c2c;width:35px;padding-left: 3px;"></i></a></td>
<a href="https://in.pinterest.com/cybrosys" target="_blank"><i class="fa fa-2x fa-pinterest" style="color:white;background: #ac0f18;width:35px;padding-left: 3px;"></i></a></td>
</div>
</div>
</section>

BIN
fleet_report/static/description/pic1.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
fleet_report/static/description/pic_2.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

BIN
fleet_report/static/description/pic_3.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
fleet_report/static/description/pic_5.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

BIN
fleet_report/static/description/pic_6.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Loading…
Cancel
Save