ERPNext Foundation ERPNext Cloud User Manual Blog Discuss Frappé* Donate

Modified Availability Timeline


Hi All,

I’m looking for a little help to modify the Appointment Analytics page from the healthcare module to fit our business. I have some USD available on freelancer if this gets complicated (and as long as it is not against the rules here)…

We operate like a little hotel with a few properties in a slowly emerging part of the island and we need to supply our external vendors with a site showing our current available properties.

P.S. I’m a semi-retired systems architect & admin so when it comes to programming I’m limited to modifying other examples with the hopes that I can get it to work.

I’ve made a Property DocType with the following fields.

Property Name (Data)
Property Type (Select)
Beds (Int)
Sleeps (Int)
Pool (Data)

There is a Booking DocType with the following fields.

Property Name (Link to Property DocType)
Arrival Date (Date)
Departure Date (Date)

There is a separate Property Rate DocType with a Property Rate Table which I would use for Budget and Budget Period… We can get to that later because I am still thinking the best way to do it.


The unique value of each filters are loaded from unique data in the database, example data is:

Property Type [Condo, Apartment]
Beds [1,2,3]
Sleeps [2,3,4,5,6]
Pool [No, Yes - Ground Floor, Yes - Roof top]

Filters by default are ALL or ANY so all properties are shown. Hence it would Select all data from Booking DocType and calculate the days which the Property is Booked. Example above “Test Room” has an Arrival Date on 01-01 and Departure Date on 03-01 so 01-02 are marked as Booked. If the Arrival Date was 01-01 and Departure Date was 08-01 then the whole row would be marked as Booked.


When a vendor changes any field the results would filter out accordingly.

 this.tree_grids = {
                    "Medical Department": {
                            label: __("Department"),
                            show: true,
                            item_key: "practitioner",
                            parent_field: "department",
                            formatter: function(item) {
                    "Healthcare Practitioner": {
                            label: __("Healthcare Practitioner"),
                            show: true,
                            item_key: "practitioner",
                            formatter: function(item) {

I see what this tree grid does, but it is not needed in my case. Is it necessary code? I try to remove all traces of the code but then the page doesn’t load (no errors, just white screen).

{fieldtype:"Select", label: __("Healthcare Practitioner"), link:"Healthcare Practitioner", fieldname: "practitioner",
                        default_value: __("Select Healthcare Practitioner..."), filter: function(val, item, opts) {
                                return val == opts.default_value || == val || item._show;
                        }, link_formatter: {filter_input: "practitioner"}},

I don’t need a Link for any of my filters correct? So what would the code look like based on my examples?

“” would be changed to item.property_type, item.beds, item.sleeps (and so on)?

This Is what I think would need to be changed to calculate if the property is booked or available, i.e. If the Arrival Date was 01-01 and Departure Date was 07-01 then the whole row would be marked as Booked.

prepare_table: function() {
var me = this;
var from_date = frappe.datetime.str_to_obj(this.arrival_date);
var to_date = frappe.datetime.str_to_obj(this.departure_date);
$.each(, function(i, tl) {
if (me.is_default(‘company’) ? true : === {

  //if date range is shown on the table (between the values selected in filters) then mark //columns starting on the from_date to the to_date (exclusive - to_date is still available to //book).
  //Else mark all the columns as available..

Any and all help or guidance is appreciated.