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

I want to print the product_id and the name in my invoice if one differs from each other, if not only the product_id should be printed.

I added these two lines in my report, but it is not working :-( ....

<td t-if="l.name != l.product_id"><span t-field="l.product_id"/><br></br><div style="font-size:smaller; text-indent:10px"><span t-field="l.name"/></div></td>

<td t-if="l.name == l.product_id"><span t-field="l.product_id"/></td>


The Log files warns me: "Comparing apples and oranges" - but I don't know what that means!




아바타
취소

Thanks for the advice - the condition is working now.  But unfortunately it's not what I want. Like Ray mentioned not with products with description and not with products with different variants/attributes. How can I include this in my condition?

My intention is: if the user manually fills in or overwrites the text in field "description", both fields (name and product_id) should be printed on the invoice. Maybe my approach is wrong?

Are you trying to handle the case where users remove the product information and overwrite instead of just appending? Perhaps you need an additional field for them, and not let them change description?

작성자

Yes, that is what I'm trying. I thought it was easier than adding a custom field, but that's apparently not the case. I will add a field. Thanks for the help Ray!

베스트 답변

Hi,

In your condition, you're comparing a string (text)  with a Record ( Product ).
Try:

<td t-if="l.name != l.product_id.name"><span t-field="l.product_id"/><br></br><div style="font-size:smaller; text-indent:10px"><span t-field="l.name"/></div></td>

<td t-if="l.name == l.product_id.name"><span t-field="l.product_id"/></td>

아바타
취소
베스트 답변

You are comparing a PRODUCT with a TEXT field.

You can compare the Product NAME with the Description (name) field, but they will only match for products without an Internal Reference and Description for Customers as the Description field concatenates the Internal Reference to the start and the Description for Customers to the end.

<td t-if="l.name == l.product_id.name">
아바타
취소