| @ -0,0 +1,49 @@ | |||
| .. image:: https://img.shields.io/badge/license-AGPL--3-blue.svg | |||
|     :target: https://www.gnu.org/licenses/agpl-3.0-standalone.html | |||
|     :alt: License: AGPL-3 | |||
| 
 | |||
| Many2Many Attachment Preview | |||
| ============================ | |||
| This Module will help to preview the attachments in Many2Many fields. | |||
| 
 | |||
| Configuration | |||
| ============= | |||
| * No additional configurations needed | |||
| Company | |||
| ------- | |||
| * `Cybrosys Techno Solutions <https://cybrosys.com/>`__ | |||
| 
 | |||
| License | |||
| ======= | |||
| GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) | |||
| (https://www.gnu.org/licenses/agpl-3.0-standalone.html) | |||
| 
 | |||
| Credits | |||
| ------- | |||
| * Developer: (V16) Ajith V, | |||
|              (V15) Shonima, Contact: odoo@cybrosys.com | |||
| 
 | |||
| Contacts | |||
| -------- | |||
| * Mail Contact : odoo@cybrosys.com | |||
| * Website : https://cybrosys.com | |||
| 
 | |||
| Bug Tracker | |||
| ----------- | |||
| Bugs are tracked on GitHub Issues. In case of trouble, please check there if your | |||
| issue has already been reported. | |||
| 
 | |||
| Maintainer | |||
| ========== | |||
| .. image:: https://cybrosys.com/images/logo.png | |||
|    :target: https://cybrosys.com | |||
| 
 | |||
| This module is maintained by Cybrosys Technologies. | |||
| 
 | |||
| For support and more information, please visit `Our Website <https://cybrosys.com/>`__ | |||
| 
 | |||
| Further information | |||
| =================== | |||
| HTML Description: `<static/description/index.html>`__ | |||
| 
 | |||
| 
 | |||
| @ -0,0 +1,22 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | |||
| #    Author: Ajith(<https://www.cybrosys.com>) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from . import models | |||
| @ -0,0 +1,48 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | |||
| #    Author: Ajith(<https://www.cybrosys.com>) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| { | |||
|     'name': "Many2Many Attachment Preview", | |||
|     'version': '16.0.1.0.0', | |||
|     'summary': """Preview the attachment in Many2Many field""", | |||
|     'description': """"This module helps you to preview the attachments in | |||
|      Many2Many fields.""", | |||
|     'category': 'Uncategorized', | |||
|     'author': 'Cybrosys Techno Solutions', | |||
|     'company': 'Cybrosys Techno Solutions', | |||
|     'maintainer': 'Cybrosys Techno Solutions', | |||
|     'website': "http://www.cybrosys.com", | |||
|     'depends': ['base', 'sale_management'], | |||
|     'data': ['views/sale_order_views.xml'], | |||
|     'assets': { | |||
|         'web.assets_backend': [ | |||
|             'many2many_attachment_preview/static/src/js/attachment_preview.js', | |||
|             'many2many_attachment_preview/static/src/xml/attachment_preview.xml', | |||
|             'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.css', | |||
|             'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@3.5.6/dist/jquery.fancybox.min.js' | |||
|         ], | |||
|     }, | |||
|     'license': 'AGPL-3', | |||
|     'images': ['static/description/banner.png'], | |||
|     'installable': True, | |||
|     'auto_install': False, | |||
|     'application': False, | |||
| } | |||
| @ -0,0 +1,6 @@ | |||
| ## Module <many2many_attachment_preview> | |||
| 
 | |||
| #### 29.08.2024 | |||
| #### Version 16.0.1.0.0 | |||
| #### ADD | |||
| - Initial Commit for Many2Many Attachment Preview | |||
| @ -0,0 +1,22 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | |||
| #    Author: Ajith(<https://www.cybrosys.com>) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from . import sale_order | |||
| @ -0,0 +1,31 @@ | |||
| # -*- coding: utf-8 -*- | |||
| ############################################################################# | |||
| # | |||
| #    Cybrosys Technologies Pvt. Ltd. | |||
| # | |||
| #    Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>). | |||
| #    Author: Ajith(<https://www.cybrosys.com>) | |||
| # | |||
| #    You can modify it under the terms of the GNU AFFERO | |||
| #    GENERAL PUBLIC LICENSE (AGPL v3), Version 3. | |||
| # | |||
| #    This program is distributed in the hope that it will be useful, | |||
| #    but WITHOUT ANY WARRANTY; without even the implied warranty of | |||
| #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | |||
| #    GNU AFFERO GENERAL PUBLIC LICENSE (AGPL v3) for more details. | |||
| # | |||
| #    You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE | |||
| #    (AGPL v3) along with this program. | |||
| #    If not, see <http://www.gnu.org/licenses/>. | |||
| # | |||
| ############################################################################# | |||
| from odoo import fields, models | |||
| 
 | |||
| 
 | |||
| class SaleOrder(models.Model): | |||
|     """Inherited sale. order class to add a new field for attachments""" | |||
|     _inherit = 'sale.order' | |||
| 
 | |||
