Skip to content

Commit a9f1089

Browse files
committed
[FIX] helpdesk_mgmt: Don't fail on category not required
Steps to reproduce: - Go to Helpdesk > Configuration > Settings. - Uncheck "Required Category" and save. - Go to portal page (/my) and click on "New Ticket". - Fill all the required data except "Category". - Press on "Submit Ticket". An error will raise: ``` File "./helpdesk_mgmt/controllers/main.py", line 106, in submit_ticket vals = self._prepare_submit_ticket_vals(**kw) File "./helpdesk_custom_esment/controllers/main.py", line 41, in _prepare_submit_ticket_vals vals = super()._prepare_submit_ticket_vals(**kw) File "./helpdesk_mgmt_timesheet/controllers/main.py", line 11, in _prepare_submit_ticket_vals vals = super(CustomHelpdeskTicketController, self)._prepare_submit_ticket_vals( File "./helpdesk_mgmt/controllers/main.py", line 73, in _prepare_submit_ticket_vals int(kw.get("category", 0)) ValueError: invalid literal for int() with base 10: '' ``` As there's no value set there. The solution is to make the code resilient for empty values in that field. TT56656
1 parent 5029eea commit a9f1089

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

helpdesk_mgmt/controllers/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ def create_new_ticket(self, **kw):
7070

7171
def _prepare_submit_ticket_vals(self, **kw):
7272
category = http.request.env["helpdesk.ticket.category"].browse(
73-
int(kw.get("category"))
73+
int(kw.get("category") or 0)
7474
)
7575
company = category.company_id or http.request.env.company
7676
vals = {

0 commit comments

Comments
 (0)