Commit be9a87e7 by Arturo Jasso Origel

se retiro la restricción de tickets sin valorar, y se agrego la restricción de…

se retiro la restricción de tickets sin valorar, y se agrego la restricción de la creación de adjuntos vacios
parent b6c8bf30
......@@ -349,13 +349,6 @@ class PortalCustomerMaintenence(CustomerPortal):
if not partner_id:
return json.dumps({"resp":"Error","message":"Colaborador no encontrado, favor de verificar que haya agregado uno"})
if partner_id:
unvalued_tickets = len(
request.env['helpdesk.ticket'].sudo().search([
('stage_id','=',request.env.ref('sh_all_in_one_helpdesk.done_stage').id),
('priority_new','=',False)])
)
if unvalued_tickets >= 3:
return json.dumps({"resp":"Error","message":"Tienes demasiados tickets sin evaluar, favor de evaluarlos"})
ticket_dic = {
'partner_id': partner_id.id,
'ticket_from_portal': True
......@@ -415,11 +408,12 @@ class PortalCustomerMaintenence(CustomerPortal):
ticket_id = request.env['helpdesk.ticket'].sudo().create(ticket_dic)
if 'portal_file' in request.params:
if kw.get('portal_file'):
attached_files = request.httprequest.files.getlist('portal_file')
attachment_ids = []
for attachment in attached_files:
result = base64.b64encode(attachment.read())
if result:
attachment_id = request.env['ir.attachment'].sudo(
).create({
'name': attachment.filename,
......@@ -430,8 +424,6 @@ class PortalCustomerMaintenence(CustomerPortal):
})
attachment_ids.append(attachment_id.id)
ticket_id.attachment_ids = [(6, 0, attachment_ids)]
return request.redirect("/my/mantenimientos?ctr=False")
except Exception as e:
_logger.exception('Something went wrong %s',str(e))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment