mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP]pms: checkin partner residence state
This commit is contained in:
@@ -143,18 +143,6 @@ class PmsCheckinPartner(models.Model):
|
||||
compute="_compute_nationality_id",
|
||||
comodel_name="res.country",
|
||||
)
|
||||
# TODO: Use new partner contact "other or "private" with
|
||||
# personal contact address complete??
|
||||
# to avoid user country_id on companies contacts.
|
||||
# View to res.partner state_id inherit
|
||||
state_id = fields.Many2one(
|
||||
string="Country State",
|
||||
help="host state",
|
||||
readonly=False,
|
||||
store=True,
|
||||
compute="_compute_state_id",
|
||||
comodel_name="res.country.state",
|
||||
)
|
||||
residence_street = fields.Char(
|
||||
string="Street",
|
||||
help="Street of the guest's residence",
|
||||
@@ -360,14 +348,6 @@ class PmsCheckinPartner(models.Model):
|
||||
elif not record.nationality_id:
|
||||
record.nationality_id = False
|
||||
|
||||
@api.depends("partner_id")
|
||||
def _compute_state_id(self):
|
||||
for record in self:
|
||||
if not record.state_id and record.partner_id.state_id:
|
||||
record.state_id = record.partner_id.state_id
|
||||
elif not record.state_id:
|
||||
record.state_id = False
|
||||
|
||||
@api.depends("partner_id")
|
||||
def _compute_residence_street(self):
|
||||
for record in self:
|
||||
@@ -876,10 +856,10 @@ class PmsCheckinPartner(models.Model):
|
||||
if not values.get("document_type"):
|
||||
values.update({"document_type": False})
|
||||
if values.get("state"):
|
||||
state_id = self.env["res.country.state"].search(
|
||||
residence_state_id = self.env["res.country.state"].search(
|
||||
[("id", "=", values.get("state"))]
|
||||
)
|
||||
values.update({"state_id": state_id})
|
||||
values.update({"residence_state_id": residence_state_id})
|
||||
values.pop("state")
|
||||
if values.get("document_expedition_date"):
|
||||
doc_type = values.get("document_type")
|
||||
|
||||
@@ -86,15 +86,6 @@ class ResPartner(models.Model):
|
||||
store=True,
|
||||
compute="_compute_nationality_id",
|
||||
)
|
||||
# TODO: Use new partner contact "other or "private" with
|
||||
# personal contact address complete??
|
||||
# to avoid user country_id on companies contacts.
|
||||
# view to checkin partner state_id field
|
||||
state_id = fields.Many2one(
|
||||
readonly=False,
|
||||
store=True,
|
||||
compute="_compute_state_id",
|
||||
)
|
||||
email = fields.Char(
|
||||
readonly=False,
|
||||
store=True,
|
||||
@@ -302,25 +293,6 @@ class ResPartner(models.Model):
|
||||
elif not record.nationality_id:
|
||||
record.nationality_id = False
|
||||
|
||||
@api.depends("pms_checkin_partner_ids", "pms_checkin_partner_ids.state_id")
|
||||
def _compute_state_id(self):
|
||||
if hasattr(super(), "_compute_state_id"):
|
||||
super()._compute_state_id()
|
||||
for record in self:
|
||||
if not record.state_id and record.pms_checkin_partner_ids:
|
||||
state_id = list(
|
||||
filter(
|
||||
None,
|
||||
set(record.pms_checkin_partner_ids.mapped("state_id")),
|
||||
)
|
||||
)
|
||||
if len(state_id) == 1:
|
||||
record.state_id = state_id[0]
|
||||
else:
|
||||
record.state_id = False
|
||||
elif not record.state_id:
|
||||
record.state_id = False
|
||||
|
||||
@api.depends("pms_checkin_partner_ids", "pms_checkin_partner_ids.phone")
|
||||
def _compute_phone(self):
|
||||
if hasattr(super(), "_compute_phone"):
|
||||
|
||||
@@ -67,7 +67,6 @@
|
||||
<field name="document_number" />
|
||||
<field name="document_expedition_date" />
|
||||
<field name="nationality_id" />
|
||||
<field name="state_id" />
|
||||
<field name="email" />
|
||||
<field name="mobile" />
|
||||
<field name="phone" />
|
||||
@@ -163,7 +162,7 @@
|
||||
<field name="document_number" />
|
||||
<field name="document_expedition_date" />
|
||||
<field name="nationality_id" />
|
||||
<field name="state_id" />
|
||||
<field name="residence_state_id" />
|
||||
<field name="mobile" />
|
||||
<field name="email" />
|
||||
<field name="arrival" />
|
||||
@@ -209,7 +208,7 @@
|
||||
<field name="document_number" />
|
||||
<field name="document_expedition_date" />
|
||||
<field name="nationality_id" />
|
||||
<field name="state_id" />
|
||||
<field name="residence_state_id" />
|
||||
<field name="mobile" />
|
||||
<field name="email" />
|
||||
<field name="arrival" invisible="1" />
|
||||
@@ -252,7 +251,7 @@
|
||||
<field name="document_number" />
|
||||
<field name="document_expedition_date" />
|
||||
<field name="nationality_id" />
|
||||
<field name="state_id" />
|
||||
<field name="residence_state_id" />
|
||||
<field name="mobile" />
|
||||
<field name="email" />
|
||||
<field name="arrival" />
|
||||
@@ -291,7 +290,7 @@
|
||||
<field name="document_number" />
|
||||
<field name="document_expedition_date" />
|
||||
<field name="nationality_id" />
|
||||
<field name="state_id" />
|
||||
<field name="residence_state_id" />
|
||||
<field name="email" />
|
||||
<field name="mobile" />
|
||||
<field name="arrival" />
|
||||
|
||||
@@ -242,24 +242,6 @@
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group col-12 col-md-6">
|
||||
<label
|
||||
class="col-form-label"
|
||||
for="state"
|
||||
>Country State</label>
|
||||
<select class="form-control" id="state" name='state'>
|
||||
<option value="">Select an option</option>
|
||||
<t t-foreach="state_ids" t-as='state'>
|
||||
<option
|
||||
t-att-value="state.id"
|
||||
t-att-country_id="state.country_id.id"
|
||||
t-att-selected="state.id == checkin_partner_id.state_id.id"
|
||||
>
|
||||
<t t-esc="state.name" />
|
||||
</option>
|
||||
</t>
|
||||
</select>
|
||||
</div>
|
||||
<div t-attf-class="form-group col-12 col-md-6 pt-5">
|
||||
<label
|
||||
id="label_mobile"
|
||||
@@ -1248,19 +1230,6 @@
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-12 col-md-6 font-weight-bold"
|
||||
>
|
||||
Country State:
|
||||
<br />
|
||||
<span
|
||||
class="font-weight-normal ml-3"
|
||||
>
|
||||
<t
|
||||
t-esc="checkin_partner.state_id.name"
|
||||
/>
|
||||
</span>
|
||||
</div>
|
||||
<div
|
||||
t-attf-class="form-group col-12 col-md-6 font-weight-bold"
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user