diff --git a/addons/hw_posbox_homepage/controllers/main.py b/addons/hw_posbox_homepage/controllers/main.py index 11d7a9d2f30..7c9f90dab2e 100644 --- a/addons/hw_posbox_homepage/controllers/main.py +++ b/addons/hw_posbox_homepage/controllers/main.py @@ -55,7 +55,7 @@ index_template = """ Wi-Fi can be configured by visiting the Wi-Fi configuration page.
- The PosBox software installed on this posbox is version 13, + The PosBox software installed on this posbox is version 14, the posbox version number is independent from Odoo. You can upgrade the software on the upgrade page.
diff --git a/addons/point_of_sale/point_of_sale.py b/addons/point_of_sale/point_of_sale.py index 5d0b3526740..b52bb92ec17 100644 --- a/addons/point_of_sale/point_of_sale.py +++ b/addons/point_of_sale/point_of_sale.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. import logging +import psycopg2 import time from datetime import datetime import uuid @@ -783,6 +784,9 @@ class pos_order(osv.osv): try: 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: _logger.error('Could not fully process the POS Order: %s', tools.ustr(e)) diff --git a/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh b/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh index 47e11d1bdd3..ce2f2e633e6 100755 --- a/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh +++ b/addons/point_of_sale/tools/posbox/configuration/setup_ramdisks.sh @@ -15,11 +15,10 @@ create_ramdisk () { 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..." create_ramdisk "/var" "128M" 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 diff --git a/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh b/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh index bf7a3427f69..97b011b296d 100755 --- a/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh +++ b/addons/point_of_sale/tools/posbox/configuration/wireless_ap.sh @@ -28,7 +28,7 @@ if [ -z "${WIRED_IP}" ] ; then 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 diff --git a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/default/isc-dhcp-server b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/default/isc-dhcp-server new file mode 100644 index 00000000000..ec7fb5a5b6a --- /dev/null +++ b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/default/isc-dhcp-server @@ -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" diff --git a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/dhcp/dhcpd.conf b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/dhcp/dhcpd.conf index 054b4b4477f..d13dbb9a639 100644 --- a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/dhcp/dhcpd.conf +++ b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/dhcp/dhcpd.conf @@ -37,10 +37,10 @@ ddns-update-style none; # option routers rtr-239-0-1.example.org, rtr-239-0-2.example.org; #} -subnet 10.10.0.0 netmask 255.255.255.0 { - range 10.10.0.2 10.10.0.254; +subnet 10.11.12.0 netmask 255.255.255.0 { + range 10.11.12.2 10.11.12.254; 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, diff --git a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/init.d/rcS b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/init.d/rcS deleted file mode 100755 index 4d32107fac8..00000000000 --- a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/init.d/rcS +++ /dev/null @@ -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 diff --git a/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/ld.so.preload b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/ld.so.preload new file mode 100644 index 00000000000..37a96726c29 --- /dev/null +++ b/addons/point_of_sale/tools/posbox/overwrite_after_init/etc/ld.so.preload @@ -0,0 +1 @@ +/usr/lib/arm-linux-gnueabihf/libarmmem.so diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/fstab b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/fstab new file mode 100644 index 00000000000..d8e448c02d0 --- /dev/null +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/fstab @@ -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 diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh index 932bb3abf08..e54a8688741 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/init_posbox_image.sh @@ -11,37 +11,16 @@ __base="$(basename ${__file} .sh)" # Recommends: antiword, graphviz, ghostscript, postgresql, python-gevent, poppler-utils 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 -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 clean localepurge 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 # 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 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 # to not have "setting up console font and keymap" during boot take ages setupcon @@ -81,6 +64,7 @@ create_ramdisk_dir () { create_ramdisk_dir "/var" create_ramdisk_dir "/etc" +create_ramdisk_dir "/tmp" mkdir /root_bypass_ramdisks reboot diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/ld.so.preload b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/ld.so.preload index cfa850b8356..f1341ff1a3e 100644 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/ld.so.preload +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/ld.so.preload @@ -1 +1 @@ -#/usr/lib/arm-linux-gnueabihf/libcofi_rpi.so +#/usr/lib/arm-linux-gnueabihf/libarmmem.so diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/rc.local b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/rc.local index c55290c3978..22b8b8a5c8a 100755 --- a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/rc.local +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/rc.local @@ -17,6 +17,6 @@ if [ "$_IP" ]; then printf "My IP address is %s\n" "$_IP" fi -/etc/init_posbox_image.sh +/etc/init_posbox_image.sh 2>&1 | tee /home/pi/init_posbox_image.log exit 0 diff --git a/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/ramdisks.service b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/ramdisks.service new file mode 100644 index 00000000000..48c75daabb8 --- /dev/null +++ b/addons/point_of_sale/tools/posbox/overwrite_before_init/etc/systemd/system/ramdisks.service @@ -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 diff --git a/addons/point_of_sale/tools/posbox/posbox_create_image.sh b/addons/point_of_sale/tools/posbox/posbox_create_image.sh index 5e3d464ef2b..ba01ef09da5 100755 --- a/addons/point_of_sale/tools/posbox/posbox_create_image.sh +++ b/addons/point_of_sale/tools/posbox/posbox_create_image.sh @@ -50,8 +50,29 @@ rm ngrok.zip cd "${__dir}" 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="/dev/mapper/${LOOP_MAPPER_PATH}" + +# resize filesystem +e2fsck -f "${LOOP_MAPPER_PATH}" # resize2fs requires clean fs +resize2fs "${LOOP_MAPPER_PATH}" + mkdir "${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/ # 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 QEMU_OPTS+=(-nographic) fi diff --git a/addons/point_of_sale/tools/posbox/posbox_download_images.sh b/addons/point_of_sale/tools/posbox/posbox_download_images.sh index a138e44bfab..b500094058d 100755 --- a/addons/point_of_sale/tools/posbox/posbox_download_images.sh +++ b/addons/point_of_sale/tools/posbox/posbox_download_images.sh @@ -1,5 +1,5 @@ #!/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 -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 diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 2ecd2ebb169..da812f8528b 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -256,6 +256,14 @@ class PurchaseOrder(models.Model): def print_quotation(self): self.write({'state': "sent"}) 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 def button_approve(self): diff --git a/addons/web_editor/models/ir_qweb.py b/addons/web_editor/models/ir_qweb.py index 5fdbd4ae209..36ce06c5141 100644 --- a/addons/web_editor/models/ir_qweb.py +++ b/addons/web_editor/models/ir_qweb.py @@ -350,7 +350,7 @@ class Image(orm.AbstractModel): alt = 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'): alt = options['alt']