@ -0,0 +1,44 @@ |
|||||
|
.. image:: https://img.shields.io/badge/licence-LGPL--3-green.svg |
||||
|
:target: https://www.gnu.org/licenses/lgpl-3.0-standalone.html |
||||
|
:alt: License: LGPL-3 |
||||
|
|
||||
|
Website Order Delivery Tracking |
||||
|
=============================== |
||||
|
This module allows us to track our delivery from odoo and the delivery partners |
||||
|
can update the status using the api key provided. |
||||
|
|
||||
|
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: (V17) Saneen K, Contact: odoo@cybrosys.com |
||||
|
(V18) Raveena V, 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) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Raveena V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import controllers |
||||
|
from . import models |
@ -0,0 +1,53 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Raveena V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
{ |
||||
|
'name': "Website Order Delivery Tracking", |
||||
|
'version': '18.0.1.0.0', |
||||
|
'category': 'Website', |
||||
|
'summary': """Track order delivery status, and delivery partners can update |
||||
|
the status.""", |
||||
|
'description': """This module allows us to track delivery status of product |
||||
|
and the delivery partners can update the status using the api key provided. |
||||
|
The delivery partners can pass data and edit the record using this api |
||||
|
also instead of visiting website.""", |
||||
|
'author': "Cybrosys Techno Solutions", |
||||
|
'company': 'Cybrosys Techno Solutions', |
||||
|
'maintainer': 'Cybrosys Techno Solutions', |
||||
|
'website': "https://www.cybrosys.com", |
||||
|
'depends': ['base', 'website', 'stock', 'sale_stock', 'sale_management', 'stock_delivery'], |
||||
|
'data': [ |
||||
|
'views/tracking_menu.xml', |
||||
|
'views/tracking_templates.xml', |
||||
|
'views/res_config_settings_views.xml', |
||||
|
], |
||||
|
'assets': { |
||||
|
'web.assets_frontend': [ |
||||
|
'website_order_delivery_tracking/static/src/css/delivery_tracking.css', |
||||
|
'website_order_delivery_tracking/static/src/js/delivery_tracking.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) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Saneen K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import website_order_delivery_tracking |
@ -0,0 +1,69 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Saneen K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import http |
||||
|
from odoo.http import request |
||||
|
|
||||
|
|
||||
|
class Tracking(http.Controller): |
||||
|
"""Class representing Tracking""" |
||||
|
|
||||
|
@http.route('/tracking/details', type='http', auth="user", website=True, |
||||
|
csrf=False) |
||||
|
def get_track_details(self): |
||||
|
"""Track data""" |
||||
|
return request.render( |
||||
|
'website_order_delivery_tracking.trackingTemplate') |
||||
|
|
||||
|
@http.route(['/tracking/details/update'], type='json', auth="user", |
||||
|
website=True) |
||||
|
def input_data_processing(self, **post): |
||||
|
"""Fetch input json data sent from js""" |
||||
|
track_data = request.env['stock.picking'].search( |
||||
|
[('carrier_tracking_ref', '=', post.get('input_data'))]) |
||||
|
tracking_details = [ |
||||
|
[ |
||||
|
rec.name, |
||||
|
rec.origin, |
||||
|
rec.carrier_id.name, |
||||
|
rec.tracking_status or 'Status currently not available', |
||||
|
] |
||||
|
for rec in track_data |
||||
|
] |
||||
|
return tracking_details |
||||
|
|
||||
|
@http.route('/tracking/details/edit', type='json', auth="public", |
||||
|
website=False, |
||||
|
csrf=False, methods=['GET', 'POST']) |
||||
|
def track_data_edit(self, **post): |
||||
|
"""Edit tracking data""" |
||||
|
tracking_api = request.env['ir.config_parameter'].sudo().get_param( |
||||
|
'stock.delivery_tracking_api_key') |
||||
|
track_data = request.env['stock.picking'].sudo().search( |
||||
|
[('carrier_tracking_ref', '=', post.get('tracking_number'))]) |
||||
|
if track_data and post.get( |
||||
|
'api_key') == tracking_api: |
||||
|
track_data.write({ |
||||
|
'tracking_status': post.get('tracking_status'), |
||||
|
}) |
||||
|
return track_data.tracking_status |
||||
|
else: |
||||
|
return [] |
@ -0,0 +1,5 @@ |
|||||
|
## Module <website_order_delivery_tracking> |
||||
|
#### 02.11.2024 |
||||
|
#### Version 18.0.1.0.0 |
||||
|
#### ADD |
||||
|
- Initial Commit for Website Order Delivery Tracking |
@ -0,0 +1,23 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Raveena V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from . import stock_picking |
||||
|
from . import res_config_settings |
@ -0,0 +1,56 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Raveena V (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class ResConfigSettings(models.TransientModel): |
||||
|
"""Model representing res.config.settings""" |
||||
|
_inherit = 'res.config.settings' |
||||
|
|
||||
|
delivery_tracking_api_key = fields.Char( |
||||
|
'API Key', |
||||
|
help='This API key is used to access Odoo and change the delivery' |
||||
|
' status',required=True) |
||||
|
|
||||
|
def set_values(self): |
||||
|
""" |
||||
|
Overrides the base method to set the configured delivery tracking API |
||||
|
key value in the 'ir.config_parameter' model. |
||||
|
""" |
||||
|
res = super(ResConfigSettings, self).set_values() |
||||
|
self.env['ir.config_parameter'].set_param( |
||||
|
'stock.delivery_tracking_api_key', self.delivery_tracking_api_key) |
||||
|
return res |
||||
|
|
||||
|
def get_values(self): |
||||
|
""" |
||||
|
Overrides the base method to get the delivery tracking API key value |
||||
|
from the 'ir.config_parameter' model and include it in the result. |
||||
|
""" |
||||
|
res = super(ResConfigSettings, self).get_values() |
||||
|
params = self.env['ir.config_parameter'].sudo() |
||||
|
delivery_tracking_api_key = params.get_param( |
||||
|
'stock.delivery_tracking_api_key') |
||||
|
res.update( |
||||
|
delivery_tracking_api_key=delivery_tracking_api_key, |
||||
|
) |
||||
|
return res |
@ -0,0 +1,31 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################### |
||||
|
# |
||||
|
# Cybrosys Technologies Pvt. Ltd. |
||||
|
# |
||||
|
# Copyright (C) 2024-TODAY Cybrosys Technologies(<https://www.cybrosys.com>) |
||||
|
# Author: Saneen K (odoo@cybrosys.com) |
||||
|
# |
||||
|
# You can modify it under the terms of the GNU LESSER |
||||
|
# GENERAL PUBLIC LICENSE (LGPL 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 LESSER GENERAL PUBLIC LICENSE (LGPL v3) for more details. |
||||
|
# |
||||
|
# You should have received a copy of the GNU LESSER GENERAL PUBLIC LICENSE |
||||
|
# (LGPL v3) along with this program. |
||||
|
# If not, see <http://www.gnu.org/licenses/>. |
||||
|
# |
||||
|
############################################################################### |
||||
|
from odoo import fields, models |
||||
|
|
||||
|
|
||||
|
class StockPicking(models.Model): |
||||
|
"""Add a field named 'tracking_status' in 'stock.picking' to have the |
||||
|
status of the delivery """ |
||||
|
_inherit = 'stock.picking' |
||||
|
|
||||
|
tracking_status = fields.Text(string='Tracking Status', |
||||
|
help="Status of the picking") |
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: 254 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: 90 KiB |
After Width: | Height: | Size: 138 KiB |
After Width: | Height: | Size: 710 KiB |
After Width: | Height: | Size: 92 KiB |
After Width: | Height: | Size: 738 KiB |
After Width: | Height: | Size: 697 KiB |
After Width: | Height: | Size: 156 KiB |
After Width: | Height: | Size: 122 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 78 KiB |
After Width: | Height: | Size: 86 KiB |
After Width: | Height: | Size: 117 KiB |
After Width: | Height: | Size: 104 KiB |
After Width: | Height: | Size: 88 KiB |
After Width: | Height: | Size: 880 KiB |
After Width: | Height: | Size: 143 KiB |
After Width: | Height: | Size: 9.8 KiB |
@ -0,0 +1,24 @@ |
|||||
|
|
||||
|
#trackingNumberInput:focus, #trackingInputBtn:focus{ |
||||
|
box-shadow: none; |
||||
|
} |
||||
|
|
||||
|
#trackingNumberInput::placeholder { |
||||
|
font-size: 0.95rem; |
||||
|
color: #aaa; |
||||
|
font-style: italic; |
||||
|
} |
||||
|
#trackingNumberInput::-webkit-outer-spin-button, |
||||
|
#trackingNumberInput::-webkit-inner-spin-button { |
||||
|
-webkit-appearance: none; |
||||
|
margin: 0; |
||||
|
} |
||||
|
|
||||
|
#trackingNumberInput { |
||||
|
-moz-appearance: textfield; |
||||
|
} |
||||
|
|
||||
|
#trackedTableDetails{ |
||||
|
max-width: 70%; |
||||
|
margin: 0 auto; |
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
/** @odoo-module **/ |
||||
|
import publicWidget from "@web/legacy/js/public/public_widget"; |
||||
|
import { rpc } from "@web/core/network/rpc"; |
||||
|
|
||||
|
publicWidget.registry.OrderTrackingWidget = publicWidget.Widget.extend({ |
||||
|
// Bind the widget to the #deliveryTrackingForm element
|
||||
|
selector: '.TrackingTemplates', |
||||
|
|
||||
|
// Handler for the delivery tracking form submit event
|
||||
|
events: { |
||||
|
'click #trackingInputBtn': '_onDeliveryTracking', |
||||
|
'click #TrackingUpdate': '_onDeliveryTrackingUpdate', |
||||
|
'input #trackingNumberInput': '_onTrackingNumberInput', |
||||
|
}, |
||||
|
|
||||
|
_onTrackingNumberInput:function(ev){ |
||||
|
if(!this.$el.find("#trackingNumberInput").val()){ |
||||
|
this.$el.find("#trackedTableDetails").hide(); |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
_onDeliveryTracking: function(ev) { |
||||
|
let self = this |
||||
|
// Submit event handler for delivery tracking form
|
||||
|
self.$el.find('#deliveryTrackingForm').submit(function(e) { |
||||
|
|
||||
|
e.preventDefault(); |
||||
|
|
||||
|
// Get the tracking number from the input field
|
||||
|
var trackingNumber = self.$el.find("#trackingNumberInput").val(); |
||||
|
// Call the server-side controller to update tracking details
|
||||
|
rpc("/tracking/details/update", { |
||||
|
'input_data': trackingNumber, |
||||
|
}).then(function(data) { |
||||
|
let noRecordsMsg = self.$el.find('#noRecordsMsg'); |
||||
|
// Check if data exists
|
||||
|
if (data.length > 0) { |
||||
|
self.$el.find("#trackedTableDetails").show(); |
||||
|
// Display the tracking details in a table
|
||||
|
self.$el.find("#trackedTableDetails").html(` |
||||
|
<table class="table"> |
||||
|
<thead class="thead-dark"> |
||||
|
<tr> |
||||
|
<th scope="col">Sale Order</th> |
||||
|
<th scope="col">Delivery Partner</th> |
||||
|
<th scope="col">Status</th> |
||||
|
</tr> |
||||
|
</thead> |
||||
|
<tbody> |
||||
|
<tr> |
||||
|
<td>${data[0][1]}</td> |
||||
|
<td>${data[0][2]}</td> |
||||
|
<td>${data[0][3]}</td> |
||||
|
</tr> |
||||
|
</tbody> |
||||
|
</table> |
||||
|
`);
|
||||
|
self.$el.find('#noRecordsMsg').hide(); |
||||
|
} |
||||
|
|
||||
|
// If no data is returned, display an alert and hide the table
|
||||
|
if (data.length <= 0) { |
||||
|
self.$el.find('#NoRecordsApiKey').modal('show'); |
||||
|
self.$el.find("#trackedTableDetails").hide(); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
|
||||
|
_onDeliveryTrackingUpdate: function(ev) { |
||||
|
let self = this |
||||
|
// Submit event handler for editing tracking status form
|
||||
|
self.$el.find('#editTrackingStatusForm').submit(function(e) { |
||||
|
e.preventDefault(); |
||||
|
// Get input values
|
||||
|
var trackingNumber = self.$el.find("#trackingNumber").val(); |
||||
|
var apiKey = self.$el.find("#apiKey").val(); |
||||
|
var trackingStatus = self.$el.find("#trackingStatus").val(); |
||||
|
|
||||
|
// Call the server-side controller to edit tracking status
|
||||
|
rpc("/tracking/details/edit", { |
||||
|
'api_key': apiKey, |
||||
|
'tracking_number': trackingNumber, |
||||
|
'tracking_status': trackingStatus, |
||||
|
}).then(function(data) { |
||||
|
if (data.length > 0) { |
||||
|
// Show success modal if data is returned
|
||||
|
self.$el.find('#successApiKey').modal('show'); |
||||
|
} else { |
||||
|
// Show failure modal if no data is returned
|
||||
|
self.$el.find('#failedApiKey').modal('show'); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
}, |
||||
|
}) |
||||
|
|
@ -0,0 +1,34 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Configuration Settings Form view--> |
||||
|
<record id="res_config_settings_view_form" model="ir.ui.view"> |
||||
|
<field name="name"> |
||||
|
res.config.settings.view.form.inherit.website.order.delivery.tracking |
||||
|
</field> |
||||
|
<field name="model">res.config.settings</field> |
||||
|
<field name="inherit_id" |
||||
|
ref="stock.res_config_settings_view_form"/> |
||||
|
<field name="arch" type="xml"> |
||||
|
<xpath expr="//block[@name='invoicing_setting_container']" |
||||
|
position="before"> |
||||
|
<h2>Delivery Tracking</h2> |
||||
|
<div class="row mt16 o_settings_container" |
||||
|
id="delivery_tracking"> |
||||
|
<div class="col-12 col-lg-6 o_setting_box" |
||||
|
id="delivery_tracking_api "> |
||||
|
<div class="o_setting_left_pane"> |
||||
|
</div> |
||||
|
<div class="o_setting_right_pane"> |
||||
|
<label for="delivery_tracking_api_key" |
||||
|
string="Delivery Tracking"/> |
||||
|
<div class="text-muted mb16"> |
||||
|
Set Delivery tracking API key |
||||
|
</div> |
||||
|
<field name="delivery_tracking_api_key"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</xpath> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Website Menu For Tracking Details--> |
||||
|
<record id="tracking_menu" model="website.menu"> |
||||
|
<field name="name">Tracking Details</field> |
||||
|
<field name="url">/tracking/details</field> |
||||
|
<field name="parent_id" ref="website.main_menu"/> |
||||
|
<field name="sequence" type="int">50</field> |
||||
|
</record> |
||||
|
</odoo> |
@ -0,0 +1,215 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- Tracking template--> |
||||
|
<template id="trackingTemplate"> |
||||
|
<t t-call="website.layout"> |
||||
|
<div class="TrackingTemplates"> |
||||
|
<div class="container mt-3"> |
||||
|
<div class="row mb-5"> |
||||
|
<div class="col-lg-8 mx-auto"> |
||||
|
<div class="bg-white p-5 rounded shadow"> |
||||
|
<form id="deliveryTrackingForm" action=""> |
||||
|
<h5 class="text-center mt-2 mb-4 "> |
||||
|
Track Your Orders |
||||
|
</h5> |
||||
|
<div class="input-group mb-4 border rounded-pill p-1"> |
||||
|
<input type="text" |
||||
|
placeholder="Enter your tracking reference here" |
||||
|
aria-describedby="trackingInputBtn" |
||||
|
class="form-control bg-none border-0" |
||||
|
autocomplete="off" |
||||
|
id="trackingNumberInput" |
||||
|
required="1"/> |
||||
|
<div class="input-group-append border-0"> |
||||
|
<button id="trackingInputBtn" |
||||
|
class="btn btn-link text-success"> |
||||
|
<i class="fa fa-search"/> |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
<!-- Button trigger modal --> |
||||
|
<a type="button" class="btn btn-link" |
||||
|
data-bs-toggle="modal" |
||||
|
data-bs-target="#staticBackdrop" |
||||
|
data-toggle="tooltip" |
||||
|
data-placement="bottom" |
||||
|
title="Edit delivery status using access key"> |
||||
|
Delivery Partner? |
||||
|
</a> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- Modal --> |
||||
|
<div class="modal fade" id="staticBackdrop" |
||||
|
data-bs-backdrop="static" data-bs-keyboard="false" |
||||
|
tabindex="-1" aria-labelledby="staticBackdropLabel" |
||||
|
aria-hidden="true"> |
||||
|
<div class="modal-dialog"> |
||||
|
<form id="editTrackingStatusForm"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h1 class="modal-title fs-5" |
||||
|
id="staticBackdropLabel">Provide Access |
||||
|
Key |
||||
|
</h1> |
||||
|
<button type="button" class="btn-close" |
||||
|
aria-label="Close" data-bs-dismiss="modal"/> |
||||
|
</div> |
||||
|
<div class="modal-body m-3"> |
||||
|
<div class="form-group row mb-3"> |
||||
|
<label for="trackingNumber" |
||||
|
class="col-sm-2 col-form-label"> |
||||
|
Track Ref |
||||
|
</label> |
||||
|
<div class="col-sm-9"> |
||||
|
<input type="text" |
||||
|
class="form-control" |
||||
|
id="trackingNumber" |
||||
|
placeholder="Tracking Reference"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group row row mb-3"> |
||||
|
<label for="apiKey" |
||||
|
class="col-sm-2 col-form-label"> |
||||
|
API key |
||||
|
</label> |
||||
|
<div class="col-sm-9"> |
||||
|
<input type="text" |
||||
|
class="form-control" |
||||
|
id="apiKey" |
||||
|
placeholder="API Key"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group row row mb-3"> |
||||
|
<label for="trackingStatus" |
||||
|
class="col-sm-2 col-form-label"> |
||||
|
Status |
||||
|
</label> |
||||
|
<div class="col-sm-9"> |
||||
|
<input type="text" |
||||
|
class="form-control" |
||||
|
id="trackingStatus" |
||||
|
placeholder="Tracking Status"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" |
||||
|
class="btn btn-secondary" |
||||
|
data-bs-dismiss="modal" |
||||
|
> |
||||
|
Close |
||||
|
</button> |
||||
|
<button id="TrackingUpdate" |
||||
|
class="btn btn-primary"> |
||||
|
Submit |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Failed Modal--> |
||||
|
<div class="modal fade" id="failedApiKey" |
||||
|
data-bs-backdrop="static" data-bs-keyboard="false" |
||||
|
tabindex="-1" aria-labelledby="FailedApiKeyLabel" |
||||
|
aria-hidden="true"> |
||||
|
<div class="modal-dialog"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h1 class="modal-title fs-5" |
||||
|
id="FailedApiKeyLabel">ERROR |
||||
|
</h1> |
||||
|
<button type="button" class="btn-close" |
||||
|
data-bs-dismiss="modal" |
||||
|
aria-label="Close"/> |
||||
|
</div> |
||||
|
<div class="modal-body m-3"> |
||||
|
<h4 class="text-danger">Please provide correct |
||||
|
API key and Tracking Reference. |
||||
|
</h4> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" |
||||
|
class="btn btn-secondary" |
||||
|
data-bs-dismiss="modal"> |
||||
|
Close |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- Success Modal--> |
||||
|
<div class="modal fade" id="successApiKey" |
||||
|
data-bs-backdrop="static" data-bs-keyboard="false" |
||||
|
tabindex="-1" aria-labelledby="successApiKeyLabel" |
||||
|
aria-hidden="true"> |
||||
|
<div class="modal-dialog"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h1 class="modal-title fs-5" |
||||
|
id="successApiKeyLabel">SUCCESS |
||||
|
</h1> |
||||
|
<button type="button" class="btn-close" |
||||
|
data-bs-dismiss="modal" |
||||
|
aria-label="Close"/> |
||||
|
</div> |
||||
|
<div class="modal-body m-3"> |
||||
|
<h4 class="text-success">Successfully updated |
||||
|
the Delivery Status |
||||
|
</h4> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" |
||||
|
class="btn btn-secondary" |
||||
|
data-bs-dismiss="modal"> |
||||
|
Close |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<!-- No Records Modal--> |
||||
|
<div class="modal fade" id="NoRecordsApiKey" |
||||
|
data-bs-backdrop="static" data-bs-keyboard="false" |
||||
|
tabindex="-1" aria-labelledby="RecordApiKeyLabel" |
||||
|
aria-hidden="true"> |
||||
|
<div class="modal-dialog"> |
||||
|
<div class="modal-content"> |
||||
|
<div class="modal-header"> |
||||
|
<h1 class="modal-title fs-5" |
||||
|
id="RecordApiKeyLabel">NO RECORDS |
||||
|
</h1> |
||||
|
<button type="button" class="btn-close" |
||||
|
data-bs-dismiss="modal" |
||||
|
aria-label="OK"/> |
||||
|
</div> |
||||
|
<div class="modal-body m-3"> |
||||
|
<h4 class="text-danger">There are no records with |
||||
|
this Tracking Reference. |
||||
|
</h4> |
||||
|
</div> |
||||
|
<div class="modal-footer"> |
||||
|
<button type="button" |
||||
|
class="btn btn-secondary" |
||||
|
data-bs-dismiss="modal"> |
||||
|
Ok |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- details table--> |
||||
|
<div id="trackedTableDetails" |
||||
|
class="container table-responsive py-5"/> |
||||
|
<div id="noRecordsMsg" |
||||
|
class="container py-5 text-center"/> |
||||
|
</div> |
||||
|
</t> |
||||
|
</template> |
||||
|
</odoo> |