Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
2 Vastaukset
3442 Näkymät

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
Hylkää
Paras vastaus

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
Hylkää
Tekijä Paras vastaus

Hi Jaiswal,

Thank you for your answers. 

Avatar
Hylkää
Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
0
maalisk. 24
934
1
kesäk. 24
2017
2
toukok. 24
3300
4
toukok. 25
1744
2
toukok. 25
4989