Contributors mailing list archives

Browse archives


Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html

Data Dance s.r.o., Radovan Skolnik
- 30/07/2021 14:39:38

the users require that products description is at least somewhat "rich" - i.e. allow for some formatting that would be displayed in various places like: quotations, website, ... We already have more than 5000 products. Most of the descriptions were imported, some few hundreds have been manually edited to contain some plain text pseudo formatting. For simplicity we want to keep one description that goes out of company - i.e. quotations, website, ...

We are not able to edit all of them at the same time so we need to take iterative approach to this meaning for some (long) time there will be products with plain text descriptions and some already HTML formatted (I plan to ask users to edit them whenever they add them to quotation). 

However this brings forward another issue: what would be the best approach? Because few issues come to mind:
1) I can either force different widget in product (and other) form(s) or (I guess) it should be possible to re-define the field as HTML.
2) If I just force different widget on forms I need to modify all the web templates that use the field to use t-raw instead of t-field and there is lot of them. It's doable but if I want to keep the changes in one place (module) there would be many dependencies across many modules which I do not consider healthy.
3) I also need to take into consideration that in the process I need to treat descriptions that weren't updated yet - i.e. put <pre> around them to get at least some formatting. Should I detect that in templates or is it possible to write a getter method that would do that automatically?

So I would welcome any suggestions here. Which way would you recommend to go here?

Thank you very much. Best regards

	Radovan Skolnik