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
OE_USER="odoo"
OE_PORT="8069"
WEBSITE_NAME="_"
LONGPOLLING_PORT="8072"
ADMIN_EMAIL="test@example.com"
OE_CONFIG="${OE_USER}-server"
#--------------------------------------------------
# Install Nginx if needed
#--------------------------------------------------
@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),
@yasmanycastillo
yasmanycastillo / external_api.py
Created August 17, 2018 17:52
Odoo external api
import xmlrpc.server as Server
import ssl
class Utils(object):
def __init__(self, host, db_name, user, password):
ssl.match_hostname = lambda cert, hostname: True
self._host = host
self._db = db_name
# 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 / odoo_download_file.py
Last active August 30, 2023 14:46
Odoo: How to download a file immediately from wizard
# -*- coding: utf-8 -*-
from odoo import http
from odoo.http import request
from odoo.addons.web.controllers.main import serialize_exception,content_disposition
import base64
class Binary(http.Controller):
@http.route('/web/binary/download_document', type='http', auth="public")