Skip to content

Instantly share code, notes, and snippets.

@dperaltab
dperaltab / NumeroALetras.js
Last active December 20, 2017 03:24 — forked from alfchee/NumeroALetras.js
Código en JavaScript que convierte números a letras, bastante útil para formularios de documentos contables y similares
/*************************************************************/
// NumeroALetras
// The MIT License (MIT)
//
// Copyright (c) 2015 Luis Alfredo Chee
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
odoo.define('minsa_serums.HiddenImport', function (require) {
"use strict";
var core = require('web.core');
var Model = require('web.Model');
var Menu = require('web.Menu');
// Ocultar menu Registrar reinscripción para los postulantes
Menu.include({
bind_menu: function () {
this._super.apply(this, arguments);
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="assets_backend" name="minsa_serums" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/minsa_serums/static/src/js/serums.js"/>
</xpath>
</template>
</odoo>
class GrupoSanguineo(models.Model):
_name = 'grupo.sanguineo'
name = fields.Char(string='Nombre')
class RegistroUnidadAlmacenada(models.Model):
_name = 'registro.unidad.almacenada'
unidad_almacenada_id = fields.Many2one(
'unidad.almacenada', string='Establecimiento de salud')
@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 = {
@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 / 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.
#
import base64
read_file = open('/tmp/newgalax.png', 'rb')
data = read_file.read()
b64 = base64.b64encode(data)
print (b64)
[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
#!/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