renaming portal supplier to supplier

This commit is contained in:
jeowsome 2024-10-05 02:34:11 +08:00
parent 79f305b481
commit 3caa14fc45
13 changed files with 26 additions and 14 deletions

View file

@ -571,7 +571,7 @@ const saveInvoice = () => {
})
}
const portalSuppliers = createListResource({
doctype: 'Portal Supplier',
doctype: 'Supplier',
fields: ['name as value', 'company_name as label'],
orderBy: 'creation desc',
})

View file

@ -245,5 +245,11 @@ app_license = "mit"
website_route_rules = [
{"from_route": "/erpnext", "to_route": "/login"},
{"from_route": "/frontend/<path:app_path>", "to_route": "frontend"},
{"from_route": "/frontend/<path:app_path>", "to_route": "/frontend"},
{"from_route": "/supplier-portal/frontend", "to_route": "/frontend"},
]
website_redirects = [
{"source": "/supplier-portal/frontend", "target": "/frontend"},
]

View file

@ -3,9 +3,9 @@ import frappe
@frappe.whitelist(allow_guest=True)
def validate_supplier_id(supplier_id: str) -> dict:
if frappe.db.exists("Portal Supplier", {"name": supplier_id}):
if frappe.db.exists("Supplier", {"name": supplier_id}):
user = frappe.get_doc("User", f"{supplier_id}@supplier-portal.com")
portal_supplier = frappe.get_doc("Portal Supplier", supplier_id)
portal_supplier = frappe.get_doc("Supplier", supplier_id)
# login user
frappe.local.login_manager.user = user.name
frappe.local.login_manager.post_login()

View file

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

View file

@ -62,7 +62,7 @@
"modified": "2024-09-28 02:13:04.095973",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Portal Supplier",
"name": "Supplier",
"owner": "Administrator",
"permissions": [
{

View file

@ -7,12 +7,12 @@ import frappe
from frappe.model.document import Document
class PortalSupplier(Document):
class Supplier(Document):
def generate_supplier_id(self, length: int = 8) -> str:
# generate unique supplier integer id based on length
supplier_id = random.randint(10 ** (length - 1), 10**length - 1)
while frappe.db.exists("Portal Supplier", {"supplier_id": supplier_id}):
while frappe.db.exists("Supplier", {"supplier_id": supplier_id}):
supplier_id = random.randint(10 ** (length - 1), 10**length - 1)
return str(supplier_id)

View file

@ -5,5 +5,5 @@
from frappe.tests.utils import FrappeTestCase
class TestPortalSupplier(FrappeTestCase):
class TestSupplier(FrappeTestCase):
pass

View file

@ -36,7 +36,7 @@
"fieldname": "supplier",
"fieldtype": "Link",
"label": "Supplier ID",
"options": "Portal Supplier"
"options": "Supplier"
},
{
"fieldname": "supplier_invoice_number",
@ -168,7 +168,7 @@
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2024-10-02 16:26:51.407319",
"modified": "2024-10-05 02:26:32.725807",
"modified_by": "Administrator",
"module": "Suppliers Portal",
"name": "Supplier Portal Invoices",

View file

@ -1,7 +1,7 @@
{
"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\":\"Portal Supplier\",\"col\":4}},{\"id\":\"_vl927eRbo\",\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Supplier Portal Invoices\",\"col\":4}}]",
"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\":\"Supplier Portal Invoices\",\"col\":4}}]",
"creation": "2024-10-02 17:23:06.804441",
"custom_blocks": [],
"docstatus": 0,
@ -29,8 +29,8 @@
{
"color": "Grey",
"doc_view": "List",
"label": "Portal Supplier",
"link_to": "Portal Supplier",
"label": "Supplier",
"link_to": "Supplier",
"stats_filter": "[]",
"type": "DocType"
},

View file

@ -0,0 +1,6 @@
def before_request(request, method, url, headers):
print("Before Request")
print(request)
print(method)
print(url)
print(headers)