viernes, 20 de mayo de 2016

Only things... how to get a backup from Odoo using wget

Hi everyone, my recent publication:
Go to my Gist page
https://gist.github.com/Endika/209e9d31a86e2820acfb84e62b748648

Is very easy, with this line you can download ZIP file backup for you Odoo server.

Nice, and see you

domingo, 5 de julio de 2015

How to know my public IP in terminal

Hi everybody, today i share a simple list for get your public IP in linux command line.
First command, check your IP using dyndns service is very long command.
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
This is short command and very easy to remember.
curl ifconfig.me
Ipify is the same than ifconfig but response is in JSON format, prefer for webservices or other apps.
curl 'https://api.ipify.org?format=json'
Mi favorite is this command, is very elegant only send a request to obtain IP using DNS server.
dig +short myip.opendns.com @resolver1.opendns.com
Other command is the same that others.
curl ip.appspot.com
For to use this commands you need to install curl and digpackages.
For use curl install sudo aptitude install curl
For use dig install sudo aptitude install dnsutils

viernes, 3 de julio de 2015

Differents cases for you don't use position="replace" in Odoo xml

Hi everybody, today i explain how to use position attribute in Odoo XML.

Realy is very easy, only you never forget this rule:

Never use this attribute position="replace" NEVER NEVER.
<field name="street" position="replace">
    <!-- .... Never use!!!! -->
</field>
Exist other for example position="attribute", position="after", position="before"
<!-- You need add new attributes to field -->
<field name="street" position="attribute">
    <attribute name="class">big_field</attribute>
    <attribute name="value">Default Value</attribute>
    <attribute name="style">boder:solid 0.1em #f00;</attribute>
</field>

<!-- You need add other field after that -->
<field name="street" position="after">
    <field name="street2"/>
</field>

<!-- You need add other field before that -->
<field name="street" position="before">
    <field name="first_name"/>
</field>
Is very importan in your addons not use replace attribute because is posible in your view or inherit view other addons touch the same part and cause error and generates incompatibilities.

Other example with xpath expresion
<!-- add in all links with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links']" position="attributes">
    <attribute name="style">color:#f00;</attribute>
</xpath>

<!-- add in only in first link with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links'][0]" position="attributes">
    <attribute name="style">color:#f00;</attribute>
</xpath>

<!-- add in only in second link with class 
is menu_links text color red. -->
<xpath expr="//a[@class='menu_links'][1]" position="attributes">
    <attribute name="style">boder:solid 0.1em #f00;</attribute>
</xpath>
The last example is very dangerous because is possible the second link not exist and cause error.

lunes, 22 de junio de 2015

My return random.randint(0, 1)

Hi everybody, i didn't posted like before days.
But the summer arrive and i will try posts new content. Now a days i publised a lot of commits and PR's (pull request) in my github account (https://github.com/Endika) i will try posted all interesting things in my blog.

This is only a notify posts but the next posts i promise i published interesting things.

Thanks for followme @endika_iglesias

domingo, 1 de febrero de 2015

How to check if my website this ON?

With Selenium language, is very easy. Only need installed selenium python library.
Simple example using Selenium library
browser = webdriver.Firefox()
browser.get('http://google.es')
assert 'Google' in browser.title
In this example only checked if google.es has the "Google" title.

Now, if don't has the correct title the webs site, takes a screenshot.
browser = webdriver.Firefox()
browser.get('http://google.es')
if 'Google' not in browser.title:
    base64 = browser.get_screenshot_as_base64()
Finally, you can program tasks to check your websites and send email on error. If you want see the full example code go to this url Github/Endika/test_script/checkWebsite.py

miércoles, 21 de mayo de 2014

[SOLVED] Servers Digital Ocean with timezone problems

use this command
cp /usr/share/zoneinfo/Europe/Madrid /etc/localtime 

lunes, 19 de mayo de 2014

How to create certificates in a single line

complete as follows
/C= Country Name (2 letter code)
/ST= State or Province Name (full name)
/L= Locality Name
/O= Organization Name
/OU= Organizational Unit Name
/CN=website.com
openssl req -new -newkey rsa:4096 -days 2 -nodes -x509 -subj "/C=SP/ST=Madrid/L=Madrid/O=Empresa/OU=Internet Services/CN=website.com" -keyout server.key  -out server.cert
view example in github

lunes, 17 de febrero de 2014

Solution jQueryMobile viewport tag

If we use the jQueryMobile library, it may not work the viewport tag
Si usamos la librería jQueryMobile es muy posible que tengamos problemas para que nos funcione la etiqueta viewport
<html>
<head>
...
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
...
</head>
<body>
...
</body>
It has very easy solution. First step to remove the label.
Bueno por suerte tiene muy fácil solución. Primer paso eliminar la etiqueta.
Second step, add an instruction using javascript with jquery.
Segundo paso, añadimos mediante una instrucción javascript con jquery.
jQuery(document).bind('mobileinit', function(){
        jQuery.mobile.metaViewportContent = 'width=device-width, minimum-scale=1, maximum-scale=2';
});
With this statement, we can zoom in on our mobile device.
Con esta instrucción, podremos hacer zoom en nuestro dispositivo movil.

jueves, 6 de febrero de 2014

Translate the organization number of internal number of SAP


    CALL METHOD cl_crm_org_management=>get_instance
      IMPORTING
        ev_instance = lv_orgman.

    CALL METHOD lv_orgman->get_sales_org_of_vkorg
      EXPORTING
        iv_vkorg            = lv_s_vkorg
      IMPORTING
        ev_sales_org        = lv_sales_org
      EXCEPTIONS
        crm_key_not_defined = 1.

How to delete the zeros of a variable?

Use this function, and convert 00001 to 1.
  CALL FUNCTION 'CONVERSION_EXIT_ALPHA_OUTPUT'
    EXPORTING
      input  = lv_partner
    IMPORTING
      output = lv_partner.