- Mailing Lists
- Contributors
- Re: Module for uploading multiple images/attachments to website
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: Module for uploading multiple images/attachments to website
Re: Module for uploading multiple images/attachments to website
Re: Module for uploading multiple images/attachments to website
For a one time load you could use a single use module with an XML
data file.
XML data files are capable of importing directly from files.
Example: https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/res_partner_demo.xml#L54
You would need to script the XML generation from a directory containing the files to import.
--dr
XML data files are capable of importing directly from files.
Example: https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/res_partner_demo.xml#L54
You would need to script the XML generation from a directory containing the files to import.
--dr
On 14/10/2020 08:32, Peter Hahn wrote:
If I got you right you are asking for a one-time import job for migration, not for a front end based user friendly solution, right?
by Daniel Reis - 10:31 - 14 Oct 2020
Reference
-
Module for uploading multiple images/attachments to website
Hello, we are migrating old site (done in WordPress) into Odoo created site. I am looking for a way to upload and store multiple images for use in the migrated pages/blogs. So far I couldn't find a way to do this but I have a hunch I am missing something here :-) Any help is appreciated. Thank you. Best regards Radovan Skolnik
by Radovan Skolnik - 10:46 - 28 Sep 2020-
Re: Module for uploading multiple images/attachments to website
Thanx for info. What I wanted to achieve was to somehow upload batch of images into website so they could be used in HTML of blog posts we are migrating from old site. Or generally have the option in Media selection dialog in web editor to upload a batch of images. However I found that this would be rather complicated because the URL of those images would be something like /web/ image/107007/image.png The number is generated so not much of a prediction where it'd go. I solved it in another way. I create a simple module that only contains static/src/img directory with all the images from original blog. That way it was easy to update the HTML content to point to these as the path would be fixed to /module_name/static/src/img/ Still I think it would be beneficial if it was possible to upload media in batch into website editor to be used later because now you have to upload them one by one. S pozdravom Radovan Skolnik On streda 14. októbra 2020 10:32:23 CEST Daniel Reis wrote: > For a one time load you could use a single use module with an XML > data file. > XML data files are capable of importing directly from files. > Example: > https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/res_partner_dem > o.xml#L54 [1] > > You would need to script the XML generation from a directory > containing the files to import. > > --dr > > > On 14/10/2020 08:32, Peter Hahn wrote: > > If I got you right you are asking for a one-time import job for > migration, not for a front end based user friendly solution, right? > > > _______________________________________________ > Mailing-List: https://odoo-community.org/groups/contributors-15 [2] > Post to: mailto:contributors@odoo-community.org > Unsubscribe: https://odoo-community.org/groups?unsubscribe [3] > > > > [1] > https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/res_partner_de > mo.xml#L54 [2] https://odoo-community.org/groups/contributors-15 > [3] https://odoo-community.org/groups?unsubscribe
by Radovan Skolnik - 11:21 - 14 Oct 2020 -
Re: Module for uploading multiple images/attachments to website
For a one time load you could use a single use module with an XML data file.
XML data files are capable of importing directly from files.
Example: https://github.com/odoo/odoo/blob/14.0/odoo/addons/base/data/res_partner_demo.xml#L54
You would need to script the XML generation from a directory containing the files to import.
--dr
On 14/10/2020 08:32, Peter Hahn wrote:
If I got you right you are asking for a one-time import job for migration, not for a front end based user friendly solution, right?
by Daniel Reis - 10:31 - 14 Oct 2020 -
Re: Module for uploading multiple images/attachments to website
Hello Radovan, If I got you right you are asking for a one-time import job for migration, not for a front end based user friendly solution, right? If that’s the case the best way to do it is using the python shell interface for odoo and writing import scripts. Usual way we do stuff like this is to dump data from the old system in some structured way (access old DB, export to CSV/XML etc.) and read and transform using python scripts. Example for writing: ``` image_path = "/".join([self.image_base_path, path]) try: with Image.open(image_path) as image: buf = io.BytesIO() image.save(buf, format=image.format) b64_image = base64.b64encode(buf.getvalue()) return b64_image, basename(image_path) except FileNotFoundError as e: _logger.warning( f"Could not import image {image_path}", exc_info=_no_traceback(e)) ``` Attached is a simple script for reading. It just reads an image from a custom model. Doesn’t make sence for your case, but you can use this as a minimal starting example for the script and combine with the above code. If you use Odoo with buildout simply call: `bin/python_odoo <your_script.py> [your script arguments]` to run it. regards, Peter Am 13.10.20 um 16:36 schrieb Radovan Skolnik: > Nobody has anything on this? I really hate repetitive tasks - in this case > uploading images one by one. Isn't there a way for example to import > attachments? I've seen something like base64 encoding the content of image and > the provide it as content. But still needs to set Resource Model to ir.ui.view > which seems to be read only? Am I missing somethin crucial here? Any advice is > highly appreciated. Thank you. > Best regards > Radovan > On pondelok 28. septembra 2020 10:42:15 CEST Radovan Skolnik wrote: >> Hello, >> >> we are migrating old site (done in WordPress) into Odoo created site. I am >> looking for a way to upload and store multiple images for use in the >> migrated pages/blogs. So far I couldn't find a way to do this but I have a >> hunch I am missing something here :-) Any help is appreciated. Thank you. >> >> Best regards >> >> Radovan Skolnik > > > > _______________________________________________ > Mailing-List: https://odoo-community.org/groups/contributors-15 [1] > Post to: mailto:contributors@odoo-community.org > Unsubscribe: https://odoo-community.org/groups?unsubscribe [2] > > > > [1] https://odoo-community.org/groups/contributors-15 > [2] https://odoo-community.org/groups?unsubscribe >
by Pete Hahn - 09:31 - 14 Oct 2020 -
Re: Module for uploading multiple images/attachments to website
Nobody has anything on this? I really hate repetitive tasks - in this case uploading images one by one. Isn't there a way for example to import attachments? I've seen something like base64 encoding the content of image and the provide it as content. But still needs to set Resource Model to ir.ui.view which seems to be read only? Am I missing somethin crucial here? Any advice is highly appreciated. Thank you. Best regards Radovan On pondelok 28. septembra 2020 10:42:15 CEST Radovan Skolnik wrote: > Hello, > > we are migrating old site (done in WordPress) into Odoo created site. I am > looking for a way to upload and store multiple images for use in the > migrated pages/blogs. So far I couldn't find a way to do this but I have a > hunch I am missing something here :-) Any help is appreciated. Thank you. > > Best regards > > Radovan Skolnik
by Radovan Skolnik - 04:35 - 13 Oct 2020
-