Skip to content

Instantly share code, notes, and snippets.

View allanaguilar's full-sized avatar
🎯
Focusing

Allan Aguilar allanaguilar

🎯
Focusing
View GitHub Profile
@allanaguilar
allanaguilar / size.py
Created October 15, 2021 03:42 — forked from drkpkg/size.py
Dynamic size report invoice odoo
"""
Dynamic size in account_invoice report
Just send the account_invoice_line_id take the len() and multiply it with 7 (millimeters)
This example is simulating the paper of a supermarket invoice, the default size in my country is 24 millimeters for a correct
format, but you can change it!
How it works: You need pass this method inside the qweb report sending the lines.
"""
#Qweb
<t t-esc="o.change_size_page(o.lines)"/>
@Klerith
Klerith / email-pattern.txt
Created September 10, 2020 15:08
Email Pattern para validaciones de correo
pattern="^([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5})$"
@allanaguilar
allanaguilar / CouchDB_Python.md
Created July 16, 2018 23:12 — forked from marians/CouchDB_Python.md
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module

@allanaguilar
allanaguilar / file_to_base64.py
Created June 28, 2018 19:48 — forked from maniartech/file_to_base64.py
A python function which converts file to base64 string.
def file_to_base64(file_path):
"""
A simple function which accepts the file_path and
converts and returns base64 string if specified file
exists. Returns blank string '' if file is not found.
"""
from os import path
if not path.exists(file_path):
return ''
return open(file_path, 'rb').read().encode('base64')
@drkpkg
drkpkg / size.py
Last active August 26, 2023 13:59
Dynamic size report invoice odoo
"""
Dynamic size in account_invoice report
Just send the account_invoice_line_id take the len() and multiply it with 7 (millimeters)
This example is simulating the paper of a supermarket invoice, the default size in my country is 24 millimeters for a correct
format, but you can change it!
How it works: You need pass this method inside the qweb report sending the lines.
"""
#Qweb
<t t-esc="o.change_size_page(o.lines)"/>
@mozillazg
mozillazg / app.py
Created December 5, 2017 00:06
A simple demo for how to use flask-paginate.
from flask import Flask, render_template
from flask_paginate import Pagination, get_page_args
app = Flask(__name__)
app.template_folder = ''
users = list(range(100))
def get_users(offset=0, per_page=10):
[options]
#
# WARNING:
# If you use the Odoo Database utility to change the master password be aware
# that the formatting of this file WILL be LOST! A copy of this file named
# /etc/odoo/openerp-server.conf.template has been made in case this happens
# Note that the copy does not have any first boot changes
#-----------------------------------------------------------------------------
# Odoo Server Config File - TurnKey Linux
@miguelgrinberg
miguelgrinberg / app.py
Created July 13, 2017 11:46
datetimepicker-example
from flask import Flask, render_template
from flask_bootstrap import Bootstrap
from flask_wtf import Form
from wtforms.fields import DateField
app = Flask(__name__)
app.config['SECRET_KEY'] = 'secret'
Bootstrap(app)
@kosso
kosso / custom-types-and-fields.php
Last active April 29, 2024 05:33
An example Wordpress (4.7+) plugin to create custom post types with custom taxonomies and custom meta fields, including exposing these to the REST API and adding custom columns in admin.
<?php
/**
* Plugin Name: Custom Post Types Example
* Description: An example plugin to create custom post types with custom taxonomies and custom meta fields, including exposing to the REST API.
* Plugin URI: http://kosso.co.uk
* Version: 1.0.0
* Author: Kosso
* Author URI: http://kosso.co.uk
* License: GPLv2
* Network: true
@marians
marians / CouchDB_Python.md
Last active May 21, 2024 20:53
The missing Python couchdb tutorial

This is an unofficial manual for the couchdb Python module I wish I had had.

Installation

pip install couchdb

Importing the module