Mainenance Module ERROR AFTER CHANGING FROM SALES ORDER TO INSTALLATION NOTE

I am getting the error afer I did some coding in the Maintenance Module in replacing FROM SALES ORDER TO INSTALLATION NOTE.

**Any further coding I have to update in py files?

File “/home/iuser/frappe-bench/apps/frappe/frappe/desk/search.py”, line 101, in search_widget
as_list=not as_dict)
File “/home/iuser/frappe-bench/apps/frappe/frappe/init.py”, line 1115, in get_list
return frappe.model.db_query.DatabaseQuery(doctype).execute(None, *args, **kwargs)
File “/home/iuser/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 88, in execute
result = self.build_and_run()
File “/home/iuser/frappe-bench/apps/frappe/frappe/model/db_query.py”, line 112, in build_and_run
return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug, update=self.update)
File “/home/iuser/frappe-bench/apps/frappe/frappe/database.py”, line 153, in sql
self._cursor.execute(query)
File “/home/iuser/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py”, line 250, in execute
self.errorhandler(self, exc, value)
File “/home/iuser/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py”, line 42, in defaulterrorhandler
raise errorvalue
OperationalError: (1054, “Unknown column ‘tabInstallation Note.transaction_date’ in ‘field list’”)

This is really difficult to say anything about the error without seeing your code changes. Please share you changes.

Thanks,

Please find the below code as I have done the coding only in the .js file of he Maintenance Module.

// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.provide(“erpnext.maintenance”);

frappe.ui.form.on(‘Maintenance Schedule’, {
setup: function(frm) {
frm.set_query(‘contact_person’, erpnext.queries.contact_query);
frm.set_query(‘customer_address’, erpnext.queries.address_query);
},
customer: function(frm) {
erpnext.utils.get_party_details(frm)
},
customer_address: function(frm) {
erpnext.utils.get_address_display(frm, ‘customer_address’, ‘address_display’);
},
contact_person: function(frm) {
erpnext.utils.get_contact_details(frm);
}

})

// TODO commonify this code
erpnext.maintenance.MaintenanceSchedule = frappe.ui.form.Controller.extend({
refresh: function() {
frappe.dynamic_link = {doc: this.frm.doc, fieldname: ‘customer’, doctype: ‘Customer’}

	var me = this;

	if (this.frm.doc.docstatus === 0) {
		this.frm.add_custom_button(__('Installation Note'),
			function() {
				erpnext.utils.map_current_doc({
					method: "erpnext.selling.doctype.installation_note.installation_note.make_maintenance_schedule",
					source_doctype: "Installation Note",
					target: me.frm,
					setters: {
						customer: me.frm.doc.customer || undefined
					},
					get_query_filters: {
						docstatus: 1,
						company: me.frm.doc.company
					}
				});
			}, __("Get items from"));
	} else if (this.frm.doc.docstatus === 1) {
		this.frm.add_custom_button(__("Make Maintenance Visit"), function() {
			frappe.model.open_mapped_doc({
				method: "erpnext.maintenance.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
				source_name: me.frm.doc.name,
				frm: me.frm
			})
		}, __("Make"));
	}
},

start_date: function(doc, cdt, cdn) {
	this.set_no_of_visits(doc, cdt, cdn);
},

end_date: function(doc, cdt, cdn) {
	this.set_no_of_visits(doc, cdt, cdn);
},

periodicity: function(doc, cdt, cdn) {
	this.set_no_of_visits(doc, cdt, cdn);
},

set_no_of_visits: function(doc, cdt, cdn) {
	var item = frappe.get_doc(cdt, cdn);

	if (item.start_date && item.end_date && item.periodicity) {
		if(item.start_date > item.end_date) {
			frappe.msgprint(__("Row {0}:Start Date must be before End Date", [item.idx]));
			return;
		}

		var date_diff = frappe.datetime.get_diff(item.end_date, item.start_date) + 1;

		var days_in_period = {
			"Weekly": 7,
			"Monthly": 30,
			"Quarterly": 91,
			"Half Yearly": 182,
			"Yearly": 365
		}

		var no_of_visits = cint(date_diff / days_in_period[item.periodicity]);
		frappe.model.set_value(item.doctype, item.name, "no_of_visits", no_of_visits);
	}
},

});

$.extend(cur_frm.cscript, new erpnext.maintenance.MaintenanceSchedule({frm: cur_frm}));

cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:‘Draft’});

if(doc.__islocal){
	set_multiple(dt,dn,{transaction_date: frappe.datetime.get_today()});
}

// set add fetch for item_code's item_name and description
cur_frm.add_fetch('item_code', 'item_name', 'item_name');
cur_frm.add_fetch('item_code', 'description', 'description');

}

cur_frm.cscript.generate_schedule = function(doc, cdt, cdn) {

Hi Nabin,

Thanks

Can you please clarify the line of coding to be changed.
Hope I do n’t need to change anything in the DB.

Hi, I am facing similar kind of issue like pymysql.err.InternalError: (1054, “Unknown column ‘tabGate Entry.transaction_date’ in ‘field list’”) while selecting Get items from button. What would be the solution for this?

Regards,
Nivedha

i have mapped Purchase Order doctype to another doctype which is Gate Entry through Get items custom button and then in Purchase Receipt i kept Get items from button and here i mapped Gate entry doctype and Purchase Receipt doctype button is visible by selecting on Get items from button popup it throws error like pymysql.err.InternalError: (1054, “Unknown column ‘tabGate Entry.transaction_date’ in ‘field list’”). I don’t want Purchase Order Transaction Date here. how can i rectify it?