mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[ADD] Refactoring module
This commit is contained in:
@@ -32,15 +32,16 @@
|
||||
],
|
||||
'data': [
|
||||
'data/report_kellys_paperformat.xml',
|
||||
'views/kellys.xml',
|
||||
'wizard/kellys_daily_rooms.xml',
|
||||
'wizard/kellys_daily_report.xml',
|
||||
'views/kellys.xml',
|
||||
'data/menus.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,
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="tree_kellysnames" model="ir.ui.view">
|
||||
<field name="model">kellysnames</field>
|
||||
<field name="name">kellysnames.tree.view</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<act_window
|
||||
id="names_kellys_act"
|
||||
name="Kellys Names"
|
||||
res_model="kellysnames"
|
||||
view_mode="tree,form"
|
||||
/>
|
||||
<menuitem
|
||||
id="menu_hotel_kellys_names"
|
||||
name="Personal de limieza"
|
||||
parent="hotel.menu_hotel_room"
|
||||
action="names_kellys_act"
|
||||
groups="hotel.group_hotel_user,hotel.group_hotel_manager"
|
||||
sequence="45"
|
||||
/>
|
||||
</data>
|
||||
</odoo>
|
||||
<?xml version="1.0"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="tree_kellysnames" model="ir.ui.view">
|
||||
<field name="model">kellysnames</field>
|
||||
<field name="name">kellysnames.tree.view</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree>
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<act_window id="names_kellys_act" name="Kellys Names" res_model="kellysnames" view_mode="tree,form"/>
|
||||
<menuitem id="menu_hotel_kellys_names" name="Personal de limieza" parent="hotel.menu_hotel_room" action="names_kellys_act" groups="hotel.group_hotel_user,hotel.group_hotel_manager" sequence="45"/>
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -18,4 +18,5 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from . import kellys_daily_rooms
|
||||
from . import kellys_daily_report
|
||||
|
||||
@@ -22,7 +22,7 @@ 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
|
||||
|
||||
class KellysWizard(models.TransientModel):
|
||||
_name = 'kellys'
|
||||
@@ -63,12 +63,7 @@ class KellysWizard(models.TransientModel):
|
||||
('state', '<>', 'cancelled'),
|
||||
('room_id', '=', x.id)
|
||||
], order='checkin ASC')
|
||||
# rooms = self.env['hotel.reservation'].search(
|
||||
# ['&', '&', ('checkin', '<=', dates),
|
||||
# ('checkout', '>=', dates),
|
||||
# ('state', '<>', 'cancelled'),
|
||||
# ('product_id', '=', x.product_id.id)
|
||||
# ], order='checkin ASC')
|
||||
|
||||
tipos = False
|
||||
if len(rooms) != 0:
|
||||
if len(rooms) == 2:
|
||||
@@ -122,19 +117,6 @@ class KellysWizard(models.TransientModel):
|
||||
rooms = self.env['kellysrooms'].search([('id', 'in',
|
||||
self.habitaciones.ids)],
|
||||
order=self.order)
|
||||
return self.env['report'].get_action(rooms, 'report.kellys')
|
||||
|
||||
|
||||
class KellysRooms(models.TransientModel):
|
||||
_name = 'kellysrooms'
|
||||
|
||||
habitacion = fields.Char('Habitacion')
|
||||
habitacionid = fields.Integer('Habitacion ID')
|
||||
tipo = fields.Selection([(1, 'Salida'), (2, 'Cliente'), (3, 'Revisar'),
|
||||
(4, 'Staff'), (5, 'Averia')],
|
||||
string='Limpiar como')
|
||||
notas = fields.Char('Notas limpieza')
|
||||
checkin = fields.Char('Entrada')
|
||||
checkout = fields.Char('Salida')
|
||||
kelly = fields.Many2one('kellysnames', string='Asignado a:')
|
||||
clean_date = fields.Date('Clean Date')
|
||||
# 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)
|
||||
|
||||
@@ -1,236 +1,51 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="tree_kellysrooms" model="ir.ui.view">
|
||||
<field name="model">kellysrooms</field>
|
||||
<field name="name">kellysrooms.tree.view</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree options='{"bg_color": "black: tipo == 5; orange: tipo == 4; blue: tipo == 3; green: tipo == 2; red: tipo == 1"}' editable="top" create="false">
|
||||
<!-- <tree colors="black: tipo == 5; orange: tipo == 4; blue: tipo == 3; green: tipo == 2; red: tipo == 1" editable="top" create="false"> -->
|
||||
<field name="habitacion" readonly="1"/>
|
||||
<field name="tipo"/>
|
||||
<field name="notas"/>
|
||||
<field name="checkin" readonly="1"/>
|
||||
<field name="checkout" readonly="1"/>
|
||||
<field name="kelly"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<!--Import assets-->
|
||||
<!-- <template id="assets_backend" name="custom assets" inherit_id="web.assets_backend">
|
||||
<xpath expr="." position="inside">
|
||||
<link rel="stylesheet" href="/kellys_daily_report/static/src/css/kellys_daily_report.css"/>
|
||||
</xpath>
|
||||
</template> -->
|
||||
<!-- <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:" 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> -->
|
||||
<act_window id="report_kellys_act" name="Kellys Daily Report Wizard" res_model="kellys" view_mode="form"/>
|
||||
<!-- <report id="action_report_kellys" model="kellysrooms" string="Parte de kellys" report_type="qweb-pdf" name="report.kellys" file="report.kellys"/> -->
|
||||
<!-- <template id="report.kellys">
|
||||
<div class="page">
|
||||
<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;
|
||||
width: 100%;
|
||||
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.65em;
|
||||
margin: 0 0 4em;
|
||||
}
|
||||
.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>
|
||||
<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-field-options='{"format": "d MMMM Y"}'/>
|
||||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-set="totalkelly" t-value="totalkelly + 1"/>
|
||||
<div t-if="o.tipo == 1" class="exit section group">
|
||||
<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-field-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">
|
||||
<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-field-options='{"format": "d MMMM"}'/>
|
||||
al
|
||||
<span t-field="o.checkout" t-field-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">
|
||||
<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-field-options='{"format": "d MMMM"}'/>
|
||||
al
|
||||
<span t-field="o.checkout" t-field-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">
|
||||
<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-field-options='{"format": "d MMMM"}'/>
|
||||
al
|
||||
<span t-field="o.checkout" t-field-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>
|
||||
<act_window id="report_kellys_act" name="Kellys Daily Report Wizard" res_model="kellys" view_mode="form"/>
|
||||
|
||||
</div>
|
||||
</template> -->
|
||||
<!-- <record id="action_report_kellys" model="ir.actions.report.xml">
|
||||
<field name="paperformat_id" ref="report_kellys_paperformat"/>
|
||||
</record> -->
|
||||
</data>
|
||||
<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>
|
||||
|
||||
36
kellys_daily_report/wizard/kellys_daily_rooms.py
Normal file
36
kellys_daily_report/wizard/kellys_daily_rooms.py
Normal file
@@ -0,0 +1,36 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Odoo, Open Source Management Solution
|
||||
# Copyright (C) 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
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class KellysRooms(models.TransientModel):
|
||||
_name = 'kellysrooms'
|
||||
|
||||
habitacion = fields.Char('Habitacion')
|
||||
habitacionid = fields.Integer('Habitacion ID')
|
||||
tipo = fields.Selection([(1, 'Salida'), (2, 'Cliente'), (3, 'Revisar'),
|
||||
(4, 'Staff'), (5, 'Averia')],
|
||||
string='Limpiar como')
|
||||
notas = fields.Char('Notas limpieza')
|
||||
checkin = fields.Char('Entrada')
|
||||
checkout = fields.Char('Salida')
|
||||
kelly = fields.Many2one('kellysnames', string='Asignado a:')
|
||||
clean_date = fields.Date('Clean Date')
|
||||
26
kellys_daily_report/wizard/kellys_daily_rooms.xml
Normal file
26
kellys_daily_report/wizard/kellys_daily_rooms.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" ?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="tree_kellysrooms">
|
||||
<field name="name">kellysrooms.tree.view</field>
|
||||
<field name="model">kellysrooms</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree decoration-danger="tipo == 1" decoration-success="tipo == 2" decoration-info="tipo == 3" decoration-warning="tipo == 4" decoration-muted="tipo == 5" editable="top" create="false" string="Kellys Rooms">
|
||||
<field name="habitacion" readonly="1"/>
|
||||
<field name="tipo"/>
|
||||
<field name="notas"/>
|
||||
<field name="checkin" readonly="1"/>
|
||||
<field name="checkout" readonly="1"/>
|
||||
<field name="kelly"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<template id="report_kellys">
|
||||
<div class="page">
|
||||
Hola Mundo
|
||||
</div>
|
||||
</template>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user