Skip to Content
Menu
Musisz się zarejestrować, aby móc wchodzić w interakcje z tą społecznością.
To pytanie dostało ostrzeżenie
1 Odpowiedz
1081 Widoki

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?

Awatar
Odrzuć
Autor Najlepsza odpowiedź

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

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
paź 24
3086
0
sie 25
279
1
kwi 25
800
1
cze 25
1595
1
mar 25
1103