Merge branch 'develop' of github.com:frappe/erpnext into develop

This commit is contained in:
Nabin Hait 2014-04-28 17:09:13 +05:30
commit 6777efa7fa
6 changed files with 36 additions and 30 deletions

View File

@ -6,5 +6,5 @@ import frappe
from frappe.model.document import Document
class ModeOfPayment(Document):
pass
class ModeofPayment(Document):
pass

View File

@ -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

View File

@ -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();

View File

@ -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;
cur_frm.fields_dict.customer.get_query;

View File

@ -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();

View File

@ -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, {
});
}
}
});
});