summaryrefslogtreecommitdiff
path: root/addons/crm_iap_lead_website/controllers/main.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/crm_iap_lead_website/controllers/main.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/crm_iap_lead_website/controllers/main.py')
-rw-r--r--addons/crm_iap_lead_website/controllers/main.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/addons/crm_iap_lead_website/controllers/main.py b/addons/crm_iap_lead_website/controllers/main.py
new file mode 100644
index 00000000..4a9b6357
--- /dev/null
+++ b/addons/crm_iap_lead_website/controllers/main.py
@@ -0,0 +1,18 @@
+# -*- coding: utf-8 -*-
+import json
+
+from odoo import http
+from odoo.addons.website_form.controllers.main import WebsiteForm
+from odoo.http import request
+
+
+class ContactController(WebsiteForm):
+
+ def _handle_website_form(self, model_name, **kwargs):
+ if model_name == 'crm.lead':
+ # Add the ip_address to the request in order to add this to the lead
+ # that will be created. With this, we avoid to create a lead from
+ # reveal if a lead is already created from the contact form.
+ request.params['reveal_ip'] = request.httprequest.remote_addr
+
+ return super(ContactController, self)._handle_website_form(model_name, **kwargs)