~koi-accounting-modules-maintainer/koi-accounting-modules/7.0-fixed-asset

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# -*- coding: utf-8 -*-
##############################################################################
#
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU Affero General Public License for more details.
#
#    You should have received a copy of the GNU Affero General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################


from osv import osv,fields

class wizard_batch_change_account(osv.osv_memory):
    _name = 'account.wizard_batch_change_account'
    _description = 'Wizard Batch Change Account'

    _columns =  {
                'currency_id' : fields.many2one(string='Currency',obj='res.currency'),
                'flag_currency_id' : fields.boolean(string='Currency'),
                'flag_type' : fields.boolean(string='Internal Type'),
                'type' : fields.selection(string='Internal Type', selection=[('view','View'),('other','Regular'),('receivable','Receivable'),('payable','Payable'),('liquidity','Liquidity'),('consolidation','Consolidation'),('closed','Closed')]),
                'account_type_id' : fields.many2one(string='Account Type', obj='account.account.type'),
                'flag_account_type_id' : fields.boolean(string='Account Type'),
                'flag_parent_id' : fields.boolean(string='Parent'),
                'parent_id' : fields.many2one(string='Parent', obj='account.account'),
                'flag_reconcile' : fields.boolean(string='Allow Reconcilliation'),
                'reconcile' : fields.boolean(string='Allow Reconcilliation'),
                }


    def execute_wizard(self, cr, uid, ids, context=None):
        obj_account = self.pool.get('account.account')
        account_ids = context.get('active_ids', [])

        wizard = self.browse(cr, uid, ids)[0]

        res = {}


        if account_ids:
            if wizard.flag_currency_id:
                res.update({'currency_id' : wizard.currency_id.id})

            if wizard.flag_account_type_id:
                res.update({'user_type' : wizard.account_type_id.id})

            if wizard.flag_parent_id:
                res.update({'parent_id' : wizard.parent_id.id})

            if wizard.flag_reconcile:
                res.update({'reconcile' : wizard.reconcile})

            if wizard.flag_type:
                res.update({'type' : wizard.type})

            obj_account.write(cr, uid, account_ids, res)


        return True

        
wizard_batch_change_account()

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: