diff --git a/addons/hw_posbox_homepage/controllers/main.py b/addons/hw_posbox_homepage/controllers/main.py
index 31af076f689..a021986bee7 100644
--- a/addons/hw_posbox_homepage/controllers/main.py
+++ b/addons/hw_posbox_homepage/controllers/main.py
@@ -36,16 +36,16 @@ index_template = """
For more information on how to setup the Point of Sale with
- the PosBox, please refer to the manual
+ the PosBox, please refer to the manual.
To see the status of the connected hardware, please refer
- to the hardware status page
+ to the hardware status page.
The PosBox software installed on this posbox is version 13,
the posbox version number is independent from Odoo. You can upgrade
- the software on the upgrade page
+ the software on the upgrade page.
For any other question, please contact the Odoo support at support@odoo.com
diff --git a/addons/hw_posbox_upgrade/controllers/main.py b/addons/hw_posbox_upgrade/controllers/main.py
index 52df1e8e245..5ed958d020e 100644
--- a/addons/hw_posbox_upgrade/controllers/main.py
+++ b/addons/hw_posbox_upgrade/controllers/main.py
@@ -29,17 +29,8 @@ upgrade_template = """
$.ajax({
url:'/hw_proxy/perform_upgrade/'
}).then(function(status){
- $('#upgrade').html('Upgrade Successful
Click to Restart the PosBox');
+ $('#upgrade').html('Upgrade successful, restarting the posbox...');
$('#upgrade').off('click');
- $('#upgrade').click(function(){
- $.ajax({ url:'/hw_proxy/perform_restart' })
- $('#upgrade').text('Restarting');
- $('#upgrade').off('click');
- setTimeout(function(){
- window.location = '/'
- },30*1000);
- });
-
},function(){
$('#upgrade').text('Upgrade Failed');
});
@@ -95,7 +86,6 @@ class PosboxUpgrader(hw_proxy.Proxy):
def __init__(self):
super(PosboxUpgrader,self).__init__()
self.upgrading = threading.Lock()
- self.last_upgrade = 0
@http.route('/hw_proxy/upgrade', type='http', auth='none', )
def upgrade(self):
@@ -104,25 +94,8 @@ class PosboxUpgrader(hw_proxy.Proxy):
@http.route('/hw_proxy/perform_upgrade', type='http', auth='none')
def perform_upgrade(self):
self.upgrading.acquire()
- if time.time() - self.last_upgrade < 30:
- self.upgrading.release()
- return 'UPTODATE'
- else:
- os.system('/bin/bash /home/pi/odoo/posbox/update.sh')
- self.last_upgrade = time.time()
- self.upgrading.release()
- return 'SUCCESS'
-
- @http.route('/hw_proxy/perform_restart', type='http', auth='none')
- def perform_restart(self):
- self.upgrading.acquire()
- if time.time() - self.last_upgrade < 30:
- self.upgrading.release()
- return 'RESTARTED'
- else:
- os.system('/bin/bash /home/pi/odoo/posbox/restart.sh')
- self.last_upgrade = time.time()
- self.upgrading.release()
- return 'SUCCESS'
+ os.system('/home/pi/posbox_update.sh')
+ self.upgrading.release()
+ return 'SUCCESS'
diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/home/pi/posbox_update.sh b/addons/point_of_sale/tools/posbox/overwrite_before_init/home/pi/posbox_update.sh
new file mode 100755
index 00000000000..e994a60461f
--- /dev/null
+++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/home/pi/posbox_update.sh
@@ -0,0 +1,6 @@
+#!/usr/bin/env bash
+
+sudo mount -o remount,rw /
+sudo git --work-tree=/home/pi/odoo/ --git-dir=/home/pi/odoo/.git pull
+sudo mount -o remount,ro /
+(sleep 5 && sudo reboot) &