Skip to Content
Menu
This question has been flagged
2 Replies
3748 Zobrazenia

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)



Avatar
Zrušiť
Best Answer

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!!!

Avatar
Zrušiť
Autor Best Answer

Hi Jaiswal,

Thank you for your answers. 

Avatar
Zrušiť
Related Posts Replies Zobrazenia Aktivita
0
mar 24
1087
1
jún 24
2158
2
máj 24
3587
4
máj 25
2132
2
máj 25
5473