Error in solution for "2.3. Add a dashboard item"
维护者通常 1 天内回复
@fdardenne 已经在做这个了。
开始于 2026年1月5日。
评估
这个 Issue 还没有评估数据。
描述
Hi,
The assignment has us create a dashboard item, with optional size prop, that should default to 1. That should be reflected in the size of the displayed element.
This is the solution provided: dashboard_item.js
And it's used like this in the Dashboard: dashboard.xml
However, if the prop isn't provided, this is what appears:
<div class="card m-2 border-dark" style="width: NaNrem;"><div class="card-body">some content </div></div>
It looks like I'm not imagining this since it appears to be included in the relevant screenshot as well:
https://www.odoo.com/documentation/18.0/_images/dashboard_item.png
If the elements containing "some content" truly were 18rem wide, they'd be about half of what the element containing "I love milk" is.
I solved it myself by adding setup() in DashboardItem:
setup() { this.size = 1; if(this.props.size && this.props.size > 0) { this.size = this.props.size; } }
And adjusting line 5 in dashboard_item.xml:
<div class="card d-inline-block m-2" t-attf-style="width: {{18*size}}rem;">
Is there a way to make it work with the default value for the size prop though?
- 主要语言
- Python
- 星标
- 182
- 派生
- 3.4k
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
odoo/tutorials 的其他 Issue
-
awesome_owl module shows error: A css error occured, using an old style to render this page可能重新可做 @fdardenne 于 392 天前认领,目前没有进行中的 PR。 未关闭
odoo/tutorials#1012 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
MarkdownDocSerializer.post_process escapes '\<' to '\<', rendering literal '<' in CommonMark未关闭
难度 2/5 1-3 小时 新手友好度 74/100
docling-project/docling-core#1067 ·
维护者通常 3 天内回复
-
correction metadata
难度 1/5 1 小时以内 新手友好度 85/100
acl-org/acl-anthology#11101 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] crewai tool create/install/login exit 0 when they fail可能已有人在做 @Kiko0301 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 85/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
vllm-project/compressed-tensors#1033 ·
维护者通常 3 天内回复
-
chore kaizen ui-rewrite
难度 2/5 1-3 小时 新手友好度 64/100
IBM/mcp-context-forge#7681 ·
维护者通常 2 天内回复