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)"/>
@allanaguilar
allanaguilar / app.py
Created July 21, 2020 18:15 — forked from mozillazg/app.py
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):
@allanaguilar
allanaguilar / ipython3_mavericks.sh
Created February 6, 2020 15:48 — forked from rossov/ipython3_mavericks.sh
Install ipython3 on Mac OS X Mavericks
# Install ipython3 on Mac OS X Maverics
# Update brew
brew update
brew upgrade
# Install Python 3
brew install python3
# Install ipython
@api.onchange('phase_type')
def _onchange_phase_type(self):
if self.phase_type:
phase_line_ids = []
for line in self.phase_type.phase_lines:
phase_line_ids.append((0, 0, {
'phase': line.phase_id.id,
}))
self.project_sch_lines = phase_line_ids
# CONVERT ANY STRING TO FLOAT
def string_to_float(v):
if isinstance(v, (int, float)):
res = v
else:
v2 = v.replace(",","")
res = float(v2) if v2.replace(".","").isdigit() else 0
return res
@allanaguilar
allanaguilar / app.py
Created January 11, 2019 19:41 — forked from miguelgrinberg/app.py
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)
@allanaguilar
allanaguilar / 1: helloworld
Created December 27, 2018 14:24 — forked from marthall/1: helloworld
Very basic python packaging
#!/usr/bin/env python
print "Hello World"
[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
@allanaguilar
allanaguilar / image_stof.py
Created October 24, 2018 19:24 — forked from RaminNietzsche/image_stof.py
Python flask upload base64 image
import base64
from io import BytesIO
from PIL import Image
file = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAcAAAAHACAYAAAA1JbhzAAAgAElEQVR4Xoy96ZKt3XKVt5p97pmgMSDAdI6wABMWdiB+yEgQQoBN38h34HMkjiTEraCqtYgc4xmZOd+qT+EtON/eVWu9zZzZjBzZzPuf+Y2fv+/v2+19e91u98ftcb/dPl/v2/N2v71v79vtdr/Vb+s/79dNfx6P2+31ft/u9/pd/fau79W/3++60ut2fz1ut4e/7c/oJvrM/f6+vd/32+N9u32+b7rXq65/e90e9/re+/aqX9Rn+b7+w/1ubz+Zf1T3vt9eLz9cninfrWeuF6zn0mfrWd5ctV6cN6z3edyft9f7k2f0c75u79vj9tSz1bff70/97FnP+ao3rcd91EvUwun56xO1IHlGrdn9x+19+6yFu9Vb1RvkWe+v9+398HrUf+tVtMZcoR5Tz32v+7/0NJ999R+35+2z/13Xut/rYW5a07qK//eu79Uz1Xp/1lPUhete7/utlqT++al98P77+/lTT+Br1XPWs2kv65lrP0oAstestaRHH6h7WTYe9bs361wXuj18LV3zfnve57m1T6/b7VnXrjUq2by9bz/qWWu5tY48T/2s9roeMz971bVqvfIutX7elfqZJful69Sf+p3ur/evfaxrzi6+63k/7tprfRe5q2vVn+zJo/5dz/L0Netr9f4fklGvWcmsZarWxd/V52rj37W/dU0/u69bP3/d7qVfev/77V6y8raEavV41Fon3VfX9nUka6UHein//zeyohW4l3RoEdBWXQQLUM9dMuUb1Ecsu++2A+9Xyf7T+lA/r/dHDu6lz+icf1bPW+vw0p56S7APWleLWq3vo97x86131f3Qn9ipeo96z3qtkpHS+/f9pWtKFPQ6tRYlZ/V/slYtuyUfdcO6V62tzCDrV+8ou1
@allanaguilar
allanaguilar / template_view.xml
Created August 24, 2018 16:29
Esta es una plantilla completa de vistas en odoo, incluye: menu, tree view, form view, y sus respectivos actions
<?xml version="1.0"?>
<odoo>
<data>
<!-- TREE VIEW -->
<record id="maintenance_order_tree" model="ir.ui.view">
<field name="name">maintenance.order.tree</field>
<field name="model">maintenance.order</field>
<field name="arch" type="xml">
<tree string="maintenance_order"> <!-- decoration-info="state == 'draft'" decoration-muted="state == 'cancel'" -->
<field name="name"/>