콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
1319 화면

Hello, I'm trying to hide the prices of logged out users on the product page.


These prices are inside a "form" element which when submitted, updates the cast of the user. My initial thinking was to remove the entire form element using xpath.


I started with creating a new view, which is an extension of "Product" view.


With the following code, I managed to replace the form, when the user is not logged it, but it currently breaks the code when the user is logged in.


My extension code:

 









Please login to view prices








I want to conditionally apply the xpath only when the user is logged out, but it doesn't seem like there's a way to currently do it?

아바타
취소
작성자

I keep trying to edit the code, but it doesn't update. here's the actual code I used.

<data>
<xpath expr="//form" position="replace">
<t t-set="isNotLoggedIn" t-value="request.env.user.id == request.env.ref('base.public_user').id"/>

<t t-if="isNotLoggedIn">
<p>Please login to view prices</p>
</t>
</xpath>
</data>

관련 게시물 답글 화면 활동
1
3월 25
493
0
3월 25
500
0
2월 25
400
0
1월 25
3
0
10월 24
799