Skip to content

Commit

Permalink
feat: doctype links for sales order
Browse files Browse the repository at this point in the history
  • Loading branch information
muruthigitau committed Oct 15, 2024
1 parent 4376119 commit dc6fbc6
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
36 changes: 36 additions & 0 deletions utility_billing/fixtures/doctype_link.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
[
{
"custom": 0,
"docstatus": 0,
"doctype": "DocType Link",
"group": "Utility Billing",
"hidden": 0,
"is_child_table": 0,
"link_doctype": "Utility Service Request",
"link_fieldname": "sales_order",
"modified": "2024-10-15 09:05:23.141183",
"name": "p9tpcelsh8",
"parent": "Sales Order",
"parent_doctype": null,
"parentfield": "links",
"parenttype": "DocType",
"table_fieldname": null
},
{
"custom": 0,
"docstatus": 0,
"doctype": "DocType Link",
"group": "Utility Billing",
"hidden": 0,
"is_child_table": 0,
"link_doctype": "Meter Reading",
"link_fieldname": "sales_order",
"modified": "2024-10-15 09:05:23.141183",
"name": "pig054jhm1",
"parent": "Sales Order",
"parent_doctype": null,
"parentfield": "links",
"parenttype": "DocType",
"table_fieldname": "sales_order"
}
]
7 changes: 7 additions & 0 deletions utility_billing/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@
["module", "=", "Utility Billing"],
],
},
{
"doctype": "DocType Link",
"filters": [
["parent", "in", ["Sales Order"]],
["group", "=", "Utility Billing"],
],
},
]


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"date",
"request_type",
"territory",
"sales_order",
"column_break_wxld",
"company",
"tax_id",
Expand Down Expand Up @@ -265,12 +266,18 @@
"fieldtype": "Link",
"label": "Customer",
"options": "Customer"
},
{
"fieldname": "sales_order",
"fieldtype": "Link",
"label": "Sales Order",
"options": "Sales Order"
}
],
"index_web_pages_for_search": 1,
"is_submittable": 1,
"links": [],
"modified": "2024-10-15 07:45:18.266932",
"modified": "2024-10-15 08:34:46.547441",
"modified_by": "Administrator",
"module": "Utility Billing",
"name": "Utility Service Request",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ def create_sales_order(doc, customer_doc):

sales_order_doc.insert()

doc.customer = customer_doc.name
doc.sales_order = sales_order_doc.name
doc.save()

if auto_submit_sales_order != "Draft":
sales_order_doc.submit()
Expand Down

0 comments on commit dc6fbc6

Please sign in to comment.