当前位置: 首页>>代码示例>>Python>>正文


Python request.env方法代码示例

本文整理汇总了Python中openerp.http.request.env方法的典型用法代码示例。如果您正苦于以下问题:Python request.env方法的具体用法?Python request.env怎么用?Python request.env使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openerp.http.request的用法示例。


在下文中一共展示了request.env方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: verify_data

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def verify_data(self, **post):
        if not post:
            return False
        else:
            isSign = self.getSignVeryfy(**post)
            responseTxt = 'false'
            if post['notify_id']:
                responseTxt = self.getResponse(post['notify_id'])
            #??
            #$responsetTxt?????true???????????????ID?notify_id???????
            #isSign?????true??????????????????????????????????
            if responseTxt== 'true' and isSign:
                res = request.env['payment.transaction'].sudo().form_feedback(post,'alipay')
                return True
            else:
                return False 
开发者ID:Primary-Traxex,项目名称:odooalipay,代码行数:18,代码来源:main.py

示例2: all_books_mark_mine

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def all_books_mark_mine(self):
        records = request.env['library.book'].sudo().search([])
        result = '<html><body><table>'
        for record in records:
            result += '<tr>'
            if record.author_ids & request.env.user.partner_id:
                result += '<th>'
            else:
                result += '<td>'
            result += record.name
            if record.author_ids & request.env.user.partner_id:
                result += '</th>'
            else:
                result += '</td>'
            result += '</tr>'
        result += '</table></body></html>'
        return result 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:19,代码来源:main.py

示例3: website_info

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def website_info(self):
        try:
            request.website.get_template('website.info').name
        except Exception, e:
            return request.registry['ir.http']._handle_exception(e, 404)
        irm = request.env()['ir.module.module'].sudo()
        apps = irm.search([('state','=','installed'),('application','=',True)])
        modules = irm.search([('state','=','installed'),('application','=',False)])
        values = {
            'apps': apps,
            'modules': modules,
            'version': openerp.service.common.exp_version()
        }
        return request.render('website.info', values)

    #------------------------------------------------------
    # Edit
    #------------------------------------------------------ 
开发者ID:osbzr,项目名称:gooderp_org,代码行数:20,代码来源:main.py

示例4: icalendar_public

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def icalendar_public(self, partner=None, **post):
        if partner:
            #~ raise Warning("Public successfull %s" % partner.get_ics_calendar(type='public').to_ical())
            #~ return partner.sudo().get_ics_calendar(type='public')
            document = request.env['res.partner'].sudo().browse(partner).get_ics_calendar(type='public')
            return request.make_response(
                document,
                headers=[
                    ('Content-Disposition', 'attachment; filename="public.ics"'),
                    ('Content-Type', 'text/calendar'),
                    ('Content-Length', len(document)),
                ]
            )
        else:
            raise Warning("Public failed")
            pass # Some error page 
开发者ID:vertelab,项目名称:odoo-calendar,代码行数:18,代码来源:res_partner.py

示例5: get_ics_events

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def get_ics_events(self):
        if (self.ics_url):
            try:
                res = urllib2.urlopen(self.ics_url).read()
            except urllib2.HTTPError as e:
                _logger.error('ICS a %s %s' % (e.code, e.reason))
                return False
            except urllib2.URLError as e:
                _logger.error('ICS c %s %s' % (e.code, e.reason))
                return False
            _logger.debug('ICS %s' % res)

            self.env['calendar.event'].search(['&',('partner_ids','in',self.id),('ics_subscription','=',True)]).unlink()
            #~ for event in self.env['calendar.event'].search([('ics_id','=',self.id)]):
                #~ event.unlink()
                
            self.env['calendar.event'].set_ics_event(res, self) 
开发者ID:vertelab,项目名称:odoo-calendar,代码行数:19,代码来源:res_partner.py

示例6: get_pricelist

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def get_pricelist():
    sale_order = request.env.context.get('sale_order')
    if sale_order:
        pricelist = sale_order.pricelist_id
    else:
        partner = request.env.user.partner_id
        pricelist = partner.property_product_pricelist
    return pricelist 
开发者ID:pledra,项目名称:odoo-product-configurator,代码行数:10,代码来源:main.py

