[FIX] Kellys Report date format

This commit is contained in:
Jose Luis
2019-05-15 17:48:03 +02:00
parent 5b24e27bc7
commit 81784f2773
2 changed files with 29 additions and 49 deletions

View File

@@ -40,7 +40,7 @@
background-color: #FFFFFF;
}
.pie {
font-size: 0.95em;
font-size: 1.95em;
margin: 2em 0 4em 0;
}
.tipo {
@@ -135,7 +135,13 @@
<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 t-if="o.checkin == 'no prevista'">
<span t-field="o.checkin"/>
</t>
<t t-else="">
<span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %B')"/>
</t>
</div>
</t>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
@@ -148,9 +154,10 @@
</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"}'/>
<span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
</div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
@@ -162,9 +169,10 @@
</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"}'/>
<span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
</div>
<div class="notas col span_2_of_2" align="left">
<span t-field="o.notas"/>
</div>
@@ -176,18 +184,21 @@
</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"}'/>
<span t-esc="datetime.datetime.strptime(o.checkin, '%Y-%m-%d').strftime('%d de %b')"/>
al
<span t-field="o.checkout" t-options='{"format": "d MMMM"}'/></div>
<span t-esc="datetime.datetime.strptime(o.checkout, '%Y-%m-%d').strftime('%d de %b')"/>
</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 class="pie">
<p>Impreso el
<span t-esc="context_timestamp(datetime.datetime.now()).strftime('%d %B %Y a las %H:%M')"/>
</p>
<p>Habitaciones:
<t t-esc="totalkelly"/></p></div>
</div>
</t>
</template>

View File

@@ -2,7 +2,7 @@
##############################################################################
#
# Odoo, Open Source Management Solution
# Copyright (C) 2018 Jose Luis Algara Toledo <osotranquilo@gmail.com>
# Copyright (C) 2018-2019 Jose Luis Algara Toledo <osotranquilo@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -18,11 +18,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import datetime
from datetime import datetime, date, time
from odoo import api, fields, models, _
from openerp.tools import DEFAULT_SERVER_DATE_FORMAT
# from odoo.tools import report
from datetime import datetime, date
from odoo import api, fields, models
class KellysWizard(models.TransientModel):
_name = 'kellysreport'
@@ -112,40 +110,11 @@ 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 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_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,}
return self.env.ref(
'kellys_daily_report.report_kellysrooms').report_action(rooms)