OpenERP中的看板视图

时间:2012-04-04 05:15:33

标签: openerp kanban

如何在OpenERP中创建看板视图?

developer book似乎没有关于新看板视图的任何信息,我在OpenERP forum中看不到任何有用的信息。

4 个答案:

答案 0 :(得分:7)

以下是展示如何在OpenERP中开发看板视图的示例代码。

对于看板视图,您必须准备2个文件:(1)xml文件和(2)css文件。 CSS文件用于形成看板视图。

<record model="ir.ui.view" id="resource_kanban_view">
    <field name="name">any name of ur  model</field>
    <field name="model">object.name</field>
    <field name="type">kanban</field>
    <field name="arch" type="xml">
        <kanban>
            <templates>
                <t t-name="kanban-box">
                    <div class="oe_resource_vignette">
                        <div class="oe_resource_image">
                            <a type="edit"><img t-att-src="kanban_image('object.name', 'photo', record.id.value)" class="oe_resource_picture"/></a>
                        </div>
                        <div class="oe_resource_details">
                            <ul>
<!--Here you have to write the object's field name which you want to display in kanban view -->
                               <li><field name="name"/></li>
                               <li><field name="author"/></li>
                               <li><field name="description"/></li>
                               <li><field name="available_copy"/> </li>                                   
                             </ul>
                        </div>
                    </div>                       
                </t>
            </templates>
        </kanban>
    </field>
</record>

答案 1 :(得分:4)

他们就是Doc,KANBAN视图是基于QWEB技术创建的,由OF本身开发,你可以看到整个lib QWEB lib,在Doc Section下你可以看到如何定义qWeb {{ 3}},现在,如果您理解它,那么您只需要在视图声明中的标记下输出您的Web模板,其中其他系统与通用视图声明相同:

   <record model="ir.ui.view" id="view_external_id">
        <field name="name">View Name</field>
        <field name="model">openerp.modelfield>
        <field name="type">kanban</field>
        <field name="arch" type="xml"> 
             <kanban>
                <field name="color"/>
                <!--list of field to be loaded -->
                <field name="list_price"/>
                <templates>
                     <!--Your Qweb based template goes here, each record will be wrapped in template so you can arrange field veyr easily in box -->
                </templates>
            </kanban>
        </field>
    </record>

希望这会对你有所帮助。

此致

答案 2 :(得分:2)

我还没有看到任何文档,所以你能做的最好的事情就是在插件项目中寻找示例。搜索<kanban>的所有XML文件。以下是stock module

的示例
    <record model="ir.ui.view" id="product.product_kanban_view">
        <field name="name">Product Kanban</field>
        <field name="model">product.product</field>
        <field name="type">kanban</field>
        <field name="arch" type="xml">
            <kanban>
                <field name="color"/>
                <field name="type"/>
                <field name="product_image"/>
                <field name="list_price"/>
                <templates>
                    <t t-name="kanban-box">
                        <div class="oe_product_vignette">
                            <div class="oe_product_img">
                            <a type="edit"><img t-att-src="kanban_image('product.product', 'product_image', record.id.value)" class="oe_product_photo"/></a>
                            </div>
                            <div class="oe_product_desc">
                                <h4><a type="edit"><field name="name"></field></a></h4>
                                <ul>
                                    <li t-if="record.type.raw_value != 'service'">Stock on hand: <field name="qty_available"/> <field name="uom_id"/></li>
                                    <li t-if="record.type.raw_value != 'service'">Stock available: <field name="virtual_available"/> <field name="uom_id"/></li>
                                    <li>Price: <field name="lst_price"></field></li>
                                    <li>Cost: <field name="standard_price"></field></li>
                                </ul>
                            </div>
                        </div>
                        <script>
                            $('.oe_product_photo').load(function() { if($(this).width() > $(this).height()) { $(this).addClass('oe_product_photo_wide') } });
                        </script>
                        <div></div>
                    </t>
                </templates>
            </kanban>
        </field>
    </record>

答案 3 :(得分:-2)

只需在xml文件中使用view_mode更新此模型=“ir.actions.act_window”,如:

      <record id="action_id" model="ir.actions.act_window">
        <field name="name">Name1</field>
        <field name="type">ir.actions.act_window</field>
        <field name="res_model">model_name</field>
        <field name="view_type">form</field>
        <field name="view_mode">kanban,tree,form,calendar,graph,gantt</field>
.....
</record>

这是如何调用所有视图的方式,链接http://www.slideshare.net/openobject/openerp-61-framework-changes将帮助您创建看板视图。 我希望它能帮到你......

相关问题