跳至内容
菜单
此问题已终结
2 回复
2837 查看

Hi Guys can anyone tell me what is wrong with this function? Its not assigning the values on the form for the specified fields?

I have length, height, depth, and widt_box fields which i wish to assign a value when product_size is changed. The value is fetched correctly but not displayed on the form what can be the reason? 

    @api.onchange('product_size')

    def set_product_box_vals(self):

        if self.product_size:

            if self.three_d_size:

                length, width, depth = self.product_size.size_information.split('x', 2)

                self.width_box = float(width[1:])

                self.length = float(length[1:])

                self.depth = float(depth[1:])

            else:

                width, height = self.product_size.size_information.split('x', 1)

                self.width = float(width[1:])

                self.height = float(height[1:])

形象
丢弃
最佳答案

Did you checked the value in "float(width[1:])" is correct and not null ?

形象
丢弃
编写者

Yes the values are comming properly even if I print self.height, self.width, they too hold values, but are not displayed on the form view.

相关帖文 回复 查看 活动
2
2月 24
13028
3
10月 18
3691
1
3月 18
4418
0
11月 17
2519
2
4月 23
11451