2
0

[IMP] small improvement : calling reopen method in action_init + indentation

This commit is contained in:
Invitu 2013-10-18 06:44:19 -10:00 committed by Luis J. Salvatierra
parent dcfd81d0e1
commit 83c5c74a7a

View File

@ -98,7 +98,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
'state': fields.selection([
('init', 'Step 1'),
('ready', 'Step 2'),
('done', 'Wizard Complete')
('done', 'Wizard completed')
], 'Status', readonly=True),
'company_id': fields.many2one('res.company', 'Company', required=True, ondelete='set null'),
'chart_template_id': fields.many2one('account.chart.template', 'Chart Template', required=True, ondelete='set null'),
@ -125,9 +125,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
'updated_fps': fields.integer('Updated fiscal positions', readonly=True),
'log': fields.text('Messages and Errors', readonly=True)
}
"""
Redefine the search to search by company name.
"""
def name_search(self, cr, user, name,
args=None, operator='ilike', context=None, limit=80):
if not name:
@ -183,20 +181,16 @@ class wizard_update_charts_accounts(orm.TransientModel):
if not company_id:
user = self.pool.get('res.users').browse(cr, uid, uid, context)
company_id = user.company_id.id
property_ids = property_obj.search(
cr,
uid,
[('name', '=', 'property_account_receivable'),
property_ids = property_obj.search(cr, uid, [
('name', '=', 'property_account_receivable'),
('company_id', '=', company_id),
('res_id', '=', False),
('value_reference', '!=', False)
])
if not property_ids:
# Try to get a generic (no-company) property
property_ids = property_obj.search(
cr,
uid,
[('name', '=', 'property_account_receivable'),
property_ids = property_obj.search(cr, uid, [
('name', '=', 'property_account_receivable'),
('res_id', '=', False),
('value_reference', '!=', False)
])
@ -205,7 +199,6 @@ class wizard_update_charts_accounts(orm.TransientModel):
prop = property_obj.browse(
cr, uid, property_ids[0], context=context)
account_id = prop.value_reference.id
if account_id:
code = account_obj.read(
cr, uid, account_id, ['code'], context)['code']
@ -231,11 +224,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
def onchange_company_id(self, cr, uid, ids, company_id, context=None):
res = {
'value': {
'code_digits': self._get_code_digits(
cr,
uid,
context=context,
company_id=company_id),
'code_digits': self._get_code_digits(cr, uid, context=context, company_id=company_id),
}
}
return res
@ -248,22 +237,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
context = {}
wizard = self.browse(cr, uid, ids[0], context=context)
self.write(cr, uid, ids, {'state': 'init'}, context)
view_wizard = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'account_chart_update', 'view_update_multi_chart')
view_wizard_id = view_wizard and view_wizard[1] or False,
res = {
'type': 'ir.actions.act_window',
'name': _("Update Chart of Accounts from a Chart Template "),
'res_model': 'wizard.update.charts.accounts',
'view_type': 'form',
'view_mode': 'form',
'res_id': wizard.id,
'view_id': view_wizard_id,
'context': context,
'target': 'new',
}
return res
return True
return _reopen(self, wizard.id, 'wizard.update.chart.accounts')
##########################################################################
# Helper methods
@ -401,9 +375,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
'updated': updated_tax_codes,
'mapping': tax_code_template_mapping
}
"""
Search for, and load, tax templates to create/update.
"""
def _find_taxes(self, cr, uid, wizard, context=None):
new_taxes = 0
updated_taxes = 0
@ -924,8 +896,7 @@ class wizard_update_charts_accounts(orm.TransientModel):
if children_ids:
try:
account_account.write(cr, uid, children_ids, {'parent_id':
parent_account.id}, context=context)
account_account.write(cr, uid, children_ids, {'parent_id': parent_account.id}, context=context)
except orm.except_orm, ex:
log.add(_("Exception setting the parent of account %s children: %s - %s.\n") % (parent_account.code, ex.name, ex.value), True)