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

As mentioned in several posts here, the default formatting of the product name is [INTERNAL_REFERENCE] Product Name​.


We would like to show only the internal reference in the product_template_id​column, since we have the product name as first line of the description (column name​). 


Is there another approach than overriding `name_get(self)` in the product model? We would like to show both the reference and name in the product dropdown, but on the actual sale_order_line​, it should show the reference only.



Awatar
Odrzuć
Autor

Has anybody an idea how to sovle this?

Najlepsza odpowiedź

Hello,

You have to modify the name_get method of the product model is the only way to achieve your goal.

Thanks,
info@creyox.com

Awatar
Odrzuć
Najlepsza odpowiedź

Hi there,

Another way is to change the name (=description field on the order line) with an automated action. When the order is saved the description changes.  It respects the customer's language and all reports are printed with the right value.

You can use this solution when no development is possible.


Type: sale.order.line, Action: update the record, Activate: on create

Data to write:

Field: Description

Python expression

value:

If you need only the product name:  record.name[record.name.find('] ')+2:record.name.find('\n')]

If you need to leave out the reference:  record.name[record.name.find('] ')+2:]

If you need only the reference:  record.name[:record.name.find('] ')-1]



feel free to comment,

roeland

Awatar
Odrzuć
Powiązane posty Odpowiedzi Widoki Czynność
3
sie 25
2467
1
maj 25
2582
1
kwi 25
3547
1
kwi 25
4393
1
kwi 25
1853