Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
1 Trả lời
1033 Lượt xem

Hey Odoo devs,

I'm working on a POS customization in Odoo 18, using the latest OWL 2-powered frontend. I needed to add a simple disabled prop to the ActionpadWidget — nothing fancy — just to conditionally block the payment button for certain users.

So I did what seems obvious:

  • Patched the component:


    patch(ActionpadWidget.prototype, { props: { ...ActionpadWidget.props, disabled: { type: Boolean, optional: true }, }, });

  • Extended the template:

    <xpath expr="//ActionpadWidget" position="attributes"> <attribute name="disabled">this.pos.user.pos_block_payment</attribute> </xpath>

And bam — Owl throws:

OwlError: Invalid props for component 'ActionpadWidget': unknown key 'disabled'

Apparently, the template gets validated before the patch is applied?
Is there a clean workaround I’m missing here?

Ảnh đại diện
Huỷ bỏ
Tác giả Câu trả lời hay nhất

sorry, my bad,
I got to patch ActionpadWidget not ActionpadWidget.prototype

Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
3
thg 10 24
3051
0
thg 8 25
147
1
thg 4 25
747
1
thg 6 25
1556
1
thg 3 25
1059