[FIX] pms: fix UI errors

This commit is contained in:
miguelpadin
2021-05-25 21:38:19 +02:00
parent a8df30324c
commit 4fabd23818
2 changed files with 14 additions and 5 deletions

View File

@@ -19,6 +19,10 @@ class TravellerReport(models.TransientModel):
txt_binary = fields.Binary(string="File Download")
txt_message = fields.Char(string="File Preview")
can_be_sent = fields.Boolean(
default=False
)
def generate_file(self):
# get the active property
@@ -29,7 +33,11 @@ class TravellerReport(models.TransientModel):
# build content
content = self.generate_checkin_list(pms_property.id)
if not content:
content = _("There is no guest information to send")
if content:
self.can_be_sent = True
# file creation
txt_binary = self.env["traveller.report.wizard"].create(
{

View File

@@ -6,13 +6,13 @@
<field name="arch" type="xml">
<form>
<field name="txt_filename" invisible="1" />
<field name="can_be_sent" invisible="1" />
<div class="row">
<div
class="col-12"
attrs="{'invisible': [('txt_message','=',False)]}"
>
<group>
<div class="col-12">
<group attrs="{'invisible': [('txt_message','=',False)]}">
<field name="txt_message" readonly="1" />
</group>
<group attrs="{'invisible': [('can_be_sent','=',False)]}">
<field
name="txt_binary"
filename="txt_filename"
@@ -37,6 +37,7 @@
class="btn btn-primary btn-sm"
type="object"
string="Send file"
attrs="{'invisible': [('can_be_sent','=',False)]}"
/>
</div>
</div>