我怎样才能得到价值?Odoo(复制)

时间:2022-06-26 06:40:11

This question already has an answer here:

这个问题已经有了答案:

I have this code in the xml view:

我在xml视图中有这个代码:

<field name="fueled" sum="Sum of fueled"/>

How can I get value sum attribute to do some calculating in python file?

如何让value sum属性在python文件中进行计算?

1 个解决方案

#1


0  

Just do this:

只是这样做:

from lxml import etree

etree.fromstring('<field name="fueled" sum="Sum of fueled"/>').xpath('//field/@sum')[0]

#1


0  

Just do this:

只是这样做:

from lxml import etree

etree.fromstring('<field name="fueled" sum="Sum of fueled"/>').xpath('//field/@sum')[0]