Skip to main content
 首页 » 编程设计

python之PO 中的 OpenERP V7 自定义

2025年05月04日7lautakyan007

我是 OpenERP V7 Customization 的新手,我需要一些基本的帮助。 在采购订单窗口中单击“添加项目”时如何显示弹出屏幕(表单 View )而不是 GridView 来输入数据。

请查看以下屏幕截图:

GridView

弹出屏幕(表单 View )

请您参考如下方法:

如果您是通过代码进行操作,则在 purchase_view.xml 中更新添加此记录。

<record id="purchase_order_form_inherit" model="ir.ui.view"> 
    <field name="name">purchase.order.form.inherit</field> 
    <field name="model">purchase.order</field> 
    <field name="inherit_id" ref="purchase.purchase_order_form" /> 
    <field name="arch" type="xml"> 
        <xpath expr="//field[@name='order_line']/tree" position='replace'> 
            <tree string="Purchase Order Lines"> 
                <field name="product_id" 
                    on_change="onchange_product_id(parent.pricelist_id,product_id,0,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,context)" /> 
                <field name="name" /> 
                <field name="date_planned" /> 
                <field name="company_id" groups="base.group_multi_company" 
                    widget="selection" /> 
                <field name="account_analytic_id" groups="purchase.group_analytic_accounting" 
                    domain="[('type','not in',('view','template'))]" /> 
                <field name="product_qty" 
                    on_change="onchange_product_id(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,context)" /> 
                <field name="product_uom" groups="product.group_uom" 
                    on_change="onchange_product_uom(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,context)" /> 
                <field name="price_unit" /> 
                <field name="taxes_id" widget="many2many_tags" 
                    domain="[('parent_id','=',False),('type_tax_use','!=','sale')]" /> 
                <field name="price_subtotal" /> 
            </tree> 
        </xpath> 
    </field> 
</record> 

或者激活开发者模式,Edit form view and find for

<tree string="Purchase Order Lines" editable="bottom"> 

并将其替换为

<tree string="Purchase Order Lines"> 

它会起作用。