Odoo 도움말

0

0
6 응답
0
ANDERSON SARAIVA United Kingdom
19. 8. 26. 오후 1:10

Following workround might be helpful to check if is "production" or "local":

def _check_environment_is_production(self):
web_base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
localhost_names = ['localhost']
return False if not web_base_url or any(x in web_base_url for x in localhost_names) else True
0
Avatar

subbarao India

--subbarao--

1400
| 5 3 8
Chennai, India
--subbarao--


subbarao India
19. 2. 27. 오후 10:42

Try this one

from openerp import api, models

_logger = logging.getLogger(__name__)

import xmlrpclib


class TestConnection(models.Model):

    _name = "test.connection"   


    @api.model

    def check_connection(self):        

        url = url

        db = db_name

        username = db_user

        password = db_password

        try:

            common = xmlrpclib.ServerProxy('{}/xmlrpc/2/common'.format(url))

            common.version()

            ### connection established, do your logic

        except:

            _logger.warning('*********Unable to connect the server ***********')

            ### connection Failed


0
arthur 브라질
19. 2. 27. 오후 1:07

Does anyone have an answer for this?

질문하기
Writer
Keep Informed
1 팔로워
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now