www.numberspeaks.com

BLOG

Disable database manager in Odoo

Module for odoo 8 and 11 available on Github. Some tips found on the web hides only the link from Odoo homepage however URL are still reachable (~/web/database/manager). By installing this module, it will filter the access to Odoo database manager through the controller except connections coming from IPs listed in system parameters. Whitelist option: Key: disable_database_manager.database_manager_whitelist Value: 192.168.1.1,192.168.1.2,etc… This module will avoid unwanted connections attempts and secure your database manager access. Works with NGINX with some modification on nginx config file, click here for more detail. To disable completely database manager access: Add list_db = False in odoo.conf / …

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 …

SQL query in Odoo

    Sql query in Odoo model @api.multi def get_all_so(self, name=None): sql = "select * from sale_order where name like ‘%s%’ order by name desc;" % name self.env.cr.execute(sql) res_all = self.env.cr.fetchall() #fetchall() will return an array of dictionaries return res_all @api.multi def get_so(self, name=None): sql = "select * from sale_order where name like ‘%s’ order by name desc;" % name self.env.cr.execute(sql) #fetchone() will return the first element found as dictionary res_one = self.env.cr.fetchone() return res_one print(self.get_all_so(name=’SO2018′)) [{‘name’:’SO2018001′,’partner_id’:’Customer 1′,…},{‘name’:’SO2018002′,’partner_id’:’Customer 2′, …}] print(self.get_so(name=’SO2018001′)) {‘name’:’SO2018001′,’partner_id’:’Customer 1′,…}

Merge documents to PDF from iPhone

Are you looking for a quick and easy way to combine multiple files into a single document? Look no further than MergePDF!. This powerful PDF merging tool offers a simple and intuitive, making it easy to add files and merge them into one document. With MergePDF!, you can also scan on-fly ,reorder documents. Get organized and save time with MergePDF – the ultimate PDF merging tool! Only available in Apple Store for iOS devices. Valid extension: docx, doc, xls, xlsx, pptx, ppt, pdf, image files. Camera scan Rectangular shape detection Edit PDF Re-order and remove page Edit Images Crop and select …

Odoo 9 Email Template

This is a basic email template to put in the xml file: <record id="email_template" model="mail.template"> <field name="name">My Email Template</field> <field name="email_from">no-reply@domain.com</field> <field name="subject">Email Template</field> <field name="partner_to">${object.address_home_id.id}</field> <field name="model_id" ref="module_name.model_model_name" /> <field name="auto_delete" eval="True" /> <field name="lang">${object.user_id.lang}</field> <field name="body_html"><![CDATA[<div>My email template</div>]]></field> </record> if the module name is abc and the model name is voyelle then module_name.model_model_name should be abc.model_voyelle. ${object} is the model ${object.name} will display the attribute name of the current model.

How to protect Odoo against brute force attack behind Nginx or Caddy

Odoo community is not protected against brute force attack by default, the system is vulnerable over internet, however Odoo store provides auth_brute_force App which can handle this task, it’s available through this link. But it doesn’t work correctly behind a reverse proxy such as Caddy or Nginx. In the second part of this post, i’ll explain the little tip to make it work. Download and install the module Download the file corresponding to your version of Odoo. Unzip the file “auth_brute_force-9.0.1.1.0.zip”. Move the folder “auth_brute_force” to your module folder: “/usr/lib/python2.7/dist-packages/openerp/addons/“. Enable the developper mode through “About” popup. Then go to …