Compare commits
12 Commits
clean-inst
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| c81beb5290 | |||
| e6033a1757 | |||
| afcd9a3488 | |||
| 7b40c86b40 | |||
| 3ae0051e55 | |||
| 91783757e4 | |||
| 991038bc47 | |||
| 21173e34c6 | |||
| 21a256a26f | |||
| 9a7e3fe740 | |||
| 678eb18583 | |||
|
|
cacbc764c1 |
BIN
Screenshot from 2026-02-04 12-41-31.png
Normal file
BIN
Screenshot from 2026-02-04 12-41-31.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 496 KiB |
@ -132,7 +132,7 @@ def submit_bid_meeting_note_form(bid_meeting, project_template, fields, form_tem
|
||||
})
|
||||
new_bid_meeting_note_doc.insert(ignore_permissions=True)
|
||||
for field_row, field in zip(new_bid_meeting_note_doc.fields, fields):
|
||||
print(f"DEBUG: {field_row.label} - {field.get("label")}")
|
||||
print(f"DEBUG: {field_row.label} - {field.get('label')}")
|
||||
if not isinstance(field.get("value"), list):
|
||||
continue
|
||||
for item in field["value"]:
|
||||
|
||||
@ -2,9 +2,9 @@ import frappe, json
|
||||
from frappe.utils.pdf import get_pdf
|
||||
from custom_ui.api.db.general import get_doc_history
|
||||
from custom_ui.db_utils import DbUtils, process_query_conditions, build_datatable_dict, get_count_or_filters, build_success_response, build_error_response
|
||||
from werkzeug.wrappers import Response
|
||||
from custom_ui.api.db.clients import check_if_customer, convert_lead_to_customer
|
||||
from custom_ui.services import DbService, ClientService, AddressService, ContactService
|
||||
from custom_ui.services import DbService, ClientService, AddressService, ContactService, EstimateService, ItemService
|
||||
from frappe.email.doctype.email_template.email_template import get_email_template
|
||||
|
||||
# ===============================================================================
|
||||
# ESTIMATES & INVOICES API METHODS
|
||||
@ -86,11 +86,25 @@ def get_estimate_table_data(filters={}, sortings=[], page=1, page_size=10):
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_quotation_items():
|
||||
def get_quotation_items(project_template:str = None):
|
||||
"""Get all available quotation items."""
|
||||
try:
|
||||
items = frappe.get_all("Item", fields=["*"], filters={"item_group": "SNW-S"})
|
||||
return build_success_response(items)
|
||||
filters = EstimateService.map_project_template_to_filter(project_template)
|
||||
items = frappe.get_all("Item", fields=["item_code", "item_group"], filters=filters)
|
||||
grouped_item_dicts = {}
|
||||
for item in items:
|
||||
item_dict = ItemService.get_full_dict(item.item_code)
|
||||
if item_dict["bom"]:
|
||||
if "Packages" not in grouped_item_dicts:
|
||||
grouped_item_dicts["Packages"] = {}
|
||||
if item.item_group not in grouped_item_dicts["Packages"]:
|
||||
grouped_item_dicts["Packages"][item.item_group] = []
|
||||
grouped_item_dicts["Packages"][item.item_group].append(item_dict)
|
||||
else:
|
||||
if item.item_group not in grouped_item_dicts:
|
||||
grouped_item_dicts[item.item_group] = []
|
||||
grouped_item_dicts[item.item_group].append(item_dict)
|
||||
return build_success_response(grouped_item_dicts)
|
||||
except Exception as e:
|
||||
return build_error_response(str(e), 500)
|
||||
|
||||
@ -177,7 +191,7 @@ def send_estimate_email(estimate_name):
|
||||
print("DEBUG: Sending estimate email for:", estimate_name)
|
||||
quotation = frappe.get_doc("Quotation", estimate_name)
|
||||
|
||||
|
||||
# Get recipient email
|
||||
if not DbService.exists("Contact", quotation.contact_person):
|
||||
return build_error_response("No email found for the customer.", 400)
|
||||
party = ContactService.get_or_throw(quotation.contact_person)
|
||||
@ -196,21 +210,71 @@ def send_estimate_email(estimate_name):
|
||||
if not email:
|
||||
return build_error_response("No email found for the customer or address.", 400)
|
||||
|
||||
# email = "casey@shilohcode.com"
|
||||
template_name = "Quote with Actions - SNW"
|
||||
template = frappe.get_doc("Email Template", template_name)
|
||||
message = frappe.render_template(template.response, {"name": quotation.name})
|
||||
subject = frappe.render_template(template.subject, {"doc": quotation})
|
||||
print("DEBUG: Message: ", message)
|
||||
print("DEBUG: Subject: ", subject)
|
||||
# Get customer name
|
||||
customer_name = party.first_name or party.name or "Valued Customer"
|
||||
if party.last_name:
|
||||
customer_name = f"{party.first_name} {party.last_name}"
|
||||
|
||||
# Get full address
|
||||
full_address = "Address not specified"
|
||||
if quotation.custom_job_address:
|
||||
address_doc = frappe.get_doc("Address", quotation.custom_job_address)
|
||||
full_address = address_doc.full_address or address_doc.address_line1 or "Address not specified"
|
||||
|
||||
# Format price
|
||||
price = frappe.utils.fmt_money(quotation.grand_total, currency=quotation.currency)
|
||||
|
||||
# Get additional notes
|
||||
additional = quotation.terms or ""
|
||||
|
||||
# Get company phone
|
||||
company_phone = ""
|
||||
if quotation.company:
|
||||
company_doc = frappe.get_doc("Company", quotation.company)
|
||||
company_phone = getattr(company_doc, 'phone_no', '') or getattr(company_doc, 'phone', '')
|
||||
|
||||
# Get base URL
|
||||
base_url = frappe.utils.get_url()
|
||||
|
||||
# Get letterhead image
|
||||
letterhead_image = ""
|
||||
if quotation.letter_head:
|
||||
letterhead_doc = frappe.get_doc("Letter Head", quotation.letter_head)
|
||||
if letterhead_doc.image:
|
||||
letterhead_image = frappe.utils.get_url() + letterhead_doc.image
|
||||
|
||||
# Prepare template context
|
||||
template_context = {
|
||||
"company": quotation.company,
|
||||
"customer_name": customer_name,
|
||||
"price": price,
|
||||
"address": full_address,
|
||||
"additional": additional,
|
||||
"company_phone": company_phone,
|
||||
"base_url": base_url,
|
||||
"estimate_name": quotation.name,
|
||||
"letterhead_image": letterhead_image
|
||||
}
|
||||
|
||||
# Render the email template
|
||||
template_path = "custom_ui/templates/emails/general_estimation.html"
|
||||
message = frappe.render_template(template_path, template_context)
|
||||
subject = f"Estimate from {quotation.company} - {quotation.name}"
|
||||
|
||||
print("DEBUG: Subject:", subject)
|
||||
print("DEBUG: Sending email to:", email)
|
||||
|
||||
# Generate PDF attachment
|
||||
html = frappe.get_print("Quotation", quotation.name, print_format="Quotation - SNW - Standard", letterhead=True)
|
||||
print("DEBUG: Generated HTML for PDF.")
|
||||
pdf = get_pdf(html)
|
||||
print("DEBUG: Generated PDF for email attachment.")
|
||||
|
||||
# Send email
|
||||
frappe.sendmail(
|
||||
recipients=email,
|
||||
subject=subject,
|
||||
content=message,
|
||||
message=message,
|
||||
doctype="Quotation",
|
||||
name=quotation.name,
|
||||
read_receipt=1,
|
||||
@ -218,11 +282,14 @@ def send_estimate_email(estimate_name):
|
||||
attachments=[{"fname": f"{quotation.name}.pdf", "fcontent": pdf}]
|
||||
)
|
||||
print(f"DEBUG: Email sent to {email} successfully.")
|
||||
|
||||
# Update quotation status
|
||||
quotation.custom_current_status = "Submitted"
|
||||
quotation.custom_sent = 1
|
||||
quotation.save()
|
||||
quotation.submit()
|
||||
frappe.db.commit()
|
||||
|
||||
updated_quotation = frappe.get_doc("Quotation", estimate_name)
|
||||
return build_success_response(updated_quotation.as_dict())
|
||||
except Exception as e:
|
||||
@ -255,45 +322,6 @@ def manual_response(name, response):
|
||||
return build_error_response(str(e), 500)
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def update_response(name, response):
|
||||
"""Update the response for a given estimate."""
|
||||
print("DEBUG: RESPONSE RECEIVED:", name, response)
|
||||
try:
|
||||
if not frappe.db.exists("Quotation", name):
|
||||
raise Exception("Estimate not found.")
|
||||
estimate = frappe.get_doc("Quotation", name)
|
||||
if estimate.docstatus != 1:
|
||||
raise Exception("Estimate must be submitted to update response.")
|
||||
accepted = True if response == "Accepted" else False
|
||||
new_status = "Estimate Accepted" if accepted else "Lost"
|
||||
|
||||
estimate.custom_response = response
|
||||
estimate.custom_current_status = new_status
|
||||
estimate.custom_followup_needed = 1 if response == "Requested call" else 0
|
||||
# estimate.status = "Ordered" if accepted else "Closed"
|
||||
estimate.flags.ignore_permissions = True
|
||||
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
|
||||
estimate.save()
|
||||
|
||||
if accepted:
|
||||
template = "custom_ui/templates/estimates/accepted.html"
|
||||
# if check_if_customer(estimate.party_name):
|
||||
# print("DEBUG: Party is already a customer:", estimate.party_name)
|
||||
# else:
|
||||
# print("DEBUG: Converting lead to customer for party:", estimate.party_name)
|
||||
# convert_lead_to_customer(estimate.party_name)
|
||||
elif response == "Requested call":
|
||||
template = "custom_ui/templates/estimates/request-call.html"
|
||||
else:
|
||||
template = "custom_ui/templates/estimates/rejected.html"
|
||||
html = frappe.render_template(template, {"doc": estimate})
|
||||
return Response(html, mimetype="text/html")
|
||||
except Exception as e:
|
||||
template = "custom_ui/templates/estimates/error.html"
|
||||
html = frappe.render_template(template, {"error": str(e)})
|
||||
return Response(html, mimetype="text/html")
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_estimate_templates(company):
|
||||
"""Get available estimate templates."""
|
||||
@ -448,6 +476,7 @@ def upsert_estimate(data):
|
||||
estimate.append("items", {
|
||||
"item_code": item.get("item_code"),
|
||||
"qty": item.get("qty"),
|
||||
"rate": item.get("rate"),
|
||||
"discount_amount": item.get("discount_amount") or item.get("discountAmount", 0),
|
||||
"discount_percentage": item.get("discount_percentage") or item.get("discountPercentage", 0)
|
||||
})
|
||||
@ -492,6 +521,7 @@ def upsert_estimate(data):
|
||||
new_estimate.append("items", {
|
||||
"item_code": item.get("item_code"),
|
||||
"qty": item.get("qty"),
|
||||
"rate": item.get("rate"),
|
||||
"discount_amount": item.get("discount_amount") or item.get("discountAmount", 0),
|
||||
"discount_percentage": item.get("discount_percentage") or item.get("discountPercentage", 0)
|
||||
})
|
||||
|
||||
80
custom_ui/api/db/items.py
Normal file
80
custom_ui/api/db/items.py
Normal file
@ -0,0 +1,80 @@
|
||||
import frappe
|
||||
import json
|
||||
from custom_ui.models import PackageCreationData
|
||||
from custom_ui.services import ProjectService, ItemService
|
||||
from custom_ui.db_utils import build_error_response, build_success_response
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_by_project_template(project_template: str) -> dict:
|
||||
"""Retrieve items associated with a given project template."""
|
||||
print(f"DEBUG: Getting items for Project Template {project_template}")
|
||||
item_groups = ProjectService.get_project_item_groups(project_template)
|
||||
items = ItemService.get_items_by_groups(item_groups)
|
||||
print(f"DEBUG: Retrieved {len(items)} items for Project Template {project_template}")
|
||||
categorized_items = ItemService.build_category_dict(items)
|
||||
return build_success_response(categorized_items)
|
||||
|
||||
@frappe.whitelist()
|
||||
def save_as_package_item(data):
|
||||
"""Save a new Package Item based on the provided data."""
|
||||
from custom_ui.models import BOMItem
|
||||
data = json.loads(data)
|
||||
print(f"DEBUG: Saving Package Item with data: {data}")
|
||||
# Map 'category' to 'item_group' for the model
|
||||
data['item_group'] = data.pop('category')
|
||||
# Convert items dictionaries to BOMItem instances
|
||||
data['items'] = [
|
||||
BOMItem(
|
||||
item_code=item['item_code'],
|
||||
qty=item['qty'],
|
||||
uom=item['uom']
|
||||
) for item in data['items']
|
||||
]
|
||||
data = PackageCreationData(**data)
|
||||
item = frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": ItemService.build_item_code(data.code_prefix, data.package_name),
|
||||
"item_name": data.package_name,
|
||||
"is_stock_item": 0,
|
||||
"item_group": data.item_group,
|
||||
"description": data.description,
|
||||
"standard_rate": data.rate or 0.0,
|
||||
"company": data.company,
|
||||
"has_variants": 0,
|
||||
"stock_uom": "Nos",
|
||||
"is_sales_item": 1,
|
||||
"is_purchase_item": 0,
|
||||
"is_pro_applicable": 0,
|
||||
"is_fixed_asset": 0,
|
||||
"is_service_item": 0
|
||||
}).insert()
|
||||
bom = frappe.get_doc({
|
||||
"doctype": "BOM",
|
||||
"item": item.name,
|
||||
"uom": "Nos",
|
||||
"is_active": 1,
|
||||
"is_default": 1,
|
||||
"items": [{
|
||||
"item_code": bom_item.item_code,
|
||||
"qty": bom_item.qty,
|
||||
"uom": bom_item.uom
|
||||
} for bom_item in data.items]
|
||||
}).insert()
|
||||
bom.submit()
|
||||
item.reload() # Refresh to get latest version after BOM submission
|
||||
item.default_bom = bom.name
|
||||
item.save()
|
||||
print(f"DEBUG: Created Package Item with name: {item.name}")
|
||||
item_dict = item.as_dict()
|
||||
item_dict["bom"] = ItemService.get_full_bom_dict(item.item_code) # Attach BOM details to the item dict
|
||||
return build_success_response(item_dict)
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_categories():
|
||||
"""Retrieve all item groups for categorization."""
|
||||
print("DEBUG: Getting item categories")
|
||||
item_groups = frappe.get_all("Item Group", pluck="name")
|
||||
print(f"DEBUG: Retrieved item categories: {item_groups}")
|
||||
return build_success_response(item_groups)
|
||||
|
||||
43
custom_ui/api/public/estimates.py
Normal file
43
custom_ui/api/public/estimates.py
Normal file
@ -0,0 +1,43 @@
|
||||
import frappe
|
||||
from werkzeug.wrappers import Response
|
||||
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def update_response(name, response):
|
||||
"""Update the response for a given estimate."""
|
||||
print("DEBUG: RESPONSE RECEIVED:", name, response)
|
||||
try:
|
||||
if not frappe.db.exists("Quotation", name):
|
||||
raise Exception("Estimate not found.")
|
||||
estimate = frappe.get_doc("Quotation", name)
|
||||
if estimate.docstatus != 1:
|
||||
raise Exception("Estimate must be submitted to update response.")
|
||||
accepted = True if response == "Accepted" else False
|
||||
new_status = "Estimate Accepted" if accepted else "Lost"
|
||||
|
||||
estimate.custom_response = response
|
||||
estimate.custom_current_status = new_status
|
||||
estimate.custom_followup_needed = 1 if response == "Requested call" else 0
|
||||
# estimate.status = "Ordered" if accepted else "Closed"
|
||||
estimate.flags.ignore_permissions = True
|
||||
print("DEBUG: Updating estimate with response:", response, "and status:", new_status)
|
||||
estimate.save()
|
||||
|
||||
if accepted:
|
||||
template = "custom_ui/templates/estimates/accepted.html"
|
||||
# if check_if_customer(estimate.party_name):
|
||||
# print("DEBUG: Party is already a customer:", estimate.party_name)
|
||||
# else:
|
||||
# print("DEBUG: Converting lead to customer for party:", estimate.party_name)
|
||||
# convert_lead_to_customer(estimate.party_name)
|
||||
elif response == "Requested call":
|
||||
template = "custom_ui/templates/estimates/request-call.html"
|
||||
else:
|
||||
template = "custom_ui/templates/estimates/rejected.html"
|
||||
html = frappe.render_template(template, {"doc": estimate})
|
||||
frappe.db.commit()
|
||||
return Response(html, mimetype="text/html")
|
||||
except Exception as e:
|
||||
template = "custom_ui/templates/estimates/error.html"
|
||||
html = frappe.render_template(template, {"error": str(e)})
|
||||
return Response(html, mimetype="text/html")
|
||||
@ -1,7 +1,9 @@
|
||||
import frappe
|
||||
import json
|
||||
from datetime import datetime
|
||||
from frappe.utils.data import flt
|
||||
from custom_ui.services import DbService, StripeService
|
||||
from custom_ui.services import DbService, StripeService, PaymentService
|
||||
from custom_ui.models import PaymentData
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def half_down_stripe_payment(sales_order):
|
||||
@ -13,16 +15,17 @@ def half_down_stripe_payment(sales_order):
|
||||
frappe.throw("This sales order does not require a half-down payment.")
|
||||
if so.docstatus != 1:
|
||||
frappe.throw("Sales Order must be submitted to proceed with payment.")
|
||||
if so.custom_halfdown_is_paid or so.advanced_paid >= so.custom_halfdown_amount:
|
||||
if so.custom_halfdown_is_paid or so.advance_paid >= so.custom_halfdown_amount:
|
||||
frappe.throw("Half-down payment has already been made for this sales order.")
|
||||
stripe_session = StripeService.create_checkout_session(
|
||||
company=so.company,
|
||||
amount=so.custom_halfdown_amount,
|
||||
service=so.custom_project_template,
|
||||
sales_order=so.name,
|
||||
order_num=so.name,
|
||||
for_advance_payment=True
|
||||
)
|
||||
return frappe.redirect(stripe_session.url)
|
||||
frappe.local.response["type"] = "redirect"
|
||||
frappe.local.response["location"] = stripe_session.url
|
||||
|
||||
@frappe.whitelist(allow_guest=True)
|
||||
def stripe_webhook():
|
||||
@ -31,39 +34,60 @@ def stripe_webhook():
|
||||
sig_header = frappe.request.headers.get('Stripe-Signature')
|
||||
session, metadata = StripeService.get_session_and_metadata(payload, sig_header)
|
||||
|
||||
# Validate required metadata
|
||||
if not metadata.get("company"):
|
||||
raise frappe.ValidationError("Missing required metadata key: company")
|
||||
if not metadata.get("payment_type"):
|
||||
raise frappe.ValidationError("Missing required metadata key: payment_type")
|
||||
|
||||
# Determine reference document based on payment type
|
||||
payment_type = metadata.get("payment_type")
|
||||
reference_doctype = None
|
||||
reference_doc_name = None
|
||||
|
||||
if payment_type == "advance":
|
||||
reference_doctype = "Sales Order"
|
||||
reference_doc_name = metadata.get("sales_order")
|
||||
if not reference_doc_name:
|
||||
raise frappe.ValidationError("Missing sales_order in metadata for advance payment")
|
||||
elif payment_type == "full":
|
||||
reference_doctype = "Sales Invoice"
|
||||
reference_doc_name = metadata.get("sales_invoice")
|
||||
if not reference_doc_name:
|
||||
raise frappe.ValidationError("Missing sales_invoice in metadata for full payment")
|
||||
else:
|
||||
raise frappe.ValidationError(f"Invalid payment type in metadata: {payment_type}")
|
||||
|
||||
# Check if payment already exists
|
||||
if DbService.exists("Payment Entry", {"reference_no": session.id}):
|
||||
raise frappe.ValidationError("Payment Entry already exists for this session.")
|
||||
|
||||
reference_doctype = "Sales Invoice"
|
||||
|
||||
if metadata.get("payment_type") == "advance":
|
||||
reference_doctype = "Sales Order"
|
||||
elif metadata.get("payment_type") != "full":
|
||||
raise frappe.ValidationError("Invalid payment type in metadata.")
|
||||
|
||||
amount_paid = flt(session.amount_total) / 100
|
||||
currency = session.currency.upper()
|
||||
reference_doc = frappe.get_doc(reference_doctype, metadata.get("order_num"))
|
||||
|
||||
pe = frappe.get_doc({
|
||||
"doctype": "Payment Entry",
|
||||
"payment_type": "Receive",
|
||||
"party_type": "Customer",
|
||||
"mode_of_payment": "Stripe",
|
||||
"party": reference_doc.customer,
|
||||
"party_name": reference_doc.customer,
|
||||
"paid_to": metadata.get("company"),
|
||||
"reference_no": session.id,
|
||||
"reference_date": frappe.utils.nowdate(),
|
||||
"reference_doctype": reference_doctype,
|
||||
"reference_name": reference_doc.name,
|
||||
"paid_amount": amount_paid,
|
||||
"paid_currency": currency,
|
||||
})
|
||||
# Convert Unix timestamp to date string (YYYY-MM-DD)
|
||||
reference_date = datetime.fromtimestamp(session.created).strftime('%Y-%m-%d')
|
||||
|
||||
pe.insert()
|
||||
pe.submit()
|
||||
return "Payment Entry created and submitted successfully."
|
||||
# Set Administrator context to create Payment Entry
|
||||
frappe.set_user("Administrator")
|
||||
|
||||
try:
|
||||
pe = PaymentService.create_payment_entry(
|
||||
data=PaymentData(
|
||||
mode_of_payment="Stripe",
|
||||
reference_no=session.id,
|
||||
reference_date=reference_date,
|
||||
received_amount=amount_paid,
|
||||
company=metadata.get("company"),
|
||||
reference_doc_name=reference_doc_name
|
||||
)
|
||||
)
|
||||
pe.flags.ignore_permissions = True
|
||||
pe.submit()
|
||||
frappe.db.commit()
|
||||
return "Payment Entry created and submitted successfully."
|
||||
finally:
|
||||
# Reset to Guest user
|
||||
frappe.set_user("Guest")
|
||||
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,6 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def before_save(doc, method):
|
||||
print("DEBUG: Before save hook triggered for Customer:", doc.name)
|
||||
print("DEBUG: current state: ", doc.as_dict())
|
||||
@ -31,13 +31,13 @@ def before_insert(doc, method):
|
||||
print("DEBUG: CHECKING CUSTOMER NAME")
|
||||
print(doc.actual_customer_name)
|
||||
print("Quotation_to:", doc.quotation_to)
|
||||
doc.customer_address = frappe.get_value(doc.customer_type, doc.actual_customer_name, "customer_billing_address")
|
||||
doc.customer_address = frappe.get_value(doc.customer_type, doc.actual_customer_name, "custom_billing_address")
|
||||
# print("Party_type:", doc.party_type)
|
||||
if doc.custom_project_template == "SNW Install":
|
||||
print("DEBUG: Quotation uses SNW Install template, making sure no duplicate linked estimates.")
|
||||
address_doc = AddressService.get_or_throw(doc.custom_job_address)
|
||||
if "SNW Install" in [link.project_template for link in address_doc.quotations]:
|
||||
raise frappe.ValidationError("An Estimate with project template 'SNW Install' is already linked to this address.")
|
||||
# if "SNW Install" in [link.project_template for link in address_doc.quotations]:
|
||||
# raise frappe.ValidationError("An Estimate with project template 'SNW Install' is already linked to this address.")
|
||||
|
||||
def before_submit(doc, method):
|
||||
print("DEBUG: Before submit hook triggered for Quotation:", doc.name)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import frappe
|
||||
from custom_ui.services import AddressService, ClientService, ServiceAppointmentService, TaskService
|
||||
from custom_ui.services import SalesOrderService, AddressService, ClientService, ServiceAppointmentService, TaskService
|
||||
from datetime import timedelta
|
||||
import traceback
|
||||
|
||||
@ -62,6 +62,7 @@ def before_insert(doc, method):
|
||||
|
||||
def before_save(doc, method):
|
||||
print("DEBUG: Before Save Triggered for Project:", doc.name)
|
||||
print("DEBUG: Checking status: ", doc.status)
|
||||
if doc.expected_start_date and doc.expected_end_date:
|
||||
print("DEBUG: Project has expected start and end dates, marking as scheduled")
|
||||
doc.is_scheduled = 1
|
||||
@ -81,6 +82,18 @@ def before_save(doc, method):
|
||||
|
||||
def after_save(doc, method):
|
||||
print("DEBUG: After Save Triggered for Project:", doc.name)
|
||||
if doc.status == "Completed":
|
||||
print("DEBUG: Project marked as Completed. Generating and sending final invoice.")
|
||||
sales_order_status = frappe.get_value("Sales Order", doc.sales_order, "billing_status")
|
||||
if sales_order_status == "Not Billed":
|
||||
SalesOrderService.create_sales_invoice_from_sales_order(doc.sales_order)
|
||||
if doc.ready_to_schedule:
|
||||
service_apt_ready_to_schedule = frappe.get_value("Service Address 2", doc.service_appointment, "ready_to_schedule")
|
||||
if not service_apt_ready_to_schedule:
|
||||
print("DEBUG: Project is ready to schedule, setting Service Appointment to ready to schedule.")
|
||||
service_apt_doc = frappe.get_doc("Service Address 2", doc.service_appointment)
|
||||
service_apt_doc.ready_to_schedule = 1
|
||||
service_apt_doc.save(ignore_permissions=True)
|
||||
if doc.project_template == "SNW Install":
|
||||
print("DEBUG: Project template is SNW Install, updating Address Job Status based on Project status")
|
||||
status_mapping = {
|
||||
|
||||
16
custom_ui/events/payments.py
Normal file
16
custom_ui/events/payments.py
Normal file
@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
|
||||
def on_submit(doc, method):
|
||||
print("DEBUG: On Submit Triggered for Payment Entry")
|
||||
is_advance_payment = any(ref.reference_doctype == "Sales Order" for ref in doc.references)
|
||||
if is_advance_payment:
|
||||
print("DEBUG: Payment Entry is for an advance payment, checking Sales Order if half down requirement is met.")
|
||||
so_ref = next((ref for ref in doc.references if ref.reference_doctype == "Sales Order"), None)
|
||||
if so_ref:
|
||||
so_doc = frappe.get_doc("Sales Order", so_ref.reference_name)
|
||||
if so_doc.requires_half_payment:
|
||||
is_paid = so_doc.custom_halfdown_amount <= so_doc.advance_paid or so_doc.advance_paid >= so_doc.grand_total / 2
|
||||
if is_paid and not so_doc.custom_halfdown_is_paid:
|
||||
print("DEBUG: Sales Order requires half payment and it has not been marked as paid, marking it as paid now.")
|
||||
so_doc.custom_halfdown_is_paid = 1
|
||||
so_doc.save()
|
||||
16
custom_ui/events/sales_invoice.py
Normal file
16
custom_ui/events/sales_invoice.py
Normal file
@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
from custom_ui.services.email_service import EmailService
|
||||
|
||||
def on_submit(doc, method):
|
||||
print("DEBUG: On Submit Triggered for Sales Invoice:", doc.name)
|
||||
|
||||
# Send invoice email to customer
|
||||
try:
|
||||
print("DEBUG: Preparing to send invoice email for", doc.name)
|
||||
EmailService.send_invoice_email(doc.name)
|
||||
print("DEBUG: Invoice email sent successfully for", doc.name)
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to send invoice email: {str(e)}")
|
||||
# Don't raise the exception - we don't want to block the invoice submission
|
||||
frappe.log_error(f"Failed to send invoice email for {doc.name}: {str(e)}", "Invoice Email Error")
|
||||
|
||||
@ -71,6 +71,21 @@ def after_insert(doc, method):
|
||||
ClientService.append_link_v2(
|
||||
doc.customer, "sales_orders", {"sales_order": doc.name, "project_template": doc.custom_project_template}
|
||||
)
|
||||
|
||||
# Send down payment email if required
|
||||
if doc.requires_half_payment:
|
||||
try:
|
||||
print("DEBUG: Sales Order requires half payment, preparing to send down payment email")
|
||||
from custom_ui.services.email_service import EmailService
|
||||
|
||||
# Use EmailService to send the down payment email
|
||||
EmailService.send_downpayment_email(doc.name)
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to send down payment email: {str(e)}")
|
||||
# Don't raise the exception - we don't want to block the sales order creation
|
||||
frappe.log_error(f"Failed to send down payment email for {doc.name}: {str(e)}", "Down Payment Email Error")
|
||||
|
||||
|
||||
def on_update_after_submit(doc, method):
|
||||
print("DEBUG: on_update_after_submit hook triggered for Sales Order:", doc.name)
|
||||
@ -78,7 +93,9 @@ def on_update_after_submit(doc, method):
|
||||
project_is_scheduable = frappe.get_value("Project", doc.project, "ready_to_schedule")
|
||||
if not project_is_scheduable:
|
||||
print("DEBUG: Half-down payment made, setting Project to ready to schedule.")
|
||||
frappe.set_value("Project", doc.project, "ready_to_schedule", 1)
|
||||
project_doc = frappe.get_doc("Project", doc.project)
|
||||
project_doc.ready_to_schedule = 1
|
||||
project_doc.save()
|
||||
|
||||
|
||||
|
||||
@ -121,3 +138,4 @@ def create_sales_invoice_from_sales_order(doc, method):
|
||||
# except Exception as e:
|
||||
# print("ERROR creating Sales Invoice from Sales Order:", str(e))
|
||||
# frappe.log_error(f"Error creating Sales Invoice from Sales Order {doc.name}: {str(e)}", "Sales Order after_submit Error")
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1408,8 +1408,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:12.948757",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.309793",
|
||||
"module": "CRM",
|
||||
"name": "Properties",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -3186,8 +3186,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.056788",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.432329",
|
||||
"module": "CRM",
|
||||
"name": "SNW Jobs",
|
||||
"naming_rule": "Autoincrement",
|
||||
@ -4109,8 +4109,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.154567",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.520105",
|
||||
"module": "Projects",
|
||||
"name": "Work Schedule",
|
||||
"naming_rule": "",
|
||||
@ -9151,8 +9151,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.303974",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.684330",
|
||||
"module": "CRM",
|
||||
"name": "Follow Up Checklist",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -9457,8 +9457,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.377143",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.760407",
|
||||
"module": "CRM",
|
||||
"name": "Follow Check List Fields",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -10147,8 +10147,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.498788",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.859914",
|
||||
"module": "Brotherton SOP",
|
||||
"name": "SOP-Documentation",
|
||||
"naming_rule": "Set by user",
|
||||
@ -10348,8 +10348,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.568354",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.922266",
|
||||
"module": "Desk",
|
||||
"name": "SOP Notes",
|
||||
"naming_rule": "",
|
||||
@ -10694,8 +10694,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.644007",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:30.991664",
|
||||
"module": "Desk",
|
||||
"name": "Tutorials",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -11064,8 +11064,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.714534",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.061659",
|
||||
"module": "Desk",
|
||||
"name": "Brotherton Meetings Scheduler",
|
||||
"naming_rule": "",
|
||||
@ -11242,8 +11242,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.776408",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.124415",
|
||||
"module": "Desk",
|
||||
"name": "Meeting Participants",
|
||||
"naming_rule": "",
|
||||
@ -11588,8 +11588,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.863897",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.204512",
|
||||
"module": "Desk",
|
||||
"name": "Add-On Job Detail",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -11870,8 +11870,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:13.938332",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.273908",
|
||||
"module": "Desk",
|
||||
"name": "Crew Schedule Detail",
|
||||
"naming_rule": "",
|
||||
@ -12152,8 +12152,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.015669",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.342599",
|
||||
"module": "Setup",
|
||||
"name": "City",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -14738,8 +14738,8 @@
|
||||
"make_attachments_public": 1,
|
||||
"max_attachments": 5,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.167954",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.484159",
|
||||
"module": "Projects",
|
||||
"name": "Fencing Job Queue",
|
||||
"naming_rule": "Set by user",
|
||||
@ -15630,8 +15630,8 @@
|
||||
"make_attachments_public": 1,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.271176",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.555530",
|
||||
"module": "Setup",
|
||||
"name": "Irrigation District",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -15808,8 +15808,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.346591",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.610090",
|
||||
"module": "Setup",
|
||||
"name": "Linked Companies",
|
||||
"naming_rule": "",
|
||||
@ -16154,8 +16154,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.429267",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.668108",
|
||||
"module": "Contacts",
|
||||
"name": "Address Contact Role",
|
||||
"naming_rule": "",
|
||||
@ -17056,6 +17056,70 @@
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": null,
|
||||
"columns": 0,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"documentation_url": null,
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"hide_border": 0,
|
||||
"hide_days": 0,
|
||||
"hide_seconds": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_preview": 0,
|
||||
"in_standard_filter": 0,
|
||||
"is_virtual": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"link_filters": null,
|
||||
"make_attachment_public": 0,
|
||||
"mandatory_depends_on": null,
|
||||
"max_height": null,
|
||||
"no_copy": 1,
|
||||
"non_negative": 0,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Backflow Test Form",
|
||||
"parent": "Backflow Test Form",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"placeholder": null,
|
||||
"precision": null,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": null,
|
||||
"read_only": 1,
|
||||
"read_only_depends_on": null,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"show_dashboard": 0,
|
||||
"show_on_timeline": 0,
|
||||
"show_preview_popup": 0,
|
||||
"sort_options": 0,
|
||||
"translatable": 0,
|
||||
"trigger": null,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
@ -17140,8 +17204,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.536984",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.743894",
|
||||
"module": "Selling",
|
||||
"name": "Backflow Test Form",
|
||||
"naming_rule": "",
|
||||
@ -17830,8 +17894,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.668256",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.827955",
|
||||
"module": "Selling",
|
||||
"name": "Pre-Built Routes",
|
||||
"naming_rule": "By \"Naming Series\" field",
|
||||
@ -18351,8 +18415,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.752785",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:31.885625",
|
||||
"module": "Contacts",
|
||||
"name": "Assigned Address",
|
||||
"naming_rule": "By fieldname",
|
||||
@ -19573,6 +19637,70 @@
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": null,
|
||||
"columns": 0,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"documentation_url": null,
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"hide_border": 0,
|
||||
"hide_days": 0,
|
||||
"hide_seconds": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_preview": 0,
|
||||
"in_standard_filter": 0,
|
||||
"is_virtual": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"link_filters": null,
|
||||
"make_attachment_public": 0,
|
||||
"mandatory_depends_on": null,
|
||||
"max_height": null,
|
||||
"no_copy": 1,
|
||||
"non_negative": 0,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Locate Log",
|
||||
"parent": "Locate Log",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"placeholder": null,
|
||||
"precision": null,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": null,
|
||||
"read_only": 1,
|
||||
"read_only_depends_on": null,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"show_dashboard": 0,
|
||||
"show_on_timeline": 0,
|
||||
"show_preview_popup": 0,
|
||||
"sort_options": 0,
|
||||
"translatable": 0,
|
||||
"trigger": null,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
@ -19671,8 +19799,8 @@
|
||||
"make_attachments_public": 1,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.894391",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.021173",
|
||||
"module": "Projects",
|
||||
"name": "Locate Log",
|
||||
"naming_rule": "",
|
||||
@ -20243,6 +20371,70 @@
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": null,
|
||||
"columns": 0,
|
||||
"default": null,
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"documentation_url": null,
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"hide_border": 0,
|
||||
"hide_days": 0,
|
||||
"hide_seconds": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_preview": 0,
|
||||
"in_standard_filter": 0,
|
||||
"is_virtual": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"link_filters": null,
|
||||
"make_attachment_public": 0,
|
||||
"mandatory_depends_on": null,
|
||||
"max_height": null,
|
||||
"no_copy": 1,
|
||||
"non_negative": 0,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": "Backflow test report form",
|
||||
"parent": "Backflow test report form",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"placeholder": null,
|
||||
"precision": null,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": null,
|
||||
"read_only": 1,
|
||||
"read_only_depends_on": null,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1,
|
||||
"set_only_once": 0,
|
||||
"show_dashboard": 0,
|
||||
"show_on_timeline": 0,
|
||||
"show_preview_popup": 0,
|
||||
"sort_options": 0,
|
||||
"translatable": 0,
|
||||
"trigger": null,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
@ -20327,8 +20519,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:14.974731",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.089145",
|
||||
"module": "Brotherton SOP",
|
||||
"name": "Backflow test report form",
|
||||
"naming_rule": "",
|
||||
@ -20633,8 +20825,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.060171",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.161902",
|
||||
"module": "Accounts",
|
||||
"name": "QB Export Entry",
|
||||
"naming_rule": "Autoincrement",
|
||||
@ -21171,8 +21363,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.161301",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.228299",
|
||||
"module": "Accounts",
|
||||
"name": "QB Export",
|
||||
"naming_rule": "Expression",
|
||||
@ -21669,8 +21861,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.226771",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.288896",
|
||||
"module": "Desk",
|
||||
"name": "Custom Customer Address Link",
|
||||
"naming_rule": "",
|
||||
@ -22015,8 +22207,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.293419",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.353749",
|
||||
"module": "Selling",
|
||||
"name": "On-Site Meeting",
|
||||
"naming_rule": "Expression",
|
||||
@ -22193,8 +22385,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.349611",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.406321",
|
||||
"module": "Selling",
|
||||
"name": "Route Technician Assignment",
|
||||
"naming_rule": "",
|
||||
@ -22347,8 +22539,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.412654",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.462798",
|
||||
"module": "Desk",
|
||||
"name": "Test Doctype",
|
||||
"naming_rule": "",
|
||||
@ -22525,8 +22717,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.467707",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.512828",
|
||||
"module": "Custom",
|
||||
"name": "Lead Company Link",
|
||||
"naming_rule": "",
|
||||
@ -22743,8 +22935,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.520767",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.565309",
|
||||
"module": "Custom UI",
|
||||
"name": "Customer Task Link",
|
||||
"naming_rule": "",
|
||||
@ -22961,8 +23153,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.580338",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.619158",
|
||||
"module": "Custom UI",
|
||||
"name": "Address Task Link",
|
||||
"naming_rule": "",
|
||||
@ -23115,8 +23307,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.635575",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.669515",
|
||||
"module": "Custom",
|
||||
"name": "Lead Companies Link",
|
||||
"naming_rule": "",
|
||||
@ -23333,8 +23525,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.692709",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.723818",
|
||||
"module": "Custom",
|
||||
"name": "Address Project Link",
|
||||
"naming_rule": "",
|
||||
@ -23551,8 +23743,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.753245",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.776210",
|
||||
"module": "Custom",
|
||||
"name": "Address Quotation Link",
|
||||
"naming_rule": "",
|
||||
@ -23769,8 +23961,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.813569",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.828052",
|
||||
"module": "Custom",
|
||||
"name": "Address On-Site Meeting Link",
|
||||
"naming_rule": "",
|
||||
@ -23987,8 +24179,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.869381",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.883125",
|
||||
"module": "Custom",
|
||||
"name": "Address Sales Order Link",
|
||||
"naming_rule": "",
|
||||
@ -24141,8 +24333,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.926523",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.934024",
|
||||
"module": "Custom",
|
||||
"name": "Contact Address Link",
|
||||
"naming_rule": "",
|
||||
@ -24295,8 +24487,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:15.982944",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:32.986817",
|
||||
"module": "Custom",
|
||||
"name": "Lead On-Site Meeting Link",
|
||||
"naming_rule": "",
|
||||
@ -24897,8 +25089,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.051786",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.054497",
|
||||
"module": "Selling",
|
||||
"name": "Quotation Template",
|
||||
"naming_rule": "",
|
||||
@ -25395,8 +25587,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.131703",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.128567",
|
||||
"module": "Selling",
|
||||
"name": "Quotation Template Item",
|
||||
"naming_rule": "",
|
||||
@ -25549,8 +25741,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.186884",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.180500",
|
||||
"module": "Custom UI",
|
||||
"name": "Customer Company Link",
|
||||
"naming_rule": "",
|
||||
@ -25703,8 +25895,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.242217",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.232445",
|
||||
"module": "Custom UI",
|
||||
"name": "Customer Address Link",
|
||||
"naming_rule": "",
|
||||
@ -25857,8 +26049,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.295479",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.283358",
|
||||
"module": "Custom UI",
|
||||
"name": "Customer Contact Link",
|
||||
"naming_rule": "",
|
||||
@ -26011,8 +26203,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.349430",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.334916",
|
||||
"module": "Custom",
|
||||
"name": "Address Contact Link",
|
||||
"naming_rule": "",
|
||||
@ -26165,8 +26357,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.402648",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.388907",
|
||||
"module": "Custom",
|
||||
"name": "Customer On-Site Meeting Link",
|
||||
"naming_rule": "",
|
||||
@ -26319,8 +26511,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.453671",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.442065",
|
||||
"module": "Custom",
|
||||
"name": "Customer Project Link",
|
||||
"naming_rule": "",
|
||||
@ -26473,8 +26665,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.510653",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.493993",
|
||||
"module": "Custom",
|
||||
"name": "Customer Quotation Link",
|
||||
"naming_rule": "",
|
||||
@ -26627,8 +26819,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.565855",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.547121",
|
||||
"module": "Custom",
|
||||
"name": "Customer Sales Order Link",
|
||||
"naming_rule": "",
|
||||
@ -26781,8 +26973,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.623951",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.599872",
|
||||
"module": "Custom",
|
||||
"name": "Lead Address Link",
|
||||
"naming_rule": "",
|
||||
@ -26935,8 +27127,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.678981",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.670663",
|
||||
"module": "Custom",
|
||||
"name": "Lead Contact Link",
|
||||
"naming_rule": "",
|
||||
@ -27089,8 +27281,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.735725",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.723019",
|
||||
"module": "Custom",
|
||||
"name": "Lead Quotation Link",
|
||||
"naming_rule": "",
|
||||
@ -27243,8 +27435,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.790139",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.773957",
|
||||
"module": "Custom",
|
||||
"name": "Address Company Link",
|
||||
"naming_rule": "",
|
||||
@ -28229,8 +28421,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 10:35:03.150818",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.849415",
|
||||
"module": "Custom UI",
|
||||
"name": "Service Appointment",
|
||||
"naming_rule": "Expression",
|
||||
@ -29303,8 +29495,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.929388",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.917771",
|
||||
"module": "Custom UI",
|
||||
"name": "Bid Meeting Note Form Field",
|
||||
"naming_rule": "",
|
||||
@ -29713,8 +29905,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:16.999820",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:33.980734",
|
||||
"module": "Custom UI",
|
||||
"name": "Bid Meeting Note Form",
|
||||
"naming_rule": "",
|
||||
@ -30595,8 +30787,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:17.067503",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:34.047833",
|
||||
"module": "Custom UI",
|
||||
"name": "Bid Meeting Note Field",
|
||||
"naming_rule": "",
|
||||
@ -31005,8 +31197,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:17.135078",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:34.111266",
|
||||
"module": "Custom UI",
|
||||
"name": "Bid Meeting Note",
|
||||
"naming_rule": "",
|
||||
@ -31183,8 +31375,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:17.193504",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:34.162346",
|
||||
"module": "Custom UI",
|
||||
"name": "Project Task Link",
|
||||
"naming_rule": "",
|
||||
@ -31337,8 +31529,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:17.253714",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:34.224291",
|
||||
"module": "Custom UI",
|
||||
"name": "Condition",
|
||||
"naming_rule": "",
|
||||
@ -31643,8 +31835,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": "c9094ea959c7b6ff11522d064fe04b35",
|
||||
"modified": "2026-01-26 01:52:17.308226",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-02 09:31:34.278957",
|
||||
"module": "Custom UI",
|
||||
"name": "Bid Meeting Note Field Quantity",
|
||||
"naming_rule": "",
|
||||
@ -32672,6 +32864,70 @@
|
||||
"trigger": null,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": null,
|
||||
"columns": 0,
|
||||
"default": "1",
|
||||
"depends_on": null,
|
||||
"description": null,
|
||||
"documentation_url": null,
|
||||
"fetch_from": null,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "ready_to_schedule",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"hide_border": 0,
|
||||
"hide_days": 0,
|
||||
"hide_seconds": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_preview": 0,
|
||||
"in_standard_filter": 0,
|
||||
"is_virtual": 0,
|
||||
"label": "Ready To Schedule",
|
||||
"length": 0,
|
||||
"link_filters": null,
|
||||
"make_attachment_public": 0,
|
||||
"mandatory_depends_on": null,
|
||||
"max_height": null,
|
||||
"no_copy": 0,
|
||||
"non_negative": 0,
|
||||
"oldfieldname": null,
|
||||
"oldfieldtype": null,
|
||||
"options": null,
|
||||
"parent": "Service Address 2",
|
||||
"parentfield": "fields",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"placeholder": null,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": null,
|
||||
"read_only": 0,
|
||||
"read_only_depends_on": null,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"show_dashboard": 0,
|
||||
"show_on_timeline": 0,
|
||||
"show_preview_popup": 0,
|
||||
"sort_options": 0,
|
||||
"translatable": 0,
|
||||
"trigger": null,
|
||||
"unique": 0,
|
||||
"width": null
|
||||
}
|
||||
],
|
||||
"force_re_route_to_default_view": 0,
|
||||
@ -32693,8 +32949,8 @@
|
||||
"make_attachments_public": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": null,
|
||||
"migration_hash": null,
|
||||
"modified": "2026-01-27 04:34:52.205293",
|
||||
"migration_hash": "330c425fa522cd61f3e1012dfbe56f02",
|
||||
"modified": "2026-02-06 02:26:23.029525",
|
||||
"module": "Custom UI",
|
||||
"name": "Service Address 2",
|
||||
"naming_rule": "",
|
||||
|
||||
@ -11583,22 +11583,6 @@
|
||||
"row_name": null,
|
||||
"value": "1"
|
||||
},
|
||||
{
|
||||
"default_value": null,
|
||||
"doc_type": "Sales Order",
|
||||
"docstatus": 0,
|
||||
"doctype": "Property Setter",
|
||||
"doctype_or_field": "DocType",
|
||||
"field_name": null,
|
||||
"is_system_generated": 0,
|
||||
"modified": "2025-04-25 03:31:21.087382",
|
||||
"module": null,
|
||||
"name": "Sales Order-main-field_order",
|
||||
"property": "field_order",
|
||||
"property_type": "Data",
|
||||
"row_name": null,
|
||||
"value": "[\"customer_section\", \"column_break0\", \"custom_installation_address\", \"custom_requires_halfdown\", \"title\", \"naming_series\", \"customer\", \"customer_name\", \"tax_id\", \"column_break_7\", \"transaction_date\", \"order_type\", \"delivery_date\", \"custom_department_type\", \"custom_project_complete\", \"column_break1\", \"po_no\", \"po_date\", \"company\", \"skip_delivery_note\", \"amended_from\", \"custom_section_break_htf05\", \"custom_workflow_related_custom_fields__landry\", \"custom_coordinator_notification\", \"custom_sales_order_addon\", \"accounting_dimensions_section\", \"cost_center\", \"dimension_col_break\", \"project\", \"currency_and_price_list\", \"currency\", \"conversion_rate\", \"column_break2\", \"selling_price_list\", \"price_list_currency\", \"plc_conversion_rate\", \"ignore_pricing_rule\", \"sec_warehouse\", \"scan_barcode\", \"column_break_28\", \"set_warehouse\", \"reserve_stock\", \"items_section\", \"items\", \"section_break_31\", \"total_qty\", \"total_net_weight\", \"column_break_33\", \"base_total\", \"base_net_total\", \"column_break_33a\", \"total\", \"net_total\", \"taxes_section\", \"tax_category\", \"taxes_and_charges\", \"exempt_from_sales_tax\", \"column_break_38\", \"shipping_rule\", \"column_break_49\", \"incoterm\", \"named_place\", \"section_break_40\", \"taxes\", \"section_break_43\", \"base_total_taxes_and_charges\", \"column_break_46\", \"total_taxes_and_charges\", \"totals\", \"base_grand_total\", \"base_rounding_adjustment\", \"base_rounded_total\", \"base_in_words\", \"column_break3\", \"grand_total\", \"rounding_adjustment\", \"rounded_total\", \"in_words\", \"advance_paid\", \"disable_rounded_total\", \"section_break_48\", \"apply_discount_on\", \"base_discount_amount\", \"coupon_code\", \"column_break_50\", \"additional_discount_percentage\", \"discount_amount\", \"sec_tax_breakup\", \"other_charges_calculation\", \"packing_list\", \"packed_items\", \"pricing_rule_details\", \"pricing_rules\", \"contact_info\", \"billing_address_column\", \"customer_address\", \"address_display\", \"customer_group\", \"territory\", \"column_break_84\", \"contact_person\", \"contact_display\", \"contact_phone\", \"contact_mobile\", \"contact_email\", \"shipping_address_column\", \"shipping_address_name\", \"shipping_address\", \"column_break_93\", \"dispatch_address_name\", \"dispatch_address\", \"col_break46\", \"company_address\", \"column_break_92\", \"company_address_display\", \"payment_schedule_section\", \"payment_terms_section\", \"payment_terms_template\", \"payment_schedule\", \"terms_section_break\", \"tc_name\", \"terms\", \"more_info\", \"section_break_78\", \"status\", \"delivery_status\", \"per_delivered\", \"column_break_81\", \"per_billed\", \"per_picked\", \"billing_status\", \"sales_team_section_break\", \"sales_partner\", \"column_break7\", \"amount_eligible_for_commission\", \"commission_rate\", \"total_commission\", \"section_break1\", \"sales_team\", \"loyalty_points_redemption\", \"loyalty_points\", \"column_break_116\", \"loyalty_amount\", \"subscription_section\", \"from_date\", \"to_date\", \"column_break_108\", \"auto_repeat\", \"update_auto_repeat_reference\", \"printing_details\", \"letter_head\", \"group_same_items\", \"column_break4\", \"select_print_heading\", \"language\", \"additional_info_section\", \"is_internal_customer\", \"represents_company\", \"column_break_152\", \"source\", \"inter_company_order_reference\", \"campaign\", \"party_account_currency\", \"connections_tab\"]"
|
||||
},
|
||||
{
|
||||
"default_value": null,
|
||||
"doc_type": "Address",
|
||||
@ -15134,5 +15118,37 @@
|
||||
"property_type": "Data",
|
||||
"row_name": null,
|
||||
"value": "[\"custom_column_break_k7sgq\", \"custom_installation_address\", \"naming_series\", \"project_name\", \"job_address\", \"status\", \"custom_warranty_duration_days\", \"custom_warranty_expiration_date\", \"custom_warranty_information\", \"project_type\", \"percent_complete_method\", \"percent_complete\", \"column_break_5\", \"project_template\", \"expected_start_date\", \"expected_start_time\", \"expected_end_date\", \"expected_end_time\", \"is_scheduled\", \"invoice_status\", \"custom_completion_date\", \"priority\", \"custom_foreman\", \"custom_hidden_fields\", \"department\", \"service_appointment\", \"tasks\", \"is_active\", \"custom_address\", \"custom_section_break_lgkpd\", \"custom_workflow_related_custom_fields__landry\", \"custom_permit_status\", \"custom_utlity_locate_status\", \"custom_crew_scheduling\", \"customer_details\", \"customer\", \"column_break_14\", \"sales_order\", \"users_section\", \"users\", \"copied_from\", \"section_break0\", \"notes\", \"section_break_18\", \"actual_start_date\", \"actual_start_time\", \"actual_time\", \"column_break_20\", \"actual_end_date\", \"actual_end_time\", \"project_details\", \"estimated_costing\", \"total_costing_amount\", \"total_expense_claim\", \"total_purchase_cost\", \"company\", \"column_break_28\", \"total_sales_amount\", \"total_billable_amount\", \"total_billed_amount\", \"total_consumed_material_cost\", \"cost_center\", \"margin\", \"gross_margin\", \"column_break_37\", \"per_gross_margin\", \"monitor_progress\", \"collect_progress\", \"holiday_list\", \"frequency\", \"from_time\", \"to_time\", \"first_email\", \"second_email\", \"daily_time_to_send\", \"day_to_send\", \"weekly_time_to_send\", \"column_break_45\", \"subject\", \"message\"]"
|
||||
},
|
||||
{
|
||||
"default_value": null,
|
||||
"doc_type": "Sales Order",
|
||||
"docstatus": 0,
|
||||
"doctype": "Property Setter",
|
||||
"doctype_or_field": "DocType",
|
||||
"field_name": null,
|
||||
"is_system_generated": 0,
|
||||
"modified": "2026-02-05 12:10:08.553140",
|
||||
"module": null,
|
||||
"name": "Sales Order-main-field_order",
|
||||
"property": "field_order",
|
||||
"property_type": "Data",
|
||||
"row_name": null,
|
||||
"value": "[\"customer_section\", \"column_break0\", \"custom_installation_address\", \"custom_job_address\", \"requires_half_payment\", \"custom_project_template\", \"custom_requires_halfdown\", \"title\", \"naming_series\", \"customer\", \"customer_name\", \"tax_id\", \"custom_halfdown_is_paid\", \"custom_halfdown_amount\", \"column_break_7\", \"transaction_date\", \"order_type\", \"delivery_date\", \"custom_department_type\", \"custom_project_complete\", \"column_break1\", \"po_no\", \"po_date\", \"company\", \"skip_delivery_note\", \"has_unit_price_items\", \"amended_from\", \"custom_section_break_htf05\", \"custom_workflow_related_custom_fields__landry\", \"custom_coordinator_notification\", \"custom_sales_order_addon\", \"accounting_dimensions_section\", \"cost_center\", \"dimension_col_break\", \"project\", \"currency_and_price_list\", \"currency\", \"conversion_rate\", \"column_break2\", \"selling_price_list\", \"price_list_currency\", \"plc_conversion_rate\", \"ignore_pricing_rule\", \"sec_warehouse\", \"scan_barcode\", \"last_scanned_warehouse\", \"column_break_28\", \"set_warehouse\", \"reserve_stock\", \"items_section\", \"items\", \"section_break_31\", \"total_qty\", \"total_net_weight\", \"column_break_33\", \"base_total\", \"base_net_total\", \"column_break_33a\", \"total\", \"net_total\", \"taxes_section\", \"tax_category\", \"taxes_and_charges\", \"exempt_from_sales_tax\", \"column_break_38\", \"shipping_rule\", \"column_break_49\", \"incoterm\", \"named_place\", \"section_break_40\", \"taxes\", \"section_break_43\", \"base_total_taxes_and_charges\", \"column_break_46\", \"total_taxes_and_charges\", \"totals\", \"base_grand_total\", \"base_rounding_adjustment\", \"base_rounded_total\", \"base_in_words\", \"column_break3\", \"grand_total\", \"rounding_adjustment\", \"rounded_total\", \"in_words\", \"advance_paid\", \"disable_rounded_total\", \"section_break_48\", \"apply_discount_on\", \"base_discount_amount\", \"coupon_code\", \"column_break_50\", \"additional_discount_percentage\", \"discount_amount\", \"sec_tax_breakup\", \"other_charges_calculation\", \"packing_list\", \"packed_items\", \"pricing_rule_details\", \"pricing_rules\", \"contact_info\", \"billing_address_column\", \"customer_address\", \"address_display\", \"customer_group\", \"territory\", \"column_break_84\", \"contact_person\", \"contact_display\", \"contact_phone\", \"contact_mobile\", \"contact_email\", \"shipping_address_column\", \"shipping_address_name\", \"shipping_address\", \"column_break_93\", \"dispatch_address_name\", \"dispatch_address\", \"col_break46\", \"company_address\", \"column_break_92\", \"company_contact_person\", \"company_address_display\", \"payment_schedule_section\", \"payment_terms_section\", \"payment_terms_template\", \"payment_schedule\", \"terms_section_break\", \"tc_name\", \"terms\", \"more_info\", \"section_break_78\", \"status\", \"delivery_status\", \"per_delivered\", \"column_break_81\", \"per_billed\", \"per_picked\", \"billing_status\", \"sales_team_section_break\", \"sales_partner\", \"column_break7\", \"amount_eligible_for_commission\", \"commission_rate\", \"total_commission\", \"section_break1\", \"sales_team\", \"loyalty_points_redemption\", \"loyalty_points\", \"column_break_116\", \"loyalty_amount\", \"subscription_section\", \"from_date\", \"to_date\", \"column_break_108\", \"auto_repeat\", \"update_auto_repeat_reference\", \"printing_details\", \"letter_head\", \"group_same_items\", \"column_break4\", \"select_print_heading\", \"language\", \"additional_info_section\", \"is_internal_customer\", \"represents_company\", \"column_break_152\", \"source\", \"inter_company_order_reference\", \"campaign\", \"party_account_currency\", \"connections_tab\"]"
|
||||
},
|
||||
{
|
||||
"default_value": null,
|
||||
"doc_type": "Stripe Settings",
|
||||
"docstatus": 0,
|
||||
"doctype": "Property Setter",
|
||||
"doctype_or_field": "DocType",
|
||||
"field_name": null,
|
||||
"is_system_generated": 0,
|
||||
"modified": "2026-02-06 08:00:17.665416",
|
||||
"module": null,
|
||||
"name": "Stripe Settings-main-field_order",
|
||||
"property": "field_order",
|
||||
"property_type": "Data",
|
||||
"row_name": null,
|
||||
"value": "[\"gateway_name\", \"publishable_key\", \"custom_webhook_secret\", \"column_break_3\", \"secret_key\", \"custom_company\", \"custom_account\", \"section_break_5\", \"header_img\", \"column_break_7\", \"redirect_url\"]"
|
||||
}
|
||||
]
|
||||
@ -204,6 +204,12 @@ doc_events = {
|
||||
"before_save": "custom_ui.events.service_appointment.before_save",
|
||||
"after_insert": "custom_ui.events.service_appointment.after_insert",
|
||||
"on_update": "custom_ui.events.service_appointment.on_update"
|
||||
},
|
||||
"Payment Entry": {
|
||||
"on_submit": "custom_ui.events.payments.on_submit"
|
||||
},
|
||||
"Sales Invoice": {
|
||||
"on_submit": "custom_ui.events.sales_invoice.on_submit"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,6 +24,8 @@ def after_install():
|
||||
create_task_types()
|
||||
# create_tasks()
|
||||
create_bid_meeting_note_form_templates()
|
||||
create_accounts()
|
||||
# init_stripe_accounts()
|
||||
build_frontend()
|
||||
|
||||
def after_migrate():
|
||||
@ -42,6 +44,8 @@ def after_migrate():
|
||||
create_task_types()
|
||||
# create_tasks()
|
||||
create_bid_meeting_note_form_templates()
|
||||
create_accounts()
|
||||
# init_stripe_accounts()
|
||||
|
||||
# update_address_fields()
|
||||
# build_frontend()
|
||||
@ -354,6 +358,12 @@ def add_custom_fields():
|
||||
fieldtype="Table",
|
||||
options="Address Task Link",
|
||||
insert_after="projects"
|
||||
),
|
||||
dict(
|
||||
fieldname="is_service_address",
|
||||
label="Is Service Address",
|
||||
fieldtype="Check",
|
||||
insert_after="tasks"
|
||||
)
|
||||
],
|
||||
"Contact": [
|
||||
@ -393,6 +403,14 @@ def add_custom_fields():
|
||||
insert_after="customer_name"
|
||||
)
|
||||
],
|
||||
"Event": [
|
||||
dict(
|
||||
fieldname="participants",
|
||||
label="Participants",
|
||||
fieldtype="Section Break",
|
||||
insert_after="subject"
|
||||
)
|
||||
],
|
||||
"On-Site Meeting": [
|
||||
dict(
|
||||
fieldname="notes",
|
||||
@ -521,6 +539,20 @@ def add_custom_fields():
|
||||
options="Customer\nLead",
|
||||
insert_after="customer_name",
|
||||
allow_on_submit=1
|
||||
),
|
||||
dict(
|
||||
fieldname="from_template",
|
||||
label="From Template",
|
||||
fieldtype="Link",
|
||||
options="Quotation Template",
|
||||
insert_after="customer_type"
|
||||
),
|
||||
dict(
|
||||
fieldname="project_template",
|
||||
label="Project Template",
|
||||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
insert_after="from_template"
|
||||
)
|
||||
],
|
||||
"Sales Order": [
|
||||
@ -620,6 +652,26 @@ def add_custom_fields():
|
||||
default=0,
|
||||
insert_after="requires_half_payment"
|
||||
),
|
||||
dict(
|
||||
fieldname="service_appointment",
|
||||
label="Service Appointment",
|
||||
fieldtype="Link",
|
||||
options="Service Address 2",
|
||||
insert_after="is_half_down_paid"
|
||||
),
|
||||
dict(
|
||||
fieldname="tasks",
|
||||
label="Tasks",
|
||||
fieldtype="Table",
|
||||
options="Project Task Link",
|
||||
insert_after="service_appointment"
|
||||
),
|
||||
dict(
|
||||
fieldname="ready_to_schedule",
|
||||
label="Ready to Schedule",
|
||||
fieldtype="Check",
|
||||
insert_after="tasks"
|
||||
)
|
||||
],
|
||||
"Project Template": [
|
||||
dict(
|
||||
@ -635,6 +687,19 @@ def add_custom_fields():
|
||||
label="Calendar Color",
|
||||
fieldtype="Color",
|
||||
insert_after="company"
|
||||
),
|
||||
dict(
|
||||
fieldname="bid_meeting_note_form",
|
||||
label="Bid Meeting Note Form",
|
||||
fieldtype="Link",
|
||||
options="Bid Meeting Note Form",
|
||||
insert_after="calendar_color"
|
||||
),
|
||||
dict(
|
||||
fieldname="item_groups",
|
||||
label="Item Groups",
|
||||
fieldtype="Data",
|
||||
insert_after="bid_meeting_note_form"
|
||||
)
|
||||
],
|
||||
"Task": [
|
||||
@ -644,6 +709,130 @@ def add_custom_fields():
|
||||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
insert_after="project"
|
||||
),
|
||||
dict(
|
||||
fieldname="customer",
|
||||
label="Customer",
|
||||
fieldtype="Link",
|
||||
options="Customer",
|
||||
insert_after="project_template"
|
||||
)
|
||||
],
|
||||
"Task Type": [
|
||||
dict(
|
||||
fieldname="base_date",
|
||||
label="Base Date",
|
||||
fieldtype="Select",
|
||||
options="Start\nEnd\nCompletion\nCreation",
|
||||
reqd=1,
|
||||
insert_after="name"
|
||||
),
|
||||
dict(
|
||||
fieldname="offset_days",
|
||||
label="Offset Days",
|
||||
fieldtype="Int",
|
||||
reqd=1,
|
||||
insert_after="base_date"
|
||||
),
|
||||
dict(
|
||||
fieldname="skip_weekends",
|
||||
label="Skip Weekends",
|
||||
fieldtype="Check",
|
||||
insert_after="offset_days"
|
||||
),
|
||||
dict(
|
||||
fieldname="skip_holidays",
|
||||
label="Skip Holidays",
|
||||
fieldtype="Check",
|
||||
insert_after="skip_weekends"
|
||||
),
|
||||
dict(
|
||||
fieldname="logic_key",
|
||||
label="Logic Key",
|
||||
fieldtype="Data",
|
||||
insert_after="skip_holidays"
|
||||
),
|
||||
dict(
|
||||
fieldname="offset_direction",
|
||||
label="Offset Direction",
|
||||
fieldtype="Select",
|
||||
options="After\nBefore",
|
||||
reqd=1,
|
||||
insert_after="logic_key"
|
||||
),
|
||||
dict(
|
||||
fieldname="title",
|
||||
label="Title",
|
||||
fieldtype="Data",
|
||||
reqd=1,
|
||||
insert_after="offset_direction"
|
||||
),
|
||||
dict(
|
||||
fieldname="days",
|
||||
label="Days",
|
||||
fieldtype="Int",
|
||||
insert_after="title"
|
||||
),
|
||||
dict(
|
||||
fieldname="calculate_from",
|
||||
label="Calculate From",
|
||||
fieldtype="Select",
|
||||
options="Service Address 2\nProject\nTask",
|
||||
reqd=1,
|
||||
insert_after="days"
|
||||
),
|
||||
dict(
|
||||
fieldname="trigger",
|
||||
label="Trigger",
|
||||
fieldtype="Select",
|
||||
options="Scheduled\nCompleted\nCreated",
|
||||
reqd=1,
|
||||
insert_after="calculate_from"
|
||||
),
|
||||
dict(
|
||||
fieldname="task_type_calculate_from",
|
||||
label="Task Type For Task Calculate From",
|
||||
fieldtype="Link",
|
||||
options="Task Type",
|
||||
insert_after="trigger"
|
||||
),
|
||||
dict(
|
||||
fieldname="work_type",
|
||||
label="Work Type",
|
||||
fieldtype="Select",
|
||||
options="Admin\nLabor\nQA",
|
||||
reqd=1,
|
||||
insert_after="task_type_calculate_from"
|
||||
),
|
||||
dict(
|
||||
fieldname="no_due_date",
|
||||
label="No Due Date",
|
||||
fieldtype="Check",
|
||||
insert_after="work_type"
|
||||
),
|
||||
dict(
|
||||
fieldname="triggering_doctype",
|
||||
label="Triggering Doctype",
|
||||
fieldtype="Select",
|
||||
options="Service Address 2\nProject\nTask",
|
||||
reqd=1,
|
||||
insert_after="no_due_date"
|
||||
)
|
||||
],
|
||||
"Sales Invoice": [
|
||||
dict(
|
||||
fieldname="project_template",
|
||||
label="Project Template",
|
||||
fieldtype="Link",
|
||||
options="Project Template",
|
||||
insert_after="project"
|
||||
),
|
||||
dict(
|
||||
fieldname="job_address",
|
||||
label="Job Address",
|
||||
fieldtype="Link",
|
||||
options="Address",
|
||||
insert_after="project_template"
|
||||
)
|
||||
]
|
||||
}
|
||||
@ -1378,3 +1567,58 @@ def create_bid_meeting_note_form_templates():
|
||||
)
|
||||
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
def create_accounts():
|
||||
"""Create necessary accounts if they do not exist."""
|
||||
print("\n🔧 Checking for necessary accounts...")
|
||||
|
||||
accounts = [
|
||||
{
|
||||
"Sprinklers Northwest": [
|
||||
{
|
||||
"account_name": "Stripe Clearing - Sprinklers Northwest",
|
||||
"account_type": "Bank",
|
||||
"parent_account": "Bank Accounts - S",
|
||||
"company": "Sprinklers Northwest"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
for company_accounts in accounts:
|
||||
for company, account_list in company_accounts.items():
|
||||
for account in account_list:
|
||||
# Idempotency check
|
||||
if frappe.db.exists("Account", {"account_name": account["account_name"], "company": account["company"]}):
|
||||
continue
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Account",
|
||||
"account_name": account["account_name"],
|
||||
"account_type": account["account_type"],
|
||||
"company": account["company"],
|
||||
"parent_account": account["parent_account"],
|
||||
"is_group": 0
|
||||
})
|
||||
doc.insert(ignore_permissions=True, ignore_if_duplicate=True)
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
def init_stripe_accounts():
|
||||
"""Initializes the bare configurations for each Stripe Settings doctypes."""
|
||||
print("\n🔧 Initializing Stripe Settings for companies...")
|
||||
|
||||
companies = ["Sprinklers Northwest"]
|
||||
|
||||
for company in companies:
|
||||
if not frappe.db.exists("Stripe Settings", {"company": company}):
|
||||
doc = frappe.get_doc({
|
||||
"doctype": "Stripe Settings",
|
||||
"company": company,
|
||||
"api_key": "",
|
||||
"publishable_key": "",
|
||||
"webhook_secret": "",
|
||||
"account": f"Stripe Clearing - {company}"
|
||||
})
|
||||
doc.insert(ignore_permissions=True)
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
2
custom_ui/models/__init__.py
Normal file
2
custom_ui/models/__init__.py
Normal file
@ -0,0 +1,2 @@
|
||||
from .payments import PaymentData
|
||||
from .item_models import BOMItem, PackageCreationData
|
||||
18
custom_ui/models/item_models.py
Normal file
18
custom_ui/models/item_models.py
Normal file
@ -0,0 +1,18 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class BOMItem:
|
||||
item_code: str
|
||||
qty: float
|
||||
uom: str
|
||||
item_name: str = None
|
||||
|
||||
@dataclass
|
||||
class PackageCreationData:
|
||||
package_name: str
|
||||
items: list[BOMItem]
|
||||
item_group: str
|
||||
code_prefix: str
|
||||
rate: float = 0.0
|
||||
company: str = None
|
||||
description: str = None
|
||||
10
custom_ui/models/payments.py
Normal file
10
custom_ui/models/payments.py
Normal file
@ -0,0 +1,10 @@
|
||||
from dataclasses import dataclass
|
||||
|
||||
@dataclass
|
||||
class PaymentData:
|
||||
mode_of_payment: str
|
||||
reference_no: str
|
||||
reference_date: str
|
||||
received_amount: float
|
||||
company: str = None
|
||||
reference_doc_name: str = None
|
||||
@ -6,4 +6,9 @@ from .estimate_service import EstimateService
|
||||
from .onsite_meeting_service import OnSiteMeetingService
|
||||
from .task_service import TaskService
|
||||
from .service_appointment_service import ServiceAppointmentService
|
||||
from .stripe_service import StripeService
|
||||
from .stripe_service import StripeService
|
||||
from .payment_service import PaymentService
|
||||
from .item_service import ItemService
|
||||
from .project_service import ProjectService
|
||||
from .sales_order_service import SalesOrderService
|
||||
from .email_service import EmailService
|
||||
@ -186,6 +186,7 @@ class AddressService:
|
||||
address_doc.append(field, link)
|
||||
print("DEBUG: Saving address document after appending link.")
|
||||
address_doc.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
print(f"DEBUG: Set link field {field} for Address {address_name} with link data {link}")
|
||||
|
||||
@staticmethod
|
||||
|
||||
@ -55,6 +55,7 @@ class ClientService:
|
||||
client_doc.append(field, link)
|
||||
print("DEBUG: Saving client document after appending link.")
|
||||
client_doc.save(ignore_permissions=True)
|
||||
frappe.db.commit()
|
||||
print(f"DEBUG: Set link field {field} for client {client_doc.get('name')} with link data {link}")
|
||||
|
||||
@staticmethod
|
||||
@ -91,6 +92,7 @@ class ClientService:
|
||||
try:
|
||||
print(f"DEBUG: Processing address: {address.get('address')}")
|
||||
ClientService.append_link_v2(customer_doc.name, "properties", {"address": address.get("address")})
|
||||
customer_doc.reload()
|
||||
address_doc = AddressService.get_or_throw(address.get("address"))
|
||||
AddressService.link_address_to_customer(address_doc, "Customer", customer_doc.name)
|
||||
print(f"DEBUG: Linked address {address.get('address')} to customer")
|
||||
@ -104,6 +106,7 @@ class ClientService:
|
||||
try:
|
||||
print(f"DEBUG: Processing contact: {contact.get('contact')}")
|
||||
ClientService.append_link_v2(customer_doc.name, "contacts", {"contact": contact.get("contact")})
|
||||
customer_doc.reload()
|
||||
contact_doc = ContactService.get_or_throw(contact.get("contact"))
|
||||
ContactService.link_contact_to_customer(contact_doc, "Customer", customer_doc.name)
|
||||
print(f"DEBUG: Linked contact {contact.get('contact')} to customer")
|
||||
@ -117,6 +120,7 @@ class ClientService:
|
||||
try:
|
||||
print(f"DEBUG: Processing quotation: {quotation.get('quotation')}")
|
||||
ClientService.append_link_v2(customer_doc.name, "quotations", {"quotation": quotation.get("quotation")})
|
||||
customer_doc.reload()
|
||||
quotation_doc = EstimateService.get_or_throw(quotation.get("quotation"))
|
||||
EstimateService.link_estimate_to_customer(quotation_doc, "Customer", customer_doc.name)
|
||||
print(f"DEBUG: Linked quotation {quotation.get('quotation')} to customer")
|
||||
@ -130,6 +134,7 @@ class ClientService:
|
||||
print(f"DEBUG: Processing onsite meeting: {meeting.get('onsite_meeting')}")
|
||||
meeting_doc = DbService.get_or_throw("On-Site Meeting",meeting.get("onsite_meeting"))
|
||||
ClientService.append_link_v2(customer_doc.name, "onsite_meetings", {"onsite_meeting": meeting.get("onsite_meeting")})
|
||||
customer_doc.reload()
|
||||
OnSiteMeetingService.link_onsite_meeting_to_customer(meeting_doc, "Customer", customer_doc.name)
|
||||
print(f"DEBUG: Linked onsite meeting {meeting.get('onsite_meeting')} to customer")
|
||||
except Exception as e:
|
||||
@ -141,11 +146,13 @@ class ClientService:
|
||||
try:
|
||||
print(f"DEBUG: Processing company: {company.get('company')}")
|
||||
ClientService.append_link_v2(customer_doc.name, "companies", {"company": company.get("company")})
|
||||
customer_doc.reload()
|
||||
print(f"DEBUG: Linked company {company.get('company')} to customer")
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to link company {company.get('company')}: {str(e)}")
|
||||
frappe.log_error(f"Company linking error: {str(e)}", "convert_lead_to_customer")
|
||||
print(f"DEBUG: Converted Lead {lead_name} to Customer {customer_doc.name}")
|
||||
frappe.db.commit()
|
||||
return customer_doc
|
||||
|
||||
except Exception as e:
|
||||
|
||||
240
custom_ui/services/email_service.py
Normal file
240
custom_ui/services/email_service.py
Normal file
@ -0,0 +1,240 @@
|
||||
import frappe
|
||||
from frappe.utils import get_url
|
||||
|
||||
class EmailService:
|
||||
|
||||
@staticmethod
|
||||
def get_customer_email(customer_name: str, doctype: str = "Customer") -> str | None:
|
||||
"""
|
||||
Get the primary email for a customer or lead.
|
||||
|
||||
Args:
|
||||
customer_name: Name of the Customer or Lead
|
||||
doctype: Either "Customer" or "Lead"
|
||||
|
||||
Returns:
|
||||
Email address if found, None otherwise
|
||||
"""
|
||||
try:
|
||||
customer_doc = frappe.get_doc(doctype, customer_name)
|
||||
email = None
|
||||
|
||||
# Try primary_contact field
|
||||
if hasattr(customer_doc, 'primary_contact') and customer_doc.primary_contact:
|
||||
try:
|
||||
primary_contact = frappe.get_doc("Contact", customer_doc.primary_contact)
|
||||
email = primary_contact.email_id
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not get primary_contact: {str(e)}")
|
||||
|
||||
# Fallback to customer_primary_contact
|
||||
if not email and hasattr(customer_doc, 'customer_primary_contact') and customer_doc.customer_primary_contact:
|
||||
try:
|
||||
primary_contact = frappe.get_doc("Contact", customer_doc.customer_primary_contact)
|
||||
email = primary_contact.email_id
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not get customer_primary_contact: {str(e)}")
|
||||
|
||||
# Last resort - get any contact linked to this customer/lead
|
||||
if not email:
|
||||
contact_links = frappe.get_all("Dynamic Link",
|
||||
filters={
|
||||
"link_doctype": doctype,
|
||||
"link_name": customer_name,
|
||||
"parenttype": "Contact"
|
||||
},
|
||||
pluck="parent"
|
||||
)
|
||||
if contact_links:
|
||||
try:
|
||||
contact = frappe.get_doc("Contact", contact_links[0])
|
||||
email = contact.email_id
|
||||
except Exception as e:
|
||||
print(f"Warning: Could not get contact from dynamic link: {str(e)}")
|
||||
|
||||
return email
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to get email for {doctype} {customer_name}: {str(e)}")
|
||||
return None
|
||||
|
||||
@staticmethod
|
||||
def send_templated_email(
|
||||
recipients: str | list,
|
||||
subject: str,
|
||||
template_path: str,
|
||||
template_context: dict,
|
||||
doctype: str = None,
|
||||
docname: str = None,
|
||||
cc: str | list = None,
|
||||
bcc: str | list = None,
|
||||
attachments: list = None
|
||||
) -> bool:
|
||||
"""
|
||||
Send an email using a Jinja2 template.
|
||||
|
||||
Args:
|
||||
recipients: Email address(es) to send to
|
||||
subject: Email subject line
|
||||
template_path: Path to the Jinja2 template (relative to app root)
|
||||
template_context: Dictionary of variables to pass to template
|
||||
doctype: Optional doctype to link email to
|
||||
docname: Optional document name to link email to
|
||||
cc: Optional CC recipients
|
||||
bcc: Optional BCC recipients
|
||||
attachments: Optional list of attachments
|
||||
|
||||
Returns:
|
||||
True if email sent successfully, False otherwise
|
||||
"""
|
||||
try:
|
||||
# Render the email template
|
||||
message = frappe.render_template(template_path, template_context)
|
||||
|
||||
# Prepare sendmail arguments
|
||||
email_args = {
|
||||
"recipients": recipients,
|
||||
"subject": subject,
|
||||
"message": message,
|
||||
}
|
||||
|
||||
if doctype:
|
||||
email_args["doctype"] = doctype
|
||||
if docname:
|
||||
email_args["name"] = docname
|
||||
if cc:
|
||||
email_args["cc"] = cc
|
||||
if bcc:
|
||||
email_args["bcc"] = bcc
|
||||
if attachments:
|
||||
email_args["attachments"] = attachments
|
||||
|
||||
# Send email
|
||||
frappe.sendmail(**email_args)
|
||||
|
||||
print(f"DEBUG: Email sent successfully to {recipients}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to send email: {str(e)}")
|
||||
frappe.log_error(f"Failed to send email to {recipients}: {str(e)}", "Email Service Error")
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def send_downpayment_email(sales_order_name: str) -> bool:
|
||||
"""
|
||||
Send a down payment email for a Sales Order.
|
||||
|
||||
Args:
|
||||
sales_order_name: Name of the Sales Order
|
||||
|
||||
Returns:
|
||||
True if email sent successfully, False otherwise
|
||||
"""
|
||||
try:
|
||||
doc = frappe.get_doc("Sales Order", sales_order_name)
|
||||
|
||||
# Get customer email
|
||||
email = EmailService.get_customer_email(doc.customer, "Customer")
|
||||
|
||||
if not email:
|
||||
print(f"ERROR: No email found for customer {doc.customer}, cannot send down payment email")
|
||||
return False
|
||||
|
||||
# Prepare template context
|
||||
half_down_amount = doc.custom_halfdown_amount or (doc.grand_total / 2)
|
||||
base_url = get_url()
|
||||
|
||||
template_context = {
|
||||
"company_name": doc.company,
|
||||
"customer_name": doc.customer_name or doc.customer,
|
||||
"sales_order_number": doc.name,
|
||||
"total_amount": frappe.utils.fmt_money(half_down_amount, currency=doc.currency),
|
||||
"base_url": base_url
|
||||
}
|
||||
|
||||
# Send email
|
||||
template_path = "custom_ui/templates/emails/downpayment.html"
|
||||
subject = f"Down Payment Required - {doc.company} - {doc.name}"
|
||||
|
||||
return EmailService.send_templated_email(
|
||||
recipients=email,
|
||||
subject=subject,
|
||||
template_path=template_path,
|
||||
template_context=template_context,
|
||||
doctype="Sales Order",
|
||||
docname=doc.name
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to send down payment email for {sales_order_name}: {str(e)}")
|
||||
frappe.log_error(f"Failed to send down payment email for {sales_order_name}: {str(e)}", "Down Payment Email Error")
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def send_invoice_email(sales_invoice_name: str) -> bool:
|
||||
"""
|
||||
Send an invoice email for a Sales Invoice.
|
||||
|
||||
Args:
|
||||
sales_invoice_name: Name of the Sales Invoice
|
||||
|
||||
Returns:
|
||||
True if email sent successfully, False otherwise
|
||||
"""
|
||||
try:
|
||||
doc = frappe.get_doc("Sales Invoice", sales_invoice_name)
|
||||
|
||||
# Get customer email
|
||||
email = EmailService.get_customer_email(doc.customer, "Customer")
|
||||
|
||||
if not email:
|
||||
print(f"ERROR: No email found for customer {doc.customer}, cannot send invoice email")
|
||||
return False
|
||||
|
||||
# Calculate amounts
|
||||
outstanding_amount = doc.outstanding_amount
|
||||
paid_amount = doc.grand_total - outstanding_amount
|
||||
|
||||
# Get related Sales Order if available
|
||||
sales_order = None
|
||||
if hasattr(doc, 'items') and doc.items:
|
||||
for item in doc.items:
|
||||
if item.sales_order:
|
||||
sales_order = item.sales_order
|
||||
break
|
||||
|
||||
# Prepare template context
|
||||
base_url = get_url()
|
||||
|
||||
template_context = {
|
||||
"company_name": doc.company,
|
||||
"customer_name": doc.customer_name or doc.customer,
|
||||
"invoice_number": doc.name,
|
||||
"invoice_date": doc.posting_date,
|
||||
"due_date": doc.due_date,
|
||||
"grand_total": frappe.utils.fmt_money(doc.grand_total, currency=doc.currency),
|
||||
"outstanding_amount": frappe.utils.fmt_money(outstanding_amount, currency=doc.currency),
|
||||
"paid_amount": frappe.utils.fmt_money(paid_amount, currency=doc.currency),
|
||||
"sales_order": sales_order,
|
||||
"base_url": base_url,
|
||||
"payment_url": f"{base_url}/api/method/custom_ui.api.public.payments.invoice_stripe_payment?sales_invoice={doc.name}" if outstanding_amount > 0 else None
|
||||
}
|
||||
|
||||
# Send email
|
||||
template_path = "custom_ui/templates/emails/invoice.html"
|
||||
subject = f"Invoice {doc.name} - {doc.company}"
|
||||
|
||||
return EmailService.send_templated_email(
|
||||
recipients=email,
|
||||
subject=subject,
|
||||
template_path=template_path,
|
||||
template_context=template_context,
|
||||
doctype="Sales Invoice",
|
||||
docname=doc.name
|
||||
)
|
||||
|
||||
except Exception as e:
|
||||
print(f"ERROR: Failed to send invoice email for {sales_invoice_name}: {str(e)}")
|
||||
frappe.log_error(f"Failed to send invoice email for {sales_invoice_name}: {str(e)}", "Invoice Email Error")
|
||||
return False
|
||||
@ -1,4 +1,5 @@
|
||||
import frappe
|
||||
from .item_service import ItemService
|
||||
|
||||
class EstimateService:
|
||||
|
||||
@ -93,4 +94,18 @@ class EstimateService:
|
||||
estimate_doc.customer = customer_name
|
||||
estimate_doc.save(ignore_permissions=True)
|
||||
print(f"DEBUG: Linked Quotation {estimate_doc.name} to {customer_type} {customer_name}")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def map_project_template_to_filter(project_template: str = None) -> dict | None:
|
||||
"""Map a project template to a filter."""
|
||||
print(f"DEBUG: Mapping project template {project_template} to quotation category")
|
||||
if not project_template:
|
||||
print("DEBUG: No project template provided, defaulting to 'General'")
|
||||
return None
|
||||
mapping = {
|
||||
# SNW Install is both Irrigation and SNW-S categories
|
||||
"SNW Install": ["in", ["Irrigation", "SNW-S", "Landscaping"]],
|
||||
}
|
||||
category = mapping.get(project_template, "General")
|
||||
print(f"DEBUG: Mapped to quotation category: {category}")
|
||||
return { "item_group": category }
|
||||
204
custom_ui/services/item_service.py
Normal file
204
custom_ui/services/item_service.py
Normal file
@ -0,0 +1,204 @@
|
||||
import frappe
|
||||
|
||||
class ItemService:
|
||||
|
||||
@staticmethod
|
||||
def get_item_category(item_code: str) -> str:
|
||||
"""Retrieve the category of an Item document by item code."""
|
||||
print(f"DEBUG: Getting category for Item {item_code}")
|
||||
category = frappe.db.get_value("Item", item_code, "item_group")
|
||||
print(f"DEBUG: Retrieved category: {category}")
|
||||
return category
|
||||
|
||||
@staticmethod
|
||||
def get_full_dict(item_code: str) -> frappe._dict:
|
||||
"""Retrieve the full Item document by item code."""
|
||||
print(f"DEBUG: Getting full document for Item {item_code}")
|
||||
item_doc = frappe.get_doc("Item", item_code).as_dict()
|
||||
item_doc["bom"] = ItemService.get_full_bom_dict(item_code) if item_doc.get("default_bom") else None
|
||||
return item_doc
|
||||
|
||||
@staticmethod
|
||||
def get_full_bom_dict(item_code: str):
|
||||
"""Retrieve the Bill of Materials (BOM) associated with an Item."""
|
||||
print(f"DEBUG: Getting BOM for Item {item_code}")
|
||||
bom_name = frappe.db.get_value("BOM", {"item": item_code, "is_active": 1}, "name")
|
||||
bom_dict = frappe.get_doc("BOM", bom_name).as_dict()
|
||||
for item in bom_dict.get('items', []):
|
||||
bom_no = item.get("bom_no")
|
||||
if bom_no:
|
||||
bom_item_code = frappe.db.get_value("BOM", bom_no, "item")
|
||||
item["bom"] = ItemService.get_full_bom_dict(bom_item_code)
|
||||
return bom_dict
|
||||
|
||||
@staticmethod
|
||||
def exists(item_code: str) -> bool:
|
||||
"""Check if an Item document exists by item code."""
|
||||
print(f"DEBUG: Checking existence of Item {item_code}")
|
||||
exists = frappe.db.exists("Item", item_code) is not None
|
||||
print(f"DEBUG: Item {item_code} exists: {exists}")
|
||||
return exists
|
||||
|
||||
@staticmethod
|
||||
def get_child_groups(item_group: str) -> list[str]:
|
||||
"""Retrieve all child item groups of a given item group."""
|
||||
print(f"DEBUG: Getting child groups for Item Group {item_group}")
|
||||
children = []
|
||||
child_groups = frappe.get_all("Item Group", filters={"parent_item_group": item_group}, pluck="name")
|
||||
if child_groups:
|
||||
children.extend(child_groups)
|
||||
print(f"DEBUG: Found child groups: {child_groups}. Checking for further children.")
|
||||
for child_group in child_groups:
|
||||
additional_child_groups = ItemService.get_child_groups(child_group)
|
||||
children.extend(additional_child_groups)
|
||||
|
||||
print(f"DEBUG: Retrieved child groups: {child_groups}")
|
||||
return children
|
||||
|
||||
@staticmethod
|
||||
def get_item_names_by_group(item_groups: set[str]) -> list[str]:
|
||||
"""Retrieve item names for items belonging to the specified item groups."""
|
||||
print(f"DEBUG: Getting item names for Item Groups {item_groups}")
|
||||
items = frappe.get_all("Item", filters={"item_group": ["in", list(item_groups)]}, pluck="name")
|
||||
print(f"DEBUG: Retrieved item names: {items}")
|
||||
return items
|
||||
|
||||
@staticmethod
|
||||
def get_items_by_groups(item_groups: list[str]) -> list[dict]:
|
||||
"""Retrieve all items belonging to the specified item groups."""
|
||||
print(f"DEBUG: Getting items for Item Groups {item_groups}")
|
||||
all_groups = set(item_groups)
|
||||
for group in item_groups:
|
||||
all_groups.update(ItemService.get_child_groups(group))
|
||||
|
||||
# Batch fetch all items at once with all needed fields
|
||||
items = frappe.get_all(
|
||||
"Item",
|
||||
filters={"item_group": ["in", list(all_groups)]},
|
||||
fields=[
|
||||
"name", "item_code", "item_name", "item_group", "description",
|
||||
"standard_rate", "stock_uom", "default_bom"
|
||||
]
|
||||
)
|
||||
|
||||
# Get all item codes that have BOMs
|
||||
items_with_boms = [item for item in items if item.get("default_bom")]
|
||||
item_codes_with_boms = [item["item_code"] for item in items_with_boms]
|
||||
|
||||
# Batch fetch all BOMs and their nested structure
|
||||
bom_dict = ItemService.batch_fetch_boms(item_codes_with_boms) if item_codes_with_boms else {}
|
||||
|
||||
# Attach BOMs to items
|
||||
for item in items:
|
||||
if item.get("default_bom"):
|
||||
item["bom"] = bom_dict.get(item["item_code"])
|
||||
else:
|
||||
item["bom"] = None
|
||||
|
||||
print(f"DEBUG: Retrieved {len(items)} items")
|
||||
return items
|
||||
|
||||
@staticmethod
|
||||
def batch_fetch_boms(item_codes: list[str]) -> dict:
|
||||
"""Batch fetch all BOMs and build nested structure efficiently."""
|
||||
if not item_codes:
|
||||
return {}
|
||||
|
||||
print(f"DEBUG: Batch fetching BOMs for {len(item_codes)} items")
|
||||
|
||||
# Fetch all active BOMs for the given items
|
||||
boms = frappe.get_all(
|
||||
"BOM",
|
||||
filters={"item": ["in", item_codes], "is_active": 1},
|
||||
fields=["name", "item"]
|
||||
)
|
||||
|
||||
if not boms:
|
||||
return {}
|
||||
|
||||
bom_names = [bom["name"] for bom in boms]
|
||||
|
||||
# Fetch all BOM items (children) in one query
|
||||
bom_items = frappe.get_all(
|
||||
"BOM Item",
|
||||
filters={"parent": ["in", bom_names]},
|
||||
fields=["parent", "item_code", "item_name", "qty", "uom", "bom_no"],
|
||||
order_by="idx"
|
||||
)
|
||||
|
||||
# Group BOM items by their parent BOM
|
||||
bom_items_map = {}
|
||||
nested_bom_items = set()
|
||||
|
||||
for bom_item in bom_items:
|
||||
parent = bom_item["parent"]
|
||||
if parent not in bom_items_map:
|
||||
bom_items_map[parent] = []
|
||||
bom_items_map[parent].append(bom_item)
|
||||
|
||||
# Track which items have nested BOMs
|
||||
if bom_item.get("bom_no"):
|
||||
nested_bom_items.add(bom_item["item_code"])
|
||||
|
||||
# Recursively fetch nested BOMs if any
|
||||
nested_bom_dict = {}
|
||||
if nested_bom_items:
|
||||
nested_bom_dict = ItemService.batch_fetch_boms(list(nested_bom_items))
|
||||
|
||||
# Build the result dictionary mapping item_code to its BOM structure
|
||||
result = {}
|
||||
for bom in boms:
|
||||
bom_name = bom["name"]
|
||||
item_code = bom["item"]
|
||||
|
||||
items = bom_items_map.get(bom_name, [])
|
||||
# Attach nested BOMs to items
|
||||
for item in items:
|
||||
if item.get("bom_no"):
|
||||
item["bom"] = nested_bom_dict.get(item["item_code"])
|
||||
else:
|
||||
item["bom"] = None
|
||||
|
||||
result[item_code] = {
|
||||
"name": bom_name,
|
||||
"items": items
|
||||
}
|
||||
|
||||
return result
|
||||
|
||||
@staticmethod
|
||||
def build_category_dict(items: list[dict]) -> dict:
|
||||
"""Build a dictionary categorizing items by their item group."""
|
||||
print(f"DEBUG: Building category dictionary for items")
|
||||
category_dict = {}
|
||||
category_dict["Packages"] = {}
|
||||
for item in items:
|
||||
if item.get("bom"):
|
||||
if item.get("item_group", "Uncategorized") not in category_dict["Packages"]:
|
||||
category_dict["Packages"][item.get("item_group", "Uncategorized")] = []
|
||||
category_dict["Packages"][item.get("item_group", "Uncategorized")].append(item)
|
||||
else:
|
||||
category = item.get("item_group", "Uncategorized")
|
||||
if category not in category_dict:
|
||||
category_dict[category] = []
|
||||
category_dict[category].append(item)
|
||||
print(f"DEBUG: Built category dictionary with categories: {list(category_dict.keys())}")
|
||||
return category_dict
|
||||
|
||||
@staticmethod
|
||||
def build_item_code(prefix: str, item_name: str) -> str:
|
||||
"""Build a unique item code based on the provided prefix and item name."""
|
||||
print(f"DEBUG: Building item code with prefix: {prefix} and item name: {item_name}")
|
||||
# Replace all " " with "-" and convert to uppercase
|
||||
base_code = f"{prefix}-{item_name.replace(' ', '-').upper()}"
|
||||
# Check for existing items with the same base code and append a number if necessary
|
||||
existing_codes = frappe.get_all("Item", filters={"item_code": ["like", f"{base_code}-%"]}, pluck="item_code")
|
||||
if base_code in existing_codes:
|
||||
suffix = 1
|
||||
while f"{base_code}-{suffix}" in existing_codes:
|
||||
suffix += 1
|
||||
final_code = f"{base_code}-{suffix}"
|
||||
else:
|
||||
final_code = base_code
|
||||
print(f"DEBUG: Built item code: {final_code}")
|
||||
return final_code
|
||||
@ -1,29 +1,52 @@
|
||||
import frappe
|
||||
from custom_ui.services import DbService
|
||||
from custom_ui.services import DbService, StripeService
|
||||
from dataclasses import dataclass
|
||||
from custom_ui.models import PaymentData
|
||||
|
||||
|
||||
|
||||
class PaymentService:
|
||||
|
||||
@staticmethod
|
||||
def create_payment_entry(reference_doctype: str, reference_doc_name: str, data: dict) -> frappe._dict:
|
||||
def create_payment_entry(data: PaymentData) -> frappe._dict:
|
||||
"""Create a Payment Entry document based on the reference document."""
|
||||
print(f"DEBUG: Creating Payment Entry for {reference_doctype} {reference_doc_name} with data: {data}")
|
||||
reference_doc = DbService.get_or_throw(reference_doctype, reference_doc_name)
|
||||
print(f"DEBUG: Creating Payment Entry for {data.reference_doc_name} with data: {data}")
|
||||
reference_doctype = PaymentService.determine_reference_doctype(data.reference_doc_name)
|
||||
reference_doc = DbService.get_or_throw(reference_doctype, data.reference_doc_name)
|
||||
account = StripeService.get_stripe_settings(data.company).custom_account
|
||||
pe = frappe.get_doc({
|
||||
"doctype": "Payment Entry",
|
||||
"company": data.company,
|
||||
"payment_type": "Receive",
|
||||
"party_type": "Customer",
|
||||
"mode_of_payment": data.get("mode_of_payment", "Stripe"),
|
||||
"mode_of_payment": data.mode_of_payment or "Stripe",
|
||||
"party": reference_doc.customer,
|
||||
"party_name": reference_doc.customer,
|
||||
"paid_to": data.get("paid_to"),
|
||||
"reference_no": data.get("reference_no"),
|
||||
"reference_date": data.get("reference_date", frappe.utils.nowdate()),
|
||||
"reference_doctype": reference_doctype,
|
||||
"reference_name": reference_doc.name,
|
||||
"paid_amount": data.get("paid_amount"),
|
||||
"paid_currency": data.get("paid_currency"),
|
||||
"paid_to": account,
|
||||
"reference_no": data.reference_no,
|
||||
"reference_date": data.reference_date or frappe.utils.nowdate(),
|
||||
"paid_amount": data.received_amount,
|
||||
"received_amount": data.received_amount,
|
||||
"paid_currency": "USD",
|
||||
"received_currency": "USD",
|
||||
"references": [{
|
||||
"reference_doctype": reference_doc.doctype,
|
||||
"reference_name": reference_doc.name,
|
||||
"allocated_amount": data.received_amount,
|
||||
}]
|
||||
})
|
||||
pe.insert()
|
||||
print(f"DEBUG: Created Payment Entry with name: {pe.name}")
|
||||
return pe.as_dict()
|
||||
return pe
|
||||
|
||||
@staticmethod
|
||||
def determine_reference_doctype(reference_doc_name: str) -> str:
|
||||
"""Determine the reference doctype based on the document name pattern."""
|
||||
print(f"DEBUG: Determining reference doctype for document name: {reference_doc_name}")
|
||||
if DbService.exists("Sales Order", reference_doc_name):
|
||||
return "Sales Order"
|
||||
elif DbService.exists("Sales Invoice", reference_doc_name):
|
||||
return "Sales Invoice"
|
||||
else:
|
||||
frappe.throw("Unable to determine reference doctype from document name.")
|
||||
|
||||
12
custom_ui/services/project_service.py
Normal file
12
custom_ui/services/project_service.py
Normal file
@ -0,0 +1,12 @@
|
||||
import frappe
|
||||
|
||||
class ProjectService:
|
||||
|
||||
@staticmethod
|
||||
def get_project_item_groups(project_template: str) -> list[str]:
|
||||
"""Retrieve item groups associated with a given project template."""
|
||||
print(f"DEBUG: Getting item groups for Project Template {project_template}")
|
||||
item_groups_str = frappe.db.get_value("Project Template", project_template, "item_groups") or ""
|
||||
item_groups = [item_group.strip() for item_group in item_groups_str.split(",") if item_group.strip()]
|
||||
print(f"DEBUG: Retrieved item groups: {item_groups}")
|
||||
return item_groups
|
||||
@ -1,7 +1,23 @@
|
||||
import frappe
|
||||
|
||||
from frappe.utils import today
|
||||
from erpnext.selling.doctype.sales_order.sales_order import make_sales_invoice
|
||||
|
||||
class SalesOrderService:
|
||||
|
||||
@staticmethod
|
||||
def apply_advance_payment(sales_order_name: str, payment_entry_doc):
|
||||
pass
|
||||
def create_sales_invoice_from_sales_order(sales_order_name):
|
||||
try:
|
||||
sales_order_doc = frappe.get_doc("Sales Order", sales_order_name)
|
||||
sales_invoice = make_sales_invoice(sales_order_doc.name)
|
||||
sales_invoice.project = sales_order_doc.project
|
||||
sales_invoice.posting_date = today()
|
||||
sales_invoice.due_date = today()
|
||||
sales_invoice.remarks = f"Auto-generated from Sales Order {sales_order_doc.name}"
|
||||
sales_invoice.job_address = sales_order_doc.custom_job_address
|
||||
sales_invoice.project_template = sales_order_doc.custom_project_template
|
||||
sales_invoice.insert()
|
||||
sales_invoice.submit()
|
||||
return sales_invoice.name
|
||||
except Exception as e:
|
||||
print("ERROR creating Sales Invoice from Sales Order:", str(e))
|
||||
return None
|
||||
@ -9,7 +9,7 @@ class StripeService:
|
||||
@staticmethod
|
||||
def get_stripe_settings(company: str):
|
||||
"""Fetch Stripe settings for a given company."""
|
||||
settings_name = frappe.get_all("Stripe Settings", pluck="name", filters={"company": company})
|
||||
settings_name = frappe.get_all("Stripe Settings", pluck="name", filters={"custom_company": company})
|
||||
if not settings_name:
|
||||
frappe.throw(f"Stripe Settings not found for company: {company}")
|
||||
settings = frappe.get_doc("Stripe Settings", settings_name[0]) if settings_name else None
|
||||
@ -19,63 +19,138 @@ class StripeService:
|
||||
def get_api_key(company: str) -> str:
|
||||
"""Retrieve the Stripe API key for the specified company."""
|
||||
settings = StripeService.get_stripe_settings(company)
|
||||
return settings.secret_key
|
||||
return settings.get_password("secret_key")
|
||||
|
||||
@staticmethod
|
||||
def get_webhook_secret(company: str) -> str:
|
||||
"""Retrieve the Stripe webhook secret for the specified company."""
|
||||
settings = StripeService.get_stripe_settings(company)
|
||||
if not settings.webhook_secret:
|
||||
if not settings.custom_webhook_secret:
|
||||
frappe.throw(f"Stripe Webhook Secret not configured for company: {company}")
|
||||
return settings.webhook_secret
|
||||
return settings.custom_webhook_secret
|
||||
|
||||
@staticmethod
|
||||
def create_checkout_session(company: str, amount: float, service: str, order_num: str, currency: str = "usd", for_advance_payment: bool = False, line_items: list | None = None) -> stripe.checkout.Session:
|
||||
"""Create a Stripe Checkout Session. order_num is a Sales Order name if for_advance_payment is True, otherwise it is a Sales Invoice name."""
|
||||
def create_checkout_session(
|
||||
company: str,
|
||||
amount: float,
|
||||
service: str,
|
||||
order_num: str,
|
||||
currency: str = "usd",
|
||||
for_advance_payment: bool = False,
|
||||
line_items: list | None = None,
|
||||
sales_invoice: str = None
|
||||
) -> stripe.checkout.Session:
|
||||
"""
|
||||
Create a Stripe Checkout Session.
|
||||
|
||||
Args:
|
||||
company: Company name
|
||||
amount: Payment amount (should be the outstanding amount for invoices)
|
||||
service: Service description
|
||||
order_num: Sales Order name if for_advance_payment is True, otherwise Sales Invoice name
|
||||
currency: Currency code (default: "usd")
|
||||
for_advance_payment: True if this is an advance/down payment, False for full invoice payment
|
||||
line_items: Optional custom line items for the checkout session
|
||||
sales_invoice: Sales Invoice name (for full payments)
|
||||
|
||||
Returns:
|
||||
stripe.checkout.Session object
|
||||
"""
|
||||
stripe.api_key = StripeService.get_api_key(company)
|
||||
|
||||
# Determine payment description
|
||||
if for_advance_payment:
|
||||
description = f"Advance payment for {company}{' - ' + service if service else ''}"
|
||||
else:
|
||||
description = f"Invoice payment for {company}{' - ' + service if service else ''}"
|
||||
if sales_invoice:
|
||||
description = f"Invoice {sales_invoice} - {company}"
|
||||
|
||||
# Use custom line items if provided and not an advance payment, otherwise create default line item
|
||||
line_items = line_items if line_items and not for_advance_payment else [{
|
||||
"price_data": {
|
||||
"currency": currency.lower(),
|
||||
"product_data": {
|
||||
"name": f"Advance payment for {company}{' - ' + service if service else ''}"
|
||||
"name": description
|
||||
},
|
||||
"unit_amount": int(amount * 100),
|
||||
"unit_amount": int(amount * 100), # Stripe expects amount in cents
|
||||
},
|
||||
"quantity": 1,
|
||||
}]
|
||||
|
||||
# Prepare metadata
|
||||
metadata = {
|
||||
"company": company,
|
||||
"payment_type": "advance" if for_advance_payment else "full"
|
||||
}
|
||||
|
||||
# Add appropriate document reference to metadata
|
||||
if for_advance_payment:
|
||||
metadata["sales_order"] = order_num
|
||||
else:
|
||||
metadata["sales_invoice"] = sales_invoice or order_num
|
||||
if sales_invoice:
|
||||
# Check if there's a related sales order
|
||||
invoice_doc = frappe.get_doc("Sales Invoice", sales_invoice)
|
||||
if hasattr(invoice_doc, 'items') and invoice_doc.items:
|
||||
for item in invoice_doc.items:
|
||||
if item.sales_order:
|
||||
metadata["sales_order"] = item.sales_order
|
||||
break
|
||||
|
||||
session = stripe.checkout.Session.create(
|
||||
mode="payment",
|
||||
payment_method_types=["card"],
|
||||
line_items=line_items,
|
||||
metadata={
|
||||
"order_num": order_num,
|
||||
"company": company,
|
||||
"payment_type": "advance" if for_advance_payment else "full"
|
||||
},
|
||||
success_url=f"{get_url()}/payment-success?session_id={{CHECKOUT_SESSION_ID}}",
|
||||
cancel_url=f"{get_url()}/payment-cancelled",
|
||||
metadata=metadata,
|
||||
success_url=f"{get_url()}/payment_success?session_id={{CHECKOUT_SESSION_ID}}",
|
||||
cancel_url=f"{get_url()}/payment_cancelled",
|
||||
)
|
||||
|
||||
return session
|
||||
|
||||
@staticmethod
|
||||
def get_event(payload: bytes, sig_header: str, company: str = None) -> stripe.Event:
|
||||
company = company if company else json.loads(payload).get("data", {}).get("object", {}).get("metadata", {}).get("company")
|
||||
print("DEBUG: Stripe webhook received")
|
||||
print(f"DEBUG: Signature header present: {bool(sig_header)}")
|
||||
|
||||
# If company not provided, try to extract from payload metadata
|
||||
if not company:
|
||||
try:
|
||||
payload_dict = json.loads(payload)
|
||||
print(f"DEBUG: Parsed payload type: {payload_dict.get('type')}")
|
||||
|
||||
metadata = payload_dict.get("data", {}).get("object", {}).get("metadata", {})
|
||||
print(f"DEBUG: Metadata from payload: {metadata}")
|
||||
|
||||
company = metadata.get("company")
|
||||
print(f"DEBUG: Extracted company from metadata: {company}")
|
||||
except (json.JSONDecodeError, KeyError, AttributeError) as e:
|
||||
print(f"DEBUG: Failed to parse payload: {str(e)}")
|
||||
|
||||
# If we still don't have a company, reject the webhook
|
||||
if not company:
|
||||
print("ERROR: Company information missing in webhook payload")
|
||||
frappe.throw("Company information missing in webhook payload.")
|
||||
|
||||
print(f"DEBUG: Validating webhook signature for company: {company}")
|
||||
|
||||
# Validate webhook signature with the specified company's secret
|
||||
try:
|
||||
event = stripe.Webhook.construct_event(
|
||||
payload=payload,
|
||||
sig_header=sig_header,
|
||||
secret=StripeService.get_webhook_secret(company),
|
||||
api_key=StripeService.get_api_key(company)
|
||||
secret=StripeService.get_webhook_secret(company)
|
||||
)
|
||||
print(f"DEBUG: Webhook signature validated successfully for company: {company}")
|
||||
print(f"DEBUG: Event type: {event.type}")
|
||||
print(f"DEBUG: Event ID: {event.id}")
|
||||
except ValueError as e:
|
||||
print(f"ERROR: Invalid payload: {str(e)}")
|
||||
frappe.throw(f"Invalid payload: {str(e)}")
|
||||
except stripe.error.SignatureVerificationError as e:
|
||||
frappe.throw(f"Invalid signature: {str(e)}")
|
||||
print(f"ERROR: Invalid signature for company {company}: {str(e)}")
|
||||
frappe.throw(f"Invalid signature for company {company}: {str(e)}")
|
||||
|
||||
return event
|
||||
|
||||
|
||||
@ -75,10 +75,10 @@
|
||||
<div class="payment-details">
|
||||
<h2>Payment Details</h2>
|
||||
<p><strong>Sales Order Number:</strong> {{ sales_order_number }}</p>
|
||||
<p><strong>Down Payment Amount:</strong> ${{ total_amount }}</p>
|
||||
<p><strong>Down Payment Amount:</strong> {{ total_amount }}</p>
|
||||
</div>
|
||||
<p>Please click the button below to make your secure payment through our payment processor:</p>
|
||||
<a href="https://yourdomain.com/downpayment?so={{ sales_order_number }}&amount={{ total_amount }}" class="cta-button">Make Payment</a>
|
||||
<a href="{{ base_url }}/api/method/custom_ui.api.public.payments.half_down_stripe_payment?sales_order={{ sales_order_number }}" class="cta-button">Make Payment</a>
|
||||
<p>If you have any questions or need assistance, feel free to contact us. We're here to help!</p>
|
||||
<p>Best regards,<br>The Team at {{ company_name }}</p>
|
||||
</div>
|
||||
251
custom_ui/templates/emails/general_estimation.html
Normal file
251
custom_ui/templates/emails/general_estimation.html
Normal file
@ -0,0 +1,251 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Estimate from {{ company }}</title>
|
||||
<style>
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.email-container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
.letterhead {
|
||||
text-align: center;
|
||||
padding: 30px 20px;
|
||||
background-color: #ffffff;
|
||||
border-bottom: 3px solid #0066cc;
|
||||
}
|
||||
.letterhead img {
|
||||
max-width: 250px;
|
||||
height: auto;
|
||||
}
|
||||
.company-name {
|
||||
font-size: 28px;
|
||||
font-weight: bold;
|
||||
color: #333333;
|
||||
margin: 10px 0;
|
||||
}
|
||||
.content {
|
||||
padding: 40px 30px;
|
||||
}
|
||||
.greeting {
|
||||
font-size: 18px;
|
||||
color: #333333;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.intro-text {
|
||||
font-size: 16px;
|
||||
color: #555555;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
.estimate-box {
|
||||
background-color: #f8f9fa;
|
||||
border: 2px solid #e0e0e0;
|
||||
border-radius: 8px;
|
||||
padding: 25px;
|
||||
margin: 30px 0;
|
||||
}
|
||||
.estimate-label {
|
||||
font-size: 14px;
|
||||
color: #666666;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
.estimate-value {
|
||||
font-size: 16px;
|
||||
color: #333333;
|
||||
margin-bottom: 20px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
.estimate-value:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.price-section {
|
||||
background-color: #0066cc;
|
||||
color: #ffffff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.price-label {
|
||||
font-size: 14px;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.price-amount {
|
||||
font-size: 36px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.additional-section {
|
||||
background-color: #fff9e6;
|
||||
border-left: 4px solid #ffc107;
|
||||
padding: 20px;
|
||||
margin: 30px 0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
.additional-label {
|
||||
font-size: 14px;
|
||||
color: #856404;
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 1px;
|
||||
margin-bottom: 10px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.additional-text {
|
||||
font-size: 15px;
|
||||
color: #333333;
|
||||
line-height: 1.6;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
.action-buttons {
|
||||
text-align: center;
|
||||
margin: 40px 0;
|
||||
padding: 20px;
|
||||
}
|
||||
.btn {
|
||||
display: inline-block;
|
||||
padding: 14px 28px;
|
||||
margin: 8px;
|
||||
text-decoration: none;
|
||||
border-radius: 6px;
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
transition: opacity 0.3s;
|
||||
}
|
||||
.btn:hover {
|
||||
opacity: 0.85;
|
||||
}
|
||||
.btn-accept {
|
||||
background-color: #28a745;
|
||||
color: #ffffff;
|
||||
}
|
||||
.btn-decline {
|
||||
background-color: #dc3545;
|
||||
color: #ffffff;
|
||||
}
|
||||
.btn-call {
|
||||
background-color: #ffc107;
|
||||
color: #333333;
|
||||
}
|
||||
.closing-text {
|
||||
font-size: 16px;
|
||||
color: #555555;
|
||||
line-height: 1.6;
|
||||
margin-top: 30px;
|
||||
}
|
||||
.contact-info {
|
||||
font-size: 15px;
|
||||
color: #0066cc;
|
||||
font-weight: bold;
|
||||
margin-top: 15px;
|
||||
}
|
||||
.footer {
|
||||
background-color: #f8f9fa;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
}
|
||||
.footer-text {
|
||||
font-size: 14px;
|
||||
color: #666666;
|
||||
line-height: 1.6;
|
||||
}
|
||||
@media only screen and (max-width: 600px) {
|
||||
.content {
|
||||
padding: 30px 20px;
|
||||
}
|
||||
.estimate-box {
|
||||
padding: 20px;
|
||||
}
|
||||
.price-amount {
|
||||
font-size: 28px;
|
||||
}
|
||||
.company-name {
|
||||
font-size: 24px;
|
||||
}
|
||||
.btn {
|
||||
display: block;
|
||||
margin: 10px auto;
|
||||
max-width: 250px;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="email-container">
|
||||
<!-- Letterhead Section -->
|
||||
<div class="letterhead">
|
||||
{% if letterhead_image %}
|
||||
<img src="{{ letterhead_image }}" alt="{{ company }} Logo">
|
||||
{% else %}
|
||||
<div class="company-name">{{ company }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="content">
|
||||
<div class="greeting">Hello {{ customer_name }},</div>
|
||||
|
||||
<div class="intro-text">
|
||||
Thank you for considering {{ company }} for your project. We are pleased to provide you with the following estimate for the services requested.
|
||||
</div>
|
||||
|
||||
<!-- Estimate Details Box -->
|
||||
<div class="estimate-box">
|
||||
<div class="estimate-label">Service Location</div>
|
||||
<div class="estimate-value">{{ address }}</div>
|
||||
|
||||
<!-- Price Section -->
|
||||
<div class="price-section">
|
||||
<div class="price-label">Total Estimate</div>
|
||||
<div class="price-amount">{{ price }}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Additional Notes (Conditional) -->
|
||||
{% if additional %}
|
||||
<div class="additional-section">
|
||||
<div class="additional-label">Additional Notes</div>
|
||||
<div class="additional-text">{{ additional }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<!-- Action Buttons -->
|
||||
<div class="action-buttons">
|
||||
<a href="{{ base_url }}/api/method/custom_ui.api.public.estimates.update_response?name={{ estimate_name }}&response=Accepted" class="btn btn-accept">Accept</a>
|
||||
<a href="{{ base_url }}/api/method/custom_ui.api.public.estimates.update_response?name={{ estimate_name }}&response=Rejected" class="btn btn-decline">Decline</a>
|
||||
<a href="{{ base_url }}/api/method/custom_ui.api.public.estimates.update_response?name={{ estimate_name }}&response=Requested%20call" class="btn btn-call">Request a Call</a>
|
||||
</div>
|
||||
|
||||
<!-- Closing -->
|
||||
<div class="closing-text">
|
||||
This estimate is valid for 30 days from the date of this email. If you have any questions or would like to proceed with this estimate, please don't hesitate to contact us.
|
||||
{% if company_phone %}
|
||||
<div class="contact-info">Call us at: {{ company_phone }}</div>
|
||||
{% endif %}
|
||||
<br>
|
||||
We look forward to working with you!
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Footer -->
|
||||
<div class="footer">
|
||||
<div class="footer-text">
|
||||
<strong>{{ company }}</strong><br>
|
||||
This is an automated message. Please do not reply directly to this email.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
152
custom_ui/templates/emails/invoice.html
Normal file
152
custom_ui/templates/emails/invoice.html
Normal file
@ -0,0 +1,152 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Invoice - {{ invoice_number }}</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
line-height: 1.6;
|
||||
color: #333;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
.container {
|
||||
max-width: 600px;
|
||||
margin: 0 auto;
|
||||
background-color: #ffffff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.header {
|
||||
text-align: center;
|
||||
padding-bottom: 20px;
|
||||
border-bottom: 1px solid #eee;
|
||||
}
|
||||
.header h1 {
|
||||
color: #2c3e50;
|
||||
margin: 0;
|
||||
}
|
||||
.content {
|
||||
padding: 20px 0;
|
||||
}
|
||||
.invoice-details {
|
||||
background-color: #ecf0f1;
|
||||
padding: 15px;
|
||||
border-radius: 5px;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.invoice-details h2 {
|
||||
margin-top: 0;
|
||||
color: #3498db;
|
||||
}
|
||||
.detail-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid #ddd;
|
||||
}
|
||||
.detail-row:last-child {
|
||||
border-bottom: none;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
padding-top: 10px;
|
||||
border-top: 2px solid #3498db;
|
||||
}
|
||||
.detail-label {
|
||||
font-weight: bold;
|
||||
}
|
||||
.cta-button {
|
||||
display: inline-block;
|
||||
background-color: #27ae60;
|
||||
color: #ffffff;
|
||||
padding: 12px 24px;
|
||||
text-decoration: none;
|
||||
border-radius: 5px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 20px 0;
|
||||
}
|
||||
.footer {
|
||||
text-align: center;
|
||||
padding-top: 20px;
|
||||
border-top: 1px solid #eee;
|
||||
color: #7f8c8d;
|
||||
font-size: 14px;
|
||||
}
|
||||
.note {
|
||||
background-color: #fff3cd;
|
||||
border-left: 4px solid #ffc107;
|
||||
padding: 10px;
|
||||
margin: 15px 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="header">
|
||||
<h1>Invoice</h1>
|
||||
</div>
|
||||
<div class="content">
|
||||
<p>Dear {{ customer_name }},</p>
|
||||
<p>Thank you for your business with {{ company_name }}. Please find your invoice details below:</p>
|
||||
|
||||
<div class="invoice-details">
|
||||
<h2>Invoice Details</h2>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Invoice Number:</span>
|
||||
<span>{{ invoice_number }}</span>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Invoice Date:</span>
|
||||
<span>{{ invoice_date }}</span>
|
||||
</div>
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Due Date:</span>
|
||||
<span>{{ due_date }}</span>
|
||||
</div>
|
||||
{% if sales_order %}
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Related Sales Order:</span>
|
||||
<span>{{ sales_order }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Invoice Total:</span>
|
||||
<span>{{ grand_total }}</span>
|
||||
</div>
|
||||
{% if paid_amount and paid_amount != "$0.00" %}
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Amount Paid:</span>
|
||||
<span>{{ paid_amount }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="detail-row">
|
||||
<span class="detail-label">Amount Due:</span>
|
||||
<span>{{ outstanding_amount }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if payment_url and outstanding_amount != "$0.00" %}
|
||||
<div class="note">
|
||||
<strong>Payment Required:</strong> There is an outstanding balance on this invoice. Please click the button below to make a secure payment.
|
||||
</div>
|
||||
<a href="{{ payment_url }}" class="cta-button">Pay Now</a>
|
||||
{% else %}
|
||||
<div class="note">
|
||||
<strong>Paid in Full:</strong> This invoice has been paid in full. Thank you!
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<p>If you have any questions about this invoice, please don't hesitate to contact us.</p>
|
||||
<p>Best regards,<br>The Team at {{ company_name }}</p>
|
||||
</div>
|
||||
<div class="footer">
|
||||
<p>This is an automated email. Please do not reply directly.</p>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1 +1,141 @@
|
||||
<p>Payment cancelled.</p>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Payment Cancelled</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.payment-container {
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
padding: 50px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
||||
max-width: 500px;
|
||||
width: 90%;
|
||||
position: relative;
|
||||
}
|
||||
.cancelled-icon {
|
||||
font-size: 5rem;
|
||||
color: #e74c3c;
|
||||
margin-bottom: 30px;
|
||||
animation: cancelledAnimation 1.5s ease-out;
|
||||
}
|
||||
|
||||
@keyframes cancelledAnimation {
|
||||
0% {
|
||||
transform: scale(0) rotate(180deg);
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
transform: scale(0.9) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-title {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.payment-message {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 30px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.cancelled-notice {
|
||||
background-color: #ffeaea;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-top: 30px;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
|
||||
.cancelled-notice h3 {
|
||||
margin: 0 0 10px 0;
|
||||
color: #721c24;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.cancelled-notice p {
|
||||
margin: 0;
|
||||
color: #721c24;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.next-steps {
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-top: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.next-steps h4 {
|
||||
margin: 0 0 15px 0;
|
||||
color: #333;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.next-steps ul {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.next-steps li {
|
||||
margin-bottom: 8px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="payment-container">
|
||||
<div class="cancelled-icon">✕</div>
|
||||
<h1 class="payment-title">Payment Cancelled</h1>
|
||||
<p class="payment-message">Your payment has been cancelled.</p>
|
||||
|
||||
<div class="cancelled-notice">
|
||||
<h3>Payment Not Processed</h3>
|
||||
<p>No charges have been made to your account. If you cancelled by mistake or need assistance, please try again or contact support.</p>
|
||||
</div>
|
||||
|
||||
<div class="next-steps">
|
||||
<h4>What happens next?</h4>
|
||||
<ul>
|
||||
<li>No payment has been processed</li>
|
||||
<li>You can safely close this window</li>
|
||||
<li>Try your payment again if needed</li>
|
||||
<li>Contact us if you need help</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
141
custom_ui/www/payment_cancelled.html
Normal file
141
custom_ui/www/payment_cancelled.html
Normal file
@ -0,0 +1,141 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Payment Cancelled</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.payment-container {
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
padding: 50px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
||||
max-width: 500px;
|
||||
width: 90%;
|
||||
position: relative;
|
||||
}
|
||||
.cancelled-icon {
|
||||
font-size: 5rem;
|
||||
color: #e74c3c;
|
||||
margin-bottom: 30px;
|
||||
animation: cancelledAnimation 1.5s ease-out;
|
||||
}
|
||||
|
||||
@keyframes cancelledAnimation {
|
||||
0% {
|
||||
transform: scale(0) rotate(180deg);
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
transform: scale(0.9) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-title {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.payment-message {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 30px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.cancelled-notice {
|
||||
background-color: #ffeaea;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-top: 30px;
|
||||
border: 1px solid #f5c6cb;
|
||||
}
|
||||
|
||||
.cancelled-notice h3 {
|
||||
margin: 0 0 10px 0;
|
||||
color: #721c24;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.cancelled-notice p {
|
||||
margin: 0;
|
||||
color: #721c24;
|
||||
font-weight: 400;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.next-steps {
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-top: 20px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.next-steps h4 {
|
||||
margin: 0 0 15px 0;
|
||||
color: #333;
|
||||
font-size: 1.1rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.next-steps ul {
|
||||
margin: 0;
|
||||
padding-left: 20px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.next-steps li {
|
||||
margin-bottom: 8px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="payment-container">
|
||||
<div class="cancelled-icon">✕</div>
|
||||
<h1 class="payment-title">Payment Cancelled</h1>
|
||||
<p class="payment-message">Your payment has been cancelled.</p>
|
||||
|
||||
<div class="cancelled-notice">
|
||||
<h3>Payment Not Processed</h3>
|
||||
<p>No charges have been made to your account. If you cancelled by mistake or need assistance, please try again or contact support.</p>
|
||||
</div>
|
||||
|
||||
<div class="next-steps">
|
||||
<h4>What happens next?</h4>
|
||||
<ul>
|
||||
<li>No payment has been processed</li>
|
||||
<li>You can safely close this window</li>
|
||||
<li>Try your payment again if needed</li>
|
||||
<li>Contact us if you need help</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
0
custom_ui/www/payment_cancelled.py
Normal file
0
custom_ui/www/payment_cancelled.py
Normal file
212
custom_ui/www/payment_success.html
Normal file
212
custom_ui/www/payment_success.html
Normal file
@ -0,0 +1,212 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Payment Successful</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
body {
|
||||
font-family: 'Roboto', sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
color: #333;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.payment-container {
|
||||
text-align: center;
|
||||
background-color: #fff;
|
||||
padding: 50px;
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
|
||||
max-width: 500px;
|
||||
width: 90%;
|
||||
position: relative;
|
||||
}
|
||||
.success-icon {
|
||||
font-size: 5rem;
|
||||
color: #00b894;
|
||||
margin-bottom: 30px;
|
||||
animation: checkmarkAnimation 1.5s ease-out;
|
||||
}
|
||||
|
||||
@keyframes checkmarkAnimation {
|
||||
0% {
|
||||
transform: scale(0) rotate(-180deg);
|
||||
opacity: 0;
|
||||
}
|
||||
50% {
|
||||
transform: scale(1.2) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
70% {
|
||||
transform: scale(0.9) rotate(0deg);
|
||||
}
|
||||
100% {
|
||||
transform: scale(1) rotate(0deg);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.payment-title {
|
||||
font-size: 2.5rem;
|
||||
margin-bottom: 20px;
|
||||
color: #333;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.payment-message {
|
||||
font-size: 1.2rem;
|
||||
line-height: 1.6;
|
||||
margin-bottom: 30px;
|
||||
color: #666;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.advance-notice {
|
||||
background-color: #e3f2fd;
|
||||
padding: 15px;
|
||||
border-radius: 8px;
|
||||
margin-top: 20px;
|
||||
border-left: 4px solid #2196f3;
|
||||
}
|
||||
|
||||
.contact-section {
|
||||
background-color: #f8f9fa;
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
margin-top: 30px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.contact-section h3 {
|
||||
margin: 0 0 10px 0;
|
||||
color: #333;
|
||||
font-size: 1.3rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.contact-section > p {
|
||||
margin: 0 0 15px 0;
|
||||
color: #666;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.contact-details {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
}
|
||||
|
||||
.contact-row {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 5px 0;
|
||||
border-bottom: 1px solid #e9ecef;
|
||||
}
|
||||
|
||||
.contact-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.contact-label {
|
||||
font-weight: 500;
|
||||
color: #495057;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.contact-value {
|
||||
font-weight: 400;
|
||||
color: #6c757d;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.contact-value a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.contact-value a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="payment-container">
|
||||
<div class="success-icon">✓</div>
|
||||
{% if reference_doc %}
|
||||
<h1 class="payment-title">
|
||||
{% if company_doc and company_doc.company_name %}
|
||||
{{ company_doc.company_name }}
|
||||
{% else %}
|
||||
Payment Received
|
||||
{% endif %}
|
||||
</h1>
|
||||
{% if reference_doc.doctype == "Sales Order" %}
|
||||
<p class="payment-message">
|
||||
{% if reference_doc.customer %}
|
||||
Thank you {{ reference_doc.customer }} for your advance payment!
|
||||
{% else %}
|
||||
Thank you for your advance payment!
|
||||
{% endif %}
|
||||
</p>
|
||||
<div class="advance-notice">
|
||||
<p>The remaining balance will be invoiced once the project is complete.</p>
|
||||
</div>
|
||||
{% else %}
|
||||
<p class="payment-message">
|
||||
{% if reference_doc.customer %}
|
||||
Thank you {{ reference_doc.customer }} for your payment!
|
||||
{% else %}
|
||||
Thank you for your payment!
|
||||
{% endif %}
|
||||
</p>
|
||||
{% endif %}
|
||||
|
||||
{% if company_doc %}
|
||||
<div class="contact-section">
|
||||
<h3>Have Questions?</h3>
|
||||
<p>We're here to help! Contact us if you need assistance.</p>
|
||||
<div class="contact-details">
|
||||
{% if company_doc.company_name %}
|
||||
<div class="contact-row">
|
||||
<span class="contact-label">Company:</span>
|
||||
<span class="contact-value">{{ company_doc.company_name }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if company_doc.phone_no %}
|
||||
<div class="contact-row">
|
||||
<span class="contact-label">Phone:</span>
|
||||
<span class="contact-value">{{ company_doc.phone_no }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if company_doc.email %}
|
||||
<div class="contact-row">
|
||||
<span class="contact-label">Email:</span>
|
||||
<span class="contact-value"><a href="mailto:{{ company_doc.email }}">{{ company_doc.email }}</a></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if company_doc.website %}
|
||||
<div class="contact-row">
|
||||
<span class="contact-label">Website:</span>
|
||||
<span class="contact-value"><a href="{{ company_doc.website }}" target="_blank">{{ company_doc.website }}</a></span>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<h1 class="payment-title">Payment Received</h1>
|
||||
<p class="payment-message">Thank you for your payment!</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
18
custom_ui/www/payment_success.py
Normal file
18
custom_ui/www/payment_success.py
Normal file
@ -0,0 +1,18 @@
|
||||
import frappe
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
|
||||
context.title = "Payment Received"
|
||||
context.message = "Thank you for your payment! Your transaction was successful."
|
||||
|
||||
context.session_id = frappe.form_dict.get("session_id")
|
||||
|
||||
payment_entry = frappe.get_value("Payment Entry", {"reference_no": context.session_id}, "name")
|
||||
payment_entry_doc = frappe.get_doc("Payment Entry", payment_entry) if payment_entry else None
|
||||
reference = payment_entry_doc.references[0] if payment_entry_doc and payment_entry_doc.references else None
|
||||
reference_doc = frappe.get_doc(reference.reference_doctype, reference.reference_name) if reference else None
|
||||
company_doc = frappe.get_doc("Company", reference_doc.company) if reference_doc and reference_doc.company else None
|
||||
context.reference_doc = reference_doc.as_dict() if reference_doc else None
|
||||
context.company_doc = company_doc.as_dict() if company_doc else None
|
||||
return context
|
||||
@ -1 +0,0 @@
|
||||
<p>Thank you for your payment!</p>
|
||||
8
docker-compose.local.yaml
Normal file
8
docker-compose.local.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
services:
|
||||
mailhog:
|
||||
image: mailhog/mailhog:latest
|
||||
container_name: mailhog
|
||||
ports:
|
||||
- "8025:8025" # MailHog web UI
|
||||
- "1025:1025" # SMTP server
|
||||
restart: unless-stopped
|
||||
151
doctype_diff_report.md
Normal file
151
doctype_diff_report.md
Normal file
@ -0,0 +1,151 @@
|
||||
# DocType Field Differences Report
|
||||
|
||||
## Fields present in LOCAL but missing in STAGE
|
||||
|
||||
### Address
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| is_service_address | Is Service Address | Check | None | 0 | 0 | False |
|
||||
|
||||
### Event
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| participants | Participants | Section Break | None | 0 | 0 | False |
|
||||
|
||||
### Project
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| service_appointment | Service Appointment | Link | Service Address 2 | 0 | 0 | False |
|
||||
| tasks | Tasks | Table | Project Task Link | 0 | 0 | False |
|
||||
| ready_to_schedule | Ready to Schedule | Check | None | 0 | 0 | False |
|
||||
|
||||
### Project Template
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| bid_meeting_note_form | Bid Meeting Note Form | Link | Bid Meeting Note Form | 0 | 0 | False |
|
||||
| item_groups | Item Groups | Data | None | 0 | 0 | False |
|
||||
|
||||
### Quotation
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| from_template | From Template | Link | Quotation Template | 0 | 0 | False |
|
||||
| project_template | Project Template | Link | Project Template | 0 | 0 | False |
|
||||
|
||||
### Sales Invoice
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| project_template | Project Template | Link | Project Template | 0 | 0 | False |
|
||||
| job_address | Job Address | Link | Address | 0 | 0 | False |
|
||||
|
||||
### Task
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| customer | Customer | Link | Customer | 0 | 0 | False |
|
||||
|
||||
### Task Type
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| base_date | Base Date | Select | Start
|
||||
End
|
||||
Completion
|
||||
Creation | 1 | 0 | False |
|
||||
| offset_days | Offset Days | Int | None | 1 | 0 | False |
|
||||
| skip_weekends | Skip Weekends | Check | None | 0 | 0 | False |
|
||||
| skip_holidays | Skip Holidays | Check | None | 0 | 0 | False |
|
||||
| logic_key | Logic Key | Data | None | 0 | 0 | False |
|
||||
| offset_direction | Offset Direction | Select | After
|
||||
Before | 1 | 0 | False |
|
||||
| title | Title | Data | None | 1 | 0 | False |
|
||||
| days | Days | Int | None | 0 | 0 | False |
|
||||
| calculate_from | Calculate From | Select | Service Address 2
|
||||
Project
|
||||
Task | 1 | 0 | False |
|
||||
| trigger | Trigger | Select | Scheduled
|
||||
Completed
|
||||
Created | 1 | 0 | False |
|
||||
| task_type_calculate_from | Task Type For Task Calculate From | Link | Task Type | 0 | 0 | False |
|
||||
| work_type | Work Type | Select | Admin
|
||||
Labor
|
||||
QA | 1 | 0 | False |
|
||||
| no_due_date | No Due Date | Check | None | 0 | 0 | False |
|
||||
| triggering_doctype | Triggering Doctype | Select | Service Address 2
|
||||
Project
|
||||
Task | 1 | 0 | False |
|
||||
|
||||
## Fields present in STAGE but missing in LOCAL
|
||||
|
||||
### Communication Link
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| communication_date | Communication Date | Datetime | None | 0 | 0 | False |
|
||||
|
||||
### Event
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| notifications | Notifications | Table | Event Notifications | 0 | 0 | False |
|
||||
| location | Location | Data | None | 0 | 0 | False |
|
||||
| attending | Attending | Select |
|
||||
Yes
|
||||
No
|
||||
Maybe | 0 | 0 | False |
|
||||
| participants_tab | Participants | Tab Break | None | 0 | 0 | False |
|
||||
| links_tab | Links | Tab Break | None | 0 | 0 | False |
|
||||
| notifications_tab | Notifications | Tab Break | None | 0 | 0 | False |
|
||||
|
||||
### Event Notifications
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| type | Type | Select | Notification
|
||||
Email | 0 | 0 | False |
|
||||
| before | Before | Int | None | 0 | 0 | False |
|
||||
| interval | Interval | Select | None | 0 | 0 | False |
|
||||
| time | Time | Time | None | 0 | 0 | False |
|
||||
|
||||
### Event Participants
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| attending | Attending | Select |
|
||||
Yes
|
||||
No
|
||||
Maybe | 0 | 0 | False |
|
||||
|
||||
### Job Opening
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| job_opening_template | Job Opening Template | Link | Job Opening Template | 0 | 0 | False |
|
||||
|
||||
### Job Opening Template
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| template_title | Template Title | Data | None | 1 | 0 | False |
|
||||
| department | Department | Link | Department | 0 | 0 | False |
|
||||
| column_break_wkcr | None | Column Break | None | 0 | 0 | False |
|
||||
| employment_type | Employment Type | Link | Employment Type | 0 | 0 | False |
|
||||
| location | Location | Link | Branch | 0 | 0 | False |
|
||||
| section_break_dwfh | None | Section Break | None | 0 | 0 | False |
|
||||
| description | Description | Text Editor | None | 0 | 0 | False |
|
||||
|
||||
### Payment Ledger Entry
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| project | Project | Link | Project | 0 | 0 | False |
|
||||
|
||||
### Quotation Item
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| ordered_qty | Ordered Qty | Float | None | 1 | 1 | False |
|
||||
|
||||
### Salary Structure Assignment
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| leave_encashment_amount_per_day | Leave Encashment Amount Per Day | Currency | currency | 0 | 0 | False |
|
||||
|
||||
### Selling Settings
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| set_zero_rate_for_expired_batch | Set Incoming Rate as Zero for Expired Batch | Check | None | 0 | 0 | False |
|
||||
|
||||
### Service Appointment
|
||||
| Fieldname | Label | Fieldtype | Options | Required | Hidden | Custom Field |
|
||||
|-----------|-------|----------|---------|---------|--------|--------------|
|
||||
| custom_location_of_meeting | Service Address | Link | Address | 0 | 0 | False |
|
||||
@ -19,6 +19,9 @@ const FRAPPE_GET_ESTIMATE_TEMPLATES_METHOD = "custom_ui.api.db.estimates.get_est
|
||||
const FRAPPE_CREATE_ESTIMATE_TEMPLATE_METHOD = "custom_ui.api.db.estimates.create_estimate_template";
|
||||
const FRAPPE_GET_UNAPPROVED_ESTIMATES_COUNT_METHOD = "custom_ui.api.db.estimates.get_unapproved_estimates_count";
|
||||
const FRAPPE_GET_ESTIMATES_HALF_DOWN_COUNT_METHOD = "custom_ui.api.db.estimates.get_estimates_half_down_count";
|
||||
// Item methods
|
||||
const FRAPPE_SAVE_AS_PACKAGE_ITEM_METHOD = "custom_ui.api.db.items.save_as_package_item";
|
||||
const FRAPPE_GET_ITEMS_BY_PROJECT_TEMPLATE_METHOD = "custom_ui.api.db.items.get_by_project_template";
|
||||
// Job methods
|
||||
const FRAPPE_GET_JOB_METHOD = "custom_ui.api.db.jobs.get_job";
|
||||
const FRAPPE_GET_JOBS_METHOD = "custom_ui.api.db.jobs.get_jobs_table_data";
|
||||
@ -229,8 +232,8 @@ class Api {
|
||||
// ESTIMATE / QUOTATION METHODS
|
||||
// ============================================================================
|
||||
|
||||
static async getQuotationItems() {
|
||||
return await this.request("custom_ui.api.db.estimates.get_quotation_items");
|
||||
static async getQuotationItems(projectTemplate) {
|
||||
return await this.request("custom_ui.api.db.estimates.get_quotation_items", { projectTemplate });
|
||||
}
|
||||
|
||||
static async getEstimateFromAddress(fullAddress) {
|
||||
@ -657,6 +660,22 @@ class Api {
|
||||
return await this.request(FRAPPE_GET_ADDRESSES_METHOD, { fields, filters });
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// ITEM/PACKAGE METHODS
|
||||
// ============================================================================
|
||||
|
||||
static async getItemsByProjectTemplate(projectTemplate) {
|
||||
return await this.request(FRAPPE_GET_ITEMS_BY_PROJECT_TEMPLATE_METHOD, { projectTemplate });
|
||||
}
|
||||
|
||||
static async saveAsPackageItem(data) {
|
||||
return await this.request(FRAPPE_SAVE_AS_PACKAGE_ITEM_METHOD, { data });
|
||||
}
|
||||
|
||||
static async getItemCategories() {
|
||||
return await this.request("custom_ui.api.db.items.get_item_categories");
|
||||
}
|
||||
|
||||
// ============================================================================
|
||||
// SERVICE / ROUTE / TIMESHEET METHODS
|
||||
// ============================================================================
|
||||
|
||||
@ -17,6 +17,12 @@
|
||||
<span class="date-text">{{ weekDisplayText }}</span>
|
||||
<v-icon right size="small">mdi-calendar</v-icon>
|
||||
</v-btn>
|
||||
<v-btn
|
||||
@click="nextWeek"
|
||||
icon="mdi-chevron-right"
|
||||
variant="outlined"
|
||||
size="small"
|
||||
></v-btn>
|
||||
<v-btn @click="goToThisWeek" variant="outlined" size="small" class="ml-4">
|
||||
This Week
|
||||
</v-btn>
|
||||
@ -991,13 +997,14 @@ const handleDrop = async (event, foremanId, date) => {
|
||||
await Api.updateServiceAppointmentScheduledDates(
|
||||
draggedService.value.name,
|
||||
date,
|
||||
draggedService.value.expectedEndDate, // Keep the same end date
|
||||
date, // Reset to single day when moved
|
||||
foreman.name
|
||||
);
|
||||
// Update the scheduled job
|
||||
scheduledServices.value[scheduledIndex] = {
|
||||
...scheduledServices.value[scheduledIndex],
|
||||
expectedStartDate: date,
|
||||
expectedEndDate: date, // Reset to single day
|
||||
foreman: foreman.name
|
||||
};
|
||||
notifications.addSuccess("Job moved successfully!");
|
||||
@ -1174,9 +1181,10 @@ const handleResize = (event) => {
|
||||
// Calculate proposed end date by adding days to the CURRENT end date
|
||||
let proposedEndDate = addDays(currentEndDate, daysToAdd);
|
||||
|
||||
// Don't allow shrinking before the current end date (minimum stay at current)
|
||||
if (daysToAdd < 0) {
|
||||
proposedEndDate = currentEndDate;
|
||||
// Don't allow shrinking before the start date
|
||||
const startDate = resizingJob.value.expectedStartDate;
|
||||
if (parseLocalDate(proposedEndDate) < parseLocalDate(startDate)) {
|
||||
proposedEndDate = startDate;
|
||||
}
|
||||
|
||||
let newEndDate = proposedEndDate;
|
||||
@ -1306,13 +1314,14 @@ const fetchServiceAppointments = async (currentDate) => {
|
||||
{
|
||||
"expectedStartDate": ["<=", endDate],
|
||||
"expectedEndDate": [">=", startDate],
|
||||
"status": ["not in", ["Canceled"]]
|
||||
"status": ["not in", ["Canceled", "Open"]]
|
||||
}
|
||||
);
|
||||
unscheduledServices.value = await Api.getServiceAppointments(
|
||||
[companyStore.currentCompany],
|
||||
{
|
||||
"status": "Open"
|
||||
"status": "Open",
|
||||
"ready_to_schedule": 1
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
167
frontend/src/components/common/ItemSelector.vue
Normal file
167
frontend/src/components/common/ItemSelector.vue
Normal file
@ -0,0 +1,167 @@
|
||||
<template>
|
||||
<div class="items-container">
|
||||
<div v-if="items.length === 0" class="no-items-message">
|
||||
<i class="pi pi-inbox"></i>
|
||||
<p>{{ emptyMessage }}</p>
|
||||
</div>
|
||||
<div v-else v-for="item in items" :key="item.itemCode" class="item-card" :class="{ 'item-selected': isItemSelected(item.itemCode) }" @click="handleItemClick(item, $event)">
|
||||
<div class="item-card-header">
|
||||
<span class="item-code">{{ item.itemCode }}</span>
|
||||
<span class="item-name">{{ item.itemName }}</span>
|
||||
<span class="item-price">${{ item.standardRate?.toFixed(2) || '0.00' }}</span>
|
||||
<Button
|
||||
:label="isItemSelected(item.itemCode) ? 'Selected' : 'Select'"
|
||||
:icon="isItemSelected(item.itemCode) ? 'pi pi-check' : 'pi pi-plus'"
|
||||
@click.stop="handleItemClick(item, $event)"
|
||||
size="small"
|
||||
:severity="isItemSelected(item.itemCode) ? 'success' : 'secondary'"
|
||||
class="select-item-button"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="item.description" class="item-description">
|
||||
{{ item.description }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, watch, computed, shallowRef } from "vue";
|
||||
import Button from "primevue/button";
|
||||
|
||||
const props = defineProps({
|
||||
items: {
|
||||
type: Array,
|
||||
required: true,
|
||||
default: () => []
|
||||
},
|
||||
selectedItems: {
|
||||
type: Array,
|
||||
default: () => []
|
||||
},
|
||||
emptyMessage: {
|
||||
type: String,
|
||||
default: "No items found in this category"
|
||||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['select']);
|
||||
|
||||
const internalSelection = ref([]);
|
||||
const selectionSet = shallowRef(new Set());
|
||||
|
||||
// Sync internal selection with prop
|
||||
watch(() => props.selectedItems, (newVal) => {
|
||||
internalSelection.value = [...newVal];
|
||||
selectionSet.value = new Set(newVal.map(item => item.itemCode));
|
||||
}, { immediate: true });
|
||||
|
||||
const isItemSelected = (itemCode) => {
|
||||
return selectionSet.value.has(itemCode);
|
||||
};
|
||||
|
||||
const handleItemClick = (item, event) => {
|
||||
// Always multi-select mode - toggle item in selection
|
||||
const index = internalSelection.value.findIndex(i => i.itemCode === item.itemCode);
|
||||
const newSet = new Set(selectionSet.value);
|
||||
|
||||
if (index >= 0) {
|
||||
internalSelection.value.splice(index, 1);
|
||||
newSet.delete(item.itemCode);
|
||||
} else {
|
||||
internalSelection.value.push(item);
|
||||
newSet.add(item.itemCode);
|
||||
}
|
||||
|
||||
// Update Set directly instead of recreating from array
|
||||
selectionSet.value = newSet;
|
||||
// Emit the entire selection array
|
||||
emit('select', [...internalSelection.value]);
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.items-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.no-items-message {
|
||||
text-align: center;
|
||||
padding: 3rem 2rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.no-items-message i {
|
||||
font-size: 3em;
|
||||
color: #ccc;
|
||||
margin-bottom: 1rem;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.no-items-message p {
|
||||
margin: 0;
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.item-card {
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
padding: 0.75rem;
|
||||
background-color: #fafafa;
|
||||
transition: all 0.2s ease;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.item-card:hover {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #2196f3;
|
||||
}
|
||||
|
||||
.item-selected {
|
||||
background-color: #e3f2fd;
|
||||
border-color: #2196f3;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.item-card-header {
|
||||
display: grid;
|
||||
grid-template-columns: 150px 1fr 120px 100px;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.item-code {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
font-family: monospace;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.item-price {
|
||||
font-weight: 600;
|
||||
color: #2196f3;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.select-item-button {
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
.item-description {
|
||||
margin-top: 0.5rem;
|
||||
padding-top: 0.5rem;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
line-height: 1.4;
|
||||
}
|
||||
</style>
|
||||
649
frontend/src/components/modals/AddItemModal.vue
Normal file
649
frontend/src/components/modals/AddItemModal.vue
Normal file
@ -0,0 +1,649 @@
|
||||
<template>
|
||||
<Modal
|
||||
:visible="visible"
|
||||
@update:visible="$emit('update:visible', $event)"
|
||||
@close="handleClose"
|
||||
:options="{ showActions: false, maxWidth: '90vw', width: '1350px' }"
|
||||
class="add-item-modal"
|
||||
>
|
||||
<template #title>
|
||||
<div class="modal-title-container">
|
||||
<span>Add Item</span>
|
||||
<span v-if="selectedItemsCount > 0" class="selection-badge">{{ selectedItemsCount }} selected</span>
|
||||
</div>
|
||||
</template>
|
||||
<div class="modal-content items-modal-content">
|
||||
<div class="search-section">
|
||||
<label for="item-search" class="field-label">Search Items</label>
|
||||
<InputText
|
||||
id="item-search"
|
||||
v-model="searchTerm"
|
||||
placeholder="Search by item code or name..."
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
<div class="tabs-container">
|
||||
<Tabs v-model="activeItemTab" v-if="itemGroups.length > 0 || packageGroups.length > 0">
|
||||
<TabList>
|
||||
<Tab v-if="packageGroups.length > 0" value="Packages">
|
||||
<i class="pi pi-box"></i>
|
||||
<span>Packages</span>
|
||||
</Tab>
|
||||
<Tab v-for="group in itemGroups" :key="group" :value="group">{{ group }}</Tab>
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<!-- Packages tab with nested sub-tabs -->
|
||||
<TabPanel v-if="packageGroups.length > 0" value="Packages">
|
||||
<Tabs v-model="activePackageTab" class="nested-tabs">
|
||||
<TabList>
|
||||
<Tab v-for="packageGroup in packageGroups" :key="packageGroup" :value="packageGroup">{{ packageGroup }}</Tab>
|
||||
</TabList>
|
||||
<TabPanels>
|
||||
<TabPanel v-for="packageGroup in packageGroups" :key="packageGroup" :value="packageGroup">
|
||||
<div class="package-items-container">
|
||||
<div v-for="item in getFilteredPackageItemsForGroup(packageGroup)" :key="item.itemCode" class="package-item" :class="{ 'package-item-selected': item._selected }">
|
||||
<div class="package-item-header">
|
||||
<Button
|
||||
:icon="isPackageExpanded(item.itemCode) ? 'pi pi-chevron-down' : 'pi pi-chevron-right'"
|
||||
@click="togglePackageExpansion(item.itemCode)"
|
||||
text
|
||||
rounded
|
||||
class="expand-button"
|
||||
/>
|
||||
<span class="package-item-code">{{ item.itemCode }}</span>
|
||||
<span class="package-item-name">{{ item.itemName }}</span>
|
||||
<span class="package-item-price">${{ item.standardRate?.toFixed(2) || '0.00' }}</span>
|
||||
<Button
|
||||
:label="item._selected ? 'Selected' : 'Select'"
|
||||
:icon="item._selected ? 'pi pi-check' : 'pi pi-plus'"
|
||||
@click="handleItemSelection(item)"
|
||||
size="small"
|
||||
:severity="item._selected ? 'success' : 'secondary'"
|
||||
class="add-package-button"
|
||||
/>
|
||||
</div>
|
||||
<div v-if="isPackageExpanded(item.itemCode) && item.bom && item.bom.items" class="bom-details">
|
||||
<div class="bom-header">Bill of Materials:</div>
|
||||
<div v-for="bomItem in item.bom.items" :key="bomItem.itemCode" class="bom-item-wrapper">
|
||||
<BomItem :item="bomItem" :parentPath="item.itemCode" :level="0" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
</TabPanel>
|
||||
<!-- Regular category tabs -->
|
||||
<TabPanel v-for="group in itemGroups" :key="group" :value="group">
|
||||
<ItemSelector
|
||||
:items="getFilteredItemsForGroup(group)"
|
||||
:selected-items="getSelectedItemsForGroup(group)"
|
||||
@select="handleItemSelection"
|
||||
/>
|
||||
</TabPanel>
|
||||
</TabPanels>
|
||||
</Tabs>
|
||||
<!-- Fallback if no categories -->
|
||||
<ItemSelector v-else :items="[]" empty-message="No items available. Please select a Project Template first." />
|
||||
</div>
|
||||
<div class="modal-actions">
|
||||
<Button
|
||||
label="Clear Selection"
|
||||
@click="clearSelection"
|
||||
severity="secondary"
|
||||
:disabled="selectedItemsCount === 0"
|
||||
/>
|
||||
<Button
|
||||
:label="`Add ${selectedItemsCount} Item${selectedItemsCount !== 1 ? 's' : ''}`"
|
||||
@click="addItems"
|
||||
icon="pi pi-plus"
|
||||
:disabled="selectedItemsCount === 0"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, computed, watch, defineComponent, h, shallowRef } from "vue";
|
||||
import Modal from "../common/Modal.vue";
|
||||
import ItemSelector from "../common/ItemSelector.vue";
|
||||
import InputText from "primevue/inputtext";
|
||||
import Button from "primevue/button";
|
||||
import Tabs from "primevue/tabs";
|
||||
import TabList from "primevue/tablist";
|
||||
import Tab from "primevue/tab";
|
||||
import TabPanels from "primevue/tabpanels";
|
||||
import TabPanel from "primevue/tabpanel";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true
|
||||
},
|
||||
quotationItems: {
|
||||
type: Object,
|
||||
default: () => ({})
|
||||
}
|
||||
});
|
||||
|
||||
const emit = defineEmits(['update:visible', 'add-items']);
|
||||
|
||||
const searchTerm = ref("");
|
||||
const expandedPackageItems = shallowRef(new Set());
|
||||
const selectedItemsInModal = shallowRef(new Set());
|
||||
|
||||
// BomItem component for recursive rendering
|
||||
const BomItem = defineComponent({
|
||||
name: 'BomItem',
|
||||
props: {
|
||||
item: Object,
|
||||
parentPath: String,
|
||||
level: {
|
||||
type: Number,
|
||||
default: 0
|
||||
}
|
||||
},
|
||||
setup(props) {
|
||||
const itemPath = computed(() => {
|
||||
return props.parentPath ? `${props.parentPath}.${props.item.itemCode}` : props.item.itemCode;
|
||||
});
|
||||
|
||||
const isPackage = computed(() => {
|
||||
return props.item.bom && props.item.bom.items && props.item.bom.items.length > 0;
|
||||
});
|
||||
|
||||
const isExpanded = computed(() => {
|
||||
return expandedPackageItems.value.has(itemPath.value);
|
||||
});
|
||||
|
||||
const toggleExpansion = () => {
|
||||
if (expandedPackageItems.value.has(itemPath.value)) {
|
||||
expandedPackageItems.value.delete(itemPath.value);
|
||||
} else {
|
||||
expandedPackageItems.value.add(itemPath.value);
|
||||
}
|
||||
expandedPackageItems.value = new Set(expandedPackageItems.value);
|
||||
};
|
||||
|
||||
return () => h('div', {
|
||||
class: 'bom-item',
|
||||
style: { paddingLeft: `${props.level * 1}rem` }
|
||||
}, [
|
||||
h('div', { class: 'bom-item-content' }, [
|
||||
isPackage.value ? h(Button, {
|
||||
icon: isExpanded.value ? 'pi pi-chevron-down' : 'pi pi-chevron-right',
|
||||
onClick: toggleExpansion,
|
||||
text: true,
|
||||
rounded: true,
|
||||
size: 'small',
|
||||
class: 'bom-expand-button'
|
||||
}) : h('i', { class: 'pi pi-circle-fill bom-item-bullet' }),
|
||||
isPackage.value ? h('i', { class: 'pi pi-box package-icon' }) : null,
|
||||
h('span', { class: 'bom-item-code' }, props.item.itemCode),
|
||||
h('span', { class: 'bom-item-name' }, props.item.itemName),
|
||||
h('span', { class: 'bom-item-qty' }, `Qty: ${props.item.qty}`)
|
||||
]),
|
||||
isPackage.value && isExpanded.value && props.item.bom?.items ? h('div', { class: 'nested-bom' },
|
||||
props.item.bom.items.map(nestedItem =>
|
||||
h(BomItem, {
|
||||
key: nestedItem.itemCode,
|
||||
item: nestedItem,
|
||||
parentPath: itemPath.value,
|
||||
level: props.level + 1
|
||||
})
|
||||
)
|
||||
) : null
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
const itemGroups = computed(() => {
|
||||
if (!props.quotationItems || typeof props.quotationItems !== 'object') return [];
|
||||
// Get all keys except 'Packages'
|
||||
const groups = Object.keys(props.quotationItems).filter(key => key !== 'Packages').sort();
|
||||
return groups;
|
||||
});
|
||||
|
||||
const packageGroups = computed(() => {
|
||||
if (!props.quotationItems?.Packages || typeof props.quotationItems.Packages !== 'object') return [];
|
||||
return Object.keys(props.quotationItems.Packages).sort();
|
||||
});
|
||||
|
||||
// Active tabs with default to Packages
|
||||
const activeItemTab = computed({
|
||||
get: () => _activeItemTab.value || (packageGroups.value.length > 0 ? "Packages" : itemGroups.value[0]) || "",
|
||||
set: (val) => { _activeItemTab.value = val; }
|
||||
});
|
||||
|
||||
const activePackageTab = computed({
|
||||
get: () => _activePackageTab.value || packageGroups.value[0] || "",
|
||||
set: (val) => { _activePackageTab.value = val; }
|
||||
});
|
||||
|
||||
const _activeItemTab = ref("");
|
||||
const _activePackageTab = ref("");
|
||||
|
||||
const getFilteredItemsForGroup = (group) => {
|
||||
if (!props.quotationItems || typeof props.quotationItems !== 'object') return [];
|
||||
|
||||
let items = [];
|
||||
|
||||
// Get items from the specified group
|
||||
if (group && props.quotationItems[group]) {
|
||||
items = [...props.quotationItems[group]];
|
||||
}
|
||||
|
||||
// Filter by search term
|
||||
if (searchTerm.value.trim()) {
|
||||
const term = searchTerm.value.toLowerCase();
|
||||
items = items.filter(
|
||||
(item) =>
|
||||
item.itemCode?.toLowerCase().includes(term) ||
|
||||
item.itemName?.toLowerCase().includes(term),
|
||||
);
|
||||
}
|
||||
|
||||
// Map items and mark those that are selected
|
||||
return items.map((item) => ({
|
||||
...item,
|
||||
id: item.itemCode
|
||||
}));
|
||||
};
|
||||
|
||||
const getSelectedItemsForGroup = (group) => {
|
||||
if (selectedItemsInModal.value.size === 0) return [];
|
||||
const allItems = getFilteredItemsForGroup(group);
|
||||
return allItems.filter(item => selectedItemsInModal.value.has(item.itemCode));
|
||||
};
|
||||
|
||||
const getFilteredPackageItemsForGroup = (packageGroup) => {
|
||||
if (!props.quotationItems?.Packages || typeof props.quotationItems.Packages !== 'object') return [];
|
||||
|
||||
let items = [];
|
||||
|
||||
// Get items from the specified package group
|
||||
if (packageGroup && props.quotationItems.Packages[packageGroup]) {
|
||||
items = [...props.quotationItems.Packages[packageGroup]];
|
||||
}
|
||||
|
||||
// Filter by search term
|
||||
if (searchTerm.value.trim()) {
|
||||
const term = searchTerm.value.toLowerCase();
|
||||
items = items.filter(
|
||||
(item) =>
|
||||
item.itemCode?.toLowerCase().includes(term) ||
|
||||
item.itemName?.toLowerCase().includes(term),
|
||||
);
|
||||
}
|
||||
|
||||
return items.map((item) => ({
|
||||
...item,
|
||||
id: item.itemCode,
|
||||
_selected: selectedItemsInModal.value.has(item.itemCode)
|
||||
}));
|
||||
};
|
||||
|
||||
const selectedItemsCount = computed(() => selectedItemsInModal.value.size);
|
||||
|
||||
const togglePackageExpansion = (itemCode) => {
|
||||
const newExpanded = new Set(expandedPackageItems.value);
|
||||
if (newExpanded.has(itemCode)) {
|
||||
newExpanded.delete(itemCode);
|
||||
} else {
|
||||
newExpanded.add(itemCode);
|
||||
}
|
||||
expandedPackageItems.value = newExpanded;
|
||||
};
|
||||
|
||||
const isPackageExpanded = (itemCode) => {
|
||||
return expandedPackageItems.value.has(itemCode);
|
||||
};
|
||||
|
||||
const handleItemSelection = (itemOrRows) => {
|
||||
// Handle both single item (from package cards) and array (from DataTable)
|
||||
if (Array.isArray(itemOrRows)) {
|
||||
// From ItemSelector - merge with existing selection
|
||||
const newSelection = new Set(selectedItemsInModal.value);
|
||||
const itemCodes = itemOrRows.map(row => row.itemCode);
|
||||
|
||||
// Check if all items are already selected
|
||||
const allSelected = itemCodes.every(code => newSelection.has(code));
|
||||
|
||||
if (allSelected) {
|
||||
// Deselect all items
|
||||
itemCodes.forEach(code => newSelection.delete(code));
|
||||
} else {
|
||||
// Select all items
|
||||
itemCodes.forEach(code => newSelection.add(code));
|
||||
}
|
||||
|
||||
selectedItemsInModal.value = newSelection;
|
||||
} else {
|
||||
// From package card - toggle single item
|
||||
const newSelection = new Set(selectedItemsInModal.value);
|
||||
if (newSelection.has(itemOrRows.itemCode)) {
|
||||
newSelection.delete(itemOrRows.itemCode);
|
||||
} else {
|
||||
newSelection.add(itemOrRows.itemCode);
|
||||
}
|
||||
selectedItemsInModal.value = newSelection;
|
||||
}
|
||||
};
|
||||
|
||||
const clearSelection = () => {
|
||||
selectedItemsInModal.value = new Set();
|
||||
};
|
||||
|
||||
const addItems = () => {
|
||||
// Get all selected items from all categories
|
||||
const allItems = [];
|
||||
|
||||
// Collect from regular categories
|
||||
if (props.quotationItems && typeof props.quotationItems === 'object') {
|
||||
Object.keys(props.quotationItems).forEach(key => {
|
||||
if (key !== 'Packages' && Array.isArray(props.quotationItems[key])) {
|
||||
props.quotationItems[key].forEach(item => {
|
||||
if (selectedItemsInModal.value.has(item.itemCode)) {
|
||||
allItems.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Collect from Packages sub-categories
|
||||
if (props.quotationItems.Packages && typeof props.quotationItems.Packages === 'object') {
|
||||
Object.keys(props.quotationItems.Packages).forEach(subKey => {
|
||||
if (Array.isArray(props.quotationItems.Packages[subKey])) {
|
||||
props.quotationItems.Packages[subKey].forEach(item => {
|
||||
if (selectedItemsInModal.value.has(item.itemCode)) {
|
||||
allItems.push(item);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
if (allItems.length > 0) {
|
||||
emit('add-items', allItems);
|
||||
selectedItemsInModal.value = new Set();
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
selectedItemsInModal.value = new Set();
|
||||
searchTerm.value = "";
|
||||
emit('update:visible', false);
|
||||
};
|
||||
|
||||
// Watch modal visibility to reset state when closing
|
||||
watch(() => props.visible, (newVal) => {
|
||||
if (newVal) {
|
||||
// Modal is opening - reset to first tabs
|
||||
_activeItemTab.value = "";
|
||||
_activePackageTab.value = "";
|
||||
} else {
|
||||
// Modal is closing - reset state
|
||||
selectedItemsInModal.value = new Set();
|
||||
searchTerm.value = "";
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.items-modal-content {
|
||||
height: 70vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 1rem;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tabs-container {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.tabs-container :deep(.p-tabs) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.tabs-container :deep(.p-tabpanels) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.tabs-container :deep(.p-tabpanel) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.search-section {
|
||||
/* margin removed - parent gap handles spacing */
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.tip-section {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
padding: 0.75rem;
|
||||
background-color: #e3f2fd;
|
||||
border: 1px solid #2196f3;
|
||||
border-radius: 4px;
|
||||
color: #1565c0;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.tip-section i {
|
||||
color: #2196f3;
|
||||
}
|
||||
|
||||
.tip-section kbd {
|
||||
background-color: #fff;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 3px;
|
||||
padding: 2px 6px;
|
||||
font-family: monospace;
|
||||
font-size: 0.85em;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.modal-title-container {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.modal-title-container :deep(.p-tab) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
|
||||
.selection-badge {
|
||||
background-color: #2196f3;
|
||||
color: white;
|
||||
padding: 0.25rem 0.75rem;
|
||||
border-radius: 12px;
|
||||
font-size: 0.85rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.modal-actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.75rem;
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.nested-tabs {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nested-tabs :deep(.p-tabs) {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nested-tabs :deep(.p-tabpanels) {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.nested-tabs :deep(.p-tabpanel) {
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.package-items-container {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.75rem;
|
||||
height: 100%;
|
||||
overflow-y: scroll;
|
||||
padding: 0.5rem;
|
||||
}
|
||||
|
||||
.package-item {
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
padding: 0.75rem;
|
||||
background-color: #fafafa;
|
||||
transition: all 0.2s ease;
|
||||
}
|
||||
|
||||
.package-item:hover {
|
||||
background-color: #f0f0f0;
|
||||
border-color: #2196f3;
|
||||
}
|
||||
|
||||
.package-item-selected {
|
||||
background-color: #e3f2fd;
|
||||
border-color: #2196f3;
|
||||
border-width: 2px;
|
||||
}
|
||||
|
||||
.package-item-header {
|
||||
display: grid;
|
||||
grid-template-columns: 40px 120px 1fr 100px 80px;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.expand-button {
|
||||
width: 2rem;
|
||||
height: 2rem;
|
||||
}
|
||||
|
||||
.package-item-code {
|
||||
font-weight: 600;
|
||||
color: #333;
|
||||
font-family: monospace;
|
||||
}
|
||||
|
||||
.package-item-name {
|
||||
color: #555;
|
||||
}
|
||||
|
||||
.package-item-price {
|
||||
font-weight: 600;
|
||||
color: #2196f3;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.add-package-button {
|
||||
justify-self: end;
|
||||
}
|
||||
|
||||
.bom-details {
|
||||
margin-top: 0.75rem;
|
||||
padding: 0.75rem;
|
||||
background-color: #fff;
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.bom-header {
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.bom-item {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
}
|
||||
|
||||
.bom-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.bom-item-content {
|
||||
display: grid;
|
||||
grid-template-columns: 32px 24px 120px 1fr 100px;
|
||||
gap: 0.5rem;
|
||||
padding: 0.5rem;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.bom-expand-button {
|
||||
width: 1.5rem;
|
||||
height: 1.5rem;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.bom-item-bullet {
|
||||
font-size: 0.4rem;
|
||||
color: #ccc;
|
||||
margin-left: 0.5rem;
|
||||
}
|
||||
|
||||
.package-icon {
|
||||
color: #2196f3;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.bom-item-code {
|
||||
font-family: monospace;
|
||||
color: #666;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.bom-item-name {
|
||||
color: #555;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.bom-item-qty {
|
||||
color: #888;
|
||||
font-size: 0.85rem;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.nested-bom {
|
||||
background-color: #fafafa;
|
||||
border-left: 2px solid #e0e0e0;
|
||||
margin-left: 1rem;
|
||||
}
|
||||
</style>
|
||||
@ -20,24 +20,27 @@
|
||||
|
||||
<div v-else-if="formConfig" class="form-container">
|
||||
<Button @click="debugLog" label="Debug" severity="secondary" size="small" class="debug-button" />
|
||||
<template v-for="row in groupedFields" :key="`row-${row.rowIndex}`">
|
||||
<div class="form-row">
|
||||
<div
|
||||
v-for="field in row.fields"
|
||||
:key="field.name"
|
||||
:class="`form-column-${Math.min(Math.max(field.columns || 12, 1), 12)}`"
|
||||
>
|
||||
<div class="form-field">
|
||||
<!-- Field Label -->
|
||||
<label :for="field.name" class="field-label">
|
||||
{{ field.label }}
|
||||
<span v-if="field.required" class="required-indicator">*</span>
|
||||
</label>
|
||||
<div
|
||||
v-for="row in groupedFields"
|
||||
:key="`row-${row.rowIndex}`"
|
||||
class="form-row"
|
||||
>
|
||||
<div
|
||||
v-for="field in row.fields"
|
||||
:key="field.name"
|
||||
:class="`form-column-${Math.min(Math.max(field.columns || 12, 1), 12)}`"
|
||||
>
|
||||
<div class="form-field">
|
||||
<!-- Field Label -->
|
||||
<label :for="field.name" class="field-label">
|
||||
{{ field.label }}
|
||||
<span v-if="field.required" class="required-indicator">*</span>
|
||||
</label>
|
||||
|
||||
<!-- Help Text -->
|
||||
<small v-if="field.helpText" class="field-help-text">
|
||||
{{ field.helpText }}
|
||||
</small>
|
||||
<!-- Help Text -->
|
||||
<small v-if="field.helpText" class="field-help-text">
|
||||
{{ field.helpText }}
|
||||
</small>
|
||||
|
||||
<!-- Data/Text Field -->
|
||||
<template v-if="field.type === 'Data' || field.type === 'Text'">
|
||||
@ -211,10 +214,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div v-else class="error-container">
|
||||
@ -573,7 +575,7 @@ const loadDoctypeOptions = async () => {
|
||||
for (const field of fieldsWithDoctype) {
|
||||
try {
|
||||
// Use the new API method for fetching docs
|
||||
let docs = await Api.getQuotationItems();
|
||||
let docs = await Api.getQuotationItems(props.projectTemplate);
|
||||
|
||||
// Deduplicate by value field
|
||||
const valueField = field.doctypeValueField || 'name';
|
||||
|
||||
382
frontend/src/components/modals/SavePackageModal.vue
Normal file
382
frontend/src/components/modals/SavePackageModal.vue
Normal file
@ -0,0 +1,382 @@
|
||||
<template>
|
||||
<Modal
|
||||
:visible="visible"
|
||||
@update:visible="$emit('update:visible', $event)"
|
||||
@close="handleClose"
|
||||
:options="{ showActions: false }"
|
||||
>
|
||||
<template #title>Save as Package</template>
|
||||
<div class="modal-content">
|
||||
<div class="form-section">
|
||||
<label for="packageName" class="field-label">
|
||||
Package Name
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<InputText
|
||||
id="packageName"
|
||||
v-model="formData.packageName"
|
||||
placeholder="Enter package name"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<label for="description" class="field-label">
|
||||
Description
|
||||
</label>
|
||||
<InputText
|
||||
id="description"
|
||||
v-model="formData.description"
|
||||
placeholder="Enter package description (optional)"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<label for="codePrefix" class="field-label">
|
||||
Code Prefix
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<Select
|
||||
id="codePrefix"
|
||||
v-model="formData.codePrefix"
|
||||
:options="codePrefixOptions"
|
||||
placeholder="Select a code prefix"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<label for="category" class="field-label">
|
||||
Category
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<Select
|
||||
id="category"
|
||||
v-model="formData.category"
|
||||
:options="categories"
|
||||
placeholder="Select a category"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<label for="rate" class="field-label">
|
||||
Rate
|
||||
<span class="required">*</span>
|
||||
</label>
|
||||
<InputNumber
|
||||
id="rate"
|
||||
v-model="formData.rate"
|
||||
mode="currency"
|
||||
currency="USD"
|
||||
locale="en-US"
|
||||
:min="0"
|
||||
placeholder="$0.00"
|
||||
fluid
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="form-section">
|
||||
<h4>Package Contents</h4>
|
||||
<div v-if="items.length === 0" class="no-items">
|
||||
No items selected
|
||||
</div>
|
||||
<div v-else class="items-list">
|
||||
<div
|
||||
v-for="(item, index) in items"
|
||||
:key="index"
|
||||
class="package-item"
|
||||
>
|
||||
<div class="item-header" @click="toggleItemExpansion(index)">
|
||||
<div class="item-info">
|
||||
<i
|
||||
v-if="isPackage(item)"
|
||||
:class="[
|
||||
'pi',
|
||||
expandedItems.has(index) ? 'pi-chevron-down' : 'pi-chevron-right',
|
||||
'expand-icon'
|
||||
]"
|
||||
></i>
|
||||
<span class="item-name">{{ item.itemName || item.itemCode }}</span>
|
||||
<span v-if="isPackage(item)" class="package-badge">Package</span>
|
||||
</div>
|
||||
<span class="item-qty">Qty: {{ item.qty || 1 }}</span>
|
||||
</div>
|
||||
<div
|
||||
v-if="isPackage(item) && expandedItems.has(index)"
|
||||
class="package-contents"
|
||||
>
|
||||
<div
|
||||
v-for="(bomItem, bomIndex) in item.bom"
|
||||
:key="bomIndex"
|
||||
class="bom-item"
|
||||
>
|
||||
<span class="bom-item-name">{{ bomItem.itemName || bomItem.itemCode }}</span>
|
||||
<span class="bom-item-qty">Qty: {{ bomItem.qty || 1 }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="action-buttons">
|
||||
<Button label="Cancel" @click="handleClose" severity="secondary" />
|
||||
<Button
|
||||
label="Save Package"
|
||||
@click="handleSave"
|
||||
:disabled="!isFormValid"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { ref, reactive, computed, watch } from "vue";
|
||||
import Modal from "../common/Modal.vue";
|
||||
import InputText from "primevue/inputtext";
|
||||
import InputNumber from "primevue/inputnumber";
|
||||
import Button from "primevue/button";
|
||||
import Select from "primevue/select";
|
||||
import Api from "../../api";
|
||||
import { useNotificationStore } from "../../stores/notifications-primevue";
|
||||
|
||||
const props = defineProps({
|
||||
visible: {
|
||||
type: Boolean,
|
||||
required: true,
|
||||
},
|
||||
items: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
defaultRate: {
|
||||
type: Number,
|
||||
default: 0,
|
||||
},
|
||||
});
|
||||
|
||||
const emit = defineEmits(["update:visible", "save"]);
|
||||
|
||||
const notificationStore = useNotificationStore();
|
||||
|
||||
const formData = reactive({
|
||||
packageName: "",
|
||||
description: "",
|
||||
codePrefix: null,
|
||||
category: null,
|
||||
rate: null,
|
||||
});
|
||||
|
||||
const codePrefixOptions = ref(["BLDR", "SNW-I"]);
|
||||
const categories = ref([]);
|
||||
const expandedItems = ref(new Set());
|
||||
const isLoading = ref(false);
|
||||
|
||||
const isFormValid = computed(() => {
|
||||
return formData.packageName.trim() !== "" &&
|
||||
formData.codePrefix !== null &&
|
||||
formData.category !== null &&
|
||||
formData.rate !== null &&
|
||||
formData.rate > 0;
|
||||
});
|
||||
|
||||
const isPackage = (item) => {
|
||||
return item.bom && Array.isArray(item.bom) && item.bom.length > 0;
|
||||
};
|
||||
|
||||
const toggleItemExpansion = (index) => {
|
||||
const item = props.items[index];
|
||||
if (!isPackage(item)) return;
|
||||
|
||||
if (expandedItems.value.has(index)) {
|
||||
expandedItems.value.delete(index);
|
||||
} else {
|
||||
expandedItems.value.add(index);
|
||||
}
|
||||
};
|
||||
|
||||
const fetchCategories = async () => {
|
||||
try {
|
||||
isLoading.value = true;
|
||||
const result = await Api.getItemCategories();
|
||||
categories.value = result || [];
|
||||
} catch (error) {
|
||||
console.error("Error fetching item categories:", error);
|
||||
notificationStore.addNotification("Failed to fetch item categories", "error");
|
||||
categories.value = [];
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
};
|
||||
|
||||
const handleClose = () => {
|
||||
// Reset form
|
||||
formData.packageName = "";
|
||||
formData.description = "";
|
||||
formData.codePrefix = null;
|
||||
formData.category = null;
|
||||
formData.rate = null;
|
||||
expandedItems.value.clear();
|
||||
emit("update:visible", false);
|
||||
};
|
||||
|
||||
const handleSave = () => {
|
||||
if (!isFormValid.value) {
|
||||
notificationStore.addNotification("Please fill in all required fields", "error");
|
||||
return;
|
||||
}
|
||||
|
||||
const packageData = {
|
||||
packageName: formData.packageName,
|
||||
description: formData.description,
|
||||
codePrefix: formData.codePrefix,
|
||||
category: formData.category,
|
||||
rate: formData.rate,
|
||||
items: props.items.map(item => ({
|
||||
itemCode: item.itemCode,
|
||||
itemName: item.itemName,
|
||||
qty: item.qty || 1,
|
||||
uom: item.uom || item.stockUom,
|
||||
})),
|
||||
};
|
||||
|
||||
emit("save", packageData);
|
||||
handleClose();
|
||||
};
|
||||
|
||||
// Watch for modal opening to fetch categories
|
||||
watch(
|
||||
() => props.visible,
|
||||
(newVal) => {
|
||||
if (newVal) {
|
||||
fetchCategories();
|
||||
// Set rate to defaultRate when modal opens
|
||||
if (props.defaultRate > 0) {
|
||||
formData.rate = props.defaultRate;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.modal-content {
|
||||
padding: 1.5rem;
|
||||
max-height: 70vh;
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
.form-section {
|
||||
margin-bottom: 1.5rem;
|
||||
}
|
||||
|
||||
.field-label {
|
||||
display: block;
|
||||
margin-bottom: 0.5rem;
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.required {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.no-items {
|
||||
padding: 2rem;
|
||||
text-align: center;
|
||||
color: #666;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.items-list {
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.package-item {
|
||||
border-bottom: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.package-item:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.item-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
padding: 0.75rem 1rem;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.item-header:hover {
|
||||
background-color: #f8f9fa;
|
||||
}
|
||||
|
||||
.item-info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.expand-icon {
|
||||
font-size: 0.8rem;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.item-name {
|
||||
font-weight: 500;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.package-badge {
|
||||
display: inline-block;
|
||||
padding: 0.2rem 0.5rem;
|
||||
background-color: #e3f2fd;
|
||||
color: #1976d2;
|
||||
border-radius: 4px;
|
||||
font-size: 0.75rem;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.item-qty {
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.package-contents {
|
||||
background-color: #f8f9fa;
|
||||
padding: 0.5rem 1rem 0.5rem 2.5rem;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
}
|
||||
|
||||
.bom-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 0.5rem 0;
|
||||
color: #666;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.bom-item-name {
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.bom-item-qty {
|
||||
color: #999;
|
||||
}
|
||||
|
||||
.action-buttons {
|
||||
display: flex;
|
||||
gap: 1rem;
|
||||
justify-content: flex-end;
|
||||
margin-top: 1.5rem;
|
||||
padding-top: 1rem;
|
||||
border-top: 1px solid #e0e0e0;
|
||||
}
|
||||
</style>
|
||||
@ -318,9 +318,9 @@ const handleSubmit = async () => {
|
||||
const createdClient = await Api.createClient(client.value);
|
||||
console.log("Created client:", createdClient);
|
||||
notificationStore.addSuccess("Client created successfully!");
|
||||
stripped_name = createdClient.customerName.split("-#-")[0].trim();
|
||||
const strippedName = createdClient.name.split("-#-")[0].trim();
|
||||
// Navigate to the created client
|
||||
router.push('/client?client=' + encodeURIComponent(stripped_name));
|
||||
router.push('/client?client=' + encodeURIComponent(strippedName));
|
||||
} else {
|
||||
// TODO: Implement save logic
|
||||
notificationStore.addSuccess("Changes saved successfully!");
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
115
stripe-init-webhook.sh
Normal file
115
stripe-init-webhook.sh
Normal file
@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to initialize and run Stripe CLI webhook forwarding
|
||||
# Usage: ./stripe-init-webhook.sh --site <site> --port <port>
|
||||
|
||||
set -e
|
||||
|
||||
# Default values
|
||||
SITE=""
|
||||
PORT="8000"
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--site)
|
||||
SITE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--port)
|
||||
PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 --site <site> [--port <port>]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --site Required. The site domain (e.g., erp.local)"
|
||||
echo " --port Optional. The port number (default: 8000)"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " $0 --site erp.local --port 8000"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Use --help for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if required flag is provided
|
||||
if [ -z "$SITE" ]; then
|
||||
echo "Error: --site flag is required"
|
||||
echo "Usage: $0 --site <site> [--port <port>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking Stripe CLI installation..."
|
||||
|
||||
# Check if Stripe CLI is installed
|
||||
if ! command -v stripe &> /dev/null; then
|
||||
echo "Stripe CLI is not installed."
|
||||
read -p "Would you like to install it now? (y/n) " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo "Installing Stripe CLI..."
|
||||
|
||||
# Add GPG key
|
||||
echo "Adding Stripe GPG key..."
|
||||
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg > /dev/null
|
||||
|
||||
# Add repository
|
||||
echo "Adding Stripe repository..."
|
||||
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list
|
||||
|
||||
# Update and install
|
||||
echo "Updating package list..."
|
||||
sudo apt update
|
||||
|
||||
echo "Installing Stripe CLI..."
|
||||
sudo apt install stripe -y
|
||||
|
||||
echo "Stripe CLI installed successfully!"
|
||||
else
|
||||
echo "Installation cancelled. Exiting."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Stripe CLI is already installed."
|
||||
fi
|
||||
|
||||
# Check if Stripe CLI is authenticated
|
||||
echo "Checking authentication status..."
|
||||
if ! stripe config --list &> /dev/null; then
|
||||
echo "Stripe CLI is not authenticated."
|
||||
echo "Please log in to your Stripe account..."
|
||||
stripe login --interactive
|
||||
else
|
||||
# Try to verify authentication by running a simple command
|
||||
if stripe config --list | grep -q "test_mode_api_key"; then
|
||||
echo "Stripe CLI is authenticated."
|
||||
else
|
||||
echo "Stripe CLI authentication may be invalid."
|
||||
echo "Please log in to your Stripe account..."
|
||||
stripe login --interactive
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start Docker containers
|
||||
echo ""
|
||||
echo "Starting Docker containers..."
|
||||
docker compose -f docker-compose.local.yaml up -d
|
||||
|
||||
# Start listening for webhooks
|
||||
WEBHOOK_URL="http://${SITE}:${PORT}/api/method/custom_ui.api.public.payments.stripe_webhook"
|
||||
echo ""
|
||||
echo "Starting Stripe webhook listener..."
|
||||
echo "Forwarding to: $WEBHOOK_URL"
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop"
|
||||
echo ""
|
||||
|
||||
stripe listen --forward-to "$WEBHOOK_URL"
|
||||
150
stripe-local-init.sh
Executable file
150
stripe-local-init.sh
Executable file
@ -0,0 +1,150 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Script to initialize and run Stripe CLI webhook forwarding
|
||||
# Usage: ./stripe-init-webhook.sh --site <site> --port <port>
|
||||
|
||||
set -e
|
||||
|
||||
# Colors for output
|
||||
BLUE='\033[0;34m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Display banner
|
||||
echo ""
|
||||
echo -e "${BLUE}+-----------------------------------------------+${NC}"
|
||||
echo -e "${BLUE} ██████╗ ██╗ ██╗██╗██╗ ██████╗ ██╗ ██╗${NC}"
|
||||
echo -e "${BLUE} ██╔════╝ ██║ ██║██║██║ ██╔═══██╗██║ ██║${NC}"
|
||||
echo -e "${BLUE} ╚█████╗ ███████║██║██║ ██║ ██║███████║${NC}"
|
||||
echo -e "${BLUE} ╚═══██╗ ██╔══██║██║██║ ██║ ██║██╔══██║${NC}"
|
||||
echo -e "${BLUE} ██████╔╝ ██║ ██║██║███████╗╚██████╔╝██║ ██║${NC}"
|
||||
echo -e "${BLUE} ╚═════╝ ╚═╝ ╚═╝╚═╝╚══════╝ ╚═════╝ ╚═╝ ╚═╝${NC}"
|
||||
echo -e "${BLUE}+-----------------------------------------------+${NC}"
|
||||
echo -e "${YELLOW} 🚀 Automated Local Stripe Environment${NC}"
|
||||
echo -e "${YELLOW} 💼 For ERPNext Development${NC}"
|
||||
echo -e "${BLUE}+-----------------------------------------------+${NC}"
|
||||
echo ""
|
||||
|
||||
# Default values
|
||||
SITE=""
|
||||
PORT="8000"
|
||||
|
||||
# Parse command line arguments
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case $1 in
|
||||
--site)
|
||||
SITE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--port)
|
||||
PORT="$2"
|
||||
shift 2
|
||||
;;
|
||||
-h|--help)
|
||||
echo "Usage: $0 --site <site> [--port <port>]"
|
||||
echo ""
|
||||
echo "Options:"
|
||||
echo " --site Required. The site domain (e.g., erp.local)"
|
||||
echo " --port Optional. The port number (default: 8000)"
|
||||
echo ""
|
||||
echo "Example:"
|
||||
echo " $0 --site erp.local --port 8000"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
echo "Use --help for usage information"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Check if required flag is provided
|
||||
if [ -z "$SITE" ]; then
|
||||
echo -e "${RED}❌ Error: --site flag is required${NC}"
|
||||
echo "Usage: $0 --site <site> [--port <port>]"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${BLUE}🔍 Checking Stripe CLI installation...${NC}"
|
||||
|
||||
# Check if Stripe CLI is installed
|
||||
if ! command -v stripe &> /dev/null; then
|
||||
echo -e "${YELLOW}⚠️ Stripe CLI is not installed.${NC}"
|
||||
read -p "Would you like to install it now? (y/n) " -n 1 -r
|
||||
echo
|
||||
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
echo -e "${BLUE}📦 Installing Stripe CLI...${NC}"
|
||||
|
||||
# Add GPG key
|
||||
echo -e "${BLUE}🔑 Adding Stripe GPG key...${NC}"
|
||||
curl -s https://packages.stripe.dev/api/security/keypair/stripe-cli-gpg/public | gpg --dearmor | sudo tee /usr/share/keyrings/stripe.gpg > /dev/null
|
||||
|
||||
# Add repository
|
||||
echo -e "${BLUE}📚 Adding Stripe repository...${NC}"
|
||||
echo "deb [signed-by=/usr/share/keyrings/stripe.gpg] https://packages.stripe.dev/stripe-cli-debian-local stable main" | sudo tee -a /etc/apt/sources.list.d/stripe.list
|
||||
|
||||
# Update and install
|
||||
echo -e "${BLUE}🔄 Updating package list...${NC}"
|
||||
sudo apt update
|
||||
|
||||
echo -e "${BLUE}⬇️ Installing Stripe CLI...${NC}"
|
||||
sudo apt install stripe -y
|
||||
|
||||
echo -e "${GREEN}✅ Stripe CLI installed successfully!${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Installation cancelled. Exiting.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo -e "${GREEN}✅ Stripe CLI is already installed.${NC}"
|
||||
fi
|
||||
|
||||
# Check if Stripe CLI is authenticated
|
||||
echo -e "${BLUE}🔐 Checking authentication status...${NC}"
|
||||
if ! stripe config --list &> /dev/null; then
|
||||
echo -e "${YELLOW}⚠️ Stripe CLI is not authenticated.${NC}"
|
||||
echo -e "${BLUE}🔑 Please log in to your Stripe account...${NC}"
|
||||
stripe login --interactive
|
||||
else
|
||||
# Try to verify authentication by running a simple command
|
||||
if stripe config --list | grep -q "test_mode_api_key"; then
|
||||
echo -e "${GREEN}✅ Stripe CLI is authenticated.${NC}"
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ Stripe CLI authentication may be invalid.${NC}"
|
||||
echo -e "${BLUE}🔑 Please log in to your Stripe account...${NC}"
|
||||
stripe login --interactive
|
||||
fi
|
||||
fi
|
||||
|
||||
# Start Docker containers
|
||||
echo ""
|
||||
echo -e "${BLUE}🐳 Starting Docker containers...${NC}"
|
||||
docker compose -f docker-compose.local.yaml up -d
|
||||
|
||||
# Cleanup function to run on exit
|
||||
cleanup() {
|
||||
echo ""
|
||||
echo -e "${YELLOW}🛑 Shutting down...${NC}"
|
||||
echo -e "${BLUE}🐳 Stopping Docker containers...${NC}"
|
||||
docker compose -f docker-compose.local.yaml down
|
||||
echo -e "${GREEN}✨ Cleanup complete. Goodbye!${NC}"
|
||||
exit 0
|
||||
}
|
||||
|
||||
# Trap Ctrl+C (SIGINT) and termination signals
|
||||
trap cleanup SIGINT SIGTERM EXIT
|
||||
|
||||
# Start listening for webhooks
|
||||
WEBHOOK_URL="http://${SITE}:${PORT}/api/method/custom_ui.api.public.payments.stripe_webhook"
|
||||
echo ""
|
||||
echo -e "${GREEN}🎧 Starting Stripe webhook listener...${NC}"
|
||||
echo -e "${BLUE}📡 Forwarding to: ${YELLOW}$WEBHOOK_URL${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}⌨️ Press Ctrl+C to stop${NC}"
|
||||
echo ""
|
||||
|
||||
stripe listen --forward-to "$WEBHOOK_URL"
|
||||
Loading…
x
Reference in New Issue
Block a user