如何在OpenERP中创建看板视图?
developer book似乎没有关于新看板视图的任何信息,我在OpenERP forum中也看不到任何有用的东西。
发布于 2012-04-05 18:33:00
下面是展示如何在OpenERP中开发看板视图的示例代码。
对于看板视图,您必须准备两个文件:(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>发布于 2012-05-16 17:22:41
他们的是文档,看板视图是基于QWEB技术创建的,由它自己开发,你可以看到整个库QWEB lib,在文档部分你可以看到如何定义qWeb QWEB Template,现在如果你理解了它,那么你只需要在视图声明中的标签下取出你的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>希望这能对你有所帮助。
问候
发布于 2012-04-06 07:07:46
我还看不到它的任何文档,所以你能做的最好的事情就是在addons项目中寻找示例。在所有XML文件中搜索<kanban>。下面是来自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>https://stackoverflow.com/questions/10005291
复制相似问题