[FIX] pms_l10n_es: avoid to attempt to send traveller report if institution is not configured

This commit is contained in:
miguelpadin
2021-12-02 15:08:23 +01:00
parent a0dce600a4
commit ea1e6b5ca9
2 changed files with 3 additions and 2 deletions

View File

@@ -19,8 +19,8 @@ class PmsProperty(models.Model):
("mossos", "Mossos_d'esquadra (soon)"), ("mossos", "Mossos_d'esquadra (soon)"),
], ],
string="Institution", string="Institution",
default="guardia_civil",
help="Institution to send daily guest data.", help="Institution to send daily guest data.",
required=False,
) )
institution_property_id = fields.Char( institution_property_id = fields.Char(
string="Institution property id", string="Institution property id",

View File

@@ -469,4 +469,5 @@ class TravellerReport(models.TransientModel):
@api.model @api.model
def send_file_institution_async(self): def send_file_institution_async(self):
for prop in self.env["pms.property"].search([]): for prop in self.env["pms.property"].search([]):
if prop.institution:
self.with_delay().send_file_institution(prop) self.with_delay().send_file_institution(prop)