Browse Source

[MRG] From last LP trunk

(lp:c2c-addons/6.1  rev 13)
pull/78/head
Joël Grand-Guillaume 13 years ago
parent
commit
e14eb006b0
  1. 21
      server_env_base_external_referentials/__init__.py
  2. 45
      server_env_base_external_referentials/__openerp__.py
  3. 47
      server_env_base_external_referentials/base_external_referentials.py

21
server_env_base_external_referentials/__init__.py

@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Guewen Baconnier. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import base_external_referentials

45
server_env_base_external_referentials/__openerp__.py

@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Guewen Baconnier. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name": "Server environment for base_external_referential",
"version": "1.0",
"depends": ["base", 'server_environment', 'base_external_referentials'],
"author": "Camptocamp",
"description": """This module is based on the server_environment module to use files for configuration.
Thus we can have a different file for each environment (dev, test, staging, prod).
This module define the config variables for the base_external_referential module.
In the configuration file, you can configure the url, login and password of the referentials
Exemple of the section to put in the configuration file :
[external_referential.name_of_my_external_referential]
location = http://localhost/magento/
apiusername = my_api_login
apipass = my_api_password
""",
"website": "http://www.camptocamp.com",
"category": "Tools",
"init_xml": [],
"demo_xml": [],
"update_xml": [],
"installable": True,
"active": False,
}

47
server_env_base_external_referentials/base_external_referentials.py

@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# Author Guewen Baconnier. Copyright Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from server_environment import serv_config
class external_referential(osv.osv):
_inherit = 'external.referential'
def _get_environment_config_by_name(self, cr, uid, ids, field_names, arg, context):
values = {}
for referential in self.browse(cr, uid, ids, context):
values[referential.id] = {}
for field_name in field_names:
section_name = '.'.join((self._name.replace('.', '_'), referential.name))
value = serv_config.get(section_name, field_name)
values[referential.id].update({field_name: value})
return values
_columns = {
'location': fields.function(_get_environment_config_by_name, type='char', size=200,
method=True, string='Location', multi='connection_config'),
'apiusername': fields.function(_get_environment_config_by_name, type='char', size=64,
method=True, string='User Name', multi='connection_config'),
'apipass': fields.function(_get_environment_config_by_name, type='char', size=64,
method=True, string='Password', multi='connection_config'),
}
external_referential()
Loading…
Cancel
Save