~vauxoo/addons-vauxoo/6.0-trunk

« back to all changes in this revision

Viewing changes to project_task_domain/model/project_task_work.py

  • Committer: Jose Morales
  • Date: 2014-07-28 20:00:11 UTC
  • mfrom: (543.7.551 7.0-addons-vauxoo)
  • Revision ID: jose@vauxoo.com-20140728200011-csytovehrzwp24lr
[FORWARD PORT] 7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
# -*- encoding: utf-8 -*-
 
3
#
 
4
#    Module Writen to OpenERP, Open Source Management Solution
 
5
#
 
6
#    Copyright (c) 2014 Vauxoo - http://www.vauxoo.com/
 
7
#    All Rights Reserved.
 
8
#    info Vauxoo (info@vauxoo.com)
 
9
#
 
10
#    Coded by: vauxoo consultores (info@vauxoo.com)
 
11
#
 
12
#
 
13
#    This program is free software: you can redistribute it and/or modify
 
14
#    it under the terms of the GNU Affero General Public License as
 
15
#    published by the Free Software Foundation, either version 3 of the
 
16
#    License, or (at your option) any later version.
 
17
#
 
18
#    This program is distributed in the hope that it will be useful,
 
19
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
20
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
21
#    GNU Affero General Public License for more details.
 
22
#
 
23
#    You should have received a copy of the GNU Affero General Public License
 
24
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
25
#
 
26
#
 
27
from openerp.osv import osv, fields
 
28
from openerp.tools.translate import _
 
29
import time
 
30
 
 
31
 
 
32
class project_task_work(osv.Model):
 
33
    _inherit = 'project.task.work'
 
34
    
 
35
    def onchange_hours(self, cr, uid, ids, hours=None, context=None):
 
36
        if context is None:
 
37
            context = {}
 
38
        warning = {}
 
39
        if hours < 0:
 
40
            warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge hours in negative?')}
 
41
        return { 'warning': warning}
 
42
        
 
43
    def onchange_date(self, cr, uid, ids, date=None, context=None):
 
44
        if context is None:
 
45
            context = {}
 
46
        warning = {}
 
47
        if date > time.strftime('%Y-%m-%d %H:%M:%S'):
 
48
            warning = { 'title': _('Warning!'), 'message': _('Are you sure that you want to charge a future date?')}
 
49
        return { 'warning': warning}
 
 
b'\\ No newline at end of file'