[IMP] Account: installer code clean
bzr revid: mra@mra-laptop-20100813041251-907ivapveulkodhg
This commit is contained in:
parent
9c19076d09
commit
4a39261bfe
|
@ -18,11 +18,13 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from os.path import join as opj
|
||||
from operator import itemgetter
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
import netsvc
|
||||
|
@ -84,11 +86,6 @@ class account_installer(osv.osv_memory):
|
|||
return {}
|
||||
|
||||
def generate_configurable_chart(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id)
|
||||
|
||||
obj_acc = self.pool.get('account.account')
|
||||
obj_acc_tax = self.pool.get('account.tax')
|
||||
obj_journal = self.pool.get('account.journal')
|
||||
|
@ -97,6 +94,14 @@ class account_installer(osv.osv_memory):
|
|||
obj_fiscal_position_template = self.pool.get('account.fiscal.position.template')
|
||||
obj_fiscal_position = self.pool.get('account.fiscal.position')
|
||||
data_pool = self.pool.get('ir.model.data')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'account', 'configurable_chart_template')
|
||||
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
|
||||
obj_multi = self.pool.get('account.chart.template').browse(cr, uid, id)
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id
|
||||
seq_journal = True
|
||||
|
||||
|
@ -386,10 +391,12 @@ class account_installer(osv.osv_memory):
|
|||
obj_ac_fp.create(cr, uid, vals_acc)
|
||||
|
||||
def execute(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
super(account_installer, self).execute(cr, uid, ids, context=context)
|
||||
record = self.browse(cr, uid, ids, context=context)[0]
|
||||
company_id = self.pool.get('res.users').browse(cr,uid,[uid],context)[0].company_id
|
||||
for res in self.read(cr,uid,ids):
|
||||
company_id = self.pool.get('res.users').browse(cr, uid, [uid], context)[0].company_id
|
||||
for res in self.read(cr, uid, ids):
|
||||
if record.charts == 'configurable':
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
fp = tools.file_open(opj('account','configurable_account_chart.xml'))
|
||||
|
@ -482,17 +489,16 @@ class account_installer(osv.osv_memory):
|
|||
'Installing chart of accounts %s'%chart)
|
||||
return modules | set([chart])
|
||||
|
||||
|
||||
account_installer()
|
||||
|
||||
class account_bank_accounts_wizard(osv.osv_memory):
|
||||
_name='account.bank.accounts.wizard'
|
||||
|
||||
_columns = {
|
||||
'acc_name':fields.char('Account Name.', size=64, required=True),
|
||||
'bank_account_id':fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
|
||||
'currency_id':fields.many2one('res.currency', 'Currency'),
|
||||
'account_type':fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
|
||||
'acc_name': fields.char('Account Name.', size=64, required=True),
|
||||
'bank_account_id': fields.many2one('wizard.multi.charts.accounts', 'Bank Account', required=True),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency'),
|
||||
'account_type': fields.selection([('cash','Cash'),('check','Check'),('bank','Bank')], 'Type', size=32),
|
||||
}
|
||||
_defaults = {
|
||||
'currency_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.currency_id.id,
|
||||
|
|
Loading…
Reference in New Issue