Skip to content

Instantly share code, notes, and snippets.

View nabinhait's full-sized avatar

Nabin Hait nabinhait

View GitHub Profile
@nabinhait
nabinhait / Claude.md
Created May 23, 2026 19:24
Coding Guidelines for Claude

General code quality guidelines

  1. Choose clean code over clever code.
  2. Write object oriented code as much as possible.
  3. Keep function sizes small, ideally 10 lines.
  4. Try and keep files between 100 and 300 lines.
  5. Don't keep too many files in a folder or module. Try and keep it under 15.
  6. Avoid abbreviations.
  7. Use standard API as much as possible.
  8. Reuse. Write as little code as possible.
  9. Use Frappe UI, espresso for UI styling.
@nabinhait
nabinhait / party_import_tool_prompts.md
Last active May 23, 2026 20:08
Party Import Feature Prompts
> I want to create a party import tool. Currently users need to use Data Import Tool for that, but it has a lot of dependencied like importing territory, customer groups beforehand. Also, address and contact need to be imported separately. Write a specification and give me design. Use espresso design style.

> create a mvp

> let's call Party Import doctype as Party Import Log?

> in party import import wizard page, should not be multiple primary buttons, also there are multiple coulours, the prgress stages also doesn't match with frappe styles (espresso and frappe-ui)

> 2 line separators [with image]
employee_list = frappe.get_all("Employee", fields=["employee_name"])
qualification_entry_list = frappe.get_all("Qualification Entry", fields=["employee_name", "qualification_name", "level"], as_dict=1)
qualification_dict = {}
for d in qualification_entry_list:
qualification_dict.setdefault(d.employee_name, {}).setdefault(d.qualification_name, d.level)
frappe.ui.form.on("Journal Entry Account", "reference_no", function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
if(row.reference_type == "Purchase Invoice" && row.reference_no) {
me.frm.call({
method: "frappe.client.get_value",
args: {
doctype: "Purchase Invoice",
fieldname: "bill_no",
filters: { name: row.reference_no },
},
frappe.ui.form.on("Salary Structure Earning", "modified_value", function(frm, cdt, cdn) {
console.log(frm.doc.doctype);
console.log("we are here");
var c = frm.add_child('deductions');
c.d_type = 'Employee CPF';
c.modified_value = 20;
refresh_field("deductions");
// frm.layout.refresh_sections();
});
@nabinhait
nabinhait / is_chart_of_accounts.json
Created January 19, 2015 07:13
Iceland Chart of Accounts
{
"country_code": "is",
"name": "Íslenskur bókhaldslykill fyrir ERPNext - útgáfa 1",
"is_active": "Yes",
"tree": {
"Eignir": {
"Veltufjármunir": {
"Viðskiptakröfur": {
"Viðskiptamenn": {
"account_type": "Receivable"
from __future__ import unicode_literals
import frappe
from frappe import _
from frappe.model.document import Document
from frappe.utils import nowdate
class LibraryTransaction(Document):
def validate(self):
last_transaction = frappe.get_list("Library Transaction",
fields=["transaction_type", "transaction_date"],
frappe.ui.form.on("Quotation Item", "disc", function(frm, cdt, cdn) {
var row = locals[cdt][cdn];
if(row.disc) {
// var final_discount = get_final_discount(row.disc);
frappe.model.set_value(cdt, cdn, "discount_percentage", 49);
}
})
//
// get_final_discount = function(disc) {
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe import msgprint, _
def execute(filters=None):
if not filters: filters = {}
@nabinhait
nabinhait / 2013_07.css
Last active December 20, 2015 12:19
ERPNext Open Day - July 2013
/*
html5doctor.com Reset Stylesheet
v1.6.1
Last Updated: 2010-09-17
Author: Richard Clark - http://richclarkdesign.com
Twitter: @rich_clark
*/
html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,