Skip to content

Instantly share code, notes, and snippets.

View moylop260's full-sized avatar

Moisés López - https://www.vauxoo.com/ moylop260

View GitHub Profile
import csv
import pandas as pd
cars = {'Brand': ['Honda, Civic','Toyota; Corolla','Ford "Focus','Audi - A4'],
'Price': [22000,25000,27000,35000]
}
df = pd.DataFrame(cars, columns = ['Brand', 'Price'])
diff --git a/odoo/addons/base/models/ir_attachment.py b/odoo/addons/base/models/ir_attachment.py
index 666329c6..b6d4fa3d 100644
--- a/odoo/addons/base/models/ir_attachment.py
+++ b/odoo/addons/base/models/ir_attachment.py
@@ -200,6 +200,11 @@ class IrAttachment(models.Model):
for attach in self:
if attach.store_fname:
attach.datas = self._file_read(attach.store_fname, bin_size)
+ size_mb = len(attach.datas)/1024/1024
+ if size_mb >= 0.2:
# Similar to run
# tsql -H ${SYBASE_SERVER} -U ${SYBASE_UID} -P ${SYBASE_PWD} -p ${SYBASE_PORT}
# 1> SELECT @@version
# 2> GO
import os
import pyodbc
cs = ("SERVER=%s,%s;"
EXPLAIN (ANALYZE, VERBOSE, BUFFERS) SELECT count(id)                                                                                                                                                      
FROM "product_template"
LEFT JOIN (SELECT res_id, value
    FROM "ir_translation"
    WHERE type='model' AND name='product.template,name' AND lang='es_CR' AND value!='') as "product_template__name"                                                                                               
    ON ("product_template"."id" = "product_template__name"."res_id") WHERE (("product_template"."active" = true) AND ("product_template"."type" in ('consu','product')))
@moylop260
moylop260 / get_cron_unfinished.py
Created April 25, 2020 18:14
Detects odoo cron that doesn't finished
from collections import defaultdict
crons = defaultdict(dict)
with open("/home/odoo/odoo.log") as f:
for line in f:
if '`' not in line:
continue
line = line.strip(' \n')
line_separated = line.split('`')
sat pac Allow delete?
none: State not defined none: CFDI not necessary
none: State not defined retry: Retry
none: State not defined to_sign: To sign
none: State not defined signed: Signed
none: State not defined to_cancel: To cancel
none: State not defined cancelled: Cancelled
undefined: Not Synced Yet none: CFDI not necessary
undefined: Not Synced Yet retry: Retry
EXPLAIN (ANALYZE, VERBOSE, BUFFERS)
SELECT DISTINCT l.partner_id, UPPER(res_partner.name)
FROM account_move_line AS l left join res_partner on l.partner_id = res_partner.id
left join account_account ON account_account.id = l.account_id
left join account_move am ON am.id = l.move_id
WHERE (am.state IN ('posted'))
AND (account_account.internal_type IN ('receivable'))
AND (l.reconciled IS FALSE
OR (l.id, l.id) IN(
SELECT credit_move_id, debit_move_id FROM account_partial_reconcile where max_date > '2019-05-01'
# -*- coding: utf-8 -*-
import csv
fname = '/Users/moylop260/Downloads/bancomer.exp'
delimiter = '\xa6'
with open(fname) as infile:
csvfile = csv.reader(infile, delimiter=delimiter)
for line in csvfile:
for col in line:
python -c "from collections import Counter;lines = open('eslint.out').readlines();checks=[line.split(' ')[-1].strip() for line in lines];print(Counter(checks))
diff --git a/odoo/sql_db.py b/odoo/sql_db.py
index d804a4543..773fbd535 100644
--- a/odoo/sql_db.py
+++ b/odoo/sql_db.py
@@ -65,6 +65,11 @@ re_into = re.compile('.* into "?([a-zA-Z_0-9]+)"? .*$')
sql_counter = 0
+import hashlib, traceback, collections
+TRACEBACK_GROUP = collections.defaultdict(dict)