|     attachment_ids = fields.Many2many( | |||
|         comodel_name='ir.attachment', | |||
|         string="Attachments", help="Add Multiple attachment file") | |||
| After Width: | Height: | Size: 3.6 KiB | 
| After Width: | Height: | Size: 310 B | 
| After Width: | Height: | Size: 1.3 KiB | 
| After Width: | Height: | Size: 1.4 KiB | 
| After Width: | Height: | Size: 576 B | 
| After Width: | Height: | Size: 733 B | 
| After Width: | Height: | Size: 911 B | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 3.4 KiB | 
| After Width: | Height: | Size: 673 B | 
| After Width: | Height: | Size: 878 B | 
| After Width: | Height: | Size: 653 B | 
| After Width: | Height: | Size: 905 B | 
| After Width: | Height: | Size: 839 B | 
| After Width: | Height: | Size: 427 B | 
| After Width: | Height: | Size: 627 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 988 B | 
| After Width: | Height: | Size: 1.2 KiB | 
| After Width: | Height: | Size: 1.5 KiB | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 1.9 KiB | 
| After Width: | Height: | Size: 1.1 KiB | 
| After Width: | Height: | Size: 2.1 KiB | 
| After Width: | Height: | Size: 4.4 KiB | 
| After Width: | Height: | Size: 589 B | 
| After Width: | Height: | Size: 3.4 KiB | 
| After Width: | Height: | Size: 1.7 KiB | 
| After Width: | Height: | Size: 2.3 KiB | 
| After Width: | Height: | Size: 967 B | 
| After Width: | Height: | Size: 1.6 KiB | 
| After Width: | Height: | Size: 3.8 KiB | 
| After Width: | Height: | Size: 5.0 KiB | 
| After Width: | Height: | Size: 56 KiB | 
| After Width: | Height: | Size: 59 KiB | 
| After Width: | Height: | Size: 57 KiB | 
| After Width: | Height: | Size: 65 KiB | 
| After Width: | Height: | Size: 50 KiB | 
| After Width: | Height: | Size: 60 KiB | 
| After Width: | Height: | Size: 122 KiB | 
| After Width: | Height: | Size: 192 KiB | 
| After Width: | Height: | Size: 82 KiB | 
| After Width: | Height: | Size: 72 KiB | 
| After Width: | Height: | Size: 15 KiB | 
| @ -0,0 +1,622 @@ | |||
| <div style="background-color: #714B67; min-height: 600px; width: 100%; padding: 15px; position: relative;"> | |||
|     <!-- TITLE BAR --> | |||
|     <div | |||
|             style="border-bottom: 1px solid #875A7B; padding: 15px; display: flex; justify-content: space-between; align-items: center;"> | |||
|         <img src="./assets/misc/cybrosys-logo.png" width="42" height="42" | |||
|              style="width: 42px; height: 42px;"/> | |||
|         <div> | |||
|             <div style="color: #7C7BAD; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;" | |||
|                  class="mr-2"> | |||
|                 <i class="fa fa-check mr-1"></i>Community | |||
|             </div> | |||
|             <div style="color: #875A7B; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;" | |||
|                  class="mr-2"> | |||
|                 <i class="fa fa-check mr-1"></i>Enterprise | |||
|             </div> | |||
|             <div style="color: #017E84; font-size: 14px; font-family: 'Montserrat', sans-serif; font-weight: bold; background-color: white; display: inline-block; padding: 3px 10px; border-radius: 50px;" | |||
|                  class="mr-2"> | |||
|                 <i class="fa fa-check mr-1"></i>Odoo.sh | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
|     <!-- END OF TITLE BAR --> | |||
| 
 | |||
|     <!-- APP HERO --> | |||
|     <h1 style="color: #FFFFFF; font-weight: bolder; font-size: 50px; text-align: center; margin-top: 50px;"> | |||
|         Many2Many Attachment Preview</h1> | |||
|     <p style="color:#FFFFFF; padding: 8px 15px; text-align: center; font-size: 24px;"> | |||
|         Preview the Attachments.</p> | |||
|     <!-- END OF APP HERO --> | |||
|     <img src="./assets/screenshots/hero.gif" | |||
|          style="width: 75%; height: auto; position: absolute; margin-left: auto; margin-right: auto; top: 45%; left: 12%; right: auto;"/> | |||
| 
 | |||
| </div> | |||
| 
 | |||
