Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

T1799 - Fix zoom invite Part 2 (1/2) #1664

Merged
merged 4 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,12 @@ def zoom_registration(self, session=None, **kwargs):
session = request.env["res.partner.zoom.session"].get_next_session(start)
if not session.website_published:
raise Unauthorized()
participant = request.env["res.partner.zoom.attendee"]
partner = request.env["res.partner"]
if request.env.user and request.env.user != request.env.ref("base.public_user"):
partner = request.env.user.partner_id
kwargs["partner_id"] = partner.id
participant = session.participant_ids.filtered(
lambda p: p.partner_id == partner
)
kwargs["zoom_session_id"] = session.id
return request.render(
"partner_communication_switzerland.zoom_registration_template",
{"session": session, "main_object": participant},
{"session": session, "partner": partner},
)
1 change: 1 addition & 0 deletions partner_communication_switzerland/data/form_data.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
'inform_me_for_next_zoom',
'optional_message',
'zoom_session_id',
'partner_id',
'state',
]"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,18 +85,44 @@ def create(self, vals_list):
vals_list_to_create = vals_list.copy()

for vals in vals_list:
existing_attendee = self.search(
[
("partner_id", "=", vals.get("partner_id")),
("zoom_session_id", "=", vals.get("zoom_session_id")),
]
)
if existing_attendee:
vals_list_to_create.remove(vals)
del vals["partner_id"]
del vals["zoom_session_id"]
existing_attendee.write(vals)
res += existing_attendee
if vals.get("partner_id"):
existing_attendee = self.search(
[
("partner_id", "=", vals.get("partner_id")),
("zoom_session_id", "=", vals.get("zoom_session_id")),
]
)
if existing_attendee:
vals_list_to_create.remove(vals)
del vals["partner_id"]
del vals["zoom_session_id"]
existing_attendee.write(vals)
res += existing_attendee

else:
partner_vals = self._convert_vals_for_res_partner(vals)
partner_id = (
self.env["res.partner.match"]
.match_values_to_partner(
partner_vals, match_update=False, match_create=False
)
.id
)

existing_attendee = self.search(
[
("partner_id", "=", partner_id),
("zoom_session_id", "=", vals.get("zoom_session_id")),
]
)
if existing_attendee:
vals_list_to_create.remove(vals)
del vals["partner_firstname"]
del vals["partner_lastname"]
del vals["partner_email"]
del vals["zoom_session_id"]
existing_attendee.write(vals)
res += existing_attendee

res += super().create(vals_list_to_create)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<div class="col-sm">
<input
type="text"
t-att-value="partner.firstname"
class="form-control s_website_form_input"
name="partner_firstname"
required="true"
Expand Down Expand Up @@ -147,6 +148,7 @@
<div class="col-sm">
<input
type="text"
t-att-value="partner.lastname"
class="form-control s_website_form_input"
name="partner_lastname"
required="true"
Expand All @@ -172,6 +174,7 @@
<div class="col-sm">
<input
type="text"
t-att-value="partner.email"
class="form-control s_website_form_input"
name="partner_email"
required="true"
Expand All @@ -196,6 +199,7 @@
<div class="col-sm">
<input
type="text"
t-att-value="partner.phone"
class="form-control s_website_form_input"
name="partner_phone"
id="ocd0qhy3mm5"
Expand Down Expand Up @@ -304,6 +308,23 @@
</div>
</div>
</div>
<div
class="form-group s_website_form_field_hidden col-12 "
data-type="boolean"
data-name="Field"
>
<div class="row s_col_no_resize s_col_no_bgcolor">
<div class="col-sm">
<input
type="text"
t-att-value="partner.id"
class="s_website_form_input"
name="partner_id"
id="partner_id"
/>
</div>
</div>
</div>
<div
class="form-group s_website_form_field_hidden col-12 "
data-type="char"
Expand Down
Loading