mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-19 09:53:38 -06:00
39 lines
1.6 KiB
Python
39 lines
1.6 KiB
Python
# -*- encoding: utf-8 -*-
|
|
##############################################################################
|
|
#
|
|
# OpenERP, Open Source Management Solution
|
|
# This module copyright (C) 2014 Savoir-faire Linux
|
|
# (<http://www.savoirfairelinux.com>).
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU Affero General Public License as
|
|
# published by the Free Software Foundation, either version 3 of the
|
|
# License, or (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
#
|
|
##############################################################################
|
|
|
|
from openerp.addons.connector.connector import (Environment,
|
|
install_in_connector)
|
|
|
|
install_in_connector()
|
|
|
|
|
|
def get_environment(session, model_name, backend_id):
|
|
""" Create an environment to work with. """
|
|
backend_record = session.browse('cmis.backend', backend_id)
|
|
env = Environment(backend_record, session, model_name)
|
|
lang = backend_record.default_lang_id
|
|
lang_code = lang.code if lang else 'en_US'
|
|
env.set_lang(code=lang_code)
|
|
return env
|
|
|
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|