@ -0,0 +1,50 @@ |
|||||
|
.. image:: https://img.shields.io/badge/license-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Multiple Attachments In eCommerce Order |
||||
|
======================================= |
||||
|
This Module allows customer to upload documents for the sale order |
||||
|
|
||||
|
Configuration |
||||
|
============= |
||||
|
* No additional configurations needed |
||||
|
|
||||
|
Company |
||||
|
------- |
||||
|
* `Cybrosys Techno Solutions <https://cybrosys.com/>`__ |
||||
|
|
||||
|
License |
||||
|
------- |
||||
|
General Public License, Version 3 (LGPL v3). |
||||
|
(https://www.gnu.org/licenses/lgpl-3.0-standalone.html) |
||||
|
|
||||
|
Credits |
||||
|
------- |
||||
|
Developer: (V16) Fathima Mazlin AM, |
||||
|
(V17) Gayathri V, |
||||
|
(V18) Ranjith R |
||||
|
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,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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 controllers |
||||
|
from . import models |
@ -0,0 +1,52 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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': 'Multiple Attachments In eCommerce Order', |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'eCommerce', |
||||
|
'summary': 'Can upload files in payment page of website.', |
||||
|
'description': 'Can upload files related to the sale order in payment page' |
||||
|
'of website.This attachment can also view in website order.' |
||||
|
'Through the attachment we can give further details or ' |
||||
|
'information regarding the sale order.', |
||||
|
'author': 'Cybrosys Techno solutions', |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': 'https://www.cybrosys.com', |
||||
|
'depends': [ |
||||
|
'website_sale', 'sale_management', |
||||
|
], |
||||
|
'data': [ |
||||
|
'views/website_sale_templates.xml', |
||||
|
'views/sale_order_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_frontend': [ |
||||
|
'website_upload_files/static/src/js/attachment.js', |
||||
|
], |
||||
|
}, |
||||
|
'images': ['static/description/banner.jpg'], |
||||
|
'license': 'LGPL-3', |
||||
|
'installable': True, |
||||
|
'auto_install': False, |
||||
|
'application': False, |
||||
|
} |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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 website_upload_files |
@ -0,0 +1,57 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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/>. |
||||
|
# |
||||
|
############################################################################# |
||||
|
import base64 |
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
from odoo.addons.website_sale.controllers import main |
||||
|
|
||||
|
|
||||
|
class WebsiteSaleFileUpload(main.WebsiteSale): |
||||
|
"""For attaching the file in website sale order""" |
||||
|
@http.route() |
||||
|
def shop_payment(self, **post): |
||||
|
res = super(WebsiteSaleFileUpload, self).shop_payment(**post) |
||||
|
order = res.qcontext['order'] |
||||
|
if post.get('attachment'): |
||||
|
if post.get('attachment', False): |
||||
|
file = post.get('attachment') |
||||
|
request.env['ir.attachment'].sudo().create({ |
||||
|
'name': post.get('attachment').filename, |
||||
|
'res_name': post.get('attachment').filename, |
||||
|
'type': 'binary', |
||||
|
'res_model': 'sale.order', |
||||
|
'res_id': order.id, |
||||
|
'datas': base64.b64encode(file.read()), |
||||
|
}) |
||||
|
all_attachments = request.env['ir.attachment'].search( |
||||
|
[('res_model', '=', 'sale.order'), ('res_id', '=', order.id)]) |
||||
|
res.qcontext.update({'attachment': all_attachments}) |
||||
|
return res |
||||
|
|
||||
|
@http.route('/shop/attachments', type='json', auth='public', website=True, |
||||
|
sitemap=False) |
||||
|
def shop_attachments(self, **post): |
||||
|
"""For delete the attachment from websites""" |
||||
|
attachment = request.env['ir.attachment'].sudo().browse(int(post.get( |
||||
|
"attachment_id"))) |
||||
|
attachment.unlink() |
||||
|
return 1 |
@ -0,0 +1,7 @@ |
|||||
|
## Module <website_upload_files> |
||||
|
|
||||
|
#### 13.01.2025 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
|
||||
|
- Initial commit for Multiple Attachments In eCommerce Order |
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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,48 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################# |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2025-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Cybrosys Techno Solutions(<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): |
||||
|
"""For adding the count of attachment as field in sale order""" |
||||
|
_inherit = 'sale.order' |
||||
|
|
||||
|
attachment_count = fields.Integer(string='Attachment Count', |
||||
|
help="Count of attachment", |
||||
|
compute='_compute_attachment_count') |
||||
|
|
||||
|
def _compute_attachment_count(self): |
||||
|
"""Count of attached documents""" |
||||
|
for rec in self: |
||||
|
rec.attachment_count = self.env['ir.attachment'].search_count( |
||||
|
[('res_model', '=', 'sale.order'), ('res_id', '=', rec.id)]) |
||||
|
|
||||
|
def action_show_attachments(self): |
||||
|
"""To show attached documents""" |
||||
|
return { |
||||
|
'name': _('Attachments'), |
||||
|
'view_mode': 'kanban,form', |
||||
|
'res_model': 'ir.attachment', |
||||
|
'type': 'ir.actions.act_window', |
||||
|
'domain': [('res_model', '=', 'sale.order'), |
||||
|
('res_id', '=', self.id)] |
||||
|
} |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 628 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 210 KiB |
After Width: | Height: | Size: 209 KiB |
After Width: | Height: | Size: 109 KiB |
After Width: | Height: | Size: 495 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 136 KiB |
After Width: | Height: | Size: 214 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 3.6 KiB |
After Width: | Height: | Size: 310 B |
After Width: | Height: | Size: 929 B |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 3.3 KiB |
After Width: | Height: | Size: 1.4 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 542 B |
After Width: | Height: | Size: 576 B |
After Width: | Height: | Size: 733 B |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 4.0 KiB |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 2.2 KiB |
After Width: | Height: | Size: 911 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 600 B |
After Width: | Height: | Size: 673 B |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 462 B |
After Width: | Height: | Size: 2.1 KiB |
After Width: | Height: | Size: 926 B |
After Width: | Height: | Size: 9.0 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 878 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 653 B |
After Width: | Height: | Size: 800 B |
After Width: | Height: | Size: 905 B |
After Width: | Height: | Size: 189 KiB |
After Width: | Height: | Size: 4.3 KiB |
After Width: | Height: | Size: 839 B |
After Width: | Height: | Size: 1.7 KiB |
After Width: | Height: | Size: 5.9 KiB |
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 26 KiB |
After Width: | Height: | Size: 3.8 KiB |
After Width: | Height: | Size: 23 KiB |
After Width: | Height: | Size: 1.9 KiB |
After Width: | Height: | Size: 2.3 KiB |
After Width: | Height: | Size: 427 B |
After Width: | Height: | Size: 627 B |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 988 B |
After Width: | Height: | Size: 3.7 KiB |
After Width: | Height: | Size: 5.0 KiB |
After Width: | Height: | Size: 875 B |
After Width: | Height: | Size: 1.2 KiB |
After Width: | Height: | Size: 767 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 760 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 1.1 MiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 155 KiB |
After Width: | Height: | Size: 154 KiB |
After Width: | Height: | Size: 203 KiB |
After Width: | Height: | Size: 87 KiB |
After Width: | Height: | Size: 240 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 761 KiB |
After Width: | Height: | Size: 39 KiB |
@ -0,0 +1,22 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
import publicWidget from "@web/legacy/js/public/public_widget"; |
||||
|
import { rpc } from "@web/core/network/rpc"; |
||||
|
import { useRef } from "@odoo/owl"; |
||||
|
publicWidget.registry.add_attachment = publicWidget.Widget.extend({ |
||||
|
selector: '.div-class-button', |
||||
|
events: { |
||||
|
'click #button_add_attachment_payment': 'AttachmentPaymentOnClick', |
||||
|
}, |
||||
|
/** |
||||
|
For delete the attachments |
||||
|
**/ |
||||
|
AttachmentPaymentOnClick: function (ev) { |
||||
|
var attachment_id = ev.target.closest('div') |
||||
|
rpc("/shop/attachments" , { |
||||
|
"attachment_id":attachment_id.id |
||||
|
}).then(function (data) { |
||||
|
return |
||||
|
}); |
||||
|
attachment_id.remove(); |
||||
|
}, |
||||
|
}); |
@ -0,0 +1,19 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<odoo> |
||||
|
<!-- Add a button to show the count of attached documents--> |
||||
|
<record id="view_order_form" model="ir.ui.view"> |
||||
|
<field name="name">sale.order.view.form.inherit.website.upload.files |
||||
|
</field> |
||||
|
<field name="model">sale.order</field> |
||||
|
<field name="inherit_id" ref="sale.view_order_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<div name="button_box" position="inside"> |
||||
|
<button class="oe_stat_button" type="object" |
||||
|
name="action_show_attachments" icon="fa-paperclip"> |
||||
|
<field string="Attachments" name="attachment_count" |
||||
|
widget="statinfo"/> |
||||
|
</button> |
||||
|
</div> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,55 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!--Add a button named as Add Attachment in payment page in website--> |
||||
|
<template id="payment_add_files" name="Upload Files" |
||||
|
inherit_id="website_sale.payment"> |
||||
|
<xpath expr="//div[@id='payment_method']" position="after"> |
||||
|
<br/> |
||||
|
<div class="div-class-button"> |
||||
|
<div t-attf-class="form-group"> |
||||
|
<div class="col"> |
||||
|
<form id="add_sale_attachment" method="POST" |
||||
|
action="/shop/payment" |
||||
|
class="modal-content" |
||||
|
enctype="multipart/form-data"> |
||||
|
<input type="hidden" name="csrf_token" |
||||
|
t-att-value="request.csrf_token()"/> |
||||
|
<input type="file" name="attachment" |
||||
|
class="file" |
||||
|
data-show-upload="true" |
||||
|
data-show-caption="true" |
||||
|
lass="file" |
||||
|
data-show-preview="true" |
||||
|
/> |
||||
|
<button type="submit" name="Upload" |
||||
|
style="margin-top:20px;" |
||||
|
class="fa fa-upload"> |
||||
|
Upload |
||||
|
</button> |
||||
|
</form> |
||||
|
</div> |
||||
|
<t t-if="attachment"> |
||||
|
<t t-foreach="attachment" t-as="attach"> |
||||
|
<div t-att-id="attach.id" border="0"> |
||||
|
<table class="table table-borderless"> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td scope="col" |
||||
|
style="width:800px;"> |
||||
|
<t t-esc="attach.name"/> |
||||
|
</td> |
||||
|
<td scope="col"> |
||||
|
<button class="fa fa-trash-o" |
||||
|
id="button_add_attachment_payment"/> |
||||
|
</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
</div> |
||||
|
</t> |
||||
|
</t> |
||||
|
</div> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</template> |
||||
|
</odoo> |