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 …

Add xlsx support in scheduled outgoing email – Odoo 11

Download updated report_xlsx module Report_xlsx module adds xlsx report support to Odoo with xlsxwriter python library. However when trying to send an email with a xlsx report attached. I got this error message: “Unsupported report type xlsx found”. Mail module handles only PDF document as attachement, to add xlsx type support, we have to make some modification on report_xlsx module by inheriting mail.template model and overriding generate_email method, you’ll find the code bellow, customized report_xlsx module is downloadable above or by clicking on the link at the bottom of the page. import babel import base64 import copy import datetime import …

Add menu in dropdown list on tree view – Odoo 9

To add an additional menu in action dropdown list on tree view, we need to register “ir.actions.server” and “ir.values” on the qweb/xml file as follow. Note that code field name is using old Odoo python API. <?xml version="1.0" encoding="utf-8"?> <openerp> <data> … <record id="action_cancel_request" model="ir.actions.server"> <field name="name">Cancel</field> <field name="type">ir.actions.server</field> <field name="model_id" ref="sale.model_sale_order" /> <field name="state">code</field> <field name="binding_model_id" ref="sale.model_sale_order" /> <field name="code">action = self.action_cancel(cr, uid, context.get(‘active_ids’, []), context=context)</field> </record> <record id="cancel_action_menu" model="ir.values"> <field eval="’client_action_multi’" name="key2"/> <field eval="’sale.order’" name="model"/> <field name="name">Cancel</field> <field eval="’ir.actions.server,%d’%action_cancel_request" name="value"/> </record> …. </data> </openerp> In your sale order model create the method as bellow with Odoo new API. …

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;

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 …

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