Merge branch 'responsive' of github.com:webnotes/erpnext into responsive

This commit is contained in:
Nabin Hait 2013-07-10 13:16:17 +05:30
commit 96b8acb9da
21 changed files with 348 additions and 330 deletions

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-22 12:43:10", "creation": "2013-05-22 12:43:10",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:21:47", "modified": "2013-07-10 11:56:50",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -62,6 +62,12 @@
"read_only": 0, "read_only": 0,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "qty", "fieldname": "qty",
@ -155,6 +161,12 @@
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "accounting",
"fieldtype": "Section Break",
"label": "Accounting"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "expense_head", "fieldname": "expense_head",
@ -183,6 +195,12 @@
"read_only": 0, "read_only": 0,
"width": "120px" "width": "120px"
}, },
{
"doctype": "DocField",
"fieldname": "reference",
"fieldtype": "Section Break",
"label": "Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "project_name", "fieldname": "project_name",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-06-04 11:02:19", "creation": "2013-06-04 11:02:19",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:46:12", "modified": "2013-07-10 11:57:15",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -81,6 +81,12 @@
"reqd": 1, "reqd": 1,
"width": "200px" "width": "200px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "qty", "fieldname": "qty",
@ -181,15 +187,9 @@
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "accounting",
"fieldtype": "Link", "fieldtype": "Section Break",
"hidden": 0, "label": "Accounting"
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"print_hide": 1,
"read_only": 0
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -234,6 +234,24 @@
"reqd": 0, "reqd": 0,
"width": "120px" "width": "120px"
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{
"doctype": "DocField",
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"print_hide": 1,
"read_only": 0
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "serial_no", "fieldname": "serial_no",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-24 19:29:06", "creation": "2013-05-24 19:29:06",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 11:45:00", "modified": "2013-07-10 11:55:03",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -78,6 +78,12 @@
"reqd": 1, "reqd": 1,
"search_index": 1 "search_index": 1
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "description", "fieldname": "description",
@ -193,6 +199,12 @@
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "warehouse",

View File

@ -196,7 +196,7 @@ class DocType(TransactionBase):
@webnotes.whitelist() @webnotes.whitelist()
def get_dashboard_info(supplier): def get_dashboard_info(supplier):
if not webnotes.has_permission("Supplier", supplier): if not webnotes.has_permission("Supplier", "read", supplier):
webnotes.msgprint("No Permission", raise_exception=True) webnotes.msgprint("No Permission", raise_exception=True)
out = {} out = {}

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-22 12:43:10", "creation": "2013-05-22 12:43:10",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:15:15", "modified": "2013-07-10 11:54:21",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -75,6 +75,12 @@
"reqd": 1, "reqd": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"default": "0.00", "default": "0.00",
"doctype": "DocField", "doctype": "DocField",
@ -178,6 +184,12 @@
"read_only": 1, "read_only": 1,
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "warehouse",

View File

@ -177,7 +177,7 @@ class DocType(TransactionBase):
@webnotes.whitelist() @webnotes.whitelist()
def get_dashboard_info(customer): def get_dashboard_info(customer):
if not webnotes.has_permission("Customer", customer): if not webnotes.has_permission("Customer", "read", customer):
webnotes.msgprint("No Permission", raise_exception=True) webnotes.msgprint("No Permission", raise_exception=True)
out = {} out = {}

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:27:51", "creation": "2013-02-22 01:27:51",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-07 07:03:26", "modified": "2013-07-10 11:52:34",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -80,14 +80,9 @@
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "basic_rate", "fieldname": "quantity_and_rate",
"fieldtype": "Currency", "fieldtype": "Section Break",
"hidden": 1, "label": "Quantity and Rate"
"label": "Basic Rate",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -97,6 +92,17 @@
"oldfieldname": "qty", "oldfieldname": "qty",
"oldfieldtype": "Currency" "oldfieldtype": "Currency"
}, },
{
"doctype": "DocField",
"fieldname": "basic_rate",
"fieldtype": "Currency",
"hidden": 1,
"label": "Basic Rate",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "uom", "fieldname": "uom",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-03-07 11:42:57", "creation": "2013-03-07 11:42:57",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:24:21", "modified": "2013-07-10 11:52:06",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -79,6 +79,12 @@
"reqd": 1, "reqd": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"default": "0.00", "default": "0.00",
"doctype": "DocField", "doctype": "DocField",
@ -217,6 +223,12 @@
"search_index": 0, "search_index": 0,
"width": "100px" "width": "100px"
}, },
{
"doctype": "DocField",
"fieldname": "reference",
"fieldtype": "Section Break",
"label": "Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "item_group", "fieldname": "item_group",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-03-07 11:42:58", "creation": "2013-03-07 11:42:58",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:28:31", "modified": "2013-07-10 11:41:52",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -76,6 +76,12 @@
"search_index": 1, "search_index": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"default": "0.00", "default": "0.00",
"doctype": "DocField", "doctype": "DocField",
@ -203,6 +209,12 @@
"reqd": 0, "reqd": 0,
"width": "100px" "width": "100px"
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "reserved_warehouse", "fieldname": "reserved_warehouse",

View File

@ -32,4 +32,13 @@ class DocType(DocTypeNestedSet):
for d in getlist(self.doclist, 'target_details'): for d in getlist(self.doclist, 'target_details'):
if not flt(d.target_qty) and not flt(d.target_amount): if not flt(d.target_qty) and not flt(d.target_amount):
webnotes.msgprint("Either target qty or target amount is mandatory.") webnotes.msgprint("Either target qty or target amount is mandatory.")
raise Exception raise Exception
def get_email_id(self):
profile = webnotes.conn.get_value("Employee", self.doc.employee, "user_id")
if not profile:
webnotes.msgprint("User ID (Profile) no set for Employee %s" % self.doc.employee,
raise_exception=True)
else:
return webnotes.conn.get_value("Profile", profile, "email") or profile

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:24", "creation": "2013-01-10 16:34:24",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-05 14:54:33", "modified": "2013-07-10 12:51:58",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -44,12 +44,10 @@
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "trash_reason", "fieldname": "name_and_employee_id",
"fieldtype": "Small Text", "fieldtype": "Section Break",
"label": "Trash Reason", "label": "Name and Employee ID",
"oldfieldname": "trash_reason", "options": "icon-user"
"oldfieldtype": "Small Text",
"read_only": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -93,7 +91,8 @@
"fieldname": "employee", "fieldname": "employee",
"fieldtype": "Link", "fieldtype": "Link",
"label": "Employee", "label": "Employee",
"options": "Employee" "options": "Employee",
"reqd": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -138,7 +137,8 @@
"fieldname": "target_details_section_break", "fieldname": "target_details_section_break",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Sales Person Targets", "label": "Sales Person Targets",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-bullseye"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-04-22 13:15:44", "creation": "2013-04-22 13:15:44",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:42:09", "modified": "2013-07-10 11:50:59",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -82,6 +82,12 @@
"reqd": 1, "reqd": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"label": "Quantity and Rate"
},
{ {
"default": "0.00", "default": "0.00",
"doctype": "DocField", "doctype": "DocField",
@ -207,6 +213,12 @@
"reqd": 0, "reqd": 0,
"width": "100px" "width": "100px"
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "warehouse",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:28:02", "creation": "2013-02-22 01:28:02",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 11:37:12", "modified": "2013-07-10 11:53:34",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -64,6 +64,12 @@
"reqd": 1, "reqd": 1,
"width": "250px" "width": "250px"
}, },
{
"doctype": "DocField",
"fieldname": "quantity_and_warehouse",
"fieldtype": "Section Break",
"label": "Quantity and Warehouse"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "warehouse",

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-05-24 19:29:10", "creation": "2013-05-24 19:29:10",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-09 12:20:50", "modified": "2013-07-10 11:56:05",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -65,6 +65,12 @@
"reqd": 1, "reqd": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "received_and_accepted",
"fieldtype": "Section Break",
"label": "Received and Accepted"
},
{ {
"default": "0.00", "default": "0.00",
"doctype": "DocField", "doctype": "DocField",
@ -120,6 +126,12 @@
"reqd": 1, "reqd": 1,
"width": "100px" "width": "100px"
}, },
{
"doctype": "DocField",
"fieldname": "rate_and_amount",
"fieldtype": "Section Break",
"label": "Rate and Amount"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "import_ref_rate", "fieldname": "import_ref_rate",
@ -200,6 +212,12 @@
"reqd": 0, "reqd": 0,
"width": "100px" "width": "100px"
}, },
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"label": "Warehouse and Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "warehouse", "fieldname": "warehouse",

View File

@ -17,6 +17,30 @@
wn.provide("erpnext.support"); wn.provide("erpnext.support");
// TODO commonify this code // TODO commonify this code
erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
refresh: function() {
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Sales Order'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_maintenance_schedule",
source_doctype: "Sales Order",
get_query_filters: {
docstatus: 1,
order_type: cur_frm.doc.order_type,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
} else if (this.frm.doc.docstatus===1) {
cur_frm.add_custom_button(wn._("Make Maintenance Visit"), function() {
wn.model.open_mapped_doc({
method: "support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
source_name: cur_frm.doc.name
})
})
}
},
customer: function() { customer: function() {
var me = this; var me = this;
if(this.frm.doc.customer) { if(this.frm.doc.customer) {
@ -27,23 +51,8 @@ erpnext.support.MaintenanceSchedule = wn.ui.form.Controller.extend({
if(!r.exc) me.frm.refresh_fields(); if(!r.exc) me.frm.refresh_fields();
} }
}); });
}
// TODO shift this to depends_on
unhide_field(['customer_address', 'contact_person', 'customer_name',
'address_display', 'contact_display', 'contact_mobile', 'contact_email',
'territory', 'customer_group']);
}
}, },
get_items: function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_maintenance_schedule",
source_name: cur_frm.doc.quotation_no,
});
unhide_field(['customer_address', 'contact_person', 'customer_name', 'address_display',
'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
}
}); });
$.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.support.MaintenanceSchedule({frm: cur_frm}));
@ -82,15 +91,6 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
} }
} }
cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
cur_frm.cscript.periodicity = function(doc, cdt, cdn){ cur_frm.cscript.periodicity = function(doc, cdt, cdn){
var d = locals[cdt][cdn]; var d = locals[cdt][cdn];
if(d.start_date && d.end_date){ if(d.start_date && d.end_date){

View File

@ -77,8 +77,8 @@ class DocType(TransactionBase):
self.update_amc_date(d.serial_no, d.end_date) self.update_amc_date(d.serial_no, d.end_date)
if d.incharge_name not in email_map: if d.incharge_name not in email_map:
e = sql("select email_id, name from `tabSales Person` where name='%s' " %(d.incharge_name),as_dict=1)[0] email_map[d.incharge_name] = webnotes.bean("Sales Person",
email_map[d.incharge_name] = (e['email_id']) d.incharge_name).run_method("get_email_id")
scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \ scheduled_date =sql("select scheduled_date from `tabMaintenance Schedule Detail` \
where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \ where incharge_name='%s' and item_code='%s' and parent='%s' " %(d.incharge_name, \
@ -312,6 +312,9 @@ class DocType(TransactionBase):
def make_maintenance_visit(source_name, target_doclist=None): def make_maintenance_visit(source_name, target_doclist=None):
from webnotes.model.mapper import get_mapped_doclist from webnotes.model.mapper import get_mapped_doclist
def update_status(source, target, parent):
target.maintenance_type = "Scheduled"
doclist = get_mapped_doclist("Maintenance Schedule", source_name, { doclist = get_mapped_doclist("Maintenance Schedule", source_name, {
"Maintenance Schedule": { "Maintenance Schedule": {
"doctype": "Maintenance Visit", "doctype": "Maintenance Visit",
@ -320,13 +323,15 @@ def make_maintenance_visit(source_name, target_doclist=None):
}, },
"validation": { "validation": {
"docstatus": ["=", 1] "docstatus": ["=", 1]
} },
"postprocess": update_status
}, },
"Maintenance Schedule Item": { "Maintenance Schedule Item": {
"doctype": "Maintenance Visit Purpose", "doctype": "Maintenance Visit Purpose",
"field_map": { "field_map": {
"parent": "prevdoc_docname", "parent": "prevdoc_docname",
"parenttype": "prevdoc_doctype" "parenttype": "prevdoc_doctype",
"incharge_name": "service_person"
} }
} }
}, target_doclist) }, target_doclist)

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:30", "creation": "2013-01-10 16:34:30",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-07 12:18:51", "modified": "2013-07-10 12:18:19",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -24,13 +24,19 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Maintenance Schedule", "parent": "Maintenance Schedule",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1 "report": 1,
"submit": 1,
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@ -42,7 +48,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Customer Details", "label": "Customer Details",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-user"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -97,6 +103,7 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "address_display", "fieldname": "address_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1,
"label": "Address", "label": "Address",
"read_only": 1 "read_only": 1
}, },
@ -104,20 +111,23 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_display", "fieldname": "contact_display",
"fieldtype": "Small Text", "fieldtype": "Small Text",
"hidden": 1,
"label": "Contact", "label": "Contact",
"read_only": 1 "read_only": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_mobile", "fieldname": "contact_mobile",
"fieldtype": "Text", "fieldtype": "Data",
"hidden": 1,
"label": "Mobile No", "label": "Mobile No",
"read_only": 1 "read_only": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_email", "fieldname": "contact_email",
"fieldtype": "Text", "fieldtype": "Data",
"hidden": 1,
"label": "Contact Email", "label": "Contact Email",
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
@ -202,26 +212,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Items", "label": "Items",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-shopping-cart"
},
{
"doctype": "DocField",
"fieldname": "sales_order_no",
"fieldtype": "Link",
"in_filter": 1,
"label": "Sales Order No",
"oldfieldname": "sales_order_no",
"oldfieldtype": "Link",
"options": "Sales Order",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
"report_hide": 1
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -238,7 +229,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Schedule", "label": "Schedule",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-time"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -258,41 +249,11 @@
"read_only": 1 "read_only": 1
}, },
{ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0, "role": "System Manager"
"role": "System Manager",
"submit": 1,
"write": 1
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 1, "role": "Maintenance Manager"
"role": "System Manager",
"submit": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Maintenance Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Maintenance Manager",
"submit": 0
} }
] ]

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:28:05", "creation": "2013-02-22 01:28:05",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-07 07:03:24", "modified": "2013-07-10 12:45:10",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "Administrator" "owner": "Administrator"
}, },
@ -57,6 +57,12 @@
"read_only": 1, "read_only": 1,
"width": "300px" "width": "300px"
}, },
{
"doctype": "DocField",
"fieldname": "schedule_details",
"fieldtype": "Section Break",
"label": "Schedule Details"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "start_date", "fieldname": "start_date",
@ -102,13 +108,19 @@
"fieldname": "incharge_name", "fieldname": "incharge_name",
"fieldtype": "Link", "fieldtype": "Link",
"in_filter": 1, "in_filter": 1,
"label": "Incharge Name", "label": "Sales Person Incharge",
"oldfieldname": "incharge_name", "oldfieldname": "incharge_name",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Sales Person", "options": "Sales Person",
"reqd": 1, "reqd": 1,
"search_index": 0 "search_index": 0
}, },
{
"doctype": "DocField",
"fieldname": "reference",
"fieldtype": "Section Break",
"label": "Reference"
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "serial_no", "fieldname": "serial_no",

View File

@ -17,6 +17,49 @@
wn.provide("erpnext.support"); wn.provide("erpnext.support");
// TODO commonify this code // TODO commonify this code
erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
refresh: function() {
if (this.frm.doc.docstatus===0) {
cur_frm.add_custom_button(wn._('From Maintenance Schedule'),
function() {
wn.model.map_current_doc({
method: "support.doctype.maintenance_schedule.maintenance_schedule.make_maintenance_visit",
source_doctype: "Maintenance Schedule",
get_query_filters: {
docstatus: 1,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
cur_frm.add_custom_button(wn._('From Customer Issue'),
function() {
wn.model.map_current_doc({
method: "support.doctype.customer_issue.customer_issue.make_maintenance_visit",
source_doctype: "Customer Issue",
get_query_filters: {
docstatus: 1,
status: ["in", "Open, Work in Progress"],
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
cur_frm.add_custom_button(wn._('From Sales Order'),
function() {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_maintenance_visit",
source_doctype: "Sales Order",
get_query_filters: {
docstatus: 1,
order_type: cur_frm.doc.order_type,
customer: cur_frm.doc.customer || undefined,
company: cur_frm.doc.company
}
})
});
}
cur_frm.cscript.hide_contact_info();
},
customer: function() { customer: function() {
var me = this; var me = this;
if(this.frm.doc.customer) { if(this.frm.doc.customer) {
@ -29,29 +72,9 @@ erpnext.support.MaintenanceVisit = wn.ui.form.Controller.extend({
}); });
// TODO shift this to depends_on // TODO shift this to depends_on
hide_contact_info(this.frm.doc); cur_frm.cscript.hide_contact_info();
} }
}, },
get_items: function() {
if(cur_frm.doc.sales_order_no) {
wn.model.map_current_doc({
method: "selling.doctype.sales_order.sales_order.make_maintenance_visit",
source_name: cur_frm.doc.quotation_no,
});
} else if (cur_frm.doc.customer_issue_no) {
wn.model.map_current_doc({
method: "support.doctype.customer_issue.customer_issue.make_maintenance_visit",
source_name: cur_frm.doc.quotation_no,
});
} else if (cur_frm.doc.maintenance_schedule) {
wn.model.map_current_doc({
method: "support.doctype.maintenance_schedule.maintenance_schedule\
.make_maintenance_visit",
source_name: cur_frm.doc.quotation_no,
});
}
}
}); });
$.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm})); $.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm}));
@ -59,17 +82,11 @@ $.extend(cur_frm.cscript, new erpnext.support.MaintenanceVisit({frm: cur_frm}));
cur_frm.cscript.onload = function(doc, dt, dn) { cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'}); if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()}); if(doc.__islocal) set_multiple(dt,dn,{mntc_date:get_today()});
hide_contact_info(doc); cur_frm.cscript.hide_contact_info();
} }
var hide_contact_info = function(doc) { cur_frm.cscript.hide_contact_info = function() {
if(doc.customer) $(cur_frm.fields_dict.contact_info_section.row.wrapper).toggle(true); cur_frm.toggle_display("contact_info_section", cur_frm.doc.customer ? true : false);
else $(cur_frm.fields_dict.contact_info_section.row.wrapper).toggle(false);
}
cur_frm.cscript.refresh = function(doc) {
hide_contact_info(doc);
} }
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) { cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
@ -84,14 +101,6 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50'; return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
} }
cur_frm.cscript.get_items = function(doc, dt, dn) {
var callback = function(r,rt) {
hide_contact_info(doc);
cur_frm.refresh();
}
get_server_fields('fetch_items','','',doc, dt, dn,1,callback);
}
cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) { cur_frm.fields_dict['maintenance_visit_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50'; return 'SELECT tabItem.name,tabItem.item_name,tabItem.description FROM tabItem WHERE tabItem.is_service_item="Yes" AND tabItem.docstatus != 2 AND tabItem.%(key)s LIKE "%s" LIMIT 50';
} }
@ -104,36 +113,4 @@ cur_frm.cscript.item_code = function(doc, cdt, cdn) {
} }
} }
cur_frm.fields_dict['sales_order_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabSales Order`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT DISTINCT `tabSales Order`.name FROM `tabSales Order`, `tabSales Order Item`, `tabItem` WHERE `tabSales Order`.company = "%(company)s" AND `tabSales Order`.docstatus = 1 AND `tabSales Order Item`.parent = `tabSales Order`.name AND `tabSales Order Item`.item_code = `tabItem`.name AND `tabItem`.is_service_item = "Yes" AND %(cond)s `tabSales Order`.name LIKE "%s" ORDER BY `tabSales Order`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
cur_frm.fields_dict['customer_issue_no'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabCustomer Issue`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT `tabCustomer Issue`.name FROM `tabCustomer Issue` WHERE `tabCustomer Issue`.company = "%(company)s" AND %(cond)s `tabCustomer Issue`.docstatus = 1 AND (`tabCustomer Issue`.status = "Open" OR `tabCustomer Issue`.status = "Work In Progress") AND `tabCustomer Issue`.name LIKE "%s" ORDER BY `tabCustomer Issue`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
cur_frm.fields_dict['maintenance_schedule'].get_query = function(doc) {
doc = locals[this.doctype][this.docname];
var cond = '';
if(doc.customer) {
cond = '`tabMaintenance Schedule`.customer = "'+doc.customer+'" AND';
}
return repl('SELECT `tabMaintenance Schedule`.name FROM `tabMaintenance Schedule` WHERE `tabMaintenance Schedule`.company = "%(company)s" AND %(cond)s `tabMaintenance Schedule`.docstatus = 1 AND `tabMaintenance Schedule`.name LIKE "%s" ORDER BY `tabMaintenance Schedule`.name DESC LIMIT 50', {company:doc.company, cond:cond});
}
//get query select Territory
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query; cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-01-10 16:34:31", "creation": "2013-01-10 16:34:31",
"docstatus": 0, "docstatus": 0,
"modified": "2013-07-07 12:08:12", "modified": "2013-07-10 12:26:15",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "ashwini@webnotestech.com" "owner": "ashwini@webnotestech.com"
}, },
@ -24,13 +24,19 @@
"permlevel": 0 "permlevel": 0
}, },
{ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"name": "__common__", "name": "__common__",
"parent": "Maintenance Visit", "parent": "Maintenance Visit",
"parentfield": "permissions", "parentfield": "permissions",
"parenttype": "DocType", "parenttype": "DocType",
"permlevel": 0,
"read": 1, "read": 1,
"report": 1 "report": 1,
"submit": 1,
"write": 1
}, },
{ {
"doctype": "DocType", "doctype": "DocType",
@ -42,7 +48,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Customer Details", "label": "Customer Details",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-user"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -137,7 +143,7 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Maintenance Details", "label": "Maintenance Details",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-wrench"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -150,6 +156,11 @@
"options": "\nPartially Completed\nFully Completed", "options": "\nPartially Completed\nFully Completed",
"reqd": 1 "reqd": 1
}, },
{
"doctype": "DocField",
"fieldname": "column_break_14",
"fieldtype": "Column Break"
},
{ {
"default": "Unscheduled", "default": "Unscheduled",
"doctype": "DocField", "doctype": "DocField",
@ -164,58 +175,12 @@
"reqd": 1, "reqd": 1,
"search_index": 0 "search_index": 0
}, },
{
"doctype": "DocField",
"fieldname": "column_break2",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "sales_order_no",
"fieldtype": "Link",
"in_filter": 1,
"label": "Sales Order No",
"oldfieldname": "sales_order_no",
"oldfieldtype": "Link",
"options": "Sales Order",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "customer_issue_no",
"fieldtype": "Link",
"in_filter": 1,
"label": "Customer Issue No",
"oldfieldname": "customer_issue_no",
"oldfieldtype": "Link",
"options": "Customer Issue",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "maintenance_schedule",
"fieldtype": "Link",
"in_filter": 1,
"label": "Maintenance Schedule",
"options": "Maintenance Schedule"
},
{
"doctype": "DocField",
"fieldname": "get_items",
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
"print_hide": 1,
"report_hide": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "section_break0", "fieldname": "section_break0",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"oldfieldtype": "Section Break", "oldfieldtype": "Section Break",
"options": "Simple" "options": "icon-wrench"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -231,7 +196,8 @@
"fieldname": "more_info", "fieldname": "more_info",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "More Info", "label": "More Info",
"oldfieldtype": "Section Break" "oldfieldtype": "Section Break",
"options": "icon-file-text"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -301,7 +267,8 @@
"doctype": "DocField", "doctype": "DocField",
"fieldname": "contact_info_section", "fieldname": "contact_info_section",
"fieldtype": "Section Break", "fieldtype": "Section Break",
"label": "Contact Info" "label": "Contact Info",
"options": "icon-bullhorn"
}, },
{ {
"doctype": "DocField", "doctype": "DocField",
@ -341,60 +308,15 @@
"print_hide": 1 "print_hide": 1
}, },
{ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0, "role": "System Manager"
"role": "System Manager",
"submit": 1,
"write": 1
}, },
{ {
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 1, "role": "Maintenance Manager"
"role": "System Manager",
"submit": 0
}, },
{ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm", "doctype": "DocPerm",
"permlevel": 0, "role": "Maintenance User"
"role": "Maintenance Manager",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Maintenance Manager",
"submit": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
"role": "Maintenance User",
"submit": 1,
"write": 1
},
{
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"permlevel": 1,
"role": "Maintenance User",
"submit": 0
} }
] ]

View File

@ -2,7 +2,7 @@
{ {
"creation": "2013-02-22 01:28:06", "creation": "2013-02-22 01:28:06",
"docstatus": 0, "docstatus": 0,
"modified": "2013-03-07 07:03:24", "modified": "2013-07-10 12:58:21",
"modified_by": "Administrator", "modified_by": "Administrator",
"owner": "ashwini@webnotestech.com" "owner": "ashwini@webnotestech.com"
}, },
@ -25,36 +25,6 @@
"doctype": "DocType", "doctype": "DocType",
"name": "Maintenance Visit Purpose" "name": "Maintenance Visit Purpose"
}, },
{
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "service_person",
"fieldtype": "Link",
"label": "Service Person",
"oldfieldname": "service_person",
"oldfieldtype": "Link",
"options": "Sales Person",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "work_done",
"fieldtype": "Small Text",
"label": "Work Done",
"oldfieldname": "work_done",
"oldfieldtype": "Small Text",
"reqd": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "item_code", "fieldname": "item_code",
@ -81,6 +51,42 @@
"oldfieldname": "serial_no", "oldfieldname": "serial_no",
"oldfieldtype": "Small Text" "oldfieldtype": "Small Text"
}, },
{
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Small Text",
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "work_details",
"fieldtype": "Section Break",
"label": "Work Details"
},
{
"doctype": "DocField",
"fieldname": "service_person",
"fieldtype": "Link",
"label": "Sales Person",
"oldfieldname": "service_person",
"oldfieldtype": "Link",
"options": "Sales Person",
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "work_done",
"fieldtype": "Small Text",
"label": "Work Done",
"oldfieldname": "work_done",
"oldfieldtype": "Small Text",
"reqd": 1
},
{ {
"doctype": "DocField", "doctype": "DocField",
"fieldname": "prevdoc_docname", "fieldname": "prevdoc_docname",