| <!-- NAVIGATION SECTION --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px; margin-top: 300px;"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/compass.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Explore This | |||
|         Module</h2> | |||
| </div> | |||
| <div class="row my-4" style="font-family: 'Montserrat', sans-serif;"> | |||
|     <div class="col-sm-12 col-md-6 my-3"> | |||
|         <a href="#overview"> | |||
|             <div class="d-flex justify-content-between align-items-center" | |||
|                  style="background-color: #f5f5f5; padding: 30px; width: 100%;"> | |||
|                 <div> | |||
|                     <span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Overview</span> | |||
|                     <span | |||
|                             style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33;  display: block;">Learn | |||
|                         more about this | |||
|                         module</span> | |||
|                 </div> | |||
|                 <img src="./assets/misc/right-arrow.png" width="36" | |||
|                      height="36"/> | |||
|             </div> | |||
|         </a> | |||
|     </div> | |||
|     <div class="col-sm-12 col-md-6 my-3"> | |||
|         <a href="#features"> | |||
|             <div class="d-flex justify-content-between align-items-center" | |||
|                  style="background-color: #f5f5f5; padding: 30px; width: 100%;"> | |||
|                 <div> | |||
|                     <span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Features</span> | |||
|                     <span | |||
|                             style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33;  display: block;">View | |||
|                         features of this | |||
|                         module</span> | |||
|                 </div> | |||
|                 <img src="./assets/misc/right-arrow.png" width="36" | |||
|                      height="36"/> | |||
|             </div> | |||
|         </a> | |||
|     </div> | |||
|     <div class="col-sm-12 col-md-6 my-3"> | |||
|         <a href="#screenshots"> | |||
|             <div class="d-flex justify-content-between align-items-center" | |||
|                  style="background-color: #f5f5f5; padding: 30px; width: 100%;"> | |||
|                 <div> | |||
|                     <span style="color: #714B67; font-size: 24px; font-weight: 500; display: block;">Screenshots</span> | |||
|                     <span | |||
|                             style="color: #714B67; font-size: 16px; font-weight: 400; color:#282F33;  display: block;">View | |||
|                         screenshots for this | |||
|                         module</span> | |||
|                 </div> | |||
|                 <img src="./assets/misc/right-arrow.png" width="36" | |||
|                      height="36"/> | |||
|             </div> | |||
|         </a> | |||
|     </div> | |||
| </div> | |||
| <!-- END OF NAVIGATION SECTION --> | |||
| 
 | |||
| <!-- OVERVIEW SECTION --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="overview"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/pie-chart.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Overview | |||
|     </h2> | |||
| </div> | |||
| <div class="row" | |||
|      style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;"> | |||
|     <div class="col-sm-12 py-4"> | |||
|         This module helps you preview of the attachments (like pdf, png, jpg | |||
|         etc.) which are uploaded in a Many2Many field. | |||
|     </div> | |||
| </div> | |||
| <!-- END OF OVERVIEW SECTION --> | |||
| 
 | |||
| <!-- FEATURES SECTION --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;" id="features"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/features.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Features | |||
|     </h2> | |||
| </div> | |||
| <div class="row" | |||
|      style="font-family: 'Montserrat', sans-serif; font-weight: 400; font-size: 14px; line-height: 200%;"> | |||
|     <div class="col-sm-12 col-md-6"> | |||
|         <div class="d-flex align-items-center" | |||
|              style="margin-top: 40px; margin-bottom: 40px"> | |||
|             <img src="./assets/misc/check-box.png" class="mr-2"/> | |||
|             <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;">Community & Enterprise Support</span> | |||
|             <p | |||
|                     style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> | |||
|                 Available in Odoo 16.0 Community and Enterprise.</p> | |||
|         </div> | |||
|         <div class="d-flex align-items-center" | |||
|              style="margin-top: 30px; margin-bottom: 30px"> | |||
|             <img src="./assets/misc/check-box.png" class="mr-2"/> | |||
|             <span style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> Available pdf, png, jpg (image formats) etc.</span> | |||
|             <p | |||
|                     style="font-family: 'Roboto', sans-serif !important; font-weight: 400 !important; color: #282F33 !important; font-size: 1rem !important;"> | |||
|                  Available pdf, png, jpg (image formats) etc.</p> | |||
|         </div> | |||
|     </div> | |||
| </div> | |||
| <!-- END OF FEATURES SECTION --> | |||
| 
 | |||
| <!-- SCREENSHOTS SECTION --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;" | |||
|      id="screenshots"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/pictures.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Screenshots | |||
|     </h2> | |||
| </div> | |||
| <div class="row"> | |||
|     <div class="col-sm-12"> | |||
| 
 | |||
|         <div style="display: block; margin: 30px auto;"> | |||
|             <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> | |||
|                  Can add multiple attachments</h3> | |||
|             <img src="./assets/screenshots/1.png" | |||
|                  class="img-thumbnail"> | |||
|         </div> | |||
| 
 | |||
|         <div style="display: block; margin: 30px auto;"> | |||
|             <h3 style="font-family: 'Montserrat', sans-serif; font-size: 18px; font-weight: bold;"> | |||
|                  Clicking on attachment,we can preview the document.</h3> | |||
|             <img src="./assets/screenshots/2.png" | |||
|                  class="img-thumbnail"> | |||
|         </div> | |||
|     </div> | |||
| </div> | |||
| <!-- END OF SCREENSHOTS SECTION --> | |||
| 
 | |||
