Skip to content

Instantly share code, notes, and snippets.

View nhomar's full-sized avatar
🏠
Life is beautiful

Nhomar [Vauxoo] nhomar

🏠
Life is beautiful
View GitHub Profile
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys,json,urllib
from pysrt import SubRipFile, SubRipItem
url_string = 'http://ajax.googleapis.com/ajax/services/language/'
def detect(text):
query = dict(v='1.0', q=text)
import oerplib
# Prepare the connection to the server.
oerp = oerplib.OERP('localhost', protocol='xmlrpc', port=8069)
# Check available databases
print(oerp.db.list())
# Login (the object returned is a browsable record)
user = oerp.login('user', 'passwd', 'db_name')
@nhomar
nhomar / log_assert_incorrect
Created July 21, 2014 05:38
traceback yml asserting incorrectly an onchange.
2014-07-21 05:36:23,107 64273 ERROR account70 openerp.tools.yaml_import: The returning field 'account_analytic_id' from your on_change call 'product_id_change' does not exist either on the object 'account.invoice.line', either in the view 'account.invoice.line.form' used for the creation
Traceback (most recent call last):
File "/Users/nhomar/Trabajo/odoo-v7/openerp/tools/yaml_import.py", line 864, in process
self._process_node(node)
File "/Users/nhomar/Trabajo/odoo-v7/openerp/tools/yaml_import.py", line 875, in _process_node
self.process_record(node)
File "/Users/nhomar/Trabajo/odoo-v7/openerp/tools/yaml_import.py", line 325, in process_record
record_dict = self._create_record(model, fields, view_info, default=default)
File "/Users/nhomar/Trabajo/odoo-v7/openerp/tools/yaml_import.py", line 415, in _create_record
field_value = self._eval_field(model, field_name, fields[field_name], one2many_form_view or view_info, parent=record_dict, default=default)
@nhomar
nhomar / get_pull_requests.py
Last active March 2, 2023 12:58
Get the pull requests to a branch. With PyGithub
from github import Github
g = Github("user", "password")
repo = g.get_repo('organizacion/repo')
pulls = repo.get_pulls()
for p in pulls:
print p.merged
print p.base.sha
print p.id
print dir(p)
@nhomar
nhomar / descriptor
Last active August 29, 2015 14:05
Descriptor v7.0
# -*- coding: utf-8 -*-
{
'name': "",
'author': "Vauxoo",
'summary': "",
'category': "",
'description': """
""",
'version': "0.1",
'depends': [
@nhomar
nhomar / action_view.xml
Last active August 29, 2015 14:05
data_xml
<record id="{{ xml_id }}" model="ir.actions.act_window">
<field name="name">{{ action_name }}</field>
<field name="res_model">{{ model_name }}</field>
<field name="view_type">{{ }}</field>
<field name="view_id" ref="{{ xml_id_view }}"/>
<field name="context">{}</field>
<field name="search_view_id" ref="{{ xml_id_search_view }}"/>
<field name="view_mode">tree,form</field>
<field name="domain">[]</field>
<field name="help" type="html">
@nhomar
nhomar / import.py
Last active August 29, 2015 14:05
model
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
@nhomar
nhomar / sha_github.py
Created August 31, 2014 19:37
Implementing github hooks
import argparse
import hashlib
import hmac
from http.server import HTTPServer, BaseHTTPRequestHandler
import json
import pprint
import os
import sys
# It's not recommended to store the key within the code. Following
@nhomar
nhomar / balance.sql
Created October 10, 2014 15:15
difference
SELECT
l.account_id,
sum(l.debit-l.credit)
FROM account_move_line AS l
INNER JOIN account_account AS a ON a.id = l.account_id
WHERE l.debit-l.credit != 0 AND a.code ilike '1-1-08%' //<<ug l
GROUP BY account_id
/*
Tiempo de ejecución de la sentencia: 11.56 segundos
*/
@nhomar
nhomar / .bashrc
Last active August 29, 2015 14:07 — forked from marioBonales/.bashrc
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
# don't put duplicate lines in the history. See bash(1) for more options
# ... or force ignoredups and ignorespace
HISTCONTROL=ignoredups:ignorespace