Supplier Dashboard: "Submit" Button Not Appearing with Dynamic Web Page

ello everyone,

I’m trying to create a dynamic supplier dashboard in a custom Frappe app. I’ve followed the standard documentation, but I’m facing a persistent issue where a specific button is not rendering on the page.

Here’s my setup:

  1. Custom DocType: I have a Supplier Product Proposal DocType.
  2. Web Form: I have a Web Form for submitting new proposals, with Login required checked.
  3. User & Roles: I have assigned the Supplier role to the Administrator user. I have also linked this Administrator user to a specific Supplier DocType via the Portal Users child table.
  4. Web Page & Controller: I created a Web Page with the route /supplier-dashboard. It’s intended to be a dynamic page that shows a list of the supplier’s proposals and a button to submit a new one.

The Problem:

The dashboard page loads correctly with the user’s name and the table headers, but the “Ajukan Produk Baru” button is not visible.

I have identified that the button is controlled by this Jinja condition: {% if add_proposal_link %}. This variable should be set to True by my Python controller.

My Code (supplier_dashboard.py):

I have a Python controller in apps/marketplace_app/marketplace_app/www/supplier_dashboard.py with this get_context function:

def get_context(context):
    if frappe.session.user == "Guest":
        frappe.redirect_to("/login")
        return

    supplier_link = frappe.get_all("Supplier Portal User", filters={
        "user": frappe.session.user
    }, fields=["parent"])

    if not supplier_link:
        context.proposals = []
        context.add_proposal_link = False
        return
    
    supplier_name = supplier_link[0].parent

    proposals = frappe.get_all("Supplier Product Proposal", filters={
        "supplier": supplier_name
    }, fields=["name", "product_name", "supplier_price", "status"])

    context.proposals = proposals
    context.add_proposal_link = True`

What I’ve Tried:

  • I’ve confirmed that the Python controller’s logic correctly finds the Supplier name when I run the query manually.
  • I’ve moved the Jinja template code from the Web Page’s Main Section to a separate supplier_dashboard.html file in the www folder.
  • I have tried using both the Controller field and the Dynamic Template checkbox with the path www/supplier_dashboard.html. However, the Controller field seems to be missing from my Web Page document.
  • When I use Dynamic Template, the page shows the literal path www/supplier_dashboard.html as plain text.
  • I have run bench clear-cache and bench restart multiple times.
  • My files are correctly placed in apps/marketplace_app/marketplace_app/www/.

It seems the Web Page document is not correctly running my Python script or rendering the template. Any help would be greatly appreciated. Thank you!