www.numberspeaks.com

BLOG

Odoo – Filling many2many fields

Bellow code will help to manage many2many fields from model class. (0, 0, { values }) link to a new record that needs to be created with the given values dictionary (1, ID, { values }) update the linked record with id = ID (write values on it) (2, ID) remove and delete the linked record with id = ID (calls unlink on ID, that will delete the object completely, and the link to it as well) (3, ID) cut the link to the linked record with id = ID (delete the relationship between the two objects but does not …

Fail2ban Odoo 9 Authentication

Odoo 9 community doesn’t come with autoban security. Fail2ban is an alternative to secure Odoo authentication. For more information concerning fail2ban click here Let’s start with creating a new filter: Paste the content from bellow code: Add those line in jail.local Change the value of syslog in the /etc/odoo/openerp-server.conf Restart Odoo then fail2ban to apply modification.

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 …

Problem with Godaddy VPS upgrade

I recently had a problem with Godaddy ubuntu 16.04 VPS, after updating and upgrading the system: apt-get update apt-get upgrade reboot SSH port wasn’t anymore reachable, it’s the only access we have to the server, however other services are working normally, so the system is still running. I tried many times to restart, call the support, but it didn’t solve the problem. The only solution was to destroy the server and rebuild it from scratch + restoration of backups. I’ve also tested the upgrade with a clean and freshly installed system, same issue occurred. If you’re running Ubuntu 16.04 VPS …

Odoo 11 how to avoid loading the homepage after module upgrade

​ Download on GitHub Download upgrade module Odoo 11 redirects the user to his homepage after a module upgrade, to avoid this trouble I made a small modification of the module upgrade behavior. Additional module is available here. It inherits only the model “ir.module.module” and override “_button_immediate_function” method. import base64 from collections import defaultdict from decorator import decorator from operator import attrgetter import importlib import io import logging import os import shutil import tempfile import zipfile import requests from odoo.tools import pycompat from docutils import nodes from docutils.core import publish_string from docutils.transforms import Transform, writer_aux from docutils.writers.html4css1 import Writer import …

Fail2ban doesn’t ban but regex works

One of my Debian server with fail2ban has a problem to ban ip from brute force attack, however testing logs with fail2ban-regex worked perfectly. My solution has been found through this page. The cause of my issue was related to the timezone of the system. To solve this problem, i used the command bellow to reconfigure timezone and then fail2ban started to ban as usual. sudo dpkg-reconfigure tzdata