www.numberspeaks.com

BLOG

Linux

Odoo 9 Linux bash backup script

Bash backup odoo script is available on GitHub for Odoo 8 and 11. This bash script will help you to backup Odoo database, set a password on the backup file and remove files older than 7 days. You’ll need curl and 7zip linux package to make it work. This example is backing up od11-01 and od11-02 databases. It’s not really optimized with the double compression. BACKUP_DIR=/opt/backup ODOO_DATABASES="od11-01 od11-02" ADMIN_PASSWORD="ODOO_DATABASE_MANAGER_PASSORD" FILE_PASSWORD="ZIP_FILE_PASSWORD" TIMESTAMP=`date +%Y-%m-%d_%H-%M-%S` for DB in ${ODOO_DATABASES} do # create a backup curl -X POST \ -F "master_pwd=${ADMIN_PASSWORD}" \ -F "name=${DB}" \ -F "backup_format=zip" \ -o ${BACKUP_DIR}/${DB}/${DB}.${TIMESTAMP}.zip \ http://localhost:8069/web/database/backup 7z a …

Additional measure in Odoo graph view

  This article will help you to add measures in graph view, my exemple is based on sale order model, for all additional computed fields, attribute store must be set to True, otherwise you won’t be able to choose it from the dropdown list measure in graph view. When grouping, you might want to calculate on some fields the average instead of the sum, if so, you need to use group_operator = ‘avg’ directly in your model file, see margin_percent field bellow. import logging import openerp.addons.decimal_precision as dp from datetime import datetime, date, timedelta from openerp.exceptions import except_orm, Warning, RedirectWarning …

Geektool : Display system information on your MacOS X desktop

If you would like to display system information on your desktop of your Mac OS X, Geektool is the right utility you need. First download and install geektool : https://www.tynsoe.org/v2/geektool/ Open geektool app. Drag and drop Shell on your desktop, and click on command button Paste this code bellow to display your local ip and public ip. But you will need to replace 192.168.101 by your network ip address. echo ” echo ‘Local IP : ‘ `ifconfig | grep inet | grep 192.168.101 | cut -d’ ‘ -f2` echo ‘Public IP : ‘ `curl ipecho.net/plain ; echo` Result :

Send an email using a template

Create a function in your model: @api.multi def send_email_notification(self): self.ensure_one() template_obj = self.env.ref(‘module_name.email_template_id’) template_obj.send_mail(self.ids[0], force_send=True) call the function by the following XML code: <button name="action_email_notification" string="Send Email Notification" type="object" class="oe_highlight" />

Mssql differential restoration error

After trying to restore differential backup after a full backup, i got this error message : The log or differential backup cannot be restored because no files are ready to roll forward. To be able to complete differential restoration, full backup needs to be restored with “WITH NORECOVERY” option as follow: RESTORE DATABASE numberspeaks FROM DISK = ‘D:\numberspeaks-full.bak’ WITH NORECOVERY RESTORE DATABASE numberspeaks FROM DISK = ‘D:\numberspeaks-diff.bak’ WITH RECOVERY

Whitelist / Blacklist Amavis SpamAssassin Zimbra 8.6

Sometimes SpamAssassin scores email as False Positive spam, to avoid incoming emails to get junked, we can define globally in the config file /opt/zimbra/conf/amavisd.conf.in domain with a initial score. # read_hash("/var/amavis/sender_scores_sitewide"), { # a hash-type lookup table (associative array) ‘nobody@cert.org’ => -3.0, ‘cert-advisory@us-cert.gov’ => -3.0, ‘owner-alert@iss.net’ => -3.0, ‘slashdot@slashdot.org’ => -3.0, … To whitelist a domain we add domain with a negative score: # read_hash("/var/amavis/sender_scores_sitewide"), { # a hash-type lookup table (associative array) ‘mydomain.com’ => -3.0, ‘nobody@cert.org’ => -3.0, ‘cert-advisory@us-cert.gov’ => -3.0, ‘owner-alert@iss.net’ => -3.0, ‘slashdot@slashdot.org’ => -3.0, … To blacklist a domain we add domain with positive score: # …