Skip to content

Instantly share code, notes, and snippets.

View rmehta's full-sized avatar

Rushabh Mehta rmehta

View GitHub Profile

Petition for mandating use of Free and Open Source in New Education Policy Draft circulated by Government of India

For the first time, the Government of India is embarking on a time-bound grassroots consultative process, which will enable the Ministry of HRD to reach out to individuals across the country through over 2.75 lakh direct consultations while also taking input from citizens online.

Here is the draft policy http://mhrd.gov.in/nep-new

In reference to this, we find it strange that the government has not included the mandate for schools to use Free and Open Source Software. Not only is Free Software cost effective, there are many other benefits.

doc = frappe.get_doc(doctype, name)
if hasattr(doc, 'has_web_form_permission'):
if not doc.has_web_form_permission():
return False
# you can selectively import objects from different files like this:
from houses import all_houses
from students import all_students
def sort(student):
for house in all_houses:
if house.ability == student.ability:
if house.students is None:
house.students = []
class House:
name = None
ability = None
students = None
class Student:
name = None
ability = None
# houses
@rmehta
rmehta / frappe_docs_remove_unused_images.py
Last active December 3, 2015 11:17
Purge unused image files in docs
# run this from the docs folder
from __future__ import unicode_literals
import os, re
images = []
for basepath, folders, files in os.walk("."):
for f in files:
key, extn = f.rsplit(".", 1)
@rmehta
rmehta / erpnext_magento.php
Last active April 24, 2024 06:57
Sample ERPNext Magento Connector
<?php
// contributed by supplify.com
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once '../curl/Zebra_cURL.php';
require_once '../app/Mage.php';
Mage::app();
class action extends Zebra_cURL{
// refactored by Rushabh Mehta
// original script https://gist.github.com/rmehta/5a7dbf05494990b838f8
cur_frm.add_fetch('item_code','amount_allocated_on_permit',
'amount_allocated_on_permit');
window.naivasha = {
recalculate: function(doc, child_doctype, child_name) {
if(!doc) {
doc = cur_frm.doc;
cur_frm.cscript.custom_entries_add = function(doc, cdt, cdn) {
var row = frappe.model.get_doc(cdt, cdn);
row.start_date_of_accounting_period = doc.start_date_of_accounting_period;
row.end_date_of_accounting_period = doc.end_date_of_accounting_period;
row.number_of_days = new Date(row.end_date_of_accounting_period) - new Date(row.start_date_of_accounting_period); // milliseconds
row.number_of_days = Math.round(row.number_of_days / 86400000);
refresh_field("start_date_of_accounting_period");
refresh_field("end_date_of_accounting_period");
refresh_field("number_of_days");
}

What are your parameters to decide strategic / non-strategic code or apps when releasing to OSS? Assuming one would only release non-strategic stuff.

No we release everything! The premise of open source is to give away.

What we don't release is our cloud platform. We are also in process of building a non-open source app, unrelated to our core application ERPNext, which will complement the open source one,

When did you first release code under OSS?

2008

@rmehta
rmehta / v4_add_row_trigger.js
Created April 7, 2015 12:16
Frappe Custom Script. Trigger on add row (version 4)
cur_frm.cscript.set_total = function(doc, dt, dn) {
var grand_total = 0;
$.each(doc.z_items, function(i, d) { grand_total += d.qty; });
cur_frm.set_value("grand_total", grand_total);
}
cur_frm.cscript.z_items_add = function(doc) {
cur_frm.cscript.set_total(doc);
}