Hi All,
I created a custom web form to capture an accountant’s signature, but the signature isn’t rendering automatically after signing; it only appears after the page is refreshed.
I added t-if="picking.accountant_signature" so that the signature should appear once it’s completed. However, it only shows up after refreshing the page.
How can I fix this?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- ลูกค้าสัมพันธ์
- e-Commerce
- ระบบบัญชี
- สินค้าคงคลัง
- PoS
- Project
- MRP
คำถามนี้ถูกตั้งค่าสถานะ
Hi,
The issue occurs because Odoo QWeb templates using t-if are evaluated only at initial render. When the picking.accountant_signature field is updated via a custom web form, the template doesn’t automatically refresh, so the signature only appears after a full page reload. QWeb is not reactive by default, which is why changes in backend fields aren’t immediately reflected in the DOM.
<img t-if="picking.accountant_signature" t-att-src="'data:image/png;base64,%s' % picking.accountant_signature"/>
To resolve this, you can use JavaScript to dynamically update the DOM after the signature is saved, or trigger a partial re-render of the template containing the signature. Alternatively, in Odoo 16/17, you can use OWL reactive components, which automatically update the view when the underlying state changes. Another approach is to ensure the <img> tag’s src attribute is dynamically bound and then refresh the component via JS after saving the signature.
Hope it helps
Hello vikas,
I think the issue in the img tag, because there is a no JavaScript that updates the DOM after the signature is submitted. you need to write something like this "selector: '#accept_accountant', for modal and event related to that.
สนุกกับการพูดคุยนี้ใช่ไหม? เข้าร่วมเลย!
สร้างบัญชีวันนี้เพื่อเพลิดเพลินไปกับฟีเจอร์พิเศษและมีส่วนร่วมกับคอมมูนิตี้ที่ยอดเยี่ยมของเรา!
ลงชื่อRelated Posts | ตอบกลับ | มุมมอง | กิจกรรม | |
---|---|---|---|---|
|
0
ก.ย. 25
|
336 | ||
|
0
ต.ค. 25
|
171 | ||
|
2
ส.ค. 25
|
1849 | ||
|
0
ก.ค. 25
|
833 | ||
|
1
ต.ค. 24
|
1960 |