示例7: get_cfg_session

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def get_cfg_session(self, product_tmpl, force_create=False):
        """Retrieve the product.config.session from backend holding all the
        configuration data stored so far by this user for the designated
        product template object"""

        public_user_id = request.env.ref('base.public_user').id

        cfg_session_obj = request.env['product.config.session']

        domain = [
            ('product_tmpl_id', '=', product_tmpl.id),
            ('user_id', '=', request.env.user.id),
            ('website', '=', True),
            ('state', '=', 'draft')
        ]

        if request.env.uid == public_user_id:
            domain.append(('session_id', '=', request.session.sid))

        cfg_session = cfg_session_obj.search(domain)

        if not cfg_session and force_create:
            vals = {
                'product_tmpl_id': product_tmpl.id,
                'user_id': request.env.user.id,
                'website': True
            }

            if request.env.uid == public_user_id:
                vals.update(session_id=request.session.sid)

            cfg_session = cfg_session_obj.sudo().create(vals)

        return cfg_session 
开发者ID:pledra,项目名称:odoo-product-configurator,代码行数:36,代码来源:main.py

示例8: getResponse

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def getResponse(self,notify_id):
        # provider = request.env['payment.acquirer'].search([('provider','=','alipay')])
        # partner = provider.alipay_partner
        # transport = provider.alipay_transport
        # veryfy_url = ''
        # if transport == 'https':
        #     veryfy_url = self.https_verify_url
        # else:
        #     veryfy_url = self.http_verify_url
        # partner = request.env['payment.acquirer'].search([('provider','=','alipay')],limit=1).alipay_partner
        veryfy_url = self.https_verify_url
        partner = '2088211834350245'
        veryfy_url += 'partner='+partner+'&notify_id='+notify_id
        resp = urllib2.urlopen(veryfy_url)
        data = resp.read()
        resp.close()
        return data 
开发者ID:Primary-Traxex,项目名称:odooalipay,代码行数:19,代码来源:main.py

示例9: all_books

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def all_books(self):
        records = request.env['library.book'].sudo().search([])
        result = '<html><body><table><tr><td>'
        result += '</td></tr><tr><td>'.join(records.mapped('name'))
        result += '</td></tr></table></body></html>'
        return result 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:8,代码来源:main.py

示例10: all_books_mine

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def all_books_mine(self):
        records = request.env['library.book'].search([
            ('author_ids', 'in', request.env.user.partner_id.ids),
        ])
        result = '<html><body><table><tr><td>'
        result += '</td></tr><tr><td>'.join(records.mapped('name'))
        result += '</td></tr></table></body></html>'
        return result 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:10,代码来源:main.py

示例11: to_python

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def to_python(self, value):
        result = request.env[self.model].browse(
            map(lambda x: x[0], request.env[self.model].sudo().name_search(
                value.replace('+', ' '), operator='=ilike', limit=1)))
        if not result:
            raise werkzeug.exceptions.NotFound()
        return result 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:9,代码来源:ir_http.py

示例12: book_details

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def book_details(self, book_id):
        record = request.env['library.book'].sudo().browse(int(book_id))
        return '<html><body><h1>%s</h1>Authors: %s' % (
            record.name,
            ', '.join(record.author_ids.mapped('name')) or 'none',
        ) 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:8,代码来源:main.py

示例13: books_json

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def books_json(self):
        records = request.env['library.book'].sudo().search([])
        return records.read(['name']) 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:5,代码来源:main.py

示例14: route

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def route(self):
        return request.render(
            'ch14_r02_creating_or_modifying_templates.books',
            {
                'books': request.env['library.book'].search([]),
            }) 
开发者ID:PacktPublishing,项目名称:Odoo-Development-Cookbook,代码行数:8,代码来源:main.py

示例15: send

# 需要导入模块: from openerp.http import request [as 别名]
# 或者: from openerp.http.request import env [as 别名]
def send(self, channel, message):
        if not isinstance(channel, basestring):
            raise Exception("bus.Bus only string channels are allowed.")
        return request.env['bus.bus'].sendone(channel, message)

    # override to add channels 
开发者ID:adaptivdesign,项目名称:odooku-compat,代码行数:8,代码来源:main.py


注:本文中的openerp.http.request.env方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。