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 …

Odoo 11 community SO PO iOS approval

 Simple app to approve Odoo SO, PO from your iPhone / iPad, it has been tested only on Odoo Community 11, but it should work with newer version also. It requires an additional module on Odoo available on Github (link bellow). Odoo – NS module will add “Waiting for confirmation” Status on sale.order and purchase.order model.You will be able to customize the module and add any document that needs approval (like Invoices, payment confirmation, etc…)Long press on document from Odoo – NS iOS app will display PDF.If you have any question, you can contact me here:https://www.numberspeaks.com/contact/ 

Flush DNS cache Mac OSX

Create a file flush_dns.sh chmod 755 flush_dns.sh edit and paste the code bellow: #!/bin/bash sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder;

How to search string in files Linux

Use this command bellow to find a pattern in the arborescence. grep -rnw ‘/path/to/somewhere/’ -e ‘pattern’ https://stackoverflow.com/questions/16956810/how-do-i-find-all-files-containing-specific-text-on-linux

Cannot connect SMB shared folder from Mac OS

After a samba upgrade on a debian server, i couldn’t connect anymore my SMB shared folder from Mac OS X. I just replaced the protocol used smb by cifs on the link. cifs://192.168.10.1/backup instead of smb://192.168.10.1/backup

Import xlsx file Odoo 11 – Sales orders

I will describe the basis in python to import xlsx file and how to handle the imported data, in this exemple sales orders is imported. Uploaded file is stored in the variable upload_file and is encoded in base 64, to read it we have to decode first the data by using b64decode function, then save it, for me i chose “/tmp” folder. Result import_data is an array of dictionary as follow [{‘column_name_1’:data_column_1_row_1, ‘column_name_2’:data_column_2_row_1,…},{‘column_name_1’:data_column_1_row_2, ‘column_name_2’:data_column_2_row_2,…},…] import logging import xlrd import base64 import openerp.addons.decimal_precision as dp from datetime import datetime, date, timedelta from openerp.exceptions import UserError from openerp import models, fields, api, …