5
# Created by Nicolas Bessi on 12.02.09.
6
# Copyright (c) 2009 CamptoCamp. All rights reserved.
8
from osv import fields, osv
10
class Tax_template(osv.osv_memory):
11
"""Creat account.journal.todo class in order
12
to add configuration wizzard"""
13
_name ="account.tax.template.todo"
14
_inherit = 'res.config'
16
def _ensure_step(self):
17
if getattr(self, '_inner_steps', None) is None:
20
def _current_tax_template(self, cr, uid):
21
ids = self.pool.get('account.tax.template').search(cr,uid,[])
22
return self.pool.get('account.tax.template').browse(
23
cr, uid, ids[self._inner_steps]
26
def _get_tax(self, cr, uid, ctx):
28
return self.pool.get('account.tax.template')\
29
.search(cr,uid,[])[self._inner_steps]
31
def _get_collected(self, cr, uid, ctx):
33
return self._current_tax_template(cr, uid).account_collected_id.id
35
def _get_paid(self, cr, uid, ctx):
37
return self._current_tax_template(cr, uid).account_paid_id.id
40
'name': fields.many2one(
41
'account.tax.template',
44
help="The tax template you are currently editing"
46
'account_collected_id':fields.many2one(
47
'account.account.template',
48
'Invoice Tax Account',
49
help="You can set here the invoice tax account"
51
'account_paid_id':fields.many2one(
52
'account.account.template',
54
help="You can set here the refund tax account"
60
'account_collected_id': _get_collected,
61
'account_paid_id': _get_paid,
64
def _on_change(self, cr, uid, id, tax, vals):
66
self.pool.get('account.tax.template').write(cr, uid, tax, vals=vals)
69
def on_change_collected(self, cr, uid, ids, tax, account):
70
return self._on_change(cr, uid, ids, tax, vals={'account_collected_id': account})
72
def on_change_paid(self, cr, uid, id, tax, account):
73
return self._on_change(
74
cr, uid, id, tax, vals={'account_paid_id': account})
76
def execute(self,cr,uid,ids,context={}):
77
jids = self.pool.get('account.tax.template').search(cr, uid, [])
78
if self._inner_steps < len(jids)-1 :
79
self._inner_steps += 1
83
'res_model': 'account.tax.template.todo',
84
'view_id':self.pool.get('ir.ui.view').search(
85
cr, uid, [('name','=','account.tax.template.todo')]),
86
'type': 'ir.actions.act_window',
91
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: