[MERGE] forward port of branch saas-6 up to 7033a97
This commit is contained in:
@@ -55,7 +55,7 @@ index_template = """
|
|||||||
Wi-Fi can be configured by visiting the <a href='/wifi'>Wi-Fi configuration page</a>.
|
Wi-Fi can be configured by visiting the <a href='/wifi'>Wi-Fi configuration page</a>.
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
The PosBox software installed on this posbox is <b>version 13</b>,
|
The PosBox software installed on this posbox is <b>version 14</b>,
|
||||||
the posbox version number is independent from Odoo. You can upgrade
|
the posbox version number is independent from Odoo. You can upgrade
|
||||||
the software on the <a href='/hw_proxy/upgrade/'>upgrade page</a>.
|
the software on the <a href='/hw_proxy/upgrade/'>upgrade page</a>.
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import psycopg2
|
||||||
import time
|
import time
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
import uuid
|
import uuid
|
||||||
@@ -783,6 +784,9 @@ class pos_order(osv.osv):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
self.signal_workflow(cr, uid, [order_id], 'paid')
|
self.signal_workflow(cr, uid, [order_id], 'paid')
|
||||||
|
except psycopg2.OperationalError:
|
||||||
|
# do not hide transactional errors, the order(s) won't be saved!
|
||||||
|
raise
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
_logger.error('Could not fully process the POS Order: %s', tools.ustr(e))
|
_logger.error('Could not fully process the POS Order: %s', tools.ustr(e))
|
||||||
|
|
||||||
|
|||||||
@@ -15,11 +15,10 @@ create_ramdisk () {
|
|||||||
mount --bind "${RAMDISK}" "${ORIGINAL}"
|
mount --bind "${RAMDISK}" "${ORIGINAL}"
|
||||||
}
|
}
|
||||||
|
|
||||||
# check /proc/cmdline
|
|
||||||
|
|
||||||
# bind mount / so that we can get to the real /var and /etc
|
|
||||||
mount --bind / /root_bypass_ramdisks
|
|
||||||
|
|
||||||
echo "Creating ramdisks..."
|
echo "Creating ramdisks..."
|
||||||
create_ramdisk "/var" "128M"
|
create_ramdisk "/var" "128M"
|
||||||
create_ramdisk "/etc" "16M"
|
create_ramdisk "/etc" "16M"
|
||||||
|
create_ramdisk "/tmp" "16M"
|
||||||
|
|
||||||
|
# bind mount / so that we can get to the real /var and /etc
|
||||||
|
mount --bind / /root_bypass_ramdisks
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ if [ -z "${WIRED_IP}" ] ; then
|
|||||||
|
|
||||||
service hostapd restart
|
service hostapd restart
|
||||||
|
|
||||||
ip addr add 10.10.0.1/24 dev wlan0
|
ip addr add 10.11.12.1/24 dev wlan0
|
||||||
|
|
||||||
service isc-dhcp-server restart
|
service isc-dhcp-server restart
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Defaults for isc-dhcp-server initscript
|
||||||
|
# sourced by /etc/init.d/isc-dhcp-server
|
||||||
|
# installed at /etc/default/isc-dhcp-server by the maintainer scripts
|
||||||
|
|
||||||
|
#
|
||||||
|
# This is a POSIX shell fragment
|
||||||
|
#
|
||||||
|
|
||||||
|
# Path to dhcpd's config file (default: /etc/dhcp/dhcpd.conf).
|
||||||
|
#DHCPD_CONF=/etc/dhcp/dhcpd.conf
|
||||||
|
|
||||||
|
# Path to dhcpd's PID file (default: /var/run/dhcpd.pid).
|
||||||
|
#DHCPD_PID=/var/run/dhcpd.pid
|
||||||
|
|
||||||
|
# Additional options to start dhcpd with.
|
||||||
|
# Don't use options -cf or -pf here; use DHCPD_CONF/ DHCPD_PID instead
|
||||||
|
#OPTIONS=""
|
||||||
|
|
||||||
|
# On what interfaces should the DHCP server (dhcpd) serve DHCP requests?
|
||||||
|
# Separate multiple interfaces with spaces, e.g. "eth0 eth1".
|
||||||
|
INTERFACES="wlan0"
|
||||||
@@ -37,10 +37,10 @@ ddns-update-style none;
|
|||||||
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
|
# option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org;
|
||||||
#}
|
#}
|
||||||
|
|
||||||
subnet 10.10.0.0 netmask 255.255.255.0 {
|
subnet 10.11.12.0 netmask 255.255.255.0 {
|
||||||
range 10.10.0.2 10.10.0.254;
|
range 10.11.12.2 10.11.12.254;
|
||||||
option domain-name-servers 8.8.8.8, 208.67.222.222;
|
option domain-name-servers 8.8.8.8, 208.67.222.222;
|
||||||
option routers 10.10.0.1;
|
option routers 10.11.12.1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# This declaration allows BOOTP clients to get dynamic addresses,
|
# This declaration allows BOOTP clients to get dynamic addresses,
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
#
|
|
||||||
# rcS
|
|
||||||
#
|
|
||||||
# Call all S??* scripts in /etc/rcS.d/ in numerical/alphabetical order
|
|
||||||
#
|
|
||||||
|
|
||||||
/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh
|
|
||||||
|
|
||||||
exec /etc/init.d/rc S
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
/usr/lib/arm-linux-gnueabihf/libarmmem.so
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
proc /proc proc defaults 0 0
|
||||||
|
#/dev/mmcblk0p1 /boot vfat defaults 0 2
|
||||||
|
#/dev/mmcblk0p2 / ext4 defaults,noatime 0 1
|
||||||
|
# a swapfile is not a swap partition, no line here
|
||||||
|
# use dphys-swapfile swap[on|off] for that
|
||||||
@@ -11,37 +11,16 @@ __base="$(basename ${__file} .sh)"
|
|||||||
# Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
|
# Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils
|
||||||
export DEBIAN_FRONTEND=noninteractive
|
export DEBIAN_FRONTEND=noninteractive
|
||||||
|
|
||||||
# GUI-related packages
|
|
||||||
PKGS_TO_DELETE="xserver-xorg-video-fbdev xserver-xorg xinit gstreamer1.0-x gstreamer1.0-omx gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-alsa gstreamer1.0-libav epiphany-browser lxde lxtask menu-xdg gksu xserver-xorg-video-fbturbo xpdf gtk2-engines alsa-utils netsurf-gtk zenity desktop-base lxpolkit weston omxplayer raspberrypi-artwork lightdm gnome-themes-standard-data gnome-icon-theme qt50-snapshot qt50-quick-particle-examples idle python-pygame python-tk idle3 python-serial python-picamera debian-reference-en dillo x2x scratch nuscratch raspberrypi-ui-mods timidity smartsim penguinspuzzle pistore sonic-pi python-pifacecommon python-pifacedigitalio oracle-java8-jdk minecraft-pi python-minecraftpi wolfram-engine raspi-config libgl1-mesa-dri libicu48 pypy-upstream lxde-icon-theme python3 avahi-daemon"
|
|
||||||
INSTALLED_PKGS_TO_DELETE=""
|
|
||||||
set +o errexit
|
|
||||||
for CURRENT_PKG in $(echo $PKGS_TO_DELETE); do
|
|
||||||
$(dpkg --status $CURRENT_PKG &> /dev/null)
|
|
||||||
if [[ $? -eq 0 ]]; then
|
|
||||||
INSTALLED_PKGS_TO_DELETE="$INSTALLED_PKGS_TO_DELETE $CURRENT_PKG"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
set -o errexit
|
|
||||||
|
|
||||||
apt-get -y remove --purge ${INSTALLED_PKGS_TO_DELETE}
|
|
||||||
|
|
||||||
# Remove automatically installed dependency packages
|
|
||||||
apt-get -y autoremove
|
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get -y dist-upgrade
|
apt-get -y dist-upgrade
|
||||||
|
|
||||||
PKGS_TO_INSTALL="adduser postgresql-client python python-dateutil python-decorator python-docutils python-feedparser python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-tz python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml postgresql python-gevent python-serial python-pip python-dev localepurge vim mc mg screen iw hostapd isc-dhcp-server"
|
PKGS_TO_INSTALL="adduser postgresql-client python python-dateutil python-decorator python-docutils python-feedparser python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-tz python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml postgresql python-gevent python-serial python-pip python-dev localepurge vim mc mg screen iw hostapd isc-dhcp-server git rsync console-data"
|
||||||
|
|
||||||
apt-get -y install ${PKGS_TO_INSTALL}
|
apt-get -y install ${PKGS_TO_INSTALL}
|
||||||
|
|
||||||
apt-get clean
|
apt-get clean
|
||||||
localepurge
|
localepurge
|
||||||
rm -rf /usr/share/doc
|
rm -rf /usr/share/doc
|
||||||
rm -rf /home/pi/python_games
|
|
||||||
|
|
||||||
# remove raspi-config notice, it's not necessary and it's not installed anyway
|
|
||||||
rm -f /etc/profile.d/raspi-config.sh
|
|
||||||
|
|
||||||
# python-usb in wheezy is too old
|
# python-usb in wheezy is too old
|
||||||
# the latest pyusb from pip does not work either, usb.core.find() never returns
|
# the latest pyusb from pip does not work either, usb.core.find() never returns
|
||||||
@@ -70,6 +49,10 @@ echo "* * * * * rm /var/run/odoo/sessions/*" | crontab -
|
|||||||
update-rc.d -f hostapd remove
|
update-rc.d -f hostapd remove
|
||||||
update-rc.d -f isc-dhcp-server remove
|
update-rc.d -f isc-dhcp-server remove
|
||||||
|
|
||||||
|
systemctl daemon-reload
|
||||||
|
systemctl enable ramdisks.service
|
||||||
|
systemctl disable dphys-swapfile.service
|
||||||
|
|
||||||
# https://www.raspberrypi.org/forums/viewtopic.php?p=79249
|
# https://www.raspberrypi.org/forums/viewtopic.php?p=79249
|
||||||
# to not have "setting up console font and keymap" during boot take ages
|
# to not have "setting up console font and keymap" during boot take ages
|
||||||
setupcon
|
setupcon
|
||||||
@@ -81,6 +64,7 @@ create_ramdisk_dir () {
|
|||||||
|
|
||||||
create_ramdisk_dir "/var"
|
create_ramdisk_dir "/var"
|
||||||
create_ramdisk_dir "/etc"
|
create_ramdisk_dir "/etc"
|
||||||
|
create_ramdisk_dir "/tmp"
|
||||||
mkdir /root_bypass_ramdisks
|
mkdir /root_bypass_ramdisks
|
||||||
|
|
||||||
reboot
|
reboot
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so
|
#/usr/lib/arm-linux-gnueabihf/libarmmem.so
|
||||||
|
|||||||
@@ -17,6 +17,6 @@ if [ "$_IP" ]; then
|
|||||||
printf "My IP address is %s\n" "$_IP"
|
printf "My IP address is %s\n" "$_IP"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
/etc/init_posbox_image.sh
|
/etc/init_posbox_image.sh 2>&1 | tee /home/pi/init_posbox_image.log
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
+12
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=ramdisks
|
||||||
|
DefaultDependencies=no
|
||||||
|
After=sysinit.target local-fs.target
|
||||||
|
Before=basic.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
ExecStart=/home/pi/odoo/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=basic.target
|
||||||
@@ -50,8 +50,29 @@ rm ngrok.zip
|
|||||||
cd "${__dir}"
|
cd "${__dir}"
|
||||||
mv /tmp/ngrok "${USR_BIN}"
|
mv /tmp/ngrok "${USR_BIN}"
|
||||||
|
|
||||||
|
# zero pad the image to be around 3.5 GiB, by default the image is only ~1.3 GiB
|
||||||
|
dd if=/dev/zero bs=1M count=2048 >> posbox.img
|
||||||
|
|
||||||
|
# resize partition table
|
||||||
|
START_OF_ROOT_PARTITION=$(fdisk -l posbox.img | tail -n 1 | awk '{print $2}')
|
||||||
|
(echo 'p'; # print
|
||||||
|
echo 'd'; # delete
|
||||||
|
echo '2'; # second partition
|
||||||
|
echo 'n'; # create new partition
|
||||||
|
echo 'p'; # primary
|
||||||
|
echo '2'; # number 2
|
||||||
|
echo "${START_OF_ROOT_PARTITION}"; # starting at previous offset
|
||||||
|
echo ''; # ending at default (fdisk should propose max)
|
||||||
|
echo 'p'; # print
|
||||||
|
echo 'w') | fdisk posbox.img # write and quit
|
||||||
|
|
||||||
LOOP_MAPPER_PATH=$(kpartx -av posbox.img | tail -n 1 | cut -d ' ' -f 3)
|
LOOP_MAPPER_PATH=$(kpartx -av posbox.img | tail -n 1 | cut -d ' ' -f 3)
|
||||||
LOOP_MAPPER_PATH="/dev/mapper/${LOOP_MAPPER_PATH}"
|
LOOP_MAPPER_PATH="/dev/mapper/${LOOP_MAPPER_PATH}"
|
||||||
|
|
||||||
|
# resize filesystem
|
||||||
|
e2fsck -f "${LOOP_MAPPER_PATH}" # resize2fs requires clean fs
|
||||||
|
resize2fs "${LOOP_MAPPER_PATH}"
|
||||||
|
|
||||||
mkdir "${MOUNT_POINT}"
|
mkdir "${MOUNT_POINT}"
|
||||||
mount "${LOOP_MAPPER_PATH}" "${MOUNT_POINT}"
|
mount "${LOOP_MAPPER_PATH}" "${MOUNT_POINT}"
|
||||||
|
|
||||||
@@ -70,7 +91,7 @@ umount "${MOUNT_POINT}"
|
|||||||
|
|
||||||
# from http://paulscott.co.za/blog/full-raspberry-pi-raspbian-emulation-with-qemu/
|
# from http://paulscott.co.za/blog/full-raspberry-pi-raspbian-emulation-with-qemu/
|
||||||
# ssh pi@localhost -p10022
|
# ssh pi@localhost -p10022
|
||||||
QEMU_OPTS=(-kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 panic=1 rootfstype=ext4 rw' -hda posbox.img -net user,hostfwd=tcp::10022-:22,hostfwd=tcp::18069-:8069 -net nic)
|
QEMU_OPTS=(-kernel kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append 'root=/dev/sda2 rootfstype=ext4 rw' -hda posbox.img -net user,hostfwd=tcp::10022-:22,hostfwd=tcp::18069-:8069 -net nic)
|
||||||
if [ -z ${DISPLAY:-} ] ; then
|
if [ -z ${DISPLAY:-} ] ; then
|
||||||
QEMU_OPTS+=(-nographic)
|
QEMU_OPTS+=(-nographic)
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
wget 'http://downloads.raspberrypi.org/raspbian_latest' -O raspbian.img.zip
|
wget 'https://downloads.raspberrypi.org/raspbian_lite_latest' -O raspbian.img.zip
|
||||||
unzip raspbian.img.zip
|
unzip raspbian.img.zip
|
||||||
wget 'https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu'
|
wget 'https://github.com/dhruvvyas90/qemu-rpi-kernel/raw/master/kernel-qemu-4.1.13-jessie' -O kernel-qemu
|
||||||
|
|||||||
@@ -256,6 +256,14 @@ class PurchaseOrder(models.Model):
|
|||||||
def print_quotation(self):
|
def print_quotation(self):
|
||||||
self.write({'state': "sent"})
|
self.write({'state': "sent"})
|
||||||
return self.env['report'].get_action(self, 'purchase.report_purchasequotation')
|
return self.env['report'].get_action(self, 'purchase.report_purchasequotation')
|
||||||
|
for po in self.browse(cr, SUPERUSER_ID, ids, context=context):
|
||||||
|
for picking in po.picking_ids:
|
||||||
|
picking.move_lines.write({'purchase_line_id': False})
|
||||||
|
for invoice in po.invoice_ids:
|
||||||
|
po.write({'invoice_ids': [(3, invoice.id, _)]})
|
||||||
|
for po_line in po.order_line:
|
||||||
|
for invoice_line in po_line.invoice_lines:
|
||||||
|
po_line.write({'invoice_lines': [(3, invoice_line.id, _)]})
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def button_approve(self):
|
def button_approve(self):
|
||||||
|
|||||||
@@ -350,7 +350,7 @@ class Image(orm.AbstractModel):
|
|||||||
|
|
||||||
alt = None
|
alt = None
|
||||||
if options.get('alt-field') and getattr(record, options['alt-field'], None):
|
if options.get('alt-field') and getattr(record, options['alt-field'], None):
|
||||||
alt = record[options['alt-field']]
|
alt = escape(record[options['alt-field']])
|
||||||
elif options.get('alt'):
|
elif options.get('alt'):
|
||||||
alt = options['alt']
|
alt = options['alt']
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user