www.numberspeaks.com

BLOG

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,…},…] Bellow XML view for the importation module.

POS order to quotation in Odoo 9

Odoo 9 community does not have a button to generate from the POS (Point of Sale) Order a quotation (Sales Order), here is the following code of my module pos_2_so. Folders arborescence will have as sub folders :  model, view, static, ref the print screen : We will start by adding a new button on the interface of the pos, in the folder static/src/xml/, we create a new file named pos_2_so.xml. Bellow is its QWeb xml code : This portion of code creates a template named pos2sopad which include only a button : We need to set a placeholder by adding …

Protect Odoo 11 database backup with a password

Database auto-backup backup process crashes with a database size > 200 MB and Odoo worker enabled. The module “Database auto-backup” will help you to backup Odoo database on your local disk or remotely on a FTP server through ftp our sftp protocol, however it doesn’t give us the possibility to secure a bit more the backup file generated, therefore I added 2 additional options (Enable password and password) to be able to protect by a password the compressed file by using directly Linux 7z command line and recompressing a 2nd time the file, we should use dump file instead of …

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 …

How to get data from URL with a controller in Odoo 9

Create under your module a folder controller, in that folder create files controller.py and __init__.py and link your new file in __init__.py, don’t forget to add controller folder in the __init__.py at the root folder of your module. controller.py code bellow will make available the URL www.myodoo.com/page/random/random_variable, random_variable value will be stored in values dictionary on key variable. in folder view of your module create the file template.xml