diff --git a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py index ddabf8973f9..f07c42b7e04 100644 --- a/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py +++ b/erpnext/accounts/doctype/mode_of_payment/mode_of_payment.py @@ -6,5 +6,5 @@ import frappe from frappe.model.document import Document -class ModeOfPayment(Document): - pass \ No newline at end of file +class ModeofPayment(Document): + pass diff --git a/erpnext/hr/doctype/employee/employee.py b/erpnext/hr/doctype/employee/employee.py index 44c1752139f..f5be944f0b1 100644 --- a/erpnext/hr/doctype/employee/employee.py +++ b/erpnext/hr/doctype/employee/employee.py @@ -17,8 +17,8 @@ class Employee(Document): self.salary_structure_exists = frappe.db.get_value("Salary Structure", {"employee": self.name, "is_active": "Yes", "docstatus": ["!=", 2]}) - def as_dict(self): - doc = super(Employee, self).as_dict() + def as_dict(self, no_nulls=False): + doc = super(Employee, self).as_dict(no_nulls) if hasattr(self, "salary_structure_exists"): doc["salary_structure_exists"] = self.salary_structure_exists diff --git a/erpnext/manufacturing/doctype/production_order/production_order.js b/erpnext/manufacturing/doctype/production_order/production_order.js index 07e6e11f436..d5fb1c997b5 100644 --- a/erpnext/manufacturing/doctype/production_order/production_order.js +++ b/erpnext/manufacturing/doctype/production_order/production_order.js @@ -10,6 +10,10 @@ $.extend(cur_frm.cscript, { this.frm.add_fetch("sales_order", "delivery_date", "expected_delivery_date"); }, + before_submit: function() { + cur_frm.toggle_reqd(["fg_warehouse", "wip_warehouse"], true); + }, + refresh: function(doc, dt, dn) { this.frm.dashboard.reset(); erpnext.toggle_naming_series(); diff --git a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js index 54aa9a2b576..0415c911e1d 100644 --- a/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js +++ b/erpnext/manufacturing/doctype/production_planning_tool/production_planning_tool.js @@ -33,7 +33,7 @@ cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) { cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = function(doc) { return erpnext.queries.item({ - 'ifnull(tabItem.is_pro_applicable, "No")': 'Yes' + 'is_pro_applicable': 'Yes' }); } @@ -54,4 +54,4 @@ cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) { } cur_frm.fields_dict.pp_so_details.grid.get_field("customer").get_query = - cur_frm.fields_dict.customer.get_query; \ No newline at end of file + cur_frm.fields_dict.customer.get_query; diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 96b7105f353..75a2c392870 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -17,40 +17,40 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( refresh: function(doc, dt, dn) { this._super(); this.frm.dashboard.reset(); - + if(doc.docstatus==1) { if(doc.status != 'Stopped') { - - cur_frm.dashboard.add_progress(cint(doc.per_delivered) + __("% Delivered"), + + cur_frm.dashboard.add_progress(cint(doc.per_delivered) + __("% Delivered"), doc.per_delivered); - cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"), + cur_frm.dashboard.add_progress(cint(doc.per_billed) + __("% Billed"), doc.per_billed); cur_frm.add_custom_button(__('Send SMS'), cur_frm.cscript.send_sms, "icon-mobile-phone"); // delivery note - if(flt(doc.per_delivered, 2) < 100 && doc.order_type=='Sales') + if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1) cur_frm.add_custom_button(__('Make Delivery'), this.make_delivery_note); - + // maintenance - if(flt(doc.per_delivered, 2) < 100 && (doc.order_type !='Sales')) { + if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) { cur_frm.add_custom_button(__('Make Maint. Visit'), this.make_maintenance_visit); - cur_frm.add_custom_button(__('Make Maint. Schedule'), + cur_frm.add_custom_button(__('Make Maint. Schedule'), this.make_maintenance_schedule); } // indent - if(!doc.order_type || (doc.order_type == 'Sales')) - cur_frm.add_custom_button(__('Make ') + __('Material Request'), + if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1) + cur_frm.add_custom_button(__('Make ') + __('Material Request'), this.make_material_request); - + // sales invoice if(flt(doc.per_billed, 2) < 100) cur_frm.add_custom_button(__('Make Invoice'), this.make_sales_invoice); - + // stop if(flt(doc.per_delivered, 2) < 100 || doc.per_billed < 100) cur_frm.add_custom_button(__('Stop!'), cur_frm.cscript['Stop Sales Order'],"icon-exclamation"); - } else { + } else { // un-stop cur_frm.dashboard.set_headline_alert(__("Stopped"), "alert-danger", "icon-stop"); cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Sales Order'], "icon-check"); @@ -58,7 +58,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( } if (this.frm.doc.docstatus===0) { - cur_frm.add_custom_button(__('From Quotation'), + cur_frm.add_custom_button(__('From Quotation'), function() { frappe.model.map_current_doc({ method: "erpnext.selling.doctype.quotation.quotation.make_sales_order", @@ -76,7 +76,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( this.order_type(doc); }, - + order_type: function() { this.frm.toggle_reqd("delivery_date", this.frm.doc.order_type == "Sales"); }, @@ -84,7 +84,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( tc_name: function() { this.get_terms(); }, - + warehouse: function(doc, cdt, cdn) { var item = frappe.get_doc(cdt, cdn); if(item.item_code && item.warehouse) { @@ -119,14 +119,14 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend( source_name: cur_frm.doc.name }) }, - + make_maintenance_schedule: function() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_schedule", source_name: cur_frm.doc.name }) - }, - + }, + make_maintenance_visit: function() { frappe.model.open_mapped_doc({ method: "erpnext.selling.doctype.sales_order.sales_order.make_maintenance_visit", @@ -161,7 +161,7 @@ cur_frm.cscript['Stop Sales Order'] = function() { if (check) { return $c('runserverobj', { - 'method':'stop_sales_order', + 'method':'stop_sales_order', 'docs': doc }, function(r,rt) { cur_frm.refresh(); @@ -176,7 +176,7 @@ cur_frm.cscript['Unstop Sales Order'] = function() { if (check) { return $c('runserverobj', { - 'method':'unstop_sales_order', + 'method':'unstop_sales_order', 'docs': doc }, function(r,rt) { cur_frm.refresh(); diff --git a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js index 77e8dcf4b2d..c0dfe1f6c69 100644 --- a/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js +++ b/erpnext/stock/doctype/stock_uom_replace_utility/stock_uom_replace_utility.js @@ -3,9 +3,11 @@ $.extend(cur_frm.cscript, { onload: function() { - cur_frm.set_query("item_code", erpnext.queries.item); + cur_frm.set_query("item_code", function() { + return erpnext.queries.item({"is_stock_item": "Yes"}); + }); }, - + item_code: function() { if(cur_frm.doc.item_code) { return cur_frm.call({ @@ -14,4 +16,4 @@ $.extend(cur_frm.cscript, { }); } } -}); \ No newline at end of file +});