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

Dear helpers,


I am stuck in the error showing in the title. Below are my codes. The error occurs at this command below as it did not pop up the error when I commented this line. 

I have no clue what I should do to fix this error.  These codes are to turn on "Quality Check" button if "picking_obj" is in "assigned" state.

​rec.show_quality_check_btn = True

python file

class Picking(models.Model):
_inherit = "stock.picking"

​show_quality_check_btn = fields.Boolean(default=False, compute='_compute_show_quality_check_btn')

@api.depends('state')
def _compute_show_quality_check_btn(self):
​for rec in self:
​picking_obj = rec.filtered(lambda p: p.state == 'assigned') # assigned = Ready
​if picking_obj:
​rec.show_quality_check_btn = True



Error details 

OwlError: An error occured in the owl lifecycle (see this Error's "cause" property)
    at handleError (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:916:101)
    at App.handleError (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:1542:29)
    at Fiber._render (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:941:19)
    at Fiber.render (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:939:6)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:1007:47)

Caused by: TypeError: Cannot read properties of undefined (reading 'map')
    at get tags (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:7901:67)
    at Many2ManyTagsFieldColorEditable.template (eval at compile (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:1500:374), :15:26)
    at Fiber._render (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:940:96)
    at Fiber.render (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:939:6)
    at ComponentNode.initiateRender (http://localhost:8069/web/assets/2cca91a/web.assets_web.min.js:1007:47)



形象
丢弃
最佳答案

Hello wwy

class Picking(models.Model):
_inherit = "stock.picking"

show_quality_check_btn = fields.Boolean(default=False, compute='_compute_show_quality_check_btn')

@api.depends('state')
def _compute_show_quality_check_btn(self):
for rec in self:
picking_obj = rec.filtered(lambda p: p.state == 'assigned') # assigned = Ready
if picking_obj:
rec.show_quality_check_btn = True
else:
rec.show_quality_check_btn = False



hope this helps!!! 

I have tested in my local system and it is working fine for me

Thanks!!!

形象
丢弃
编写者 最佳答案

Hi Jaiswal,

Thank you for your answers. 

形象
丢弃
相关帖文 回复 查看 活动
0
3月 24
1096
1
6月 24
2176
2
5月 24
3679
4
5月 25
2169
2
5月 25
5519