mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] pms: fix UI errors
This commit is contained in:
@@ -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(
|
||||
{
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user