| <!-- RELATED PRODUCTS --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/categories.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Related | |||
|         Products | |||
|     </h2> | |||
| </div> | |||
| <div class="row"> | |||
|     <div class="col-sm-12"> | |||
|         <div id="demo1" class="row carousel slide" data-ride="carousel"> | |||
|             <!-- The slideshow --> | |||
|             <div class="carousel-inner" style="padding: 30px;"> | |||
|                 <div class="carousel-item" style="min-height: 198.656px;"> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/export_stockinfo_xls/" | |||
|                            target="_blank"> | |||
|                             <div style="border-radius:10px"> | |||
|                                 <img class="img img-responsive center-block" | |||
|                                      style="border-radius: 0px;" | |||
|                                      src="./assets/modules/export_image.png"> | |||
|                             </div> | |||
|                         </a> | |||
|                     </div> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/custom_gantt_view/" | |||
|                            target="_blank"> | |||
|                             <div style="border-radius:10px"> | |||
|                                 <img class="img img-responsive center-block" | |||
|                                      style="border-radius: 0px;" | |||
|                                      src="./assets/modules/gantt_image.png"> | |||
|                             </div> | |||
|                         </a> | |||
|                     </div> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/sales_credit_limit/" | |||
|                            target="_blank"> | |||
|                             <div style="border-radius:10px"> | |||
|                                 <img class="img img-responsive center-block" | |||
|                                      style="border-radius: 0px;" | |||
|                                      src="./assets/modules/credit_image.png"> | |||
|                             </div> | |||
|                         </a> | |||
|                     </div> | |||
|                 </div> | |||
|                 <div class="carousel-item active" | |||
|                      style="min-height: 198.656px;"> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/base_account_budget/" | |||
|                            target="_blank"> | |||
|                             <div style="border-radius:10px"> | |||
|                                 <img class="img img-responsive center-block" | |||
|                                      style="border-radius: 0px;" | |||
|                                      src="./assets/modules/budget_image.png"> | |||
|                             </div> | |||
|                         </a> | |||
|                     </div> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/product_to_quotation/" | |||
|                            target="_blank"> | |||
|                             <div style="border-radius:10px"> | |||
|                                 <img class="img img-responsive center-block" | |||
|                                      style="border-radius: 0px;" | |||
|                                      src="./assets/modules/quotation_image.png"> | |||
|                             </div> | |||
|                         </a> | |||
|                     </div> | |||
|                     <div class="col-xs-12 col-sm-4 col-md-4 mb16 mt16" | |||
|                          style="float:left"> | |||
|                         <a href="https://apps.odoo.com/apps/modules/16.0/employee_documents_expiry/"> | |||
|                         <div style="border-radius:10px"> | |||
|                             <img class="img img-responsive center-block" | |||
|                                  style="border-radius: 0px;" | |||
|                                  src="./assets/modules/employee_image.png"> | |||
|                         </div> | |||
|                         </a> | |||
|                     </div> | |||
|                 </div> | |||
|             </div> | |||
|             <!-- Left and right controls --> | |||
|             <a class="carousel-control-prev" href="#demo1" data-slide="prev" | |||
|                style="width:35px; color:#000"> <span | |||
|                     class="carousel-control-prev-icon"><i | |||
|                     class="fa fa-chevron-left" | |||
|                     style="font-size:24px"></i></span> | |||
|             </a> <a class="carousel-control-next" href="#demo1" | |||
|                     data-slide="next" style="width:35px; color:#000"> | |||
|                 <span class="carousel-control-next-icon"><i | |||
|                         class="fa fa-chevron-right" | |||
|                         style="font-size:24px"></i></span> | |||
|         </a> | |||
|         </div> | |||
|     </div> | |||
| </div> | |||
| <!-- END OF RELATED PRODUCTS --> | |||
| 
 | |||
| <!-- OUR SERVICES --> | |||
| 
 | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/star.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Our Services | |||
|     </h2> | |||
| </div> | |||
| 
 | |||
| <div class="container my-5"> | |||
|     <div class="row"> | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #1dd1a1 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/cogs.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Customization</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #ff6b6b !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/wrench.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Implementation</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #6462CD !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/lifebuoy.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Support</h6> | |||
|         </div> | |||
| 
 | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #ffa801 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/user.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Hire | |||
|                 Odoo | |||
|                 Developer</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #54a0ff  !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/puzzle.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Integration</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #6d7680 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/update.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Migration</h6> | |||
|         </div> | |||
| 
 | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #786fa6 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/consultation.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Consultancy</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #f8a5c2 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/training.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Implementation</h6> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-4 d-flex flex-column justify-content-center align-items-center my-4"> | |||
|             <div class="d-flex justify-content-center align-items-center mx-3 my-3" | |||
|                  style="background-color: #e6be26 !important; border-radius: 15px !important; height: 80px; width: 80px;"> | |||
|                 <img src="assets/icons/license.png" class="img-responsive" | |||
|                      height="48px" width="48px"> | |||
|             </div> | |||
|             <h6 class="text-center" | |||
|                 style="font-family: Montserrat, 'sans-serif' !important; font-weight: bold;"> | |||
|                 Odoo | |||
|                 Licensing Consultancy</h6> | |||
|         </div> | |||
|     </div> | |||
| 
 | |||
| </div> | |||
| 
 | |||
| <!-- END OF END OF OUR SERVICES --> | |||
| 
 | |||
| <!-- OUR INDUSTRIES --> | |||
| 
 | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/corporate.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Our | |||
