~openerp-commiter/openobject-addons/trunk-extra-addons

« back to all changes in this revision

Viewing changes to payroll/payroll-4.1.1/tax/tax_declaration.py

merging new development from indian accounting

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- encoding: utf-8 -*-
1
2
##############################################################################
2
3
#
3
4
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
33
34
from osv import fields, osv
34
35
 
35
36
class tax_rebate_sections(osv.osv):
36
 
        _name = "tax.rebate.sections"
37
 
        _description = "Tax Rebate Sections"
38
 
        _columns = {
39
 
                'name': fields.char("Code", size=32),
40
 
                'description': fields.char('Description', size=32),
41
 
                #'section_type'
42
 
                'max_limit' : fields.float('Maximum Limit', digits=(12,2) ),
43
 
                'deduction_inc': fields.boolean('Deduction from income'),
44
 
                'dependency' : fields.one2many('tax.rebates', 'section_id', 'Dependent Tax Rebates'),
45
 
        }
46
 
        _defaults = {
47
 
                }
48
 
                        
 
37
    _name = "tax.rebate.sections"
 
38
    _description = "Tax Rebate Sections"
 
39
    _columns = {
 
40
        'name': fields.char("Code", size=32),
 
41
        'description': fields.char('Description', size=32),
 
42
        #'section_type'
 
43
        'max_limit' : fields.float('Maximum Limit', digits=(12,2) ),
 
44
        'deduction_inc': fields.boolean('Deduction from income'),
 
45
        'dependency' : fields.one2many('tax.rebates', 'section_id', 'Dependent Tax Rebates'),
 
46
        }
 
47
    _defaults = {
 
48
        }
 
49
            
49
50
tax_rebate_sections()
50
51
 
51
52
class tax_rebates(osv.osv):
52
 
        _name = "tax.rebates"
53
 
        _description = "Tax Rebates"
54
 
        _columns = {
55
 
                'name': fields.char("Code", size=32),
56
 
                'section_id': fields.many2one('tax.rebate.sections', 'Rebate Section ID' ),
57
 
                'declaration_id': fields.many2one('employee.tax.declarations', 'Declaration ID' ),
58
 
                'description': fields.char('Description', size=32),
59
 
                }
60
 
        _defaults = {
61
 
                }
62
 
                        
 
53
    _name = "tax.rebates"
 
54
    _description = "Tax Rebates"
 
55
    _columns = {
 
56
        'name': fields.char("Code", size=32),
 
57
        'section_id': fields.many2one('tax.rebate.sections', 'Rebate Section ID' ),
 
58
        'declaration_id': fields.many2one('employee.tax.declarations', 'Declaration ID' ),
 
59
        'description': fields.char('Description', size=32),
 
60
        }
 
61
    _defaults = {
 
62
        }
 
63
            
63
64
tax_rebates()
64
65
 
65
66
class employee_tax_declarations(osv.osv):
66
 
        _name = "employee.tax.declarations"
67
 
        _description = "Employee Tax Declarations"
68
 
        _columns = {
69
 
                'name': fields.char("Declaration Name", size=32),
 
67
    _name = "employee.tax.declarations"
 
68
    _description = "Employee Tax Declarations"
 
69
    _columns = {
 
70
        'name': fields.char("Declaration Name", size=32),
70
71
        'employee_id': fields.many2one('hr.employee', 'Employee ID' ),
71
 
                'status': fields.selection([('pending','Pending'), ('provided','Provided')], 'Status' ),
72
 
                'rebate_code': fields.many2one('tax.rebates', 'Rebate code'),
73
 
                'description': fields.char('Description', size=32),
74
 
                'scheme_code': fields.char('Scheme Code', size=32),
75
 
                'policy_no': fields.char('Policy/Account No.', size=32),
76
 
                'premium_yr': fields.date('Premium for year'),
77
 
                'amount': fields.float('Amount', digits=(12,2)),
78
 
                'deduction_inc': fields.boolean('Deduction from income'),
79
 
                'proof_recv': fields.boolean('Proof received'),
80
 
        }
81
 
        _defaults = {
82
 
                'name' : lambda *a: 'Tax Declaration',
83
 
                'status': lambda *a: 'pending',
84
 
                }
85
 
        def onchange_rebate_code(self, cr, uid, ids, r_code):
86
 
                result = {'value':{'description': False, 'deduction_inc': False}}
87
 
                print 'r_code : ',r_code
88
 
                tax_decl = self.pool.get('tax.rebates').browse(cr, uid, r_code)
89
 
                if tax_decl.description:
90
 
                        result['value']['description'] = tax_decl.description
91
 
                print 'i m here'
92
 
                if tax_decl.section_id.deduction_inc:
93
 
                        result['value']['deduction_inc'] = tax_decl.section_id.deduction_inc
94
 
                return result
95
 
                        
 
72
        'status': fields.selection([('pending','Pending'), ('provided','Provided')], 'Status' ),
 
73
        'rebate_code': fields.many2one('tax.rebates', 'Rebate code'),
 
74
        'description': fields.char('Description', size=32),
 
75
        'scheme_code': fields.char('Scheme Code', size=32),
 
76
        'policy_no': fields.char('Policy/Account No.', size=32),
 
77
        'premium_yr': fields.date('Premium for year'),
 
78
        'amount': fields.float('Amount', digits=(12,2)),
 
79
        'deduction_inc': fields.boolean('Deduction from income'),
 
80
        'proof_recv': fields.boolean('Proof received'),
 
81
        }
 
82
    _defaults = {
 
83
        'name' : lambda *a: 'Tax Declaration',
 
84
        'status': lambda *a: 'pending',
 
85
        }
 
86
    def onchange_rebate_code(self, cr, uid, ids, r_code):
 
87
        result = {'value':{'description': False, 'deduction_inc': False}}
 
88
        print 'r_code : ',r_code
 
89
        tax_decl = self.pool.get('tax.rebates').browse(cr, uid, r_code)
 
90
        if tax_decl.description:
 
91
            result['value']['description'] = tax_decl.description
 
92
        print 'i m here'
 
93
        if tax_decl.section_id.deduction_inc:
 
94
            result['value']['deduction_inc'] = tax_decl.section_id.deduction_inc
 
95
        return result
 
96
            
96
97
employee_tax_declarations()
 
98
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
 
99