sábado, 18 de enero de 2014

Get BP number with customer user (Obtén el numero de BP con el usuario del cliente)

Only use one function. It's very simple.

      CALL FUNCTION 'YCRM_CC_FUNC_GET_FRONT_OFFICE'
        EXPORTING
          user       = sy-uname 
        IMPORTING
          og_partner = lv_bp.

sy-uname is the global variable in ABAP contains the current user.
lv_bp is the local variable containing BP code.

Read structures and get the sales manager (leer la estructura y obtener el jefe de ventas)

For example, i need to get my sales manager of the organizational structure. The function is this
  CALL FUNCTION 'RH_STRUC_GET'
    EXPORTING
      act_otype      = 'BP'
      act_objid      = partner_no #enter de Partner number
      act_wegid      = 'BP-CP-O'  #we indicate that we want to get
      act_tdepth     = 0
    TABLES
      result_tab     = lt_result #here the result
    EXCEPTIONS
      no_plvar_found = 1
      no_entry_found = 2
      OTHERS         = 3.

Install OpenERP7 in Linux with HTTPS (Instalar OpenERP7 en Linux con HTTPS)

Is the time to upgrade. Ok, i will change many things. Conclude with Ubuntu and only use Debian. Continued...
Es la hora de actualizarse. Ok, voy a cambiar muchas cosas. Termino con Ubuntu y sólo usaremos Debian. Continuamos...

The new version has changed many things, easier installation. (in previous post Instalar OpenERP 6 de un golpe):
La nueva versión a cambiado muchas cosas, una instalación más sencilla. (en post anteriores Instalar OpenERP 6 de un golpe):

Add in /etc/apt/sources.list
echo "deb http://nightly.openerp.com/7.0/nightly/deb/ ./" >> /etc/apt/sources.list
sudo apt-get update; sudo apt-get install openerp

And wait...
sudo service openerp start

We can see the log, while loading
Podemos ver el log, mientras carga
watch tail /var/log/openerp/openerp-server.log

When loaded, configure the HTTPS
Cuando esté cargado, configuramos el HTTPS
First, we block the default port 8069
Primero, bloqueamos el puerto por defecto 8069
sudo iptables -A INPUT -i eth0 -p tcp --destination-port 8069 -j DROP

Second, we create the SSL
Segundo, creamos el SSL
#need these packages
sudo aptitude install apache2
sudo a2enmod ssl proxy_http headers rewrite

#Create de certificate
sudo mkdir /etc/ssl/openerp
cd /etc/ssl/openerp
openssl genrsa -des3 -out openERPserver.pkey 1024
openssl rsa -in openERPserver.pkey -out openERPserver.key
openssl req -new -key openERPserver.key -out openERPserver.csr

openssl x509 -req -days 365 -in openERPserver.csr -signkey openERPserver.key -out openERPserver.crt

Now we need to configure Apache to use SSL with openERP.
Ahora tenemos que configurar apache para que use SSL con openERP.
#Create the openerp file withthis content
sudo nano /etc/apache2/sites-available/openerp

#openerp file

       SSLEngine on
       SSLCertificateFile /etc/ssl/openerp/oeserver.crt
       SSLCertificateKeyFile /etc/ssl/openerp/oeserver.key

       ProxyRequests Off

       
              Order deny,allow
              Allow from all
       

       ProxyVia On
       ProxyPass / http://127.0.0.1:8069/

       
              ProxyPassReverse /
       

       RequestHeader set “X-Forwarded-Proto” “https”

       SetEnv proxy-nokeepalive 1

And finally we enable our configuration
Ya por último habilitamos nuestra configuración
sudo a2ensite openerp

We have already completed. Now run
Ya hemos finalizado. Ahora ejecutamos
https://ipservidor