Skip to content

Instantly share code, notes, and snippets.


Daniel Palomar Rodríguez danypr92

View GitHub Profile
View gist:5d7e79cbb6f2494eb11cf773dbeb2879
package org.meveo.service.script;\n\nimport;\nimport java.lang.Double;\nimport java.math.BigDecimal;\nimport java.math.RoundingMode;\nimport java.util.ArrayList;\nimport java.util.Date;\nimport java.util.List;\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport java.util.concurrent.TimeUnit;\nimport java.text.DateFormat;\nimport java.text.SimpleDateFormat;\n\nimport org.meveo.admin.exception.BusinessException;\nimport org.meveo.commons.utils.ParamBeanFactory;\nimport org.meveo.commons.utils.ParamBean;\nimport org.meveo.commons.utils.PersistenceUtils;\nimport org.meveo.model.crm.Provider;\nimport org.meveo.model.admin.Seller;\nimport org.meveo.model.ICustomFieldEntity;\nimport org.meveo.model.admin.User;\nimport org.meveo.model.billing.BankCoordinates;\nimport org.meveo.model.billing.Invoice;\nimport org.meveo.model.billing.RatedTransaction;\nimport org.meveo.model.billing.ServiceInstance;\nimport org.meveo.model.billing.Subscription;\nimport org.meveo.model.billing.WalletOperation;\nimpor
danypr92 /
Created Nov 23, 2018
Com busquem les queries que estan blocant el sistema?

Búsqueda de queries més que bloquejen el sistema

Per trobar quina query s'esta executant en aquest moment?

SELECT * FROM pg_stat_activity WHERE state = 'active';

Matar queries per PID

danypr92 /
Last active Sep 7, 2018
Logstash filter to mapping the Tryton Log

Logstash filter to Tryton Log

We need a filter to map the Tryton log to monitoring it from ELK.

Tryton log pattern:

format = %(process)d - [%(asctime)s] %(levelname)s:%(name)s:%(message)s
datefmt = %a %b %d %H:%M:%S %Y

Tryton log example:


Try celery-tryton 0.3

  • My tasks file:
  from celery import Celery
  from celery_tryton import TrytonTask
  from trytond.transaction import Transaction
  celery = Celery('tryton')
  celery.conf.TRYTON_DATABASE = 'tryton'                                                                                              
danypr92 /
Created Aug 28, 2018
Odoo SEPA Direct Debit Configuration

Configuration SEPA Direct Debit in Odoo 11

The sepa direct pay in Odoo is part of Enterprise packages. We have installed a OCA module to cover the SEPA mandate creation/exportation: Account Banking SEPA Direct Debit.


For setting the SEPA creditor identifier:

danypr92 /
Last active Aug 10, 2018
OTRS integration Ticket model data

OTRS Ticket integration process

Curls tests

➜ curl "" -H "Content-Type: application/json" -d "{\"Ticket\":{\"Title\":\"REST Create Test\", \"Type\": \"Unclassified\", \"Queue\":\"Raw\",\"State\":\"open\",\"Priority\":\"3 normal\",\"CustomerUser\":1},\"Article\":{\"Subject\":\"Rest Create Test\",\"Body\":\"This is only a test\",\"ContentType\":\"text/plain; charset=utf8\"}}"  -X POST 
{"Error":{"ErrorCode":"TicketCreate.InvalidParameter","ErrorMessage":"TicketCreate: Ticket->CustomerUser parameter is invalid!"}}%                                                                                                                                              
➜ curl "" -H "Content-Type: application/json" -d "{\"Ticket\":{\"Title\":\"REST Create Tes
View queries.sql
# Query with the domain: [('partner_number', '=', "")]
"a"."id" AS "id",
"a"."comment" AS "comment",
"a"."code" AS "code",
"a"."create_date" AS "create_date",
"a"."write_uid" AS "write_uid",
"a"."create_uid" AS "create_uid",
"a"."first_name" AS "first_name",
danypr92 /
Created Jul 12, 2018
Genshi Templates and Babel Date format

Tenemos un template que incluye una fecha y la queremos localizada (con: dia de la semana, dia mes).


La portabilidad de la línea se llevará a cabo ${record.sim_activation_date_localized} de 2:00h a 6:00h de la madrugada.

Código Python:

danypr92 /
Last active Jul 12, 2018
Error decode Tryton Electronic Mail Wizard
ERROR:tryton.common.common:Traceback (most recent call last):
  File "/trytond/protocols/", line 170, in _marshaled_dispatch
    response['result'] = dispatch_method(method, params)
  File "/trytond/protocols/", line 206, in _dispatch
    res = dispatch(*args)
  File "/trytond/protocols/", line 185, in dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/wizard/", line 275, in execute
    return wizard._execute(state_name)
You can’t perform that action at this time.