Skip to content

Instantly share code, notes, and snippets.

View loftwah's full-sized avatar
💭
“Any sufficiently advanced technology is equivalent to magic.”

Dean Lofts loftwah

💭
“Any sufficiently advanced technology is equivalent to magic.”
View GitHub Profile
@kyleburton
kyleburton / google-sheet-script.js
Created August 30, 2019 23:01
counting colored cells in google sheets
// =countbackgrounds("C2:K2","#00ff00")
/*
it's a bit of a hack to send in the cell range as a string, though it works when calling getRange:
SpreadsheetApp.getActiveSpreadsheet().getRange(range)
This also means you can't "fill down" to have the ranges updated to match your sheet, so hack number two genreates
the formulas so you can copy/paste them into the sheet:
@planetoftheweb
planetoftheweb / insertyoutubefeed
Created April 12, 2012 14:18
Insert YouTube Channel Feed & Player into any site using JSON
<style>
#videogroup {
width: 100%;
}
iframe {
width: 90%;
padding: 5%;
}
"""
jQuery templates use constructs like:
{{if condition}} print something{{/if}}
This, of course, completely screws up Django templates,
because Django thinks {{ and }} mean something.
Wrap {% verbatim %} and {% endverbatim %} around those
blocks of jQuery templates and this will try its best
@webchick
webchick / gist:956a2d7a49c7490fefb5
Last active December 3, 2019 09:25
Most popular D7 modules (as of July 16, 2015)
SELECT n.title, SUM(w.count) as total
FROM project_usage_week_release w
INNER JOIN field_data_field_release_project r ON w.nid = r.entity_id
INNER JOIN node n ON n.nid = r.field_release_project_target_id
INNER JOIN
field_data_field_release_version v ON v.entity_id = r.entity_id
WHERE LEFT(v.field_release_version_value, 3) = '7.x'
AND FROM_UNIXTIME(w.timestamp) BETWEEN CURDATE()-INTERVAL 2 WEEK AND CURDATE()
GROUP BY n.title
ORDER BY total DESC;
@tejastank
tejastank / nginx-odoo-linux-ubuntu-centos-setup.conf
Last active December 3, 2019 09:25
NGINX Odoo Virtualhost Setup
upstream odooe{
server 127.0.0.1:8069;
}
upstream olongpolling {
server 127.0.0.1:8072;
}
@CakJuice
CakJuice / attachment_odoo11_example.py
Created August 18, 2018 02:50
Generate attachment on Odoo 11
import base64
from odoo import models, fields, api
class SomeModel(models.Model):
_name = 'some.model'
field1 = fields.Char(string="Field 1")
field2 = fields.Boolean(string="Field 2")
@api.multi
@rl4debug
rl4debug / odoo-cheatsheet.md
Last active December 3, 2019 09:25
[odoo cheatsheet] #odoo

0. Install environment (ubuntu, debian)

sudo pip3 install pyquerystring
sudo pip3 install parse-accept-language
apt-get install python3-pypdf2
sudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev
sudo pip3 install -r requirements.txt

#Note for Debian, sometime we want to install dependencie packages.
sudo apt --fix-broken install
@JRSalasM
JRSalasM / GenerateExcelOdoo.py
Last active December 3, 2019 09:25
ODOO - Generar excel
# -*- coding: utf-8 -*-
from odoo import models, api, fields
import io
import base64
import xlwt
class ControlAsistenciaWizard(models.TransientModel):
@akhdaniel
akhdaniel / Filter domain dynamic date
Last active December 3, 2019 09:26
Odoo Filter Today
<filter string="Today" name="today" domain="[('date_start','&gt;=',time.strftime('%%Y-%%m-%%d'))]"/>
<filter string="This Month" name="thismonth" domain="[('date_start','&gt;=',time.strftime('%%Y-%%m-01'))]"/>
<filter string="This Year" name="thisyear" domain="[('date_start','&gt;=',time.strftime('%%Y-01-01'))]"/>
<filter string="Today" domain="[('start_at', '>=', datetime.datetime.combine(context_today(), datetime.time(0,0,0)))]" />
enter DB via psql:
DELETE FROM ir_attachment WHERE res_model='ir.ui.view'
restart Odoo