Skip to content

Instantly share code, notes, and snippets.

View ecarreras's full-sized avatar
💡
IT for utilities

Eduard Carreras ecarreras

💡
IT for utilities
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import vatnumber
partners = O.ResPartner.search_reader([('vat', '!=', False)], ['vat'])
for p in partners:
if not vatnumber.check_vat(p['vat']):
new_vat = ''.join([x for x in p['vat'] if x.isalnum()])
if not vatnumber.check_vat(new_vat):
print new_vat
else:
#O.ResPartner.write([p['id']], {'vat': new_vat})
print "Ara es valid"
<?xml version="1.0" encoding='UTF-8'?>
<openerp>
<data noupdate="1">
<record id="res_bank_caterpillar" model="res.bank">
<field name="name">CATERPILLAR</field>
<field name="lname">CATERPILLAR FINANCIAL CORP.FINAN., S.A.E.F.C.</field>
<field name="code">4706</field>
<field name="vat">A28125805</field>
<field name="street">VIA DE LAS DOS CASTILLAS, 33 EDIF. ATICA, 6, PL.4</field>
<field name="city">POZUELO DE ALARCON</field>
#!/bin/bash
for d in `ls -1 ~/src`; do
if [ -d ~/src/$d/.git ]; then
pushd ~/src/$d &>/dev/null
branch=$(git branch | grep '^*' | cut -d ' ' -f 2)
echo "Updating $d ($branch) ..."
git fetch
git merge origin/$branch
popd &>/dev/null
fi
@ecarreras
ecarreras / popper.py
Created December 12, 2013 09:48
Simple utility to pop n elements
class Popper(object):
def __init__(self, items):
self.items = items[:]
def pop(self, n):
res = []
for x in xrange(0, min(n, len(self.items))):
res.append(self.items.pop())
return res
cambios = CambiosSuministrador()
cambios.cabecera.feed({
'agente': 'R1-323',
'tipo_mercado': 'E',
'tipo_agente': 'D',
'periodo': '201312'
})
for provincia in ['GI', 'LE', 'B']:
ds = DatosSolicitudes()
ds.feed({
[program:mongodb]
directory=%(VIRTUAL_ENV)s
command=%(VIRTUAL_ENV)s/bin/mongod --dbpath=%(VIRTUAL_ENV)s/gisce-erp/data/db
autostart=true
autorestart=true
redirect_stderr=true
@ecarreras
ecarreras / setup.py
Last active December 28, 2015 13:59
A Simple template for OpenERP addons
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP addons setup.py template
# Copyright (C) 2013 GISCE-TI, S.L.
#
# 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.

Reply-To in OpenERP Helpdesk

Define this function to crm_helpdesk.py

    def message_get_reply_to(self, cr, uid, ids, context=None):
        replies = []
        for crm in self.browse(cr, uid, ids, context):
            if crm.section_id and crm.section_id.reply_to:
 replies.append(crm.section_id.reply_to)
@ecarreras
ecarreras / compatibility.py
Created September 7, 2013 17:04
oorq Compatibility
# -*- coding: utf-8 -*-
__all_ = ['execute_v5', 'execute_v7', 'get_version']
def get_version():
"""This tries to return the version of the API.
"""
try:
from openerp.release import version_info