OpenERP按钮操作是在mrp\U bom表中插入/更新记录,但它应该

2024-04-19 10:45:24 发布

您现在位置:Python中文网/ 问答频道 /正文

我已经添加了按钮“搜索”到我的自定义,新的看法。每当我单击“搜索”时,一条记录就会插入或更新到mrp\U bom表中。我找不到原因。我想现在这个按钮什么也没用。你知道吗

以下是py中的代码:

class mrp_bom(osv.Model):
    _inherit = 'mrp.bom'

    def action_search(self, cr, uid, ids, vals, context=None):
        ptemplid = self.browse(cr, uid, ids[0], context=context).product_tmpl_id
        print "\n\n Inside action_search() ptemplid ", ptemplid  

下面是xml:

  <record id="bom_where_use_form" model="ir.ui.view">
        <field name="name">bom.where.use.form</field>
        <field name="model">mrp.bom</field>
        <field name="priority" eval="20"/>
        <field name="type">form</field>
        <field name="arch" type="xml">
            <label for="product_tmpl_id" string="Product Name" />
            <field name="product_tmpl_id" on_change="onchange_product_tmpl_id(product_tmpl_id, 0, context)"/> 
            <button name="action_search" string="Search" type="object" class="oe_highlight"/>
        </field>         
    </record> 

Tags: nameformidfieldsearchtypemrpcontext
1条回答
网友
1楼 · 发布于 2024-04-19 10:45:24

每当执行按钮操作时,它首先保存记录。因此,如果记录是新的,则将执行create方法,否则将对该记录执行write函数。然后只执行按钮操作。你知道吗

相关问题 更多 >