|         Industries | |||
|     </h2> | |||
| </div> | |||
| 
 | |||
| <div class="container my-5"> | |||
|     <div class="row"> | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/trading-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Trading | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Easily procure | |||
|                     and | |||
|                     sell your products</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/pos-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     POS | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Easy | |||
|                     configuration | |||
|                     and convivial experience</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/education-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Education | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     A platform for | |||
|                     educational management</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/manufacturing-black.png" | |||
|                      class="img-responsive mb-3" height="48px" | |||
|                      width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Manufacturing | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Plan, track and | |||
|                     schedule your operations</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/ecom-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     E-commerce & Website | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Mobile | |||
|                     friendly, | |||
|                     awe-inspiring product pages</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/service-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Service Management | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Keep track of | |||
|                     services and invoice</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/restaurant-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Restaurant | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     Run your bar or | |||
|                     restaurant methodically</p> | |||
|             </div> | |||
|         </div> | |||
| 
 | |||
|         <div class="col-lg-3"> | |||
|             <div class="my-4 d-flex flex-column justify-content-center" | |||
|                  style="background-color: #f6f8f9 !important; border-radius: 0px; padding: 2rem !important; height: 250px !important;"> | |||
|                 <img src="./assets/icons/hotel-black.png" | |||
|                      class="img-responsive mb-3" height="48px" width="48px"> | |||
|                 <h5 style="font-family: Montserrat, sans-serif !important; color: #000 !important; font-weight: bold;"> | |||
|                     Hotel Management | |||
|                 </h5> | |||
|                 <p style="font-family: Montserrat, sans-serif !important; font-size: 0.9rem !important;"> | |||
|                     An | |||
|                     all-inclusive | |||
|                     hotel management application</p> | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
| </div> | |||
| 
 | |||
| <!-- END OF END OF OUR INDUSTRIES --> | |||
| 
 | |||
| <!-- SUPPORT --> | |||
| <div class="d-flex align-items-center" | |||
|      style="border-bottom: 2px solid #714B67; padding: 15px 0px;"> | |||
|     <div class="d-flex justify-content-center align-items-center mr-2" | |||
|          style="background-color: #F5F5F5; border-radius: 0px; width: 40px; height: 40px;"> | |||
|         <img src="./assets/misc/customer-support.png"/> | |||
|     </div> | |||
|     <h2 class="mt-2" | |||
|         style="font-family: 'Montserrat', sans-serif; font-size: 24px; font-weight: bold;"> | |||
|         Support | |||
|     </h2> | |||
| </div> | |||
| <div class="container mt-5"> | |||
|     <div class="row"> | |||
|         <div class="col-sm-12 col-md-6"> | |||
|             <div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;"> | |||
|                 <div class="mr-4" | |||
|                      style="background-color: #714B67; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;"> | |||
|                     <img src="./assets/misc/support.png" height="48" width="48" | |||
|                          style="width: 42px; height: 42px;"/> | |||
|                 </div> | |||
|                 <div> | |||
|                     <h4>Need Help?</h4> | |||
|                     <p style="line-height: 100%;">Got questions or need help? | |||
|                         Get in touch.</p> | |||
|                     <a href="mailto:odoo@cybrosys.com"> | |||
|                         <p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;"> | |||
|                             odoo@cybrosys.com</p> | |||
|                     </a> | |||
|                 </div> | |||
|             </div> | |||
|         </div> | |||
|         <div class="col-sm-12 col-md-6"> | |||
|             <div style="background-color: #F6F8F9; padding: 30px; display: flex; align-items: center;"> | |||
|                 <div class="mr-4" | |||
|                      style="background-color: #2AC44D; display: inline-block; height: 70px; width: 70px; display: flex; align-items: center; justify-content: center;"> | |||
|                     <img src="./assets/misc/whatsapp.png" height="52" width="52" | |||
|                          style="width: 52px; height: 52px;"/> | |||
|                 </div> | |||
|                 <div> | |||
|                     <h4>WhatsApp</h4> | |||
|                     <p style="line-height: 100%;">Say hi to us on WhatsApp!</p> | |||
|                     <a href="https://api.whatsapp.com/send?phone=918606827707"> | |||
|                         <p style="font-weight: 400; font-size: 28px; line-height: 80%; color: #714B67;"> | |||
|                             +91 86068 | |||
|                             27707</p> | |||
|                     </a> | |||
|                 </div> | |||
|             </div> | |||
|         </div> | |||
|     </div> | |||
|     <div class="row"> | |||
|         <div class="col-sm-12 my-5 d-flex justify-content-center align-items-center"> | |||
|             <img src="./assets/misc/logo.png" width="144" height="31" | |||
|                  style="width:144px; height: 31px; margin-top: 40px;"/> | |||
|         </div> | |||
|     </div> | |||
| </div> | |||
| <!-- END OF SUPPORT --> | |||
| @ -0,0 +1,134 @@ | |||
| /** @odoo-module **/ | |||
| import {registry} from "@web/core/registry"; | |||
| import {Component, useState} from "@odoo/owl"; | |||
| import {FileInput} from "@web/core/file_input/file_input"; | |||
| import {standardFieldProps} from "@web/views/fields/standard_field_props"; | |||
| import {useService} from "@web/core/utils/hooks"; | |||
| import {useX2ManyCrud} from "@web/views/fields/relational_utils"; | |||
| 
 | |||
