Skip to content

Instantly share code, notes, and snippets.

View eneldoserrata's full-sized avatar

Eneldo Serrata eneldoserrata

View GitHub Profile
@eneldoserrata
eneldoserrata / sample.py
Created February 5, 2018 17:29
Como decargar archivos desde odoo usando una URL
class Binary(http.Controller):
@http.route('/web/binary/download_document', type='http', auth="public")
@serialize_exception
def download_document(self, model, field, id, filename=None, **kw):
""" Download link for files stored as binary fields.
:param str model: name of the model to fetch the binary from
:param str field: binary field
:param str id: id of the record from which to fetch the binary
:param str filename: field holding the file's name, if any
@eneldoserrata
eneldoserrata / pycaribbean.py
Created February 17, 2018 14:31
Pycaribbean presetation code
python odoo-bin scaffold pycaribbean /Users/eneldoserrata/Documents/PycharmProjects/marcos/marcos_odoo11/presentations
class Pycaribbean(models.Model):
_name = 'pycaribbean'
_rec_name = 'name'
_description = 'New Description'
name = fields.Char("Name")
speaker_id = fields.Many2one("speaker")
age = fields.Integer("Age")
@eneldoserrata
eneldoserrata / wkhtmltopdf.sh
Last active April 24, 2018 05:21 — forked from ajaxray/wkhtmltopdf.sh
Install wkhtmltopdf with Patched QT for CentOS 7 or RHEL 7.x
cd ~
yum install -y xorg-x11-fonts-75dpi xorg-x11-fonts-Type1 openssl git-core fontconfig
wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-generic-amd64.tar.xz
tar xvf wkhtmltox-0.12.1_linux-generic-amd64.tar.xz
mv wkhtmltox/bin/wkhtmlto* /usr/bin
# Thanks to
# https://jaimegris.wordpress.com/2015/03/04/how-to-install-wkhtmltopdf-in-centos-7-0/
# https://gist.github.com/Rajeshr34/2e9b2438ff142e51c729b4b9b772680a

CARTONE-ODOO-11

  • Ventas

    • Cotizaciones

      • Envio por correo
  • Impresión

@eneldoserrata
eneldoserrata / change_db_owner.sh
Created June 3, 2018 19:21 — forked from gingerlime/change_db_owner.sh
Postgresql - Changing ownership on all tables
#!/bin/bash
usage()
{
cat << EOF
usage: $0 options
This script set ownership for all table, sequence and views for a given database
Credit: Based on http://stackoverflow.com/a/2686185/305019 by Alex Soto
Enable debug in PostgreSQL
PgAdmin comes with built-in support for debugging your Pl/PgSQL programs. However in order to enable this, you’ll have to compile and install extra plug-in to PostgreSQL.
I Googled a lot but didn’t find one single post with all steps so here we go: ( I did this on my Ubuntu)
Prepare environment:
By default, Ubuntu doen’t come with the most recent PostgreSQL. You can do the following to add PostgreSQL’s offical repository so you get the most up-to-date version (v9.6 at the time of writing). Refer to https://www.postgresql.org/download/linux/ubuntu/
Create file /etc/apt/sources.list.d/pgdg.list, and add following line:
import urllib2
import httplib
import json
# have to export the DER certify recived from azul to base64
# openssl x509 -inform der -in MYCERT.cer -out my_cert.crt
# I ended up solving this by concatenating
# the private key you use to generate crs with your converted cert
# cat my_key.key my_cert.crt > certify.pem
CERT = "certify.pem"
@eneldoserrata
eneldoserrata / docker-compose.yml
Created April 7, 2019 04:43 — forked from thomas15v/docker-compose.yml
Install odoo with docker-compose
version: '2'
services:
db:
image: postgres:9.4
restart: always
environment:
- POSTGRES_USER=odoo
- POSTGRES_PASSWORD=odoo
odoo:
image: odoo:11
@eneldoserrata
eneldoserrata / gist:5a397f201ea90cc664544a717c310117
Created January 23, 2018 04:24
Superset serve on nginx with prefix
Hi.
Here is the content of my nginx config file :
location /analytics {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Script-Name /analytics;
proxy_pass http://YOUR_SERVER_NAME:8088;
#YOUR_SERVER_NAME is localhost if both nginx and superset run on same server
@eneldoserrata
eneldoserrata / py
Created July 18, 2017 07:10
Odoo Save excel file on Binary and open to process
import openpyxl
from openerp import models, fields, api, _
from tempfile import TemporaryFile
class ExcelReader(models.TransientModel):
_name="reader_excel"
excel_file = fields.Binary(string='Excel File')
def import_excel(self):