- dic['res_id'] = False
-
- if dic['type'] == 'model' and not strict:
- (model, field) = dic['name'].split(',')
-
- # get the ids of the resources of this model which share
- # the same source
- obj = pool.get(model)
- if obj:
- if field not in obj.fields_get_keys(cr, uid):
- continue
- ids = obj.search(cr, uid, [(field, '=', dic['src'])])
-
- # if the resource id (res_id) is in that list, use it,
- # otherwise use the whole list
- if not ids:
- ids = []
- ids = (dic['res_id'] in ids) and [dic['res_id']] or ids
- for id in ids:
- dic['res_id'] = id
- ids = trans_obj.search(cr, uid, [
- ('lang', '=', lang),
- ('type', '=', dic['type']),
- ('name', '=', dic['name']),
- ('src', '=', dic['src']),
- ('res_id', '=', dic['res_id'])
- ])
- if ids:
- if context.get('overwrite', False):
- trans_obj.write(cr, uid, ids, {'value': dic['value']})
- else:
- trans_obj.create(cr, uid, dic)