This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>IDECodeSnippetCompletionPrefix</key> | |
<string></string> | |
<key>IDECodeSnippetContents</key> | |
<string>class <#MyClass#>(osv.osv): | |
" <#DOCString#>" | |
#_name="My name" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Xcode 4 custom snippet | |
If you want to make your own custom snippets with in preview version of Xcode 4 and do not want to wait for the function to be implemented here is the way : | |
Open the folder ~/Library/Developer/Xcode/UserData/CodeSnippets | |
Create a file named my_nice_file.codesnippet (one file per snippet) | |
It should look like this : http://gist.github.com/521183 | |
There is only one rule to respect : |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import netsvc | |
logger = netsvc.Logger() | |
class Logger(object): | |
"""Provide an API similar to the standard 'logging' module.""" | |
__slots__ = ('name',) | |
def __init__(self, name): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from shapely.wkt import dumps as wktdumps, loads as wktloads | |
from shapely.geometry import Polygon, MultiPolygon | |
import geojson | |
from base_geoengine import geo_model | |
class NPA(geo_model.GeoModel): | |
_inherit = "res.better.zip" | |
_columns = { | |
'the_geom' : fields.geo_multi_polygon('NPA Shape', required=False), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
print self.geo_search(cursor, uid, domain=[('name', 'ilike', 'Lausanne')], geo_domain=[('the_geom', 'geo_greater', Polygon([(3, 0), (4, 1), (4, 0)]))]) | |
print self.geo_search(cursor, uid, domain=[('name', 'ilike', 'Lausanne')], geo_domain=[('the_geom', 'geo_greater', 0)]) | |
print self.geo_search(cursor, uid, domain=[('name', 'ilike', 'Lausanne')], geo_domain=[('the_geom', 'geo_intersect', {'geoengine.demo.automatic.retailing.machine.the_point': []})]) | |
print self.geo_search(cursor, uid, domain=[('name', 'ilike', 'Lausanne')], geo_domain=[('the_geom', 'geo_intersect', {'geoengine.demo.automatic.retailing.machine.the_point': [('name','!=','Vallorbe')]})]) | |
#will generate | |
""" | |
SELECT "res_better_zip".id FROM "res_better_zip" WHERE (res_better_zip."name" ilike E'%Lausanne%') AND ST_Area(res_better_zip.the_geom) > ST_Area(ST_GeomFromText('POLYGON ((3.0000000000000000 0.0000000000000000, 4.0000000000000000 1.0000000000000000, 4.0000000000000000 0.0000000000000000, 3.0000000000000000 0.0000000000000000))')) ORDER BY pr |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MYCONST = ('new_val', 'New Label') | |
class Partner(osv.osv): | |
"""My Stuff""" | |
_inherit = 'res.partner' | |
def __init__(self, pool, cursor): | |
"""Hack due to the lack of selection fields inheritance mechanism.""" | |
super(Partner, self).__init__(pool, cursor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Thanks to Florent for the function. | |
#Really useful. | |
def osv_method(f): | |
"""Decorator with boilerplate for OSV methods.""" | |
args, varargs, kwargs, defaults = getargspec(f) | |
len_argspec = len(args) - 4 | |
# Sanity check: no *args or **kwargs parameters |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Removed some output related to extra-addons | |
STATEMENT: ALTER TABLE "res_partner_address" ALTER COLUMN "country_id" SET NOT NULL | |
ERROR: column "smtp_host" contains null values | |
STATEMENT: ALTER TABLE "ir_mail_server" ALTER COLUMN "smtp_host" SET NOT NULL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using https://github.com/rvalyi/ooor/pull/81 in background | |
Given I find or create by login a ResUsers "admin" with | |
| key | val | | |
| partner_id | find by xml_id blabla | | |
#or | |
| partner_id | find by name and login! Pinky, daBoss | | |
and why not |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns repl.xml_to_csv | |
(:use [hiccup.core] | |
[clojure-csv.core :as csv])) | |
(defn csv-data [] (csv/parse-csv (slurp "/Users/nbessi/Downloads/doc/zip.csv"))) | |
(defn render-line [line] | |
(html [:record {:id (line 0), :model "res.better.zip"} | |
[:field {:name "name"} (line 1)] | |
[:field {:name "city"} (line 2)] | |
[:field {:name "state_id", :ref (str "state_" (line 3))}] |
OlderNewer