Skip to content

Commit

Permalink
[IMP] tg_marketing: fixed error in template
Browse files Browse the repository at this point in the history
  • Loading branch information
azimkhankuat committed Oct 31, 2024
1 parent a97aad5 commit 4fceb8a
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions tg_marketing/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,24 @@ def registration_confirm(self, event, **post):
filtered_post = {k: v for k, v in post.items() if "marketing_answer" not in k}
res = super().registration_confirm(event, **filtered_post)

return res

def _process_attendees_form(self, event, form_details):
marketing_fields = {}
non_marketing_fields = {}

for key, value in form_details.items():
if "marketing_answer" in key:
marketing_fields[key] = value
else:
non_marketing_fields[key] = value

MarketingAnswers = request.env["res.partner.marketing.answer"].sudo()
partner_marketing_vals = {}
for key, value in post.items():
if "marketing_answer" in key and value:
dummy, registration_index, field_name = key.split("-")

for key, value in marketing_fields.items():
if value:
_, registration_index, field_name = key.split("-")
try:
value_answer_id = int(value)
value_answer = MarketingAnswers.browse(value_answer_id).exists()
Expand All @@ -33,4 +46,4 @@ def registration_confirm(self, event, **post):
if partner_marketing_vals:
request.env.user.partner_id.sudo().write(partner_marketing_vals)

return res
return super()._process_attendees_form(event, non_marketing_fields)

0 comments on commit 4fceb8a

Please sign in to comment.