| /** | |||
|  * The Many2ManyAttachmentPreview component is designed to manage the preview and handling | |||
|  * of many2many fields that contain file attachments. It allows users to upload, preview, | |||
|  * and remove files associated with a record. | |||
|  * | |||
|  * @class | |||
|  * @extends Component | |||
|  * | |||
|  * @prop {Object} props - The props object includes all the standard field properties, | |||
|  *                        as well as additional properties such as acceptedFileExtensions, | |||
|  *                        className, and numberOfFiles. | |||
|  * @prop {String} props.acceptedFileExtensions - (Optional) A string defining the accepted file | |||
|  *                                               extensions for uploads. | |||
|  * @prop {String} props.className - (Optional) A string defining any additional CSS classes | |||
|  *                                  to be applied. | |||
|  * @prop {Number} props.numberOfFiles - (Optional) A number representing the maximum number of | |||
|  *                                      files allowed. | |||
|  * | |||
|  * @setup | |||
|  * @method setup - Initializes services and state for the component, including ORM service, | |||
|  *                 notification service, and operations for managing many2many CRUD. | |||
|  * | |||
|  * @state {Object} state - Contains component state, including a flag for internal logic handling. | |||
|  * | |||
|  * @getter uploadText - Retrieves the label for the upload button, typically the field's label. | |||
|  * | |||
|  * @getter files - Returns a list of files associated with the record, including their IDs | |||
|  *                 and other relevant data. | |||
|  * | |||
|  * @method getUrl(id) - Constructs the URL to access a file attachment by its ID. | |||
|  * @param {Number} id - The ID of the file attachment. | |||
|  * @returns {String} - The URL for the file attachment. | |||
|  * | |||
|  * @method getExtension(file) - Extracts the file extension from a file's name. | |||
|  * @param {Object} file - The file object. | |||
|  * @returns {String} - The file extension. | |||
|  * | |||
|  * @method onFileUploaded(files) - Handles the logic after files are uploaded, | |||
|  *                                 including error handling and saving the records. | |||
|  * @param {Array} files - An array of uploaded files. | |||
|  * @returns {Promise<void>} | |||
|  * | |||
|  * @method onFileRemove(deleteId) - Handles the logic for removing a file by its ID, | |||
|  *                                  including updating the records. | |||
|  * @param {Number} deleteId - The ID of the file to be removed. | |||
|  * @returns {Promise<void>} | |||
|  * | |||
|  * @supportedTypes - Specifies that this component supports "many2many" fields. | |||
|  * | |||
|  * @fieldsToFetch - Defines the fields to be fetched from the related records, such as | |||
|  *                  'name' and 'mimetype'. | |||
|  * | |||
|  * @registry.category("fields").add("many2many_attachment_preview", Many2ManyAttachmentPreview) | |||
|  *                             - Registers the component in the Odoo registry. | |||
|  */ | |||
| 
 | |||
| export class Many2ManyAttachmentPreview extends Component { | |||
|     static template = 'many2many_attachment_preview.Many2ManyImageField' | |||
|     static components = { | |||
|         FileInput, | |||
|     }; | |||
|     static props = { | |||
|         ...standardFieldProps, | |||
|         acceptedFileExtensions: {type: String, optional: true}, | |||
|         className: {type: String, optional: true}, | |||
|         numberOfFiles: {type: Number, optional: true}, | |||
|     }; | |||
| 
 | |||
|     setup() { | |||
|         this.orm = useService("orm"); | |||
|         this.notification = useService("notification"); | |||
|         this.operations = useX2ManyCrud(() => this.props.value, true); | |||
|         this.state = useState({ | |||
|             flag: false, | |||
|         }); | |||
|     } | |||
| 
 | |||
|     get uploadText() { | |||
|         return this.props.record.fields[this.props.name].string; | |||
|     } | |||
| 
 | |||
|     get files() { | |||
|         return this.props.record.data[this.props.name].records.map((record) => { | |||
|             return { | |||
|                 ...record.data, | |||
|                 id: record.resId, | |||
|             }; | |||
|         }); | |||
|     } | |||
| 
 | |||
|     getUrl(id) { | |||
|         return "/web/content/ir.attachment/" + id + "/datas"; | |||
|     } | |||
| 
 | |||
|     getExtension(file) { | |||
|         return file.name.replace(/^.*\./, ""); | |||
|     } | |||
| 
 | |||
|     async onFileUploaded(files) { | |||
|         for (const file of files) { | |||
|             if (file.error) { | |||
|                 return this.notification.add(file.error, { | |||
|                     title: this.env._t("Uploading error"), | |||
|                     type: "danger", | |||
|                 }); | |||
|             } | |||
|             await this.operations.saveRecord([file.id]); | |||
|         } | |||
|     } | |||
| 
 | |||
|     async onFileRemove(deleteId) { | |||
|         const record = this.props.value.records.find((record) => record.data.id === deleteId); | |||
|         this.operations.removeRecord(record); | |||
|     } | |||
| } | |||
| 
 | |||
| Many2ManyAttachmentPreview.supportedTypes = ["many2many"]; | |||
| Many2ManyAttachmentPreview.fieldsToFetch = { | |||
|     name: { | |||
|         type: 'char' | |||
|     }, | |||
|     mimetype: { | |||
|         type: 'char' | |||
|     }, | |||
| } | |||
| registry.category("fields").add("many2many_attachment_preview", Many2ManyAttachmentPreview) | |||
| @ -0,0 +1,151 @@ | |||
| <template> | |||
|     <!-- | |||
|    This template defines a Many2ManyImageField component used to display a list of image attachments | |||
|    with an option to upload additional files. The component utilizes the Odoo Owl framework. | |||
| 
 | |||
|    Structure: | |||
|    - The outermost `div` has a dynamic class that includes `oe_fileupload` and optionally | |||
|      a custom class if provided in `props.className`. | |||
|    - Inside this `div`, there's a container `div` with the class `o_attachments o_attachments_widget` | |||
|      which holds the list of attached files. | |||
|    - The files are iterated over using `t-foreach`, where each `file` is rendered using the | |||
|      `many2many_attachment_preview.image_preview` template. | |||
|    - If the `readonly` property is not set, an upload section is rendered, allowing the user to | |||
|      attach more files. The upload button triggers the `FileInput` component with the following attributes: | |||
|        - `acceptedFileExtensions`: Defines the types of files allowed for upload. | |||
|        - `multiUpload`: Enables multiple file uploads at once. | |||
|        - `onUpload.bind`: Binds the `onFileUploaded` method for handling the upload process. | |||
|        - `resModel`: Specifies the model associated with the uploaded files. | |||
|        - `resId`: Specifies the record ID. If no ID is provided, it defaults to 0. | |||
|    - The upload button has a tooltip "Attach" and displays a paperclip icon with a label and upload text. | |||
|    --> | |||
|     <t t-name="many2many_attachment_preview.Many2ManyImageField" owl="1"> | |||
|         <div t-attf-class="oe_fileupload {{ props.className ? props.className : ''}}" | |||
|              aria-atomic="true"> | |||
|             <div class="o_attachments o_attachments_widget"> | |||
|                 <t t-foreach="files" t-as="file" t-key="file_index"> | |||
|                     <t t-call="many2many_attachment_preview.image_preview"/> | |||
|                 </t> | |||
|             </div> | |||
|             <div t-if="!props.readonly" class="oe_add"> | |||
|                 <FileInput | |||
|                         acceptedFileExtensions="props.acceptedFileExtensions" | |||
|                         multiUpload="true" | |||
|                         onUpload.bind="onFileUploaded" | |||
|                         resModel="props.record.resModel" | |||
|                         resId="props.record.data.id or 0"> | |||
|                     <button class="btn btn-secondary o_attach o_attach_wiget" | |||
|                             data-tooltip="Attach"> | |||
|                         <span class="fa fa-paperclip" aria-label="Attach"/> | |||
|                         <t t-esc="uploadText"/> | |||
|                     </button> | |||
|                 </FileInput> | |||
|             </div> | |||
|         </div> | |||
|     </t> | |||
|     <!-- | |||
|    This template defines the `image_preview` component used to display individual file attachments | |||
|    in a many-to-many relationship field within Odoo. It handles various file types such as images, | |||
|    PDFs, and videos, and provides functionalities for viewing, downloading, and deleting files. | |||
| 
 | |||
|    Structure: | |||
|    - A variable `editable` is set based on the `readonly` property from `props`, determining whether the file is editable. | |||
|    - The outer `div` uses dynamic classes based on the `editable` state and upload status to provide appropriate styling. | |||
|    - The inner `div` wraps the file attachment and displays the content based on the file extension: | |||
|        - For image files (`png`, `jpg`, `jpeg`), an image preview is displayed. The image is wrapped in a link that uses Fancybox to allow zooming. | |||
|        - For PDF files, the link is set to open in an iframe using Fancybox. | |||
|        - For video files (`mkv`), the link is configured to play the video in an HTML5 video player using Fancybox. | |||
|    - The `caption` section displays the file name and extension. Clicking the file name triggers a download. | |||
|    - If the file is editable, a progress bar is shown during the upload process, and a delete button is provided to remove the file. | |||
|    - Once the file is uploaded, a checkmark icon indicates successful upload. | |||
|    - The delete button allows the user to remove the file, triggering the `onFileRemove` function with the file's ID. | |||
|    --> | |||
|     <t t-name="many2many_attachment_preview.image_preview" owl="1"> | |||
|         <t t-set="editable" t-value="!props.readonly"/> | |||
|         <div t-attf-class="o_attachment_widget o_attachment_many2many #{ editable ? 'o_attachment_editable' : '' } #{upload ? 'o_attachment_uploading' : ''}" | |||
|              t-att-title="file.name"> | |||
|             <div t-attf-class="o_attachment o_attachment_many2many #{ editable ? 'o_attachment_editable' : '' } #{upload ? 'o_attachment_uploading' : ''}" | |||
|                  t-att-title="file.name"> | |||
|                 <div class="o_attachment_wrap"> | |||
|                     <t t-set="ext" t-value="getExtension(file)"/> | |||
|                     <t t-if="ext=='png' or ext=='jpg' or ext=='jpeg'"> | |||
|                         <div class="o_image_box float-start" | |||
|                              t-att-data-tooltip="'Download ' + file.name"> | |||
|                             <a t-att-href="getUrl(file.id)" | |||
|                                aria-label="Download" | |||
|                                style="cursor: zoom-in;" data-fancybox="gallery" | |||
|                                data-options="Toolbar"> | |||
|                                 <span class="o_image o_hover" | |||
|                                       t-att-data-mimetype="file.mimetype" | |||
|                                       t-att-data-ext="ext" role="img" | |||
|                                       t-attf-data-src="/web/content/{{file.id}}"/> | |||
|                             </a> | |||
|                         </div> | |||
|                     </t> | |||
|                     <t t-if="ext=='pdf'"> | |||
|                         <div class="o_image_box float-start" | |||
|                              t-att-data-tooltip="'Download ' + file.name"> | |||
|                             <a t-att-href="getUrl(file.id)" | |||
|                                aria-label="Download" | |||
|                                style="cursor: zoom-in;" data-fancybox="" | |||
|                                data-type="iframe"> | |||
|                                 <span class="o_image o_hover" | |||
|                                       t-att-data-mimetype="file.mimetype" | |||
|                                       t-att-data-ext="ext" role="img" | |||
|                                       t-attf-data-src="/web/content/{{file.id}}"/> | |||
|                             </a> | |||
|                         </div> | |||
|                     </t> | |||
|                     <t t-if="ext=='mkv'"> | |||
|                         <div class="o_image_box float-start" | |||
|                              t-att-data-tooltip="'Download ' + file.name"> | |||
|                             <a t-att-href="getUrl(file.id)" | |||
|                                aria-label="Download" | |||
|                                style="cursor: zoom-in;" data-fancybox="" | |||
|                                data-type="html5video" data-width="640" | |||
|                                data-height="360"> | |||
|                                 <span class="o_image o_hover" | |||
|                                       t-att-data-mimetype="file.mimetype" | |||
|                                       t-att-data-ext="ext" role="img" | |||
|                                       t-attf-data-src="/web/content/{{file.id}}"/> | |||
|                             </a> | |||
|                         </div> | |||
|                     </t> | |||
| 
 | |||
|                     <div class="caption"> | |||
|                         <a class="ml4" | |||
|                            t-att-data-tooltip="'Download ' + file.name" | |||
|                            t-att-href="getUrl(file.id)"> | |||
|                             <t t-esc='file.name'/> | |||
|                         </a> | |||
|                     </div> | |||
|                     <div class="caption small"> | |||
|                         <a class="ml4 small text-uppercase" | |||
|                            t-att-href="getUrl(file.id)"> | |||
|                             <b> | |||
|                                 <t t-esc='ext'/> | |||
|                             </b> | |||
|                         </a> | |||
|                         <div t-if="editable" | |||
|                              class="progress o_attachment_progress_bar"> | |||
|                             <div class="progress-bar progress-bar-striped active" | |||
|                                  style="width: 100%">Uploading | |||
|                             </div> | |||
|                         </div> | |||
|                     </div> | |||
| 
 | |||
|                     <div class="o_attachment_uploaded"> | |||
|                         <i class="text-success fa fa-check" role="img" | |||
|                            aria-label="Uploaded" title="Uploaded"/> | |||
|                     </div> | |||
|                     <div t-if="editable" class="o_attachment_delete" | |||
|                          t-on-click.stop="() => this.onFileRemove(file.id)"> | |||
|                         <span class="text-white" role="img" aria-label="Delete" | |||
|                               title="Delete">× | |||
|                         </span> | |||
|                     </div> | |||
|                 </div> | |||
|             </div> | |||
|         </div> | |||
|     </t> | |||
| </template> | |||
| @ -0,0 +1,22 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <odoo> | |||
|     <!-- | |||
|     This XML file inherits the sale order form view to add a new field, | |||
|     `attachment_ids`, which uses the `many2many_attachment_preview` widget. | |||
|     The new field is placed right after the `payment_term_id` field. | |||
|     This customization allows users to preview attachments directly in the | |||
|     sale order form. | |||
|     --> | |||
|     <record id="view_order_form" model="ir.ui.view"> | |||
|         <field name="name"> | |||
|             sale.order.view.form.inherit.many2many.attachment.preview | |||
|         </field> | |||
|         <field name="inherit_id" ref="sale.view_order_form"/> | |||
|         <field name="model">sale.order</field> | |||
|         <field name="arch" type="xml"> | |||
|             <field name="payment_term_id" position="after"> | |||
|                 <field name="attachment_ids" widget="many2many_attachment_preview"/> | |||
|             </field> | |||
|         </field> | |||
|     </record> | |||
| </odoo> | |||