42
by Andhitia Rama
Penambahan Wizard Batch Change Account |
1 |
# -*- coding: utf-8 -*-
|
2 |
##############################################################################
|
|
3 |
#
|
|
4 |
# OpenERP, Open Source Management Solution
|
|
5 |
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
|
6 |
#
|
|
7 |
# This program is free software: you can redistribute it and/or modify
|
|
8 |
# it under the terms of the GNU Affero General Public License as
|
|
9 |
# published by the Free Software Foundation, either version 3 of the
|
|
10 |
# License, or (at your option) any later version.
|
|
11 |
#
|
|
12 |
# This program is distributed in the hope that it will be useful,
|
|
13 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
14 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
15 |
# GNU Affero General Public License for more details.
|
|
16 |
#
|
|
17 |
# You should have received a copy of the GNU Affero General Public License
|
|
18 |
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
19 |
#
|
|
20 |
##############################################################################
|
|
21 |
||
22 |
||
23 |
from osv import osv,fields |
|
24 |
||
25 |
class wizard_batch_change_account(osv.osv_memory): |
|
26 |
_name = 'account.wizard_batch_change_account' |
|
27 |
_description = 'Wizard Batch Change Account' |
|
28 |
||
29 |
_columns = { |
|
30 |
'currency_id' : fields.many2one(string='Currency',obj='res.currency'), |
|
31 |
'flag_currency_id' : fields.boolean(string='Currency'), |
|
47
by Andhitia Rama
Revisi wizard batch change account |
32 |
'flag_type' : fields.boolean(string='Internal Type'), |
33 |
'type' : fields.selection(string='Internal Type', selection=[('view','View'),('other','Regular'),('receivable','Receivable'),('payable','Payable'),('liquidity','Liquidity'),('consolidation','Consolidation'),('closed','Closed')]), |
|
42
by Andhitia Rama
Penambahan Wizard Batch Change Account |
34 |
'account_type_id' : fields.many2one(string='Account Type', obj='account.account.type'), |
35 |
'flag_account_type_id' : fields.boolean(string='Account Type'), |
|
47
by Andhitia Rama
Revisi wizard batch change account |
36 |
'flag_parent_id' : fields.boolean(string='Parent'), |
37 |
'parent_id' : fields.many2one(string='Parent', obj='account.account'), |
|
38 |
'flag_reconcile' : fields.boolean(string='Allow Reconcilliation'), |
|
39 |
'reconcile' : fields.boolean(string='Allow Reconcilliation'), |
|
42
by Andhitia Rama
Penambahan Wizard Batch Change Account |
40 |
}
|
41 |
||
42 |
||
43 |
def execute_wizard(self, cr, uid, ids, context=None): |
|
44 |
obj_account = self.pool.get('account.account') |
|
45 |
account_ids = context.get('active_ids', []) |
|
46 |
||
47
by Andhitia Rama
Revisi wizard batch change account |
47 |
wizard = self.browse(cr, uid, ids)[0] |
48 |
||
42
by Andhitia Rama
Penambahan Wizard Batch Change Account |
49 |
res = {} |
50 |
||
51 |
||
52 |
if account_ids: |
|
53 |
if wizard.flag_currency_id: |
|
54 |
res.update({'currency_id' : wizard.currency_id.id}) |
|
55 |
||
56 |
if wizard.flag_account_type_id: |
|
57 |
res.update({'user_type' : wizard.account_type_id.id}) |
|
58 |
||
47
by Andhitia Rama
Revisi wizard batch change account |
59 |
if wizard.flag_parent_id: |
60 |
res.update({'parent_id' : wizard.parent_id.id}) |
|
61 |
||
62 |
if wizard.flag_reconcile: |
|
63 |
res.update({'reconcile' : wizard.reconcile}) |
|
64 |
||
65 |
if wizard.flag_type: |
|
66 |
res.update({'type' : wizard.type}) |
|
67 |
||
42
by Andhitia Rama
Penambahan Wizard Batch Change Account |
68 |
obj_account.write(cr, uid, account_ids, res) |
69 |
||
70 |
||
71 |
return True |
|
72 |
||
73 |
||
74 |
wizard_batch_change_account() |
|
75 |
||
76 |
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
77 |