看板观点的继承

阅读(15) 最后更新: 2019年2月6日 05:02

上一页 使用字典和列表的动态属性 | 自定义CSS和JavaScript资产 下一页

翻译进度 100%

自助翻译

看板视图和报表中使用的模板使用用于其他视图的常规技术进行扩展,例如,使用XPath表达式。
The templates used in Kanban views and reports are extended using the regular techniques used for other views, for example, using XPath expressions.See Chapter 4, Extending Modules, for more details.
一个常见的情况是使用元素作为选择器,然后在它们之前或之后添加其他元素。在看板视图中,可以多次声明相同的字段,例如,在模板之前声明一次,在模板中声明一次。在这里,选择器将匹配第一个字段元素,不会按预期在模板中添加修改。
A common case is to use the elements as selectors, then add other elements before or after them.In the case of Kanban views, the same field can be declared more than once, for example, once before the templates, and again inside the templates.Here, the selector will match the first field element and won't add our modification inside the template as intended.
为了解决这个问题,我们需要使用XPath表达式来确保模板中的字段是匹配的,例如:Contact看板修改res.PartnerPosition=“preador”>name:在前面的示例中,XPath在元素中查找元素,这排除了部分之外的相同字段元素。
To work around this, we need to use XPath expressions to make sure that the field inside the template is the one matched, for example: Contact Kanban modification res.partner position="before"> Name: In the previous example, the XPath looks for a element inside a element.This rules out the same field element outside of the section.
对于这些更复杂的XPath表达式,我们可以使用一些命令行工具来探索正确的语法。xmllint命令行实用工具可能已经在您的Linux系统上可用,并且有一个-xpath选项来执行对XML文件的查询。
For these more complex XPath expressions, we can explore the correct syntax using some command-line tools.The xmllint command-line utility is probably already available on your Linux system and has an --xpath option to perform queries on XML files.

Another option, providing nicer output, is the xpath command from the libxml-xpath- perl Debian/Ubuntu package: $ sudo apt-get install libxml-xpath-perl $ xpath -e "//record[@id='res_partner_kanban_view']" -e "//field[@name='display_name']]" /path/to/myfile.xml

odoo技术交流2 群号 625337975

http://www.odoogo.com/post/58/Odoo开发视频教程

加群密码 odoogo2019

文档不断更新中,添加微信odoogo,获取最新视频课程和模块

留言提问