Tryton无效的XML用于查看/期望属性名称

时间:2018-02-12 00:38:16

标签: xml tryton

使用管理员用户在MacOS上运行Tryton 4.6.2。

来自trytond / modules / quotation / view / quotation_form.xml (模块不在基础Tryton中,专门为此应用程序编写。)在3.4中工作,在4.6中失败。

XML的相关部分是:

from mpl_toolkits.basemap import Basemap
import matplotlib.pyplot as plt
import numpy as np
# setup Lambert Conformal basemap.
m = Basemap(width=12000000,height=9000000,projection='lcc',
            resolution='c',lat_1=45.,lat_2=55,lat_0=50,lon_0=-107.)

m.drawmapboundary(fill_color='azure')
m.fillcontinents(color='sandybrown',lake_color='azure')

parallels = np.arange(0.,81,10.)
m.drawparallels(parallels,labels=[False,True,True,False])
meridians = np.arange(10.,351.,20.)
m.drawmeridians(meridians,labels=[True,False,False,True])
# plot blue dot on Boulder, colorado and label it as such.
lon, lat = -104.237, 40.125 # Location of Boulder
# convert to map projection coords.
# Note that lon,lat can be scalars, lists or numpy arrays.
xpt,ypt = m(lon,lat)
# convert back to lat/lon
lonpt, latpt = m(xpt,ypt,inverse=True)
point, = m.plot(xpt,ypt,'bo')  # plot a blue dot there
# put some text next to the dot, offset a little bit
# (the offset is in map projection coordinates)
annotation = plt.annotate('Boulder (%5.1fW,%3.1fN)' % (lon, lat), xy=(xpt,ypt),
             xytext=(20,35), textcoords="offset points", 
             bbox={"facecolor":"w", "alpha":0.5}, 
             arrowprops=dict(arrowstyle="->", connectionstyle="arc3"))

def onclick(event):
    ix, iy = event.xdata, event.ydata
    xpti, ypti = m(ix, iy,inverse=True)
    string = '(%5.1fW,%3.1fN)' % (xpti, ypti)
    print(string)
    annotation.xy = (ix, iy)
    point.set_data([ix], [iy])
    annotation.set_text(string)
    plt.gcf().canvas.draw_idle()

cid = plt.gcf().canvas.mpl_connect("button_press_event", onclick)
plt.show()

我得到了: 视图“quotation.quotation”的XML无效。

期望属性名称:第1行第2列(字符1):

1 个答案:

答案 0 :(得分:2)

Tryton视图定义可能会在系列之间发生变化。您已在migration topic of the discuss server上解释了所有更改。

不再可能在视图上定义PYSON语句必须使用模型中的view_attributes函数将pyson语句添加到视图中。您有一个the following commit所需更改的示例。这是在3.4 to 3.6 migration topic.

上解释的

您视图的先前新版本代码将显示为:

<group id="deck_group" string="Deck" colspan="6">

在你的模型的python文件中你应该添加:

@classmethod
def view_attributes(cls):
    return [('/xpath/to/group'), 'invisible', Not(Bool(Eval('deck_quote'))]

希望它有所帮助。