1
# -*- coding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
7
# This program is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU Affero General Public License as
9
# published by the Free Software Foundation, either version 3 of the
10
# License, or (at your option) any later version.
12
# This program is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU Affero General Public License for more details.
17
# You should have received a copy of the GNU Affero General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
##############################################################################
24
from openerp.osv import fields, osv
25
from openerp import pooler
26
from openerp import tools
27
from openerp.tools.translate import _
29
from openerp.tools.sql import drop_view_if_exists
31
class custom_project_task(osv.Model):
32
_name = "custom.project.task"
36
'analytic_id': fields.many2one('account.analytic.account', 'Project',
37
readonly=True, select=True),
38
'counter': fields.integer('Num', readonly=True),
39
'userstory': fields.integer('User Story', readonly=True,
40
help='User history id of user history assigned on task.'),
41
'task_user_id': fields.many2one('res.users', 'Task user',
42
readonly=True, select=True, help='User of project task.'),
43
'project_leader_id': fields.many2one('res.users', 'Leader user',
44
readonly=True, select=True, help='Leader user of project task.'),
45
'task_id': fields.many2one('project.task', 'Task',
46
readonly=True, select=True, help='Project task title.'),
47
'deadline': fields.date('Deadline', readonly=True,
48
help='Project task deadline.'),
49
'date_end': fields.date('Date End', readonly=True,
50
help='Project task Date End.'),
51
'period_end': fields.char('Period End', 128,
52
help='Period for the end date of summary work.'),
53
'state': fields.char('State', 128, help='Project task state.'),
57
drop_view_if_exists(cr, 'custom_project_task')
59
create or replace view custom_project_task as (
63
task.date_deadline AS deadline,
64
task.user_id AS task_user_id,
65
task.project_leader_id AS project_leader_id,
66
task.date_end AS date_end,
67
to_char(task.date_end,'MM/YYYY') AS period_end,
68
analytic.id AS analytic_id,
71
task_type.name AS state
72
FROM project_task AS task
73
LEFT JOIN project_project AS project ON project.id = task.project_id
74
LEFT JOIN account_analytic_account AS analytic ON analytic.id = project.analytic_account_id
75
LEFT JOIN user_story AS us ON us.id = task.userstory_id
76
LEFT JOIN project_task_type AS task_type ON task_type.id = task.stage_id