[IMP]: Added possibility to complete partner in checkin with email or mobile

This commit is contained in:
braisab
2021-08-20 13:22:42 +02:00
parent af3e4672fb
commit d3f0a70ef2
2 changed files with 35 additions and 1 deletions

View File

@@ -213,6 +213,15 @@ class PmsCheckinPartner(models.Model):
compute="_compute_partner_incongruences",
)
is_possible_existing_customer_id = fields.Many2one(
string="Possible existing customer",
readonly=False,
store=True,
compute="_compute_is_possible_existing_customer_id",
)
add_possible_customer = fields.Boolean(string="Add possible Customer")
@api.depends("partner_id")
def _compute_document_number(self):
for record in self:
@@ -375,7 +384,12 @@ class PmsCheckinPartner(models.Model):
record.document_id = False
@api.depends(
"document_number", "document_type", "firstname", "lastname", "lastname2"
"document_number",
"document_type",
"firstname",
"lastname",
"lastname2",
"add_possible_customer",
)
def _compute_partner_id(self):
for record in self:
@@ -402,6 +416,13 @@ class PmsCheckinPartner(models.Model):
}
partner = self.env["res.partner"].create(partner_values)
record.partner_id = partner
elif record.add_possible_customer:
self.env["pms.folio"]._add_customer(record)
@api.depends("email", "mobile")
def _compute_is_possible_existing_customer_id(self):
for record in self:
self.env["pms.folio"]._apply_is_possible_existing_customer_id(record)
@api.depends(
"firstname",

View File

@@ -38,6 +38,19 @@
/>
</bold>
</div>
<div
class="alert alert-warning"
role="alert"
style="margin-bottom:0px;"
attrs="{'invisible': [('is_possible_existing_customer_id','=',False)]}"
>
There is a customer with this email or mobile, do you want to add it to the reservation?
<field name="is_possible_existing_customer_id" invisible="1" />
<field
name="add_possible_customer"
attrs="{'invisible': [('is_possible_existing_customer_id','=',False)]}"
/>
</div>
<group name="group_top">
<group name="group_left">
<field