Skip to content

Instantly share code, notes, and snippets.

View sharoonthomas's full-sized avatar

Sharoon Thomas sharoonthomas

View GitHub Profile
@sharoonthomas
sharoonthomas / example.js
Created March 12, 2012 02:03
Tryton Model Proxy example
var ir_ui_menu_proxy = new Ext.createByAlias('proxy.tmodel', {
modelName: "ir.ui.menu"
});
ir_ui_menu_proxy.doRequest(
'search_read',
[['parent', '=', false], 0, 1000, null, ['name', 'childs']],
// Callback
function(result) {
console.log(result);
});
@sharoonthomas
sharoonthomas / gist:2779418
Created May 24, 2012 04:28
Example for stack level
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test
Testing the warning stack level usage
:copyright: (c) 2012 by Openlabs Technologies & Consulting (P) Limited
:license: BSD, see LICENSE for more details.
"""
from mongoengine import Document, StringField
class Machine(Document):
data_center = StringField(choices=[
('us-east', 'US East'),
('us-west', 'US West'),
('sa-sao', 'South America (SAO)'),
('eu', 'European Union'),
])
>>> print chr.__doc__
chr(i) -> character
Return a string of one character with ordinal i; 0 <= i < 256.
>>> print unichr.__doc__
unichr(i) -> Unicode character
Return a Unicode string of one character with ordinal i; 0 <= i <= 0x10ffff.
@sharoonthomas
sharoonthomas / gist:3186197
Created July 27, 2012 04:36
Sample CSV report for Tryton CSV Report
class CSVReportEngine(ModelView):
"""CSV reports for ..."""
_name = 'csv.report.engine'
def report_tracking_numbers(self, data, buffer):
"Tracking Numbers"
shipment_obj = self.pool.get('stock.shipment.out')
move_obj = self.pool.get('stock.move')
domain = [
@sharoonthomas
sharoonthomas / nereid-2.6-change-url.diff
Created January 21, 2013 17:43
Migrating to Nereid 2.6: Changing from methods selection to activating individual HTTP methods
<record>
<field name="rule">/&lt;language&gt;/login</field>
<field name="endpoint">nereid.website.login</field>
<field name="sequence" eval="20" />
- <field name="methods">("GET", "POST")</field>
+ <field name="http_method_get" eval="True"/>
+ <field name="http_method_post" eval="True"/>
<field name="url_map" ref="default_url_map" />
</record>
@sharoonthomas
sharoonthomas / explicit-get.diff
Created January 21, 2013 18:00
Nereid 2.6: Explicitly enable HTTP GET method.
<record>
<field name="rule">/&lt;language&gt;/logout</field>
<field name="endpoint">nereid.website.logout</field>
<field name="sequence" eval="30" />
+ <field name="http_method_get" eval="True"/>
<field name="url_map" ref="default_url_map" />
</record>
@sharoonthomas
sharoonthomas / activerecord.diff
Last active December 11, 2015 10:38
Migration to Nereid 2.6: Active record pattern in URLs
<record id="activate_url" model="nereid.url_rule">
- <field name="rule">/&lt;language&gt;/activate-account/&lt;int:user_id&gt;/</field>
+ <field name="rule">/&lt;language&gt;/activate-account/&lt;int:active_id&gt;/</field>
<field name="endpoint">nereid.user.activate</field>
<field name="sequence" eval="70" />
<field name="http_method_get" eval="True"/>
<field name="http_method_post" eval="True"/>
<field name="url_map" ref="default_url_map" />
</record>
@sharoonthomas
sharoonthomas / delegate_touchstart_to_click.js
Created March 30, 2013 05:20
Delegate touchstart events on iPad to click events
if (navigator.userAgent.match(/iPad/i)) {
$('chozen-widget-created').bind('touchstart', function(event) {
$(this).trigger('click');
})
}
from connection import NetSuiteConnect
from SuiteREST import SuiteRequest
from forms import send_error
class ExportFulfillments(object):
def __init__(self):
self.instance = NetSuiteConnect()
self.conn = self.instance.erp_connection()