- Mailing Lists
- Contributors
- Re: Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html
Archives
- By thread 1419
-
By date
- August 2019 59
- September 2019 118
- October 2019 165
- November 2019 97
- December 2019 35
- January 2020 58
- February 2020 204
- March 2020 121
- April 2020 172
- May 2020 50
- June 2020 158
- July 2020 85
- August 2020 94
- September 2020 193
- October 2020 277
- November 2020 100
- December 2020 159
- January 2021 38
- February 2021 87
- March 2021 146
- April 2021 73
- May 2021 90
- June 2021 86
- July 2021 123
- August 2021 50
- September 2021 68
- October 2021 66
- November 2021 74
- December 2021 75
- January 2022 98
- February 2022 77
- March 2022 68
- April 2022 31
- May 2022 59
- June 2022 87
- July 2022 141
- August 2022 38
- September 2022 73
- October 2022 152
- November 2022 39
- December 2022 50
- January 2023 93
- February 2023 49
- March 2023 106
- April 2023 47
- May 2023 69
- June 2023 92
- July 2023 64
- August 2023 103
- September 2023 91
- October 2023 101
- November 2023 94
- December 2023 46
- January 2024 75
- February 2024 79
- March 2024 104
- April 2024 63
- May 2024 40
- June 2024 160
- July 2024 80
- August 2024 70
- September 2024 62
- October 2024 121
- November 2024 117
- December 2024 89
- January 2025 59
- February 2025 104
- March 2025 96
- April 2025 107
- May 2025 52
- June 2025 72
- July 2025 60
- August 2025 81
- September 2025 124
- October 2025 63
- November 2025 22
Contributors
Re: Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html
add an init_hook that calls odoo.tools.(somewhere there in mail I think is a
text2html function) on the column, and redefine it as html. Or if the module
already exists increase the version number and do the same in a migration
script.
Rémi's point stays valid, there are places where templates or code assume text
and not html, that you'll have to change to t-raw etc.
--
Your partner for the hard Odoo problems
https://hunki-enterprises.com
by Holger Brunn - 10:21 - 30 Jul 2021
Reference
-
Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html
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
by Radovan Skolnik - 02:41 - 30 Jul 2021-
Re: Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html
add an init_hook that calls odoo.tools.(somewhere there in mail I think is a text2html function) on the column, and redefine it as html. Or if the module already exists increase the version number and do the same in a migration script. Rémi's point stays valid, there are places where templates or code assume text and not html, that you'll have to change to t-raw etc. -- Your partner for the hard Odoo problems https://hunki-enterprises.com
by Holger Brunn - 10:21 - 30 Jul 2021 -
Re: Looking for best approach of changing description_sale of product.template from fields.Text to fields.Html
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 FilamentLe 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
by Rémi Cazenave - 06:41 - 30 Jul 2021
-