问题描述
# import the necessary libraries
import numpy as np
from skimage import io,transform,img_as_float,img_as_ubyte # here I am using skimage,you can use opencv
# read the images
img1 = io.imread('img1.JPG')
img2 = io.imread('img2.JPG')
# convert both the images to same datatype
img1 = img_as_float(img1)
img2 = img_as_float(img2)
# determine the width and heigh of the images
height_of_first_image = img1.shape[0]
width_of_first_image = img1.shape[1]
height_of_the_second_image = img2.shape[0]
width_of_the_second_image = img2.shape[1]
# the img1 and img2 might have different channels for: img1 van be (RGB) but img2 can be (RGBA) in this case you need to drop a channel
if(len(img1.shape) != len(img2.shape)):
print(f'Images provided not same shape {img1.shape} and {img2.shape}')
else:
# we need to rezise the height of the second image so that we can join
# the idea is take 1/2 of img1 + 1/2 of img2
# for that both should have same height
img2 = transform.resize(img2,(height_of_first_image,width_of_the_second_image),anti_aliasing=True)
# Now we have same height
img1_half = img1[:,: width_of_first_image//2,:] # take first half of first image
img2_half = img2[:,width_of_the_second_image//2 :,:] # take second half of second image
# Now horizontally stack the,final_image = np.hstack((img1_half,img2_half))
# finally convert the image to unsigned byte format,with values in [0,255]
final_image = img_as_ubyte(final_image)
# Now finally save the image
io.imsave('final.JPG',final_image)
有一个模型如下。
<record model="ir.ui.view" id="access_view_tree">
<field name="name">Access tree</field>
<field name="model">ka.access.rel</field>
<field name="arch" type="xml">
<tree string="Tree view" >
<field name="id_ra_access"/>
<field name="id_res_partner"/>
<field name="partner_type"/>
</tree>
</field>
</record>
我只能看到表单视图包含所有三个字段。 在树视图中,我只能看到一列“ID”
解决方法
这是默认的树视图,您的树视图定义未加载,如果 Odoo 尝试加载它,它将引发 ValidationError
,因为字段 id_ra_Access
未定义:
odoo.exceptions.ValidationError: ('Error while validating view\n\nField `id_ra_Access` does not exist\n\nError context:\nView `Access tree`.
检查清单文件并确保将 XML 文件(您定义树视图定义的位置)添加到 data
条目并使用 id_ra_access
字段名称而不是 id_ra_Access
。