Contributors mailing list archives

contributors@odoo-community.org

Avatar

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

by
Le Filament, Rémi Cazenave
- 30/07/2021 16:38:07
Dear Radovan,

We changed the field to HTML for both sale ordre line and account invoice lines (on v9 then v10 then v12) for a customer. It works fine if you then use proper widget for views and templates.
However it creates a number of side effects if yoy use the functions to create automatically tasks from sale order (since it takes the first line from sol as task name or related sol on task)...

Best Regards,
Rémi CAZENAVE
SCOP Le Filament

Le July 30, 2021 12:41:45 PM UTC, Radovan Skolnik <radovan@skolnik.info> a écrit :
Hello,

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


_______________________________________________
Mailing-List: https://odoo-community.org/groups/contributors-15
Post to: mailto:contributors@odoo-community.org
Unsubscribe: https://odoo-community.org/groups?unsubscribe