- Choose clean code over clever code.
- Write object oriented code as much as possible.
- Keep function sizes small, ideally 10 lines.
- Try and keep files between 100 and 300 lines.
- Don't keep too many files in a folder or module. Try and keep it under 15.
- Avoid abbreviations.
- Use standard API as much as possible.
- Reuse. Write as little code as possible.
- Use Frappe UI, espresso for UI styling.
> 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]
This file contains hidden or 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
| 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) |
This file contains hidden or 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
| 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 }, | |
| }, |
This file contains hidden or 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
| 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(); | |
| }); |
This file contains hidden or 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
| { | |
| "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" |
This file contains hidden or 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 __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"], |
This file contains hidden or 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
| 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) { |
This file contains hidden or 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
| # 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 = {} |
This file contains hidden or 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
| /* | |
| 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, |
NewerOlder