如何以编程方式告诉浏览器在OpenERP中自动允许弹出窗口?

如何以编程方式告诉浏览器在OpenERP中自动允许弹出窗口?,openerp,odoo,Openerp,Odoo,当我在OpenERP(包含代码)中启动一个新窗口tab时,Firefox浏览器会阻止启动。我知道我可以在Firefox设置中允许弹出窗口,但我不想这样做。我想以编程方式告诉任何浏览器允许我自动在“新建”选项卡中启动新窗口。有什么建议吗 以下是启动新窗口的代码: class mrp_bom_line(osv.osv): _inherit = 'mrp.bom.line' def action_go(self, cr, uid, ids, context=None):

当我在OpenERP(包含代码)中启动一个新窗口tab时,Firefox浏览器会阻止启动。我知道我可以在Firefox设置中允许弹出窗口,但我不想这样做。我想以编程方式告诉任何浏览器允许我自动在“新建”选项卡中启动新窗口。有什么建议吗

以下是启动新窗口的代码:

class mrp_bom_line(osv.osv):
    _inherit = 'mrp.bom.line'

    def action_go(self, cr, uid, ids, context=None):
        bom_obj = self.pool.get('mrp.bom')
                action_obj = self.pool.get('ir.actions.act_window')
                id_s = action_obj.search(cr, uid,  [('name', '=','Bill of Materials' ), ('context', '=','{}' )])
                for rec in action_obj.browse(cr, uid, id_s, context=context):    
                        action = rec.id 
        url = '/web#id=%s&view_type=form&model=mrp.bom&action=' + str(action)
        for bom_line in self.browse(cr, uid, ids, context=context):
            if bom_line.product_id.default_code > '300':
                bom_ids = bom_obj.search(cr, uid, [('product_id', '=', bom_line.product_id.id)], context=context)
                if bom_ids:
                                        return {'type': 'ir.actions.act_url', 
                        'res_model': 'ir.actions.act_url',
                        'url':url % bom_ids[0] , 
                        'nodestroy': True, 
                        'target': 'new_tab'}


        return True

如评论中所述,弹出窗口拦截器的目的是保护web用户免受web开发人员及其侵入性弹出窗口的攻击

如果有一种方法可以禁用阻止程序,每个人都会使用它(主要用于广告目的)


因此,要回答您的问题,没有办法。

如果可以通过编程方式禁用阻止弹出窗口,则无法实现此弹出窗口阻止功能。即使您可以覆盖它,也有第三方弹出窗口阻止程序,如AdBlock,尽管这可能只是针对广告。