Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
2 ตอบกลับ
1887 มุมมอง

Hello everyone, I'm new to Odoo. I am creating a module with a mechanism similar to odoo's project module. When I create a stage for a project, I declare the stage field as Many2One so that users can add stages without limitation. However, when I try to attach widget ="statusbar" to the stage view and run odoo, I always get the following error

Uncaught Promise > An error occurred in the owl lifecycle (see this Error's "cause" property)


OwlError: An error occurred in the owl lifecycle (see this Error's "cause" property)

     at handleError (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1472:101)

     at owl.App.handleError (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:2098:29)

     at Fiber._render (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1497:19)

     at Fiber.render (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1495:6)

     at ComponentNode.initiateRender (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1563:47)


Caused by: TypeError: Cannot read properties of undefined (reading 'map')

     at StatusBarField.getVisibleMany2Ones (http://localhost:8069/web/assets/979-ab892c4/web.assets_backend.min.js:3741:58)

     at StatusBarField.computeItems (http://localhost:8069/web/assets/979-ab892c4/web.assets_backend.min.js:3744:75)

     at StatusBarField.template (eval at compile (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:2056:374), :43:54)

     at Fiber._render (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1496:96)

     at Fiber.render (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1495:6)

     at ComponentNode.initiateRender (http://localhost:8069/web/assets/963-8b4659c/web.assets_common.min.js:1563:47)


Why does this happen? If I use fields.Selection the statusbar works fine but Many2One doesn't.

อวตาร
ละทิ้ง
ผู้เขียน คำตอบที่ดีที่สุด

@Savya Sachin
I appreciate your response, sir. However, I can see that the Odoo project module has a field called stage_id, and it has the value Many2One. They have also successfully applied widget="statusbar" to it.  Do you know how Odoo modified or configured the  Many2One field in order to use the statusbar ? 

อวตาร
ละทิ้ง

Yes, Pls check the updated answer

คำตอบที่ดีที่สุด

Hi,

The widget statusbar is developed to work with Selection fields rather than Many2one, but , as mentioned in the project module you can check the stage_id is the many2one field with comodel "project.task.type", similarly you will have to create a model for stages in the task


Thanks

อวตาร
ละทิ้ง
Related Posts ตอบกลับ มุมมอง กิจกรรม
1
พ.ย. 24
1647
1
พ.ค. 23
3185
1
มิ.ย. 15
3397
How to sort statusbar stages? แก้ไขแล้ว
1
ส.ค. 21
6576
0
ส.ค. 20
3243