Commit 06ed2d72 by Arturo Jasso Origel

se agregaron los siguientes cambios:

que el formulario contenga el campo de sucursal
,
al momento que se asigna el ticket cambia a estatus en progreso,
se cambia la etiqueta de otra informacióna  cierre de ticket,
se agrego asignación de proveedor
parent 2f99d324
......@@ -359,6 +359,13 @@ class PortalCustomerMaintenence(CustomerPortal):
ticket_dic.update({
'mobile_no':kw.get('portal_phone')
})
if kw.get('portal_sucursal'):
portal_surcusal_id = request.env['warehouse.helpdesk'].sudo().browse(int(kw.get('portal_sucursal')))
if portal_surcusal_id:
ticket_dic.update({
'warehouse_id':portal_surcusal_id.id
})
if kw.get('portal_contact_name'):
ticket_dic.update({
......@@ -792,6 +799,13 @@ class PortalCustomerMaintenence(CustomerPortal):
kw.get('portal_description'),
})
if kw.get('portal_sucursal'):
portal_surcusal_id = request.env['warehouse.helpdesk'].sudo().browse(int(kw.get('portal_sucursal')))
if portal_surcusal_id:
ticket_dic.update({
'warehouse_id':portal_surcusal_id.id
})
ticket_dic.update({
'maintenance_type_id': request.env.ref('helpdesk_maintenance.emergency').id,
'severity_type':'3',
......
......@@ -2,4 +2,5 @@ from . import helpdesk_ticket
from . import maintenance_type
from . import res_users
from . import res_config_settings
from . import helpdesk_team
\ No newline at end of file
from . import helpdesk_team
from . import man_supplier
\ No newline at end of file
......@@ -24,6 +24,7 @@ class HelpdeskTicket(models.Model):
('fail','Falla'),('warranty','Garantía')
],string="Tipo de falla")
is_maintenance = fields.Boolean('Es mantenimiento',compute='_verify_ticket_type')
supplier_id = fields.Many2one('maintenance.supplier','Proveedor de mantenimiento')
def _compute_access_url(self):
super(HelpdeskTicket, self)._compute_access_url()
......@@ -39,6 +40,23 @@ class HelpdeskTicket(models.Model):
else:
ticket.is_maintenance = False
def write(self,vals):
if 'user_id' in vals:
if self.team_id.id == self.env.ref('helpdesk_maintenance.maintenance').sudo().id and 'team_id' not in vals:
if self.stage_id == self.env.ref('sh_all_in_one_helpdesk.new_stage').id and self.user_id != False or vals['user_id'] != False:
vals['stage_id'] = self.env.ref('sh_all_in_one_helpdesk.in_progress_stage').id
return super(HelpdeskTicket, self).write(vals)
@api.model
def default_due_date(self):
if self.team_id.id == self.env.ref('helpdesk_maintenance.maintenance').id:
return datetime.now()+timedelta(days=6)
else:
return fields.Datetime.now()
def _get_color(self):
super(HelpdeskTicket, self)._get_color()
......@@ -58,4 +76,5 @@ class HelpdeskTicket(models.Model):
if fields.Datetime.now() >= rec.create_date+timedelta(hours=extreme_time) and rec.stage_id.id in [new_stage,in_progress_stage]:
rec.color = self.env['ir.config_parameter'].sudo().get_param('helpdesk_maintenance.color_extreme_alert_maintenance')
\ No newline at end of file
from odoo import models, fields, api, _
from odoo.exceptions import UserError
class ResPartnerInherit(models.Model):
_name = 'maintenance.supplier'
_rec_name = 'name'
name = fields.Char('Nombre')
\ No newline at end of file
......@@ -44,7 +44,6 @@ class ResUsersInherit(models.Model):
('maintenance_position','=',self.maintenance_position),
('id','!=',self.id)
])
_logger.info(users)
if len(users) == 0:
return True
else:
......
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
user_maintenance_type,maintenance.type.user,model_maintenance_type,base.group_user,1,0,0,0
admin_maintenance_type,maintenance.type.admin,model_maintenance_type,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1
\ No newline at end of file
admin_maintenance_type,maintenance.type.admin,model_maintenance_type,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1
user_maintenance_supplier,maintenance.supplier.user,model_maintenance_supplier,base.group_user,1,1,1,0
admin_maintenance_supplier,mmaintenance.supplier.admin,model_maintenance_supplier,sh_all_in_one_helpdesk.helpdesk_group_manager,1,1,1,1
\ No newline at end of file
......@@ -130,11 +130,11 @@ $(document).ready(function(e) {
function verify_date(){
var t_type = $("#tck_type").val();
if (t_type == "mantenimiento"){
console.log("mantenimiento");
var date = new Date();
var day = date.getDay();
if (day == 3){
console.log("Entra day")
hours == date.getHours();
if(hours >= 8 && hours <= 20){
$("#mdl_shw").val("show");
......
......@@ -20,7 +20,21 @@
<xpath expr="//field[@name='category_id']" position="attributes">
<attribute name="attrs">{'invisible':[('is_maintenance','=',True)]}</attribute>
</xpath>
<xpath expr="//field[@name='warehouse_id']" position="replace">
<field name="warehouse_id" attrs="{'invisible':[('is_erp', '=', False),('is_maintenance','=',False)]}"/>
</xpath>
<xpath expr="//field[@name='mobile_no']" position="after">
<field name="supplier_id" attrs="{'invisible':[('is_maintenance','=',False)]}"/>
</xpath>
<xpath expr="//page[5]" position="attributes">
<attribute name="string">Fechas de Cierre</attribute>
</xpath>
<xpath expr="//field[@name='stage_id']" position="attributes">
<attribute name="attrs">{'invisible':[('is_maintenance','=',True)]}</attribute>
</xpath>
</field>
</record>
</data>
</odoo>
\ No newline at end of file
......@@ -60,6 +60,16 @@
<input type="text" class="form-control form-field s_website_form_required" id="portal_phone" name="portal_phone" required="" />
</div>
<!--Sucursal-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_sucursal' in error and 'has-error' or ''} ">
<label class="control-label" for="portal_sucursal">Sucursal:</label>
<select class="form-control form-field o_website_form_required_custom" id="portal_sucursal" name="portal_sucursal" required="" t-att-value="request.env.user.warehouse_id.id">
<option> </option>
<t t-foreach="request.env['warehouse.helpdesk'].sudo().search([])" t-as="suc">
<option t-att-value="suc.id"><t t-esc="suc.name" /></option>
</t>
</select>
</div>
<!--fecha de decteción de falla-->
......@@ -174,7 +184,7 @@
<template id="portal_ticket_page_maintenance_emergency" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True">
<xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
<div class="row mt16 o_portal_ticket_sidebar">
<!-- Sidebar -->
<!-- Sidebar
<t t-call="portal.portal_record_sidebar">
<t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" />
<t t-set="title">
......@@ -208,7 +218,7 @@
</li>
</ul>
</t>
</t>
</t>-->
<!-- Page Content -->
<div id="ticket_content" class="col-12 col-lg justify-content-end">
......
......@@ -58,6 +58,18 @@
<label class="control-label s_website_form_required" for="portal_phone">Teléfono:</label>
<input type="text" class="form-control form-field s_website_form_required" id="portal_phone" name="portal_phone" required="" />
</div>
<!--Sucursal-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_sucursal' in error and 'has-error' or ''} ">
<label class="control-label" for="portal_sucursal">Sucursal:</label>
<select class="form-control form-field o_website_form_required_custom" id="portal_sucursal" name="portal_sucursal" t-att-value="request.env.user.warehouse_id.id" required="">
<option> </option>
<t t-foreach="request.env['warehouse.helpdesk'].sudo().search([])" t-as="suc">
<option t-att-value="suc.id"><t t-esc="suc.name" /></option>
</t>
</select>
</div>
<!--Tipo de mantenimiento-->
<div t-attf-class="form-group o_website_form_required_custom #{error and 'portal_main_type' in error and 'has-error' or ''}">
<label class="control-label" for="portal_main_type">Tipo de Mantenimiento:</label>
......@@ -188,7 +200,7 @@
<template id="portal_ticket_page_maintenance" name="Ticket Portal Template" inherit_id="portal.portal_sidebar" primary="True">
<xpath expr="//div[hasclass('o_portal_sidebar')]" position="inside">
<div class="row mt16 o_portal_ticket_sidebar">
<!-- Sidebar -->
<!-- Sidebar
<t t-call="portal.portal_record_sidebar">
<t t-set="classes" t-value="'col-12 col-lg flex-lg-grow-0 d-print-none'" />
<t t-set="title">
......@@ -222,7 +234,7 @@
</li>
</ul>
</t>
</t>
</t>-->
<!-- Page Content -->
<div id="ticket_content" class="col-12 col-lg justify-content-end">
......
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