display_name field basically combine internal reference, product name and variant name in itself. But when you have only one variant for a product then that variant name won't be grabbed by the display_name.
Now the question is why? I tried to find the original configuration of the field but couldn't find. Anybody nows why?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
1
Reply
14650
Views
Hi,
display_name is computed from the name_get function of the model,
@api.depends(lambda self: (self._rec_name,) if self._rec_name else ())
def _compute_display_name(self):
"""Compute the value of the `display_name` field.
In general `display_name` is equal to calling `name_get()[0][1]`.
In that case, it is recommended to use `display_name` to uniformize the
code and to potentially take advantage of prefetch when applicable.
However some models might override this method. For them, the behavior
might differ, and it is important to select which of `display_name` or
`name_get()[0][1]` to call depending on the desired result.
"""
names = dict(self.name_get())
for record in self:
record.display_name = names.get(record.id, False)
if the name_get function is override in the model, it will be taking the given rec_name for the model, and if the rec_name is not set, it will take the name field value in the model.
Reference:
Thanks
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign upRelated Posts | Replies | Views | Activity | |
---|---|---|---|---|
|
1
Mar 15
|
7318 | ||
|
1
Feb 24
|
3239 | ||
|
0
Mar 22
|
3063 | ||
|
3
Nov 24
|
5857 | ||
|
3
Sep 24
|
4401 |