1 # -*- encoding: utf-8 -*-
4 # Created by Nicolas Bessi on 12.02.09.
5 # Copyright (c) 2010 CamptoCamp. All rights reserved.
8 # WARNING: This program as such is intended to be used by professional
9 # programmers who take the whole responsability of assessing all potential
10 # consequences resulting from its eventual inadequacies and bugs
11 # End users who are looking for a ready-to-use solution with commercial
12 # garantees and support are strongly adviced to contract a Free Software
14 # This program is Free Software; you can redistribute it and/or
15 # modify it under the terms of the GNU General Public License
16 # as published by the Free Software Foundation; either version 2
17 # of the License, or (at your option) any later version.
18 # This program is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 # Created by Nicolas Bessi on 12.02.09.
28 # Copyright (c) 2010 CamptoCamp. All rights reserved.
30 from osv import fields, osv
33 class TaxTemplate(osv.osv):
34 """Creat account.journal.todo class in order
35 to add configuration wizzard"""
37 _name = "account.tax.template.todo"
39 def _get_tax(self, cursor, uid, ctx):
40 """will find the standardtaxes"""
41 if not self.__dict__.has_key('_inner_steps') :
43 ids = self.pool.get('account.tax.template').search( cursor, uid, [])
44 if self._inner_steps == 'done' :
46 return ids[self._inner_steps]
49 def _get_collected(self, cursor, uid, ctx):
50 """will find the tax tempaltes for collected"""
51 if not self.__dict__.has_key('_inner_steps') :
53 if self._inner_steps == 'done' :
55 ids = self.pool.get('account.tax.template').search(cursor, uid, [])
56 resid = self.pool.get('account.tax.template').browse(
59 ids[self._inner_steps]
60 ).account_collected_id.id
64 def _get_paid(self, cursor, uid, ctx):
65 """will find the payment tax"""
66 if not self.__dict__.has_key('_inner_steps') :
68 if self._inner_steps == 'done' :
70 ids = self.pool.get('account.tax.template').search(cursor, uid, [])
71 resid = self.pool.get('account.tax.template').browse(
74 ids[self._inner_steps]
81 'name': fields.many2one(
82 'account.tax.template',
85 help="The tax template you are currently editing"
87 'account_collected_id':fields.many2one(
88 'account.account.template',
89 'Invoice Tax Account',
91 here the invoice tax account"
93 'account_paid_id':fields.many2one(
94 'account.account.template',
97 here the refund tax account"
104 'account_collected_id':_get_collected,
105 'account_paid_id':_get_paid,
108 def on_change_collected(self, cursor, uid, wizid, tax, account) :
110 self.pool.get('account.tax.template').write(
115 'account_collected_id': account,
123 def on_change_paid(self, cursor, uid, wizid, tax, account) :
125 self.pool.get('account.tax.template').write(
130 'account_paid_id': account,
137 def action_cancel(self, cursor, uid, ids, context=None):
141 'res_model': 'ir.actions.configuration.wizard',
142 'type': 'ir.actions.act_window',
146 def action_new(self, cursor, uid, ids, context=None):
147 jids = self.pool.get('account.tax.template').search(cursor, uid, [])
148 if self._inner_steps < len(jids)-1 :
149 self._inner_steps += 1
151 self._inner_steps = 'done'
155 'res_model': 'account.tax.template.todo',
156 'view_id':self.pool.get('ir.ui.view').search(
159 [('name','=','view_account_journal_form_todo')]
161 'type': 'ir.actions.act_window',
168 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: