[ADD] New Kellys PDF report

This commit is contained in:
Jose Luis
2019-03-07 18:45:54 +01:00
parent bdfb801d47
commit d3727b05ac
11 changed files with 264 additions and 66 deletions

View File

@@ -1,7 +1,7 @@
KELLYS DAILY REPORT
=============
Export KELLYS REPORT
Export PDF KELLYS REPORT
Credits

View File

@@ -32,16 +32,17 @@
],
'data': [
'data/report_kellys_paperformat.xml',
'views/kellysnames.xml',
'wizard/kellys_daily_rooms.xml',
'wizard/kellys_daily_report.xml',
'views/kellys.xml',
'wizard/kellys_daily_pdf.xml',
'data/menus.xml',
'report/report_kellys.xml',
'security/ir.model.access.csv',
],
'qweb': [],
'test': [
],
# 'css': ['static/src/css/kellys_daily_report.css'],
'css': ['static/src/css/kellys_daily_report.css'],
'installable': True,
'auto_install': False,

View File

@@ -20,4 +20,4 @@
#
##############################################################################
from . import kellys
from . import kellysnames

View File

@@ -0,0 +1,194 @@
<?xml version="1.0"?>
<odoo>
<report id="report_kellysrooms" string="Reporte kellysrooms" model="kellysrooms" report_type="qweb-pdf" name="kellys_daily_report.template_kellysrooms" file="kellys_daily_report.template_kellysrooms" paperformat="report_kellys_paperformat"/>
<template id="template_kellysrooms_css">
<style>
.titulo {
font-size: 4.2em;
text-align: center;
}
.marco {
border-radius: 47px 10px 10px 10px;
-moz-border-radius: 47px 10px 10px 10px;
-webkit-border-radius: 47px 10px 10px 10px;
border: 3px solid #000000;
padding: 10px 3px;
margin: 3px 0;
text-align: center;
}
.client {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
border: 1px solid #000000;
color: #000000;
background-color: #FFFFFF;
}
.exit {
border-radius: 20px 47px 47px 10px;
-moz-border-radius: 20px 47px 47px 10px;
-webkit-border-radius: 20px 47px 47px 10px;
border: 2px solid #000000;
padding: 20px 0;
color: #000000;
background-color: #FFFFFF;
}
.revise {
padding: 20px 0;
color: #000000;
background-color: #FFFFFF;
}
.pie {
font-size: 0.95em;
margin: 2em 0 4em 0;
}
.tipo {
font-size: 3.2em;
font-weight: bold;
}
.notas {
width: 90% !important;
margin: 3px 4px;
color: #000000;
text-align: left;
font-size: 2em;
}
.habitacion {
font-size: 3.2em;
padding: 0 0 0 3px;
}
.datos {
font-size: 2.4em;
}
.section {
clear: both;
padding: 0;
margin: 3px 0;
}
/* COLUMN SETUP */
.col {
display: block;
float: left;
margin: 1% 0 1% 1.6%;
}
.col:first-child {
margin-left: 0;
}
/* GROUPING */
.group:after,
.group:before {
content: "";
display: table;
}
.group:after {
clear: both;
}
.group {
zoom: 1;
/* For IE 6/7 */
}
/* GRID OF TWO */
.span_2_of_2 {
width: 100%;
}
.span_1_of_2 {
width: 49.2%;
}
</style>
</template>
<template id="template_kellysrooms">
<t t-call="web.basic_layout">
<div class="page">
<t t-call="kellys_daily_report.template_kellysrooms_css"/>
<t t-set="actualkelly" t-value="False"/>
<t t-set="espie" t-value="False"/>
<t t-set="totalkelly" t-value="0"/>
<t t-foreach="docs" t-as="o">
<t t-if="actualkelly != o.kelly">
<t t-if="o_index != 0">
<t t-set="espie" t-value="True"/>
</t>
<t t-set="actualkelly" t-value="o.kelly"/>
<t t-if="espie == True">
<t t-set="espie" t-value="False"/>
<div class="pie">Impreso el
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d-%m-%Y a las %H:%M')"/>
Habitaciones:
<t t-esc="totalkelly"/></div>
<t t-set="totalkelly" t-value="0"/>
<p style="page-break-before:always;"></p>
</t>
<div class="marco" align="center">
<div class="titulo" align="center"><span t-field="o.kelly"/><br/>
Habitaciones<br/>
<span t-field="o.clean_date" t-options='{"format": "d MMMM Y"}'/>
</div>
</div>
</t>
<div t-if="o.tipo == 1" class="exit section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">SALIDA</div>
<t t-if="o.checkin != ''">
<div class="datos col span_2_of_2">Entrada
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/></div>
</t>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 2" class="client section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">CLIENTE</div>
<div class="datos col span_2_of_2">Del
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 3" class="revise section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">REVISAR</div>
<div class="datos col span_2_of_2">Entrada
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
<div t-if="o.tipo == 4" class="client section group">
<t t-set="totalkelly" t-value="totalkelly + 1"/>
<div class="habitacion col span_1_of_2">
<span t-field="o.habitacion"/>
</div>
<div class="tipo col span_1_of_2">STAFF</div>
<div class="datos col span_2_of_2">Del
<span t-field="o.checkin" t-options='{"format": "d MMMM"}'/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
</div>
</t>
<div class="pie">Impreso el
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d-%m-%Y a las %H:%M')"/>
Habitaciones:
<t t-esc="totalkelly"/></div>
</div>
</t>
</template>
</odoo>

View File

@@ -18,5 +18,5 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from . import kellys_daily_pdf
from . import kellys_daily_rooms
from . import kellys_daily_report

View File

@@ -25,7 +25,7 @@ from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
# from odoo.tools import report
class KellysWizard(models.TransientModel):
_name = 'kellys'
_name = 'kellysreport'
@api.model
def _get_default_habitaciones(self):
@@ -112,11 +112,40 @@ class KellysWizard(models.TransientModel):
}).id)
return self.env['kellysrooms'].search([('id', 'in', listid)])
# class ParticularReport(models.AbstractModel):
# _name = 'report.module.report_name'
# @api.model
# def render_html(self, docids, data=None):
# report_obj = self.env['report']
# report = report_obj._get_report_from_name('module.report_name')
# docargs = {
# 'doc_ids': docids,
# 'doc_model': report.model,
# 'docs': self,
# }
# return report_obj.render('module.report_name', docargs)
@api.multi
def check_report(self):
def print_rooms_report(self):
rooms = self.env['kellysrooms'].search([('id', 'in',
self.habitaciones.ids)],
order=self.order)
docargs = {
'doc_ids': rooms.ids,
'doc_model': 'kellysrooms',
'docs': self,
}
# Debug Stop -------------------
#import wdb; wdb.set_trace()
# Debug Stop -------------------
# return self.env['report'].get_action(rooms, 'action_report_kellys')
# return self.env['report'].get_action(rooms, 'report_action_kellysrooms')
return self.env.ref('kellys_daily_report.report_action_kellysrooms').report_action(self, data=rooms)
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(self, rooms)
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(self, docargs)
# return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(rooms, docargs)
return self.env.ref('kellys_daily_report.report_kellysrooms').report_action(rooms)
# return {'type': 'ir.actions.report','report_kellysrooms': 'kellys_daily_report.template_kellysrooms','report_type':"qweb-pdf",'data': rooms,}

View File

@@ -0,0 +1,31 @@
<?xml version="1.0" ?>
<odoo>
<data>
<act_window id="report_kellys_act" name="Kellys Daily Report Wizard" res_model="kellysreport" view_mode="form"/>
<record model="ir.ui.view" id="kellys_report_view">
<field name="name">kellys_daily_report_view</field>
<field name="model">kellysreport</field>
<field name="arch" type="xml">
<form string="kellys Daily Report">
<sheet>
<group string="Generar PDF de limpieza a fecha:">
<field name="date_start"/>
<button name="calculate_report" string="Recalcular" type="object" class="oe_highlight"/>
</group>
<group colspan="4">
<field name="habitaciones"/>
</group>
<group colspan="2">
<field name="order"/>
</group>
<footer>
<button type="object" class="oe_highlight" icon="fa-file-pdf-o" name="print_rooms_report" string="Print in PDF"/>
</footer>
</sheet>
</form>
</field>
</record>
</data>
</odoo>

View File

@@ -1,51 +0,0 @@
<?xml version="1.0" ?>
<odoo>
<data>
<act_window id="report_kellys_act" name="Kellys Daily Report Wizard" res_model="kellys" view_mode="form"/>
<record model="ir.ui.view" id="kellys_report_view">
<field name="name">kellys_daily_report_view</field>
<field name="model">kellys</field>
<field name="arch" type="xml">
<form string="kellys Daily Report">
<sheet>
<group string="Generar PDF de limpieza a fecha:">
<!-- <group string="Generar PDF de limpieza a fecha:" col="1" colspan="1"> -->
<field name="date_start"/>
<button name="calculate_report" string="Recalcular" type="object" class="oe_highlight"/>
</group>
<group colspan="4">
<field name="habitaciones"/>
</group>
<group colspan="2">
<field name="order"/>
</group>
<footer>
<button name="check_report" string="Imprimir" type="object" class="oe_highlight"/>
</footer>
</sheet>
</form>
</field>
</record>
<report
id="report_action_kellysrooms"
model="kellysrooms"
string="Listado de Limpieza"
report_type="qweb-pdf"
name="kellys_daily_report.report_kellysrooms"
file="kellys_daily_report.report_kellysrooms"
/>
<template id="report_kellysrooms">
<t t-foreach="docs" t-as="o">
<div class="page">
<h2>Report title</h2>
<p>This object's name is
<span t-field="o.name"/></p>
</div>
</t>
</template>
</data>
</odoo>

View File

@@ -16,11 +16,5 @@
</field>
</record>
<template id="report_kellys">
<div class="page">
Hola Mundo
</div>
</template>
</data>
</odoo>