Skip to content

Instantly share code, notes, and snippets.

View JRSalasM's full-sized avatar
🏠
Working from home

José R. Salas Montañez JRSalasM

🏠
Working from home
View GitHub Profile
@JRSalasM
JRSalasM / odoo.txt
Last active June 28, 2020 23:05
ODOO - NOTAS
Instalar modulos de Odoo
>pip3 install - r requirement.txt
Resolver problema de la compilacion de estilos
>pip install libsass
ModuleNotFoundError: No module named 'win32service'
> pip install pypiwin32
@JRSalasM
JRSalasM / GenerateExcelOdoo.py
Last active December 3, 2019 09:25
ODOO - Generar excel
# -*- coding: utf-8 -*-
from odoo import models, api, fields
import io
import base64
import xlwt
class ControlAsistenciaWizard(models.TransientModel):
@JRSalasM
JRSalasM / dateFormat.js
Last active November 28, 2019 17:17
JAVASCRIPT - Para formatear las fecha
export const getDateFormat = (format, date=null) => {
let today = date ? new Date(date) : new Date();
if(date){
today = today.setMinutes(today.getMinutes() + today.getTimezoneOffset())
today = new Date(today);
}
let r = {
dd: today.getDate(),
mm: today.getMonth()+1,
yyyy: today.getFullYear(),
@JRSalasM
JRSalasM / ModalComponent.js
Last active November 28, 2019 17:17
REACT - Component Modal Bootstrap
import React from 'react'
import PropTypes from 'prop-types';
const Modal = ({title, children, handleCancelModal, handleOkModel, buttons, cancelText, okText, width}) => {
let widthSize = { maxWidth: width || 0 }
return (
<div className="modal fade show" style={{paddingRight: '17px', display: 'block'}}>
<div className="modal-dialog" role="document" style={width ? widthSize : {}}>
<div className="modal-content">
{
@JRSalasM
JRSalasM / ExcelReader.js
Last active November 28, 2019 17:16
REACT - COMPONENTE PARA IMPORT EXCEL
import React, { Component } from 'react';
import XLSX from 'xlsx';
import { make_cols } from './MakeColumns';
import { SheetJSFT } from './types';
import PropTypes from 'prop-types';
class ExcelReader extends Component {
constructor(props) {
super(props);
this.state = {
@JRSalasM
JRSalasM / simpleText.js
Last active November 28, 2019 17:16
JAVASCRIPT - Devuelve la misma cadena de texto en minuscular, sin tildes, sin espacios extras, sin salto de lineas, ni tabulaciones.
export const simpleText = (texto) => {
return (texto.normalize('NFD')
.replace(/[\u0300-\u036f]/g,""))
.replace(/(\r\n|\n|\r)/gm, ' ')
.replace(/[\s]{2,}/gm, ' ').toString().toLowerCase();
}
@JRSalasM
JRSalasM / parentModel.py
Last active June 4, 2022 02:04
ODOO - WIZARD EXAMPLE
# -*- coding: utf-8 -*-
from odoo import models, api, fields
class parentModel(models.TransientModel):
_name = 'parent.model'
name = fields.Integer(string="Name")
#.
@JRSalasM
JRSalasM / res_config_settings.py
Last active November 28, 2019 17:14
ODOO - AGREGAR Y OBTENER CONFIGURACIÓN
# -*- coding: utf-8 -*-
from odoo import api, fields, models
class ResConfigSettings(models.TransientModel):
_inherit = 'res.config.settings'
essalud = fields.Char(string='Descuento EsSalud', default='')
eps = fields.Float(string='Descuento EPS')
@JRSalasM
JRSalasM / file.py
Created November 28, 2019 15:32
PYTHON - FECHA Y HORA ACTUAL CON ZONA HORARIA
from dateutil import relativedelta as rdelta
from datetime import datetime
import dateutil.parser
import pytz
my_date = datetime.now(pytz.timezone('America/Lima')).strftime('%Y-%m-%d %H:%M:%S')
# DATETIME TO DATE
dateutil.parser.parse(my_date).date():
@JRSalasM
JRSalasM / file.js
Created November 28, 2019 17:13
ODOO - METODO PARA SER LLAMADO DESDE ODOO-WEBKIT
const model = new Model('model.name');
model
.call_button('get_information_to_payroll', [{
idEmployees
}])
.then((res)=>{
console.log(res)
})
.catch((err) => {