www.numberspeaks.com

BLOG

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.

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

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 …

WordPress Code Display

Plugin for displaying code in the front end: http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/ code to use in the backend: [code lang=”xml”][/code]

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.