Overslaan naar inhoud
Menu
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Deze vraag is gerapporteerd
2 Antwoorden
3707 Weergaven

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
Annuleer
Beste antwoord

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
Annuleer
Auteur Beste antwoord

Hi Jaiswal,

Thank you for your answers. 

Avatar
Annuleer
Gerelateerde posts Antwoorden Weergaven Activiteit
0
mrt. 24
1065
1
jun. 24
2146
2
mei 24
3546
4
mei 25
2093
2
mei 25
5412