不管我用<model>.py fi做什么,Odoo的XML什么都不会发生

2024-05-20 21:36:54 发布

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

我一直想做的是编辑制造模块的“树视图”。我想把“产品数量”添加到这个视图中,以便更容易地看到细节。我试图编辑xml,但我不能简单地添加列,因为它不是模型的一部分,但它们彼此相关。你知道吗

以下是xml文件:

<?xml version="1.0"?>
<tree decoration-bf="message_needaction==True" decoration-info="state in ('draft','confirmed')" decoration-danger="date_planned&lt;current_date and state not in ('done','cancel')" decoration-muted="state in ('done','cancel')" string="Manufacturing Orders">
                    <field name="message_needaction" invisible="1"/>
                    <field name="name"/>
                    <field name="date_planned"/>
                    <field name="product_id"/>
                    <field name="product_qty" sum="Total Qty"/>
                    <field name="product_uom" options="{'no_open':True,'no_create':True}" groups="product.group_uom"/>
                    <field name="routing_id" groups="mrp.group_mrp_routings"/>
                    <field name="hour_total" sum="Total Hours"/>
                    <field name="cycle_total" sum="Total Cycles"/>
                    <field name="origin"/>
                    <field name="state"/>
                </tree>

我试着编辑基于Python的文件物料需求计划其中包含模型的列,但不幸的是什么都没有发生。我甚至尝试删除文件中的所有代码,但在刷新制造模块的页面后,没有任何更改。你知道吗

上述代码的基本模型是“mrp生产“这与”库存.移动“<;—包含产品的计量单位数量。你知道吗


Tags: 文件namein模型true编辑fielddate
1条回答
网友
1楼 · 发布于 2024-05-20 21:36:54

对于odoo,这不是一个有效的xml,其中是标记<openerp> <data>,树应该在<record>标记中,如果您将此文件放入模型中,并且没有得到任何错误,那么您没有将其添加到数据中的__openerp__.py:‘your\xml’_文件.xml'

<openerp>
    <data>
           <record id="tree_id" model="ir.ui.view">
                <field name="model">model.name.here</field>
                <field name="priority" eval="0"/><!  this tree will be the default tree for the model   >
                <field name="arch" type="xml">
                    <tree >
                        <field name="field_name"/>
                        <field name="field_name"/>
                    </tree>
                </field>
            </record>
    </data>
</openerp>

你应该把这个文件添加到__openepr__.py

相关问题 更多 >