Skip to content

Instantly share code, notes, and snippets.

SUBMODULOS GIT (comandos básicos)
$ git submodule add [email protected]:djperalta/cook_list.git aaa/bbb/ccc
$ git status
$ cat .gitmodules
$ git submodule init (inicializa submodulo)
#!/usr/bin/python
from suds.client import Client
from suds.wsse import *
import requests
import base64
import logging
logging.basicConfig(level=logging.INFO)
logging.getLogger('suds.client').setLevel(logging.DEBUG)
#logging.getLogger('suds.wsdl').setLevel(logging.DEBUG)
@dperaltab
dperaltab / script.sh
Created August 22, 2016 15:36
Change password users postgresql
# su - postgres
$ psql
postgres=# \password user_to_change_password
Enter new password:
Enter it again:
#!/bin/sh
# replace odoo8 per odoo version
# Start/stop odoo8
PIDFILE=/var/run/odoo8.pid
. /lib/lsb/init-functions
NAME=odoo8
# id user odoo8git
#!/bin/bash
# run this as the odoo* user!
# create dir logs
WDIR=/opt/odoo/log
# path virtualenv
VIRTUALENV_DIR=/opt/odoo/odoo_git
source $VIRTUALENV_DIR/bin/activate
[options]
addons_path = /
admin_passwd = False
csv_internal_sep = ,
data_dir = /opt/odoo9/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
import base64
read_file = open('/tmp/newgalax.png', 'rb')
data = read_file.read()
b64 = base64.b64encode(data)
print (b64)
@dperaltab
dperaltab / example_natualdocs.py
Created April 22, 2017 05:28
Example comment NaturalDocs
# -*- coding: utf-8 -*-
# Variable: var_name
# Describe variable.
var_name = True
# Class: MyClass
# Describe the class here.
#
@dperaltab
dperaltab / purchase.py
Created June 8, 2017 20:16
Method has_group odoo
class PurchaseOrderLine(models.Model):
_inherit = 'purchase.order.line'
@api.one
def _get_verify_user_group(self):
self.verify_user_group = False
if self.env['res.users'].has_group('purchase.group_purchase_manager'):
self.verify_user_group = True
def _default_user_group(self):
@dperaltab
dperaltab / adjudicacion.py
Created June 14, 2017 22:39
Ejemplo básico para enviar una notificación y email a un usuario determinado. (Odoo)
# Class: MsAdjudicacionPlaza
# Registro de la adjudicación de las plazas.
class MsAdjudicacionPlaza(models.Model):
name = 'ms.adjudicacion.plaza'
_inherit = ['mail.thread', 'ir.needaction_mixin']
_description = u"Adjudicación plaza"
# ...
# Envia una notificación y correo al usuario
def enviar_invitacion(self):
post_kwargs = {