OBPIH-6344 Show translated product names in PO view page tabs#4615
OBPIH-6344 Show translated product names in PO view page tabs#4615awalkowiak merged 1 commit intofeature/upgrade-to-grails-3.3.10from
Conversation
| <tr class="${i%2?'even':'odd'}"> | ||
| <td>${invoiceItem?.orderItem?.id}</td> | ||
| <td>${invoiceItem?.product?.productCode}</td> | ||
| <td>${invoiceItem?.description}</td> |
There was a problem hiding this comment.
can you briefly explain to me why we need this conditional? We only want to show the description if there's an adjustment?
There was a problem hiding this comment.
@ewaterman I'm sorry, I forgot to finish the answer yesterday.
description transient field is defined like this:
String getDescription() {
return orderAdjustment ? orderAdjustment.description : product?.name
}so on the frontend side I had to find some way to determine whether I return the orderAdjustment's description or the product name. If the product name, then we'd want to return a synonym of the product, otherwise we don't want to change anything and still return the orderAdjustment.description.
There was a problem hiding this comment.
Yeah, feels like we could try to move this to the domain (and return either description or product), but I am not sure how we could achieve this in a simple way, where we want to have either string or product and based on that use a format:displayName tag or not. Perhaps we could extend the displayName tag and if attr.product is type of string, then just return it as is or if it is type of product, then use the existing logic 🤔 But I am not sure if that won't overcomplicate it too much and I think we can leave it as is right now (?)
There was a problem hiding this comment.
Yeah, feels like we could try to move this to the domain (and return either description or product)
This is currently in the domain, so I might not understand what you mean.
If you meant a different method, still, it would be impossible to distinguish on the frontend side (without having the if logic) if it's the description or the product.
In my opinion trying to handle this one, minor case in the generic format:displayName seems not worth it, unless we face more of those edge cases.
There was a problem hiding this comment.
You are currently returning a product name in the domain (unless it somehow returns translated one)
There was a problem hiding this comment.
yes it does, but I didn't want to change it to return the translated name (in case somewhere it is not expected, and the description transient is used there) + again, on the frontend I would still need a mechanism to determine whether it is the product name, or the order adjustment description in order to know, if I should display the tooltip (we used to add tooltips with an original name of a product).
There was a problem hiding this comment.
That's why I wrote: "It feels like we could try to move this to the domain (...)", but we'd need to also "extend the displayName tag", but it might unnecessarily overcomplicate it and does not 100% feel right.
No description provided.