Pular para o conteúdo
Menu
Esta pergunta foi sinalizada
2 Respostas
3687 Visualizações

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
Cancelar
Melhor resposta

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
Cancelar
Autor Melhor resposta

Hi Jaiswal,

Thank you for your answers. 

Avatar
Cancelar
Publicações relacionadas Respostas Visualizações Atividade
0
mar. 24
1039
1
jun. 24
2130
2
mai. 24
3516
4
mai. 25
2072
2
mai. 25
5390