Skip to content

Instantly share code, notes, and snippets.

View yasmanycastillo's full-sized avatar

Yasmany Castillo yasmanycastillo

View GitHub Profile
https://github.com/Yenthe666/auto_backup
backup to server first
sudo pip3 install pysftp
# this is no good, it needs List_db to be True, but it's disabled for security purpose. Need another method.
https://github.com/meganz/MEGAcmd/blob/master/contrib/docs/BACKUPS.md
push local backup to mega cloud
https://github.com/meganz/MEGAcmd/blob/master/UserGuide.md
Archivo replacer
https://gist.github.com/umiphos/54658fafa9d70d9f58363a5bb96fe208
./replacer.sh "account\.invoice" "account\.move"
./replacer.sh "AccountInvoice" "AccountMove"
Esto se queda tal cual
account.group_account_invoice
# -*- coding: utf-8 -*-
import sys
import datetime
from os import path, pardir
PROJECT_ROOT = path.dirname(path.abspath(__file__))
sys.path.append(path.join(PROJECT_ROOT, pardir))
import openpay
openpay.api_key = "sk_c71babd865fd420b94bc588a8585c122"
openpay.verify_ssl_certs = False
@yasmanycastillo
yasmanycastillo / Odoo-install.md
Created February 12, 2019 02:19 — forked from erickgnavar/Odoo-install.md
Instalación Odoo

Despliegue de aplicación Odoo

Se usará Ubuntu 16.04 como sistema base

Preparación del sistema

sudo apt-get update

sudo apt-get install git python-dev libpq-dev python-pip python-virtualenv libsasl2-dev libldap2-dev libssl-dev \
@yasmanycastillo
yasmanycastillo / skip_test_from_super_class.py
Created January 22, 2019 18:52 — forked from moylop260/skip_test_from_super_class.py
How to skip a method test from a inherited test class for python
class TestCustom(Test):
def __init__(self, methodName='runTest'):
super(TestCustom, self).__init__(methodName)
# Skip original test from inherited class
custom_attributes = set(dir(TestCustom)) - set(dir(Test))
custom_test_methods = [
name for name in custom_attributes
if name.startswith('test_') and callable(getattr(self, name))]
if methodName not in custom_test_methods:
method = getattr(self, methodName)
quants = env['stock.quant'].search([])
move_line_ids = []
warning = ''
for quant in quants:
move_lines = env["stock.move.line"].search([
('product_id', '=', quant.product_id.id),
('location_id', '=', quant.location_id.id),
('lot_id', '=', quant.lot_id.id),
('package_id', '=', quant.package_id.id),
('owner_id', '=', quant.owner_id.id),
# This came up with a huge problem for days, but i resolve it.
# The main problem is the limitation in form in odoo. Mostly of this are not in the official documentation,
# so maybe you will feel a bit blind sometimes, but I feel you bro.
# Basically works for partner_id relation for many2one
# PART ONE
# Create a class res_partner.py
class ResPartner(models.Model):
"""This part is the easy part, @api.model overrides to name_get (optional) and name_search."""
_inherit = 'res.partner'
@yasmanycastillo
yasmanycastillo / bootstrap-db.py
Created January 10, 2018 16:42 — forked from sebalix/bootstrap-db.py
Bootstraping Odoo database (8.0)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Script to bootstrap an Odoo database (8.0)."""
import odoorpc
# Odoo connection
SUPER_PWD = 'admin'
HOST = 'localhost'
PORT = 8069
DB = 'my_db'
@yasmanycastillo
yasmanycastillo / csv_splitter.py
Created August 8, 2017 14:29 — forked from jrivero/csv_splitter.py
A Python CSV splitter
import os
def split(filehandler, delimiter=',', row_limit=10000,
output_name_template='output_%s.csv', output_path='.', keep_headers=True):
"""
Splits a CSV file into multiple pieces.
A quick bastardization of the Python CSV library.
Arguments:
#!/usr/bin/env python
#
# Very basic example of using Python and IMAP to iterate over emails in a
# gmail folder/label. This code is released into the public domain.
#
# RKI July 2013
# http://www.voidynullness.net/blog/2013/07/25/gmail-email-with-python-via-imap/
#
import sys
import imaplib