跳至内容
菜单
此问题已终结
1 回复
927 查看

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?

形象
丢弃
编写者 最佳答案

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

形象
丢弃
相关帖文 回复 查看 活动
3
10月 24
2935
1
4月 25
709
1
6月 25
1421
1
3月 25
1007
0
1月 25
793