Skip to content

Commit 9531860

Browse files
committed
Padronização do módulo Issue Survey
1 parent 4633e14 commit 9531860

File tree

9 files changed

+89
-75
lines changed

9 files changed

+89
-75
lines changed
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# -*- coding: utf-8 -*-
2-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
# © 2017 Mackilem Van der Laan, Trustcode
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
34

4-
import wizard
5+
from . import models
6+
from . import wizard

issue_satisfaction_survey/__manifest__.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,18 @@
22
# © 2017 Mackilem Van der Laan, Trustcode
33
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
44

5-
{
5+
{ # pylint: disable=C8101,C8103
66
'name': 'Issue Satisfaction Survey',
7-
'version': '1.0',
8-
'category': '',
9-
'sequence': 5,
7+
'version': '10.0.1.0.0',
8+
'category': 'Project',
109
'summary': 'Pesquisa de satisfação em tarefas',
11-
'description': """
12-
13-
====================================================
14-
15-
""",
10+
'description': "Pesquisa de satisfação em tarefas",
1611
'website': 'https://www.trustcode.com.br',
17-
'depends': ['project_issue',],
12+
'depends': ['project_issue'],
13+
'author': 'Trustcode',
14+
'license': 'AGPL-3',
1815
'data': [
19-
'wizard/project_issue.xml',
20-
'security/ir.model.access.csv'
16+
'views/project_issue.xml',
17+
'wizard/project_issue_close.xml',
2118
],
22-
'installable': True,
23-
'application': False,
24-
'auto_install': False,
2519
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# © 2017 Mackilem Van der Laan, Trustcode
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from . import project_issue
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# -*- encoding: utf-8 -*-
2+
# © 2017 Mackilem Van der Laan, Trustcode
3+
# © 2017 Danimar Ribeiro, Trustcode
4+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
5+
6+
from odoo import api, fields, models
7+
from odoo.exceptions import UserError
8+
9+
# Estágio em que o issue será finalizado pelo cliente
10+
STAGE_ID_CLOSED = 41
11+
12+
13+
class ProjectIssue(models.Model):
14+
_inherit = "project.issue"
15+
16+
can_close = fields.Boolean("Pode Fechar?")
17+
pergunta1 = fields.Selection([('sim', u'Sim'), ('nao', u'Não')])
18+
pergunta2 = fields.Selection([('otimo', u'Ótimo'), ('bom', u'Bom'),
19+
('regular', u'Regular'), ('ruim', u'Ruim'),
20+
('pessimo', u'Péssimo')])
21+
pergunta3 = fields.Selection([('otimo', u'Ótimo'), ('bom', u'Bom'),
22+
('regular', u'Regular'), ('ruim', u'Ruim'),
23+
('pessimo', u'Péssimo')])
24+
pergunta4 = fields.Selection([('1', '1'), ('2', '2'), ('3', '3'),
25+
('4', '4'), ('5', '5'), ('6', '6'),
26+
('7', '7'), ('8', '8'), ('9', '9'),
27+
('10', '10')])
28+
29+
@api.multi
30+
def write(self, vals):
31+
res = super(ProjectIssue, self).write(vals)
32+
if "stage_id" in vals and vals['stage_id'] == 40 and \
33+
not self.can_close:
34+
raise UserError(u'Por favor, utilize o botão localizado dentro do \
35+
ticket para encerrar o chamado.')
36+
37+
return res
38+
39+
def action_close_issue(self):
40+
return self.env.ref(
41+
'issue_satisfaction_survey.action_issue_satifaction_survey'
42+
).read()[0]

issue_satisfaction_survey/security/ir.model.access.csv

Lines changed: 0 additions & 2 deletions
This file was deleted.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<odoo>
3+
4+
<record id="view_button_close_form" model="ir.ui.view">
5+
<field name="name">Botao de Encerramento</field>
6+
<field name="model">project.issue</field>
7+
<field name="inherit_id" ref="project_issue.project_issue_form_view"/>
8+
<field name="arch" type="xml">
9+
<header>
10+
<button type="object" class="oe_stat_button" icon="fa-angellist"
11+
name="action_close_issue" string="Encerrar"
12+
group="project_issue.grupo_cliente_externo" />
13+
</header>
14+
<xpath expr="//page[@name='extra_info']" position="inside">
15+
<group string="Avaliação">
16+
<field name="pergunta1" string="Cumpriu com as Obrigações?"/>
17+
<field name="pergunta2" string="Tempo de Atendimento?"/>
18+
<field name="pergunta3" string="Qualidade do atendimento?"/>
19+
<field name="pergunta4" string="Indicação"/>
20+
</group>
21+
</xpath>
22+
</field>
23+
</record>
24+
25+
</odoo>
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
2+
# © 2017 Mackilem Van der Laan, Trustcode
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
34

4-
import project_issue
5+
from . import project_issue_close

issue_satisfaction_survey/wizard/project_issue.py renamed to issue_satisfaction_survey/wizard/project_issue_close.py

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,13 @@
33
# © 2017 Danimar Ribeiro, Trustcode
44
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
55

6-
from odoo import api, fields, models
6+
from odoo import fields, models
77
from odoo.exceptions import Warning
88

99
# Estágio em que o issue será finalizado pelo cliente
1010
STAGE_ID_CLOSED = 41
1111

1212

13-
class ProjectIssue(models.Model):
14-
_inherit = "project.issue"
15-
16-
can_close = fields.Boolean("Pode Fechar?")
17-
pergunta1 = fields.Selection([('sim', u'Sim'), ('nao', u'Não')])
18-
pergunta2 = fields.Selection([('otimo', u'Ótimo'), ('bom', u'Bom'),
19-
('regular', u'Regular'), ('ruim', u'Ruim'),
20-
('pessimo', u'Péssimo')])
21-
pergunta3 = fields.Selection([('otimo', u'Ótimo'), ('bom', u'Bom'),
22-
('regular', u'Regular'), ('ruim', u'Ruim'),
23-
('pessimo', u'Péssimo')])
24-
pergunta4 = fields.Selection([('1', '1'), ('2', '2'), ('3', '3'),
25-
('4', '4'), ('5', '5'), ('6', '6'),
26-
('7', '7'), ('8', '8'), ('9', '9'),
27-
('10', '10')])
28-
29-
@api.multi
30-
def write(self, vals):
31-
res = super(ProjectIssue, self).write(vals)
32-
if "stage_id" in vals and vals['stage_id'] == 40 and not self.can_close:
33-
raise Warning(u'Por favor, utilize o botão localizado dentro do \
34-
ticket para encerrar o chamado.')
35-
36-
return res
37-
38-
def action_close_issue(self):
39-
action = self.env.ref(
40-
'issue_satisfaction_survey.action_issue_satifaction_survey').read()[0]
41-
42-
return action
43-
44-
4513
class ProjectIssueClose(models.TransientModel):
4614
_name = "project.issue.close"
4715

issue_satisfaction_survey/wizard/project_issue.xml renamed to issue_satisfaction_survey/wizard/project_issue_close.xml

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<odoo>
33

4-
<record id="view_button_close_form" model="ir.ui.view">
5-
<field name="name">Botao de Encerramento</field>
6-
<field name="model">project.issue</field>
7-
<field name="inherit_id" ref="project_issue.project_issue_form_view"/>
8-
<field name="arch" type="xml">
9-
<header>
10-
<button type="object" class="oe_stat_button" icon="fa-angellist"
11-
name="action_close_issue" string="Encerrar"
12-
group="project_issue.grupo_cliente_externo" />
13-
</header>
14-
<xpath expr="//page[@name='extra_info']" position="inside">
15-
<group string="Avaliação">
16-
<field name="pergunta1" string="Cumpriu com as Obrigações?"/>
17-
<field name="pergunta2" string="Tempo de Atendimento?"/>
18-
<field name="pergunta3" string="Qualidade do atendimento?"/>
19-
<field name="pergunta4" string="Indicação"/>
20-
</group>
21-
</xpath>
22-
</field>
23-
</record>
24-
254
<record id="view_issue_satifaction_survey_form" model="ir.ui.view">
265
<field name="name">Pesquisa de Satisfacao</field>
276
<field name="model">project.issue.close</field>

0 commit comments

Comments
 (0)