40
39
ctx['update_mode'] = mode
41
40
return super(ir_model_data, self)._update(cr, uid, model, module, values, xml_id, store, noupdate, mode, res_id, ctx)
43
def patch13_install_export_import_lang(self, cr, uid, *a, **b):
44
mod_obj = self.pool.get('ir.module.module')
45
mod_ids = mod_obj.search(cr, uid, [('name', '=', 'export_import_lang')])
46
if mod_ids and mod_obj.read(cr, uid, mod_ids, ['state'])[0]['state'] == 'uninstalled':
47
mod_obj.write(cr, uid, mod_ids[0], {'state': 'to install'})
51
44
class account_installer(osv.osv_memory):
56
49
'charts': 'msf_chart_of_account',
59
# Fix for UF-768: correcting fiscal year and name
60
def execute(self, cr, uid, ids, context=None):
61
super(account_installer, self).execute(cr, uid, ids, context=context)
62
# Retrieve created fiscal year
63
fy_obj = self.pool.get('account.fiscalyear')
64
for res in self.read(cr, uid, ids, context=context):
65
if 'date_start' in res and 'date_stop' in res:
66
f_ids = fy_obj.search(cr, uid, [('date_start', '<=', res['date_start']), ('date_stop', '>=', res['date_stop']), ('company_id', '=', res['company_id'])], context=context)
69
new_name = "FY " + res['date_start'][:4]
70
new_code = "FY" + res['date_start'][:4]
71
if int(res['date_start'][:4]) != int(res['date_stop'][:4]):
72
new_name = "FY " + res['date_start'][:4] +'-'+ res['date_stop'][:4]
73
new_code = "FY" + res['date_start'][2:4] +'-'+ res['date_stop'][2:4]
78
fy_obj.write(cr, uid, f_ids, vals, context=context)
81
52
account_installer()
96
67
ret = super(base_setup_company, self).default_get(cr, uid, fields_list, context)
97
68
if not ret.get('name'):
98
69
ret.update({'name': 'MSF', 'street': 'Rue de Lausanne 78', 'street2': 'CP 116', 'city': 'Geneva', 'zip': '1211', 'phone': '+41 (22) 849.84.00'})
99
company = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id
100
ret['name'] = company.name
101
addresses = self.pool.get('res.partner').address_get(cr, uid, company.id, ['default'])
102
default_id = addresses.get('default', False)
105
address = self.pool.get('res.partner.address').browse(cr, uid, default_id, context=context)
106
for field in ['street','street2','zip','city','email','phone']:
107
ret[field] = address[field]
108
for field in ['country_id','state_id']:
110
ret[field] = address[field].id
112
70
cur = self.pool.get('res.currency').search(cr, uid, [('name','=','EUR')])
113
if company.currency_id:
114
ret['currency'] = company.currency_id.id
116
72
ret['currency'] = cur[0]
118
fp = tools.file_open(opj('msf_profile', 'data', 'msf.jpg'), 'rb')
73
country = self.pool.get('res.country').search(cr, uid, [('name','=','Switzerland')])
75
ret['country_id'] = country[0]
76
fp = tools.file_open(opj('msf_profile', 'data', 'msf.jpg'))
119
77
ret['logo'] = base64.encodestring(fp.read())
123
81
base_setup_company()
125
class res_users(osv.osv):
126
_inherit = 'res.users'
129
def _get_default_ctx_lang(self, cr, uid, context=None):
130
config_lang = self.pool.get('unifield.setup.configuration').get_config(cr, uid).lang_id
133
if self.pool.get('res.lang').search(cr, uid, [('translatable','=',True), ('code', '=', 'en_MF')]):
138
'context_lang': _get_default_ctx_lang,