mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[FIX] fixed send confirmation email from folio
This commit is contained in:
@@ -1251,14 +1251,29 @@ class PmsFolio(models.Model):
|
||||
if self.env.context.get("confirm_all_reservations"):
|
||||
self.reservation_ids.confirm()
|
||||
|
||||
# if self.env.context.get('send_email'):
|
||||
# self.force_quotation_send()
|
||||
|
||||
# create an analytic account if at least an expense product
|
||||
# if any([expense_policy != 'no' for expense_policy in
|
||||
# self.sale_line_ids.mapped('product_id.expense_policy')]):
|
||||
# if not self.analytic_account_id:
|
||||
# self._create_analytic_account()
|
||||
if self.pms_property_id.is_confirmed_auto_mail:
|
||||
template = self.pms_property_id.property_confirmed_template
|
||||
subject = template._render_field(
|
||||
"subject", [6, 0, self.id], compute_lang=True, post_process=True
|
||||
)[self.id]
|
||||
body = template._render_field(
|
||||
"body_html", [6, 0, self.id], compute_lang=True, post_process=True
|
||||
)[self.id]
|
||||
invitation_mail = (
|
||||
self.env["mail.mail"]
|
||||
.sudo()
|
||||
.create(
|
||||
{
|
||||
"subject": subject,
|
||||
"body_html": body,
|
||||
"email_from": self.pms_property_id.partner_id.email,
|
||||
"email_to": self.email,
|
||||
}
|
||||
)
|
||||
)
|
||||
invitation_mail.send()
|
||||
for reservation in self.reservation_ids:
|
||||
reservation.is_mail_send = True
|
||||
return True
|
||||
|
||||
# CHECKIN/OUT PROCESS
|
||||
|
||||
@@ -148,6 +148,10 @@ class PmsProperty(models.Model):
|
||||
.id,
|
||||
)
|
||||
|
||||
is_confirmed_auto_mail = fields.Boolean(string="Auto send mail")
|
||||
is_modified_auto_mail = fields.Boolean(string="Auto send mail")
|
||||
is_canceled_auto_mail = fields.Boolean(string="Auto send mail")
|
||||
|
||||
@api.depends_context(
|
||||
"checkin",
|
||||
"checkout",
|
||||
|
||||
@@ -86,10 +86,32 @@
|
||||
</group>
|
||||
</page>
|
||||
<page string="Email Configuration">
|
||||
<group string="Templates">
|
||||
<field name="property_confirmed_template" />
|
||||
<field name="property_modified_template" />
|
||||
<field name="property_canceled_template" />
|
||||
<group>
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
<group string="Email Templates">
|
||||
<field name="property_confirmed_template" />
|
||||
<field name="property_modified_template" />
|
||||
<field name="property_canceled_template" />
|
||||
</group>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
<group string="Auto Send Mail">
|
||||
<field
|
||||
name="is_confirmed_auto_mail"
|
||||
string="Confirmation Mail"
|
||||
/>
|
||||
<field
|
||||
name="is_modified_auto_mail"
|
||||
string="Modification Mail"
|
||||
/>
|
||||
<field
|
||||
name="is_canceled_auto_mail"
|
||||
string="Cancellation Mail"
|
||||
/>
|
||||
</group>
|
||||
</div>
|
||||
</div>
|
||||
</group>
|
||||
<group
|
||||
string="Mail Information"
|
||||
|
||||
Reference in New Issue
Block a user