2
# -*- encoding: utf-8 -*-
3
###############################################################################
2
# -*- encoding: utf-8 -*-
3
###############################################################################
4
4
# Module Writen to OpenERP, Open Source Management Solution
5
5
# Copyright (C) Vauxoo (<http://vauxoo.com>).
7
################# Credits######################################################
7
################# Credits######################################################
8
8
# Coded by: Luis Escobar <luis@vauxoo.com>
9
9
# Audited by: Nhomar Hernandez <nhomar@vauxoo.com>
10
###############################################################################
11
# This program is free software: you can redistribute it and/or modify
12
# it under the terms of the GNU Affero General Public License as published
13
# by the Free Software Foundation, either version 3 of the License, or
14
# (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU Affero General Public License for more details.
21
# You should have received a copy of the GNU Affero General Public License
22
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
###############################################################################
10
###############################################################################
11
# This program is free software: you can redistribute it and/or modify
12
# it under the terms of the GNU Affero General Public License as published
13
# by the Free Software Foundation, either version 3 of the License, or
14
# (at your option) any later version.
16
# This program is distributed in the hope that it will be useful,
17
# but WITHOUT ANY WARRANTY; without even the implied warranty of
18
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
# GNU Affero General Public License for more details.
21
# You should have received a copy of the GNU Affero General Public License
22
# along with this program. If not, see <http://www.gnu.org/licenses/>.
23
###############################################################################
25
25
from openerp.osv import fields, osv
27
28
class convert_note_task(osv.TransientModel):
29
30
'''Convert Note to Task Wizard'''
31
32
_name = 'convert.note.task'
34
'estimated_time':fields.float('Estimated Time', help="""Estimated Time to Complete the
35
Task""", required=True),
36
'project_id':fields.many2one('project.project', 'Project', help='Project Linked', required=True),
37
'date_deadline':fields.date('Deadline', help='Date to complete the Task', required=True),
35
'estimated_time': fields.float('Estimated Time', help="""Estimated Time to Complete the
36
Task""", required=True),
37
'project_id': fields.many2one('project.project', 'Project', help='Project Linked', required=True),
38
'date_deadline': fields.date('Deadline', help='Date to complete the Task', required=True),
40
41
def create_task(self, cr, uid, ids, context=None):
41
42
if context is None:
43
cvt_brw = self.browse(cr, uid, ids, context=context)
44
cvt_brw = self.browse(cr, uid, ids, context=context)
44
45
task_obj = self.pool.get('project.task')
45
46
note_obj = self.pool.get('note.note')
46
47
note_brw = note_obj.browse(cr, uid, [context.get('active_id')], context=context)
47
48
task_id = task_obj.create(cr, uid, {
48
'name': note_brw[0].name,
49
'description': note_brw[0].memo,
50
'project_id': cvt_brw[0].project_id.id,
52
'date_deadline': cvt_brw[0].date_deadline,
49
'name': note_brw[0].name,
50
'description': note_brw[0].memo,
51
'project_id': cvt_brw[0].project_id.id,
53
'date_deadline': cvt_brw[0].date_deadline,
54
55
note_obj.write(cr, uid, [context.get('active_id')], {
57
58
obj_model = self.pool.get('ir.model.data')
58
59
model_data_ids = obj_model.search(
59
60
cr, uid, [('model', '=', 'ir.ui.view'),