make creation and deletion work

This commit is contained in:
Tobias Brunner 2025-01-31 16:17:16 +01:00
parent 4ae237e10a
commit 7c7f315e52
No known key found for this signature in database
4 changed files with 28 additions and 5 deletions

View file

@ -53,7 +53,7 @@ class OdooAPI:
logger.debug("Full error details:", exc_info=True)
raise
def create_lead(self, lead):
def create_lead(self, lead, source="form"):
"""Create a lead in Odoo"""
try:
logger.info(
@ -74,6 +74,11 @@ class OdooAPI:
if lead.plan:
service_details.append(f"Plan: {lead.plan.name}")
if source == "form":
service_details.append(f"Source: Servala Website")
elif source == "osbapi":
service_details.append(f"Source: OSB API")
# Prepare lead data
lead_data = {
"name": f"Servala - Interest in {lead.service.name}",