~vauxoo/addons-vauxoo/8.0-import_tax_tariff-dev-yani-rev-2

« back to all changes in this revision

Viewing changes to hr_expense_analytic/hr_expense_analytic.py

  • Committer: jose at vauxoo
  • Date: 2012-10-30 22:29:46 UTC
  • mfrom: (501.1.58 6.1)
  • Revision ID: jose@vauxoo.com-20121030222946-gjtl9xw24t27xrrw
  
[MERGE] Merge to 6.1 branch to added new features 

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
###########################################################################
 
3
#    Module Writen to OpenERP, Open Source Management Solution
 
4
#
 
5
#    Copyright (c) 2012 Vauxoo - http://www.vauxoo.com
 
6
#    All Rights Reserved.
 
7
#    info@vauxoo.com
 
8
############################################################################
 
9
#    Coded by: Rodo (rodo@vauxoo.com)
 
10
############################################################################
 
11
#
 
12
#    This program is free software: you can redistribute it and/or modify
 
13
#    it under the terms of the GNU Affero General Public License as
 
14
#    published by the Free Software Foundation, either version 3 of the
 
15
#    License, or (at your option) any later version.
 
16
#
 
17
#    This program is distributed in the hope that it will be useful,
 
18
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
#    GNU Affero General Public License for more details.
 
21
#
 
22
#    You should have received a copy of the GNU Affero General Public License
 
23
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
24
#
 
25
##############################################################################
 
26
from osv import osv, fields
 
27
 
 
28
 
 
29
class hr_department(osv.osv):
 
30
    _inherit = "hr.department"
 
31
 
 
32
    _columns = {
 
33
        'analytic_account_id': fields.many2one('account.analytic.account','Analytic'),
 
34
    }
 
35
 
 
36
hr_department()
 
37
 
 
38
class hr_expense_line(osv.osv):
 
39
    _inherit ="hr.expense.line"
 
40
    
 
41
    def _get_analytic(self,cr,uid,context={}):
 
42
        if context['depto']:
 
43
            depto=self.pool.get('hr.department').browse(cr,uid,[context['depto']])[0]
 
44
            return depto.analytic_account_id.id
 
45
        return False
 
46
    
 
47
    _defaults= {
 
48
        'analytic_account': _get_analytic
 
49
    }
 
50
    
 
51
hr_expense_line()