Skip to content

Commit

Permalink
Merge pull request #28 from navariltd/ft-property-doctype
Browse files Browse the repository at this point in the history
fix: connections, previous reading
  • Loading branch information
muruthigitau authored Nov 7, 2024
2 parents c3a7fde + bb85591 commit 7be1b25
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions utility_billing/fixtures/custom_field.json
Original file line number Diff line number Diff line change
Expand Up @@ -311,14 +311,14 @@
"in_list_view": 0,
"in_preview": 0,
"in_standard_filter": 0,
"insert_after": "quantity",
"insert_after": "more_info_tab",
"is_system_generated": 0,
"is_virtual": 0,
"label": "Utility Service Request",
"length": 0,
"link_filters": null,
"mandatory_depends_on": null,
"modified": "2024-10-14 05:49:24.195096",
"modified": "2024-11-07 07:38:13.456406",
"module": "Utility Billing",
"name": "BOM-custom_utility_request",
"no_copy": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,21 @@ frappe.ui.form.on("Meter Reading", {
frm.set_value("customer_name", r.message.customer_name);
frm.set_value("territory", r.message.territory);
frm.set_value("price_list", r.message.default_price_list);
frm.doc.items.forEach((item) => {
if (item.item_code) {
frappe.call({
method: "utility_billing.utility_billing.doctype.meter_reading.meter_reading.get_previous_invoice_reading",
args: {
item_code: item.item_code,
customer: frm.doc.customer,
},
callback: function (r) {
item.previous_reading = r.message || 0;
frm.refresh_field("items");
},
});
}
});
}
},
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
"field_order": [
"item_code",
"meter_number",
"current_reading",
"meter_reading",
"column_break_fkvl",
"current_reading",
"previous_reading",
"consumption",
"stock_qty",
Expand Down Expand Up @@ -106,7 +106,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-11-06 06:20:37.916756",
"modified": "2024-11-07 07:25:13.812814",
"modified_by": "Administrator",
"module": "Utility Billing",
"name": "Sales Invoice Meter Reading",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"uom",
"qty",
"column_break_smgb",
"previous_reading",
"current_reading",
"previous_reading",
"consumption"
],
"fields": [
Expand Down Expand Up @@ -111,7 +111,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2024-11-06 06:19:27.648258",
"modified": "2024-11-07 00:03:24.415579",
"modified_by": "Administrator",
"module": "Utility Billing",
"name": "Sales Order Meter Reading",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ def get_data():
"label": "Sales",
"items": [
"Sales Order",
"Sales Invoice",
],
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ def map_sales_order_meter_readings_to_invoice(sales_order_name, target_doc):
meter_readings = sales_order.get("meter_readings")
target_doc.set("meter_readings", [])
if sales_order.utility_property: target_doc.utility_property = sales_order.utility_property
if sales_order.utility_service_request: target_doc.utility_service_request = sales_order.utility_service_request

for reading in meter_readings:
new_reading_data = reading.as_dict()
Expand Down

0 comments on commit 7be1b25

Please sign in to comment.