好日子!,我已经尝试将我的Odoo8迁移到9,但是在One2Many网格颜色中有一个错误--这是我的代码
<group>
<data>
<field name="employee_documents" string ="">
<tree colors = "red:expired=='EXP'">
<field name="document"/>
<field name="document_number"/>
<field name="date_issued"/>
<field name="date_expiry"/>
<field name="issuing_authority"/>
<field name="place_ofissue"/>
<field name="expired" />
</tree>
</field>
</data>
</group>我犯了个错误
未定义错误: QWeb2 -模板‘ListView.row’:运行时错误: QWeb2 -模板‘ListView.row’:运行时错误: NameError:名称‘过期’未定义
我发现颜色属性导致了错误,因为当我删除它时,网格不会导致错误,
在Odoo 9有新的方法来完成这个任务吗?
发布于 2016-07-29 10:31:46
这是在treeview中添加颜色属性的正确方法。您应该检查已定义字段.py的expired文件。从错误中可以清楚地看出,此错误与字段的定义有关,而不是由于颜色属性。在运行时,文件中的expired不被定位。这就是为什么你要得到这个错误。
发布于 2017-01-02 07:50:22
对于v9,颜色消失了--由以下装饰器代替:
decoration-bf - shows the line in BOLD
decoration-it - shows the line in ITALICS
decoration-danger - shows the line in LIGHT RED
decoration-info - shows the line in LIGHT BLUE
decoration-muted - shows the line in LIGHT GRAY
decoration-primary - shows the line in LIGHT PURPLE
decoration-success - shows the line in LIGHT GREEN
decoration-warning - shows the line in LIGHT BROWN格式取决于引导样式,可以组合这些样式(当显示粗体时,颜色看起来更好)
FR/forum/aide-1/question/set-color-in-tree-view-based-on-task-stage-94556
发布于 2017-01-03 07:47:07
从Odoo9开始,颜色属性(如odoo8版本)正在被降级。在odoo8中,我们可以为树视图行保留如下颜色
<tree string="tree_view_BT" colors="red:state == 'inact'">
这在odoo9中被削弱了。在odoo9中,您只能使用一组定义的颜色。
在odoo9中,树视图可以采取补充属性来进一步自定义它们的行为,如下所示: 装饰-{$name} :此属性允许根据相应记录的属性更改行文本的样式。
{$name}可以替换为bf,以使字体权重为粗体。
例如,decoration-bf="condition("state=='open'")"
为斜体保留为decoration-it="condition"
Odoo9只支持引导上下文颜色,例如
引导上下文颜色(危险,信息,静音,主要,成功或警告)。引导上下文颜色
装饰-危险= Red的“状况”
装饰-info= Blue的“条件”
装饰-- Grey的静音=“条件”
装饰- Purple的主=“条件”
装饰-- Green的成功=“条件”
装饰-- Orange的警告=“条件”
https://stackoverflow.com/questions/38654497
复制相似问题