Skip to content

Commit

Permalink
Creating childtable doctype CostType for collecting all the costs-typ…
Browse files Browse the repository at this point in the history
…e & it's server-side & client-side for calculating the fields (total cost / tax value / grand total with tax)
  • Loading branch information
Andro0o0o0w-Romany committed Jul 23, 2024
1 parent f91dd21 commit d5462fc
Show file tree
Hide file tree
Showing 8 changed files with 177 additions and 0 deletions.
Empty file.
86 changes: 86 additions & 0 deletions contracta/contracta/doctype/costtype/costtype.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-07-23 13:16:39.795083",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"document_type",
"select",
"uom",
"qty",
"unit_cost",
"column_break_gwui",
"total_cost",
"tax",
"tax_value",
"grand_total_with_tax"
],
"fields": [
{
"fieldname": "document_type",
"fieldtype": "Link",
"label": "Doctype",
"options": "DocType"
},
{
"fieldname": "select",
"fieldtype": "Dynamic Link",
"label": "Costing Type",
"options": "document_type"
},
{
"fieldname": "uom",
"fieldtype": "Link",
"label": "UOM",
"options": "UOM"
},
{
"fieldname": "qty",
"fieldtype": "Int",
"label": "Qty"
},
{
"fieldname": "unit_cost",
"fieldtype": "Int",
"label": "Unit Cost"
},
{
"fieldname": "column_break_gwui",
"fieldtype": "Column Break"
},
{
"fieldname": "total_cost",
"fieldtype": "Int",
"label": "Total Cost"
},
{
"fieldname": "tax",
"fieldtype": "Percent",
"label": "Tax"
},
{
"fieldname": "tax_value",
"fieldtype": "Int",
"label": "Tax Value"
},
{
"fieldname": "grand_total_with_tax",
"fieldtype": "Int",
"label": "Grand Total With Tax"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-07-23 13:42:06.695525",
"modified_by": "Administrator",
"module": "Contracta",
"name": "CostType",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
12 changes: 12 additions & 0 deletions contracta/contracta/doctype/costtype/costtype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Copyright (c) 2024, Andrew Romany and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class CostType(Document):
def validate(self):
self.total_cost = self.qty * self.unit_cost
self.tax_value = self.tax * self.total_cost
self.grand_total_with_tax = self.total_cost + self.tax_value
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// Copyright (c) 2024, Andrew Romany and contributors
// For license information, please see license.txt

// frappe.ui.form.on("Custom Quotation", {
// refresh(frm) {

// },
// });
53 changes: 53 additions & 0 deletions contracta/contracta/doctype/custom_quotation/custom_quotation.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-07-21 17:38:36.277478",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"section_break_oj0t",
"amended_from"
],
"fields": [
{
"fieldname": "section_break_oj0t",
"fieldtype": "Section Break"
},
{
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
"no_copy": 1,
"options": "Custom Quotation",
"print_hide": 1,
"read_only": 1,
"search_index": 1
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-07-21 17:38:36.277478",
"modified_by": "Administrator",
"module": "Contracta",
"name": "Custom Quotation",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"submit": 1,
"write": 1
}
],
"sort_field": "modified",
"sort_order": "DESC",
"states": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Andrew Romany and contributors
# For license information, please see license.txt

# import frappe
from frappe.model.document import Document


class CustomQuotation(Document):
pass
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Copyright (c) 2024, Andrew Romany and Contributors
# See license.txt

# import frappe
from frappe.tests.utils import FrappeTestCase


class TestCustomQuotation(FrappeTestCase):
pass

0 comments on commit d5462fc

Please sign in to comment.