fix: remove custom invoice doctypes

This commit is contained in:
Rohan Bansal 2025-04-28 16:59:03 +05:30
parent 92414e92f8
commit c1fabbad1b
22 changed files with 0 additions and 729 deletions

View file

@ -1,42 +0,0 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-10-09 16:28:25.879209",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": ["payment_reference_number", "payment_reference_date", "column_break_nukw", "paid_amount"],
"fields": [
{
"fieldname": "payment_reference_number",
"fieldtype": "Data",
"label": "Reference Number"
},
{
"fieldname": "payment_reference_date",
"fieldtype": "Date",
"label": "Payment Date"
},
{
"fieldname": "column_break_nukw",
"fieldtype": "Column Break"
},
{
"fieldname": "paid_amount",
"fieldtype": "Currency",
"label": "Amount"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-10-12 07:16:26.416034",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Invoice Payment References",
"owner": "Administrator",
"permissions": [],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}

View file

@ -1,9 +0,0 @@
# Copyright (c) 2024, jeowsome15@gmail.com and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class InvoicePaymentReferences(Document):
pass

View file

@ -1,8 +0,0 @@
// Copyright (c) 2024, jeowsome15@gmail.com and contributors
// For license information, please see license.txt
// frappe.ui.form.on("Invoices", {
// refresh(frm) {
// },
// });

View file

@ -1,216 +0,0 @@
{
"actions": [],
"allow_rename": 1,
"autoname": "field:supplier_invoice_number",
"creation": "2024-09-24 02:44:02.596278",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"supplier_invoice_number",
"supplier",
"supplier_name",
"column_break_yjtl",
"service_date",
"invoice_date",
"invoice_terms",
"due_date",
"status",
"section_break_swkm",
"supplier_invoice_items",
"section_break_slsq",
"payment_references",
"section_break_ajbe",
"paid_amount",
"amount_due",
"total_amount",
"column_break_quxe",
"section_break_olmx",
"service_address",
"site_code",
"street",
"city",
"state",
"zip_code",
"column_break_hvmc",
"notes"
],
"fields": [
{
"fieldname": "supplier",
"fieldtype": "Link",
"label": "Supplier",
"options": "Supplier"
},
{
"fieldname": "supplier_invoice_number",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Supplier Invoice Number",
"reqd": 1,
"unique": 1
},
{
"default": "Due On Receipt",
"fieldname": "invoice_terms",
"fieldtype": "Select",
"in_list_view": 1,
"label": "Invoice Terms",
"options": "NET 10\nNET 15\nNET 30\nNET 45\nNET 60\nDue On Receipt",
"reqd": 1
},
{
"fieldname": "column_break_yjtl",
"fieldtype": "Column Break"
},
{
"fieldname": "section_break_swkm",
"fieldtype": "Section Break"
},
{
"fieldname": "supplier_invoice_items",
"fieldtype": "Table",
"label": "Invoice Items",
"options": "Supplier Invoice Items"
},
{
"default": "Unpaid",
"fieldname": "status",
"fieldtype": "Select",
"hidden": 1,
"label": "Status",
"options": "Paid\nUnpaid\nOverdue\nPartially Paid\nPartially Paid and Overdue"
},
{
"fieldname": "service_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Service Date",
"reqd": 1
},
{
"fieldname": "section_break_olmx",
"fieldtype": "Section Break"
},
{
"fieldname": "notes",
"fieldtype": "Small Text",
"label": "Notes"
},
{
"fetch_from": "supplier.company_name",
"fieldname": "supplier_name",
"fieldtype": "Data",
"hidden": 1,
"label": "Supplier Name",
"read_only": 1
},
{
"fieldname": "service_address",
"fieldtype": "Small Text",
"hidden": 1,
"label": "Service Address"
},
{
"fieldname": "section_break_ajbe",
"fieldtype": "Section Break"
},
{
"fieldname": "total_amount",
"fieldtype": "Currency",
"label": "Total Amount",
"read_only": 1
},
{
"fieldname": "column_break_quxe",
"fieldtype": "Column Break"
},
{
"fieldname": "street",
"fieldtype": "Data",
"label": "Street"
},
{
"fieldname": "city",
"fieldtype": "Data",
"label": "City"
},
{
"fieldname": "state",
"fieldtype": "Data",
"label": "State"
},
{
"fieldname": "zip_code",
"fieldtype": "Data",
"label": "Zip Code"
},
{
"fieldname": "column_break_hvmc",
"fieldtype": "Column Break"
},
{
"fieldname": "invoice_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Invoice Date",
"reqd": 1
},
{
"fieldname": "due_date",
"fieldtype": "Date",
"label": "Due Date"
},
{
"fieldname": "site_code",
"fieldtype": "Data",
"label": "Site Code"
},
{
"fieldname": "section_break_slsq",
"fieldtype": "Section Break"
},
{
"fieldname": "payment_references",
"fieldtype": "Table",
"label": "Payment References",
"options": "Invoice Payment References"
},
{
"fieldname": "paid_amount",
"fieldtype": "Currency",
"label": "Paid Amount",
"read_only": 1
},
{
"fieldname": "amount_due",
"fieldtype": "Currency",
"label": "Amount Due",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-10-12 08:12:37.273898",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Invoices",
"naming_rule": "By fieldname",
"owner": "Administrator",
"permissions": [
{
"create": 1,
"delete": 1,
"email": 1,
"export": 1,
"print": 1,
"read": 1,
"report": 1,
"role": "System Manager",
"share": 1,
"write": 1
}
],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}

View file

@ -1,90 +0,0 @@
# Copyright (c) 2024, jeowsome15@gmail.com and contributors
# For license information, please see license.txt
import frappe
from frappe.model.document import Document
from frappe.utils import add_days, flt, getdate, nowdate
class Invoices(Document):
def validate(self):
self.set_due_date()
self.set_total_amount()
self.set_total_paid()
self.update_amount_due()
self.update_status()
def on_update(self):
self.update_suppliers_invoice()
def set_total_amount(self):
if self.get("supplier_invoice_items"):
total_amount = 0
for item in self.get("supplier_invoice_items"):
item.amount = flt(item.rate) * flt(item.quantity)
total_amount += item.amount
self.db_set("total_amount", total_amount)
def set_due_date(self):
if self.invoice_terms:
if self.invoice_terms == "NET 10":
self.due_date = add_days(self.invoice_date, 10)
elif self.invoice_terms == "NET 15":
self.due_date = add_days(self.invoice_date, 15)
elif self.invoice_terms == "NET 30":
self.due_date = add_days(self.invoice_date, 30)
elif self.invoice_terms == "NET 45":
self.due_date = add_days(self.invoice_date, 45)
elif self.invoice_terms == "NET 60":
self.due_date = add_days(self.invoice_date, 60)
def set_total_paid(self):
total_paid = 0
for item in self.payment_references:
total_paid += item.paid_amount
self.db_set("paid_amount", total_paid)
def update_status(self):
if self.paid_amount == 0:
self.status = "Unpaid"
elif self.paid_amount < self.total_amount and self.paid_amount > 0:
self.status = "Partially Paid"
elif self.paid_amount == self.total_amount:
self.status = "Paid"
if getdate(nowdate()) > getdate(self.due_date):
if self.paid_amount == 0:
self.status = "Overdue"
elif self.paid_amount < self.total_amount:
self.status = "Partially Paid and Overdue"
self.db_set("status", self.status, update_modified=False, commit=True)
def update_amount_due(self):
self.db_set(
"amount_due",
flt(self.total_amount) - flt(self.paid_amount),
update_modified=False,
commit=True,
)
def update_suppliers_invoice(self):
supplier = frappe.get_doc("Supplier", self.supplier)
# check if invoice already exists
for invoice in supplier.invoices:
if invoice.invoice_number == self.name:
if invoice.total_due != self.total_amount:
invoice.total_amount = self.total_amount
if invoice.invoice_date != self.invoice_date:
invoice.invoice_date = self.invoice_date
if invoice.status != self.status:
invoice.status = self.status
supplier.save()
return
supplier.append(
"invoices",
{"invoice_number": self.name},
)
supplier.save()

View file

@ -1,5 +0,0 @@
frappe.listview_settings['Invoices'] = {
before_render() {
$('button[data-label="Add Invoices"]>span>span').html('Add Invoice')
},
}

View file

@ -1,9 +0,0 @@
# Copyright (c) 2024, jeowsome15@gmail.com and Contributors
# See license.txt
# import frappe
from frappe.tests.utils import FrappeTestCase
class TestInvoices(FrappeTestCase):
pass

View file

@ -1,50 +0,0 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-09-24 02:47:44.354811",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": ["service_type", "column_break_ocxt", "quantity", "rate", "amount"],
"fields": [
{
"fieldname": "service_type",
"fieldtype": "Select",
"label": "Service Type",
"options": "Repair\nPreventive Maintence"
},
{
"fieldname": "column_break_ocxt",
"fieldtype": "Column Break"
},
{
"default": "1",
"fieldname": "quantity",
"fieldtype": "Float",
"label": "Quantity"
},
{
"fieldname": "rate",
"fieldtype": "Currency",
"label": "Rate"
},
{
"fieldname": "amount",
"fieldtype": "Currency",
"label": "Amount",
"read_only": 1
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-09-28 00:59:33.037008",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Supplier Invoice Items",
"owner": "Administrator",
"permissions": [],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}

View file

@ -1,9 +0,0 @@
# Copyright (c) 2024, jeowsome15@gmail.com and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class SupplierInvoiceItems(Document):
pass

View file

@ -1,62 +0,0 @@
{
"actions": [],
"allow_rename": 1,
"creation": "2024-10-09 16:59:58.079331",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": ["invoice_number", "status", "column_break_mprs", "invoice_date", "terms", "total_due"],
"fields": [
{
"fieldname": "invoice_number",
"fieldtype": "Link",
"label": "Invoice Number",
"options": "Invoices",
"read_only": 1
},
{
"fetch_from": "invoice_number.invoice_date",
"fieldname": "invoice_date",
"fieldtype": "Date",
"label": "Invoice Date",
"read_only": 1
},
{
"fetch_from": "invoice_number.invoice_terms",
"fieldname": "terms",
"fieldtype": "Data",
"label": "Term",
"read_only": 1
},
{
"fetch_from": "invoice_number.total_amount",
"fieldname": "total_due",
"fieldtype": "Currency",
"label": "Total Due",
"read_only": 1
},
{
"fetch_from": "invoice_number.status",
"fieldname": "status",
"fieldtype": "Data",
"label": "Status",
"read_only": 1
},
{
"fieldname": "column_break_mprs",
"fieldtype": "Column Break"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-10-09 17:33:59.785852",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Supplier Invoices",
"owner": "Administrator",
"permissions": [],
"sort_field": "creation",
"sort_order": "DESC",
"states": []
}

View file

@ -1,9 +0,0 @@
# Copyright (c) 2024, jeowsome15@gmail.com and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class SupplierInvoices(Document):
pass

View file

@ -1,30 +0,0 @@
frappe.query_reports['Supplier Invoices'] = {
filters: [
{
fieldname: 'invoice_date_from',
label: __('Invoice Date From'),
fieldtype: 'Date',
default: frappe.datetime.add_months(frappe.datetime.get_today(), -1), // Default to last month
placeholder: __('Invoice Date From'),
},
{
fieldname: 'invoice_date_to',
label: __('Invoice Date To'),
fieldtype: 'Date',
default: frappe.datetime.get_today(), // Default to today
},
{
fieldname: 'supplier',
label: __('Supplier'),
fieldtype: 'Link',
options: 'Supplier',
},
{
fieldname: 'status',
label: __('Status'),
fieldtype: 'Select',
options: 'All\nPaid\nUnpaid\nOverdue',
default: 'All',
},
],
}

View file

@ -1,30 +0,0 @@
{
"add_total_row": 1,
"columns": [],
"creation": "2024-10-09 15:22:34.256149",
"disabled": 1,
"docstatus": 0,
"doctype": "Report",
"filters": [],
"idx": 0,
"is_standard": "Yes",
"letterhead": null,
"modified": "2024-10-09 17:03:58.993246",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Supplier Invoices",
"owner": "Administrator",
"prepared_report": 0,
"ref_doctype": "Invoices",
"report_name": "Supplier Invoices",
"report_type": "Script Report",
"roles": [
{
"role": "System Manager"
},
{
"role": "Portal Supplier"
}
],
"timeout": 0
}

View file

@ -1,49 +0,0 @@
import frappe
def execute(filters=None):
columns = [
{
"fieldname": "invoice_number",
"label": "Invoice Number",
"fieldtype": "Link",
"options": "Invoices",
},
{
"fieldname": "supplier_name",
"label": "Supplier Name",
"fieldtype": "Data",
"width": 200,
},
{"fieldname": "status", "label": "Status", "fieldtype": "Data", "width": 100},
{"fieldname": "invoice_date", "label": "Invoice Date", "fieldtype": "Date"},
{"fieldname": "due_date", "label": "Due Date", "fieldtype": "Date"},
{"fieldname": "total_amount", "label": "Total Amount", "fieldtype": "Currency"},
]
conditions = ""
if filters.get("invoice_date_from"):
conditions += " AND invoice_date >= %(invoice_date_from)s"
if filters.get("invoice_date_to"):
conditions += " AND invoice_date <= %(invoice_date_to)s"
if filters.get("supplier"):
conditions += " AND supplier = %(supplier)s"
if filters.get("status"):
if not filters.get("status") == "All":
conditions += " AND status = %(status)s"
query = f"""
SELECT
name as invoice_number,
supplier_name,
status,
invoice_date,
due_date,
total_amount
FROM
`tabInvoices`
WHERE
docstatus = 0 {conditions}
"""
data = frappe.db.sql(query, filters, as_dict=True)
return columns, data

View file

@ -1,63 +0,0 @@
{
"app": "supplier_portal",
"charts": [],
"content": "[{\"id\":\"AyiOTTupgl\",\"type\":\"paragraph\",\"data\":{\"text\":\"Documents\",\"col\":12}},{\"id\":\"64VHemT3p8\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Suppliers\",\"col\":4}},{\"id\":\"_vl927eRbo\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Invoices\",\"col\":4}},{\"id\":\"j428xL5Lje\",\"type\":\"paragraph\",\"data\":{\"text\":\"Reports\",\"col\":12}},{\"id\":\"CDzGMPClRq\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier Invoices Report\",\"col\":4}}]",
"creation": "2024-10-02 17:23:06.804441",
"custom_blocks": [],
"docstatus": 0,
"doctype": "Workspace",
"for_user": "",
"hide_custom": 0,
"icon": "clipboard",
"idx": 0,
"indicator_color": "green",
"is_hidden": 0,
"label": "Supplier Portal",
"links": [],
"modified": "2024-10-12 07:25:56.798875",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Supplier Portal",
"number_cards": [],
"owner": "Administrator",
"parent_page": "",
"public": 1,
"quick_lists": [],
"restrict_to_domain": "",
"roles": [
{
"role": "Portal Supplier"
},
{
"role": "Portal User"
}
],
"sequence_id": 2.0,
"shortcuts": [
{
"color": "Grey",
"doc_view": "List",
"label": "Supplier Invoices Report",
"link_to": "Supplier Invoices",
"type": "Report"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Suppliers",
"link_to": "Supplier",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Invoices",
"link_to": "Invoices",
"stats_filter": "[]",
"type": "DocType"
}
],
"title": "Supplier Portal",
"type": "Workspace"
}

View file

@ -1,48 +0,0 @@
{
"app": "Suppliers Portal",
"charts": [],
"content": "[{\"id\":\"Lix3qbsE_H\",\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\">Suppliers Portal</span>\",\"col\":12}},{\"id\":\"OdX-YH0tro\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier\",\"col\":4}},{\"id\":\"_vl927eRbo\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Invoices\",\"col\":4}}]",
"creation": "2024-10-02 17:23:06.804441",
"custom_blocks": [],
"docstatus": 0,
"doctype": "Workspace",
"for_user": "",
"hide_custom": 0,
"icon": "clipboard",
"idx": 0,
"indicator_color": "green",
"is_hidden": 0,
"label": "Suppliers Portal",
"links": [],
"modified": "2024-10-03 03:19:57.683322",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Suppliers Portal",
"number_cards": [],
"owner": "Administrator",
"parent_page": "",
"public": 1,
"quick_lists": [],
"roles": [],
"sequence_id": 23.0,
"shortcuts": [
{
"color": "Grey",
"doc_view": "List",
"label": "Supplier",
"link_to": "Supplier",
"stats_filter": "[]",
"type": "DocType"
},
{
"color": "Grey",
"doc_view": "List",
"label": "Invoices",
"link_to": "Invoices",
"stats_filter": "[]",
"type": "DocType"
}
],
"title": "Suppliers Portal",
"type": "Workspace"
}