Fall back in case of missing sale order ID

This commit is contained in:
Tobias Kunze 2025-06-22 19:53:55 +02:00
parent 631f726691
commit 4ccefd1c7f

View file

@ -27,9 +27,16 @@ class SupportView(OrganizationViewMixin, FormView):
"name": f"Servala Support - Organization {organization.name}",
"team_id": settings.ODOO["HELPDESK_TEAM_ID"],
"partner_id": partner_id,
"sale_order_id": organization.odoo_sale_order_id,
"description": message,
}
# All orgs should have a sale order ID, but legacy ones might not have it.
# Also, we want to be very sure that support requests work, especially for
# organizations where something in the creation process may have gone wrong,
# so if the ID does not exist, we omit it entirely.
if organization.odoo_sale_order_id:
ticket_data["sale_order_id"] = organization.odoo_sale_order_id
CLIENT.execute("helpdesk.ticket", "create", [ticket_data])
messages.success(
self.request,