Python 在OpenERP中,单击一次在新选项卡中打开URL后,按钮被禁用
单击按钮绿色箭头后,它将在新的浏览器选项卡中启动一个url,这是所需的行为,但按钮本身将被禁用。当我右键单击禁用按钮,然后选择Inspect Element时,我看到:Python 在OpenERP中,单击一次在新选项卡中打开URL后,按钮被禁用,python,openerp,odoo,Python,Openerp,Odoo,单击按钮绿色箭头后,它将在新的浏览器选项卡中启动一个url,这是所需的行为,但按钮本身将被禁用。当我右键单击禁用按钮,然后选择Inspect Element时,我看到: <button disabled="disabled" type="button" class="" title="Go!"> 我在openerp 7中遇到了同样的问题 但是: 如果你把按钮放在树上,它就不起作用了。如果你把它放在表单上,它在没有自动禁用的情况下工作 这是因为修复了一个bug: 您好,您找到这个问题
<button disabled="disabled" type="button" class="" title="Go!">
我在openerp 7中遇到了同样的问题 但是: 如果你把按钮放在树上,它就不起作用了。如果你把它放在表单上,它在没有自动禁用的情况下工作 这是因为修复了一个bug:
您好,您找到这个问题的解决方案了吗?我也有同样的要求。如果你已经找到了解决方案,一定要告诉我。
<!-- mrp_bom -->
<record id="adamson_mrp_bom_form_view" model="ir.ui.view">
<field name="name">adamson.mrp.bom.form.view</field>
<field name="model">mrp.bom</field>
<field name="type">form</field>
<field name="inherit_id" ref="mrp.mrp_bom_form_view" />
<field name="arch" type="xml">
<xpath expr="//notebook/page[@string='Components']/field/tree[@string='Components']/field[@name='sequence']" position="before" >
<field name="flag_bom_present" invisible="1" />
<button class="oe_inline oe_stat_button" type="object" readonly="0" string="Go!" icon="gtk-go-forward" name="action_go"
attrs="{'invisible':[('flag_bom_present','=',False)]}" />
</xpath>
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'}
return True