2 I configure automatically if the country is set on the company, mainly for online offers.
4 !python {model: account.installer}: |
5 modules = self.pool.get('ir.module.module')
6 wizards = self.pool.get('ir.actions.todo')
7 wiz = wizards.browse(cr, uid, ref('account.account_configuration_installer_todo'))
8 part = self.pool.get('res.partner').browse(cr, uid, ref('base.main_partner'))
9 # if we know the country and the wizard has not yet been executed, we do it
10 if (part.country_id.id) and (wiz.state=='open'):
11 mod = 'l10n_'+part.country_id.code.lower()
12 ids = modules.search(cr, uid, [ ('name','=',mod) ], context=context)
14 wizards.write(cr, uid, [ref('account.account_configuration_installer_todo')], {
17 wiz_id = self.create(cr, uid, {
20 self.execute_simple(cr, uid, [wiz_id])
21 modules.state_update(cr, uid, ids,
22 'to install', ['uninstalled'], context=context)