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

frappe.provide("erpnext.support");

frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
	erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Maintenance Schedule", "customer_address",
	erpnext.utils.get_address_display);
frappe.ui.form.on_change("Maintenance Schedule", "contact_person",
	erpnext.utils.get_contact_details);

// TODO commonify this code
erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
	refresh: function() {
		var me = this;

		if (this.frm.doc.docstatus === 0) {
			this.frm.add_custom_button(__('Sales Order'),
				function() {
					frappe.model.map_current_doc({
						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
						source_doctype: "Sales Order",
						get_query_filters: {
							docstatus: 1,
							order_type: me.frm.doc.order_type,
							customer: me.frm.doc.customer || undefined,
							company: me.frm.doc.company
						}
					});
				}, __("Get items from"));
		} else if (this.frm.doc.docstatus === 1) {
			this.frm.add_custom_button(__("Make Maintenance Visit"), function() {<commit_msg>get_address_display cannot be called directly<commit_after>// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
// License: GNU General Public License v3. See license.txt

frappe.provide("erpnext.support");

frappe.ui.form.on_change("Maintenance Schedule", "customer", function(frm) {
	erpnext.utils.get_party_details(frm) });
frappe.ui.form.on_change("Maintenance Schedule", "customer_address", function(){
	erpnext.utils.get_address_display(cur_frm, 'customer_address', 'address_display');
});
frappe.ui.form.on_change("Maintenance Schedule", "contact_person",
	erpnext.utils.get_contact_details);

// TODO commonify this code
erpnext.support.MaintenanceSchedule = frappe.ui.form.Controller.extend({
	refresh: function() {
		var me = this;

		if (this.frm.doc.docstatus === 0) {
			this.frm.add_custom_button(__('Sales Order'),
				function() {
					frappe.model.map_current_doc({
						method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule",
						source_doctype: "Sales Order",
						get_query_filters: {
							docstatus: 1,
							order_type: me.frm.doc.order_type,
							customer: me.frm.doc.customer || undefined,
							company: me.frm.doc.company
						}
					});
				}, __("Get items from"));
		} else if (this.frm.doc.docstatus === 1) {
			this.frm.add_custom_button(__("Make Maintenance Visit"), function() {
{'fraction_non_alphanumeric': 0.13896251419916697, 'fraction_numerical': 0.00605831124574025, 'mean_word_length': 4.3373737373737375, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5528045', 'n_tokens_mistral': 1032, 'n_tokens_neox': 867, 'n_words': 160}