[ADD] Checkin logo in res_compay information

This commit is contained in:
Jose Luis
2019-02-13 19:49:54 +01:00
parent b4e97547fc
commit bb45f32f7d
4 changed files with 23 additions and 11 deletions

View File

@@ -19,7 +19,16 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
############################################################################## ##############################################################################
from openerp import models, fields, api import base64
from odoo import models, fields
from odoo import modules
def get_default_img():
with open(modules.get_module_resource('hotel_l10n_es', 'static/src/img',
'logo_bn.png'),
'rb') as f:
return base64.b64encode(f.read())
class Inherit_res_company(models.Model): class Inherit_res_company(models.Model):
@@ -28,19 +37,21 @@ class Inherit_res_company(models.Model):
property_name = fields.Char('Property name', property_name = fields.Char('Property name',
help='Name of the Hotel/Property.') help='Name of the Hotel/Property.')
ine_tourism = fields.Char('Tourism number', ine_tourism = fields.Char('Tourism number',
help='Registration number in the Ministry of \ help='Registration number in the Ministry of \
Tourism. Used for INE statistics.') Tourism. Used for INE statistics.')
ine_rooms = fields.Integer('Rooms Available', default=0, ine_rooms = fields.Integer('Rooms Available', default=0,
help='Used for INE statistics.') help='Used for INE statistics.')
ine_seats = fields.Integer('Beds available', default=0, ine_seats = fields.Integer('Beds available', default=0,
help='Used for INE statistics.') help='Used for INE statistics.')
ine_permanent_staff = fields.Integer('Permanent Staff', default=0, ine_permanent_staff = fields.Integer('Permanent Staff', default=0,
help='Used for INE statistics.') help='Used for INE statistics.')
ine_eventual_staff = fields.Integer('Eventual Staff', default=0, ine_eventual_staff = fields.Integer('Eventual Staff', default=0,
help='Used for INE statistics.') help='Used for INE statistics.')
police_number = fields.Char('Police number', size=10, police_number = fields.Char('Police number', size=10,
help='Used to generate the name of the file that \ help='Used to generate the name of the file that \
will be given to the police. 10 Caracters') will be given to the police. 10 Caracters')
ine_category_id = fields.Many2one('tourism.category', ine_category_id = fields.Many2one('tourism.category',
help='Hotel category in the Ministry of \ help='Hotel category in the Ministry of \
Tourism. Used for INE statistics.') Tourism. Used for INE statistics.')
checkin_img = fields.Binary(string="Image in checkin",
default=get_default_img())

View File

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<!-- Hotel Settings -->
<record id="view_company_form" model="ir.ui.view"> <record id="view_company_form" model="ir.ui.view">
<field name="name">view.company.form</field> <field name="name">view.company.form</field>
<field name="model">res.company</field> <field name="model">res.company</field>
@@ -18,6 +19,7 @@
<field name="ine_eventual_staff" /> <field name="ine_eventual_staff" />
<field name="police_number" /> <field name="police_number" />
<field name="cardex_warning" /> <field name="cardex_warning" />
<field name="checkin_img" widget="image" class="oe_avatar"/>
</group> </group>
</group> </group>
</page> </page>

View File

@@ -7,8 +7,7 @@
<div class="container-fluid" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;"> <div class="container-fluid" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;">
<div class="row cabezera" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;"> <div class="row cabezera" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;">
<div class="col-md-12 text-center" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;"> <div class="col-md-12 text-center" style="margin:0 0 0 0 !important; padding-left: 0 !important; padding-right: 0 !important;">
<img src='/hotel_l10n_es/static/src/img/logo_alda_bn.png' <img t-attf-src="data:image/*;base64,{{company.checkin_img}}" t-att-alt="company.name" />
style="width:100%; max-heigth:50px; margin:0 0 1em 0;"/>
<p style="font-size:1.16em;">PART OF TRAVELERS ENTRY</p> <p style="font-size:1.16em;">PART OF TRAVELERS ENTRY</p>
<p class="numerocheck">Document number: <strong><span t-field="o.id"/></strong>/ <p class="numerocheck">Document number: <strong><span t-field="o.id"/></strong>/
<span t-if="o.reservation_id.room_id.description_sale"><span t-field="o.reservation_id.folio_id"/> ( <span t-field="o.reservation_id.room_id.description_sale"/>)</span> <span t-if="o.reservation_id.room_id.description_sale"><span t-field="o.reservation_id.folio_id"/> ( <span t-field="o.reservation_id.room_id.description_sale"/>)</span>