Posts

Showing posts from May, 2018

How to detect if user visit our site via mobile browser or PC browser?

In some cases, we want to know  if user visit our site via mobile browser or via PC. Maybe for purpose of give different presentation to user because we prepared two different site for them. Below is script to inject in your site in case you want to give user different view of your site. <!DOCTYPE html> < html >     < head >          < title > Detect Mobile Browser </ title >          < script type = "text/javascript" >             ( function (a,b) {                  if ( /(android | bb \d +| meego) . + mobile | avantgo | bada \/ | blackberry | blazer | compal | elaine | fennec | hiptop | iemobile | ip(hone | od) | iris | kindle | lge | maemo | midp | mmp | mobile . + firefox | netfront | opera m(ob | in)i | palm( os) ?| phone | p(ixi | re) \/ | plucker | pocket | psp | series(4 | 6)0 | symbian | treo | up \. (browser | link) | vodafone | wap | windows ce | xda | xiino/ i . test ( a ) || /1207 | 6310 | 6590 | 3gso | 4thp

Autocomplete Demo with HTML5, jQueryUI, PHP & mySQL

Below is the index.php script <!doctype html> < html lang = "en" > < head > < meta charset = "utf-8" /> < title > Autocomplete Demo with HTML5, jQueryUI, PHP & mySQL </ title > < link rel = "stylesheet" href = "http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> < script src = "http://code.jquery.com/jquery-1.8.3.js" > < / script > < script src = "http://code.jquery.com/ui/1.9.2/jquery-ui.js" > < / script > < script > // Autocomplete will show after user type at least 1 character on input $ ( function () { $ ( "#negara" ). autocomplete ({ source: "Sourcedata.php" , minLength: 1 , }); }); < / script > </ head > < body

Download Binary file in Odoo 10

To download any binary file in Odoo10 following is the link: http://127.0.0.1:8069/web/content?model=<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id> module_name    - the name of the model with the Binary field field_name         - the name of the Binary field object_id            - id of the record containing particular file. field_filename    - name of a Char field containing file's name (optional). So if you want to call a function on button click and download the file, code is as follow: file_url = "http://127.0.0.1:8069/web/content?model=<module_name>&field=<field_name>&filename_field=<field_filename>&id=<object_id>" return {     'type': 'ir.actions.act_url',     'url': file_url,     'target': 'new' } In Reports or web page, you can use it as: <t t-foreach="files"