[merge fixes]

This commit is contained in:
Saurabh 2015-10-19 16:32:24 +05:30
parent c39cef363c
commit c306b21415
10 changed files with 399 additions and 25 deletions

View File

@ -147,6 +147,52 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer",
"no_copy": 0,
"options": "Customer",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.order_type==\"Drop Shipment\"",
"fieldname": "customer_name",
"fieldtype": "Data",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Name",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -168,6 +214,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_address_display",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Address",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -189,6 +257,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_contact_display",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Contact",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -210,6 +300,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_contact_mobile",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Mobile No",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -231,6 +343,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "customer_contact_email",
"fieldtype": "Small Text",
"hidden": 1,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Contact Email",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -326,6 +460,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "drop_ship",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Drop Ship",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -1400,6 +1556,30 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.drop_ship==1",
"fieldname": "customer_address",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Address",
"no_copy": 0,
"options": "Address",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -1442,6 +1622,30 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"depends_on": "eval:doc.drop_ship==1",
"fieldname": "customer_contact_person",
"fieldtype": "Link",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Customer Contact Person",
"no_copy": 0,
"options": "Contact",
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,

View File

@ -162,6 +162,14 @@ class PurchaseOrder(BuyingController):
clear_doctype_notifications(self) clear_doctype_notifications(self)
def on_submit(self): def on_submit(self):
if self.drop_ship == 1:
self.status_updater[0].update({
"target_parent_dt": "Sales Order",
"target_parent_field": "per_ordered",
"target_dt": "Sales Order Item",
'target_field': 'ordered_qty'
})
super(PurchaseOrder, self).on_submit() super(PurchaseOrder, self).on_submit()
purchase_controller = frappe.get_doc("Purchase Common") purchase_controller = frappe.get_doc("Purchase Common")
@ -176,6 +184,14 @@ class PurchaseOrder(BuyingController):
purchase_controller.update_last_purchase_rate(self, is_submit = 1) purchase_controller.update_last_purchase_rate(self, is_submit = 1)
def on_cancel(self): def on_cancel(self):
if self.drop_ship == 1:
self.status_updater[0].update({
"target_parent_dt": "Sales Order",
"target_parent_field": "per_ordered",
"target_dt": "Sales Order Item",
'target_field': 'ordered_qty'
})
pc_obj = frappe.get_doc('Purchase Common') pc_obj = frappe.get_doc('Purchase Common')
self.check_for_stopped_status(pc_obj) self.check_for_stopped_status(pc_obj)

View File

@ -848,7 +848,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "prevdoc_doctype", "fieldname": "prevdoc_doctype",
"fieldtype": "Data", "fieldtype": "Link",
"hidden": 1, "hidden": 1,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 0, "in_filter": 0,
@ -857,6 +857,7 @@
"no_copy": 1, "no_copy": 1,
"oldfieldname": "prevdoc_doctype", "oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data", "oldfieldtype": "Data",
"options": "DocType",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"read_only": 1, "read_only": 1,
@ -871,16 +872,16 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"fieldname": "prevdoc_docname", "fieldname": "prevdoc_docname",
"fieldtype": "Link", "fieldtype": "Dynamic Link",
"hidden": 0, "hidden": 0,
"ignore_user_permissions": 0, "ignore_user_permissions": 0,
"in_filter": 1, "in_filter": 1,
"in_list_view": 0, "in_list_view": 0,
"label": "Material Request No", "label": "Reference Name",
"no_copy": 1, "no_copy": 1,
"oldfieldname": "prevdoc_docname", "oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link", "oldfieldtype": "Link",
"options": "Material Request", "options": "prevdoc_doctype",
"permlevel": 0, "permlevel": 0,
"print_hide": 1, "print_hide": 1,
"print_width": "120px", "print_width": "120px",

View File

@ -143,7 +143,7 @@ class SellingController(StockController):
throw(_("Total allocated percentage for sales team should be 100")) throw(_("Total allocated percentage for sales team should be 100"))
def validate_order_type(self): def validate_order_type(self):
valid_types = ["Sales", "Maintenance", "Shopping Cart"] valid_types = ["Sales", "Maintenance", "Shopping Cart", "Drop Shipment"]
if not self.order_type: if not self.order_type:
self.order_type = "Sales" self.order_type = "Sales"
elif self.order_type not in valid_types: elif self.order_type not in valid_types:

View File

@ -7,7 +7,7 @@ erpnext.utils.get_party_details = function(frm, method, args, callback) {
method = "erpnext.accounts.party.get_party_details"; method = "erpnext.accounts.party.get_party_details";
} }
if(!args) { if(!args) {
if(frm.doc.customer) { if(frm.doctype != "Purchase Order" && frm.doc.customer) {
args = { args = {
party: frm.doc.customer, party: frm.doc.customer,
party_type: "Customer", party_type: "Customer",

View File

@ -25,7 +25,7 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
// doc.per_billed); // doc.per_billed);
// indent // indent
if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1) if(!doc.order_type || ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && doc.drop_ship!=1)
cur_frm.add_custom_button(__('Material Request'), this.make_material_request); cur_frm.add_custom_button(__('Material Request'), this.make_material_request);
if(flt(doc.per_billed)==0) { if(flt(doc.per_billed)==0) {
@ -37,13 +37,13 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Sales Order']) cur_frm.add_custom_button(__('Stop'), cur_frm.cscript['Stop Sales Order'])
// maintenance // maintenance
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1) { if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)===-1 && doc.drop_ship!=1) {
cur_frm.add_custom_button(__('Maint. Visit'), this.make_maintenance_visit); cur_frm.add_custom_button(__('Maint. Visit'), this.make_maintenance_visit);
cur_frm.add_custom_button(__('Maint. Schedule'), this.make_maintenance_schedule); cur_frm.add_custom_button(__('Maint. Schedule'), this.make_maintenance_schedule);
} }
// delivery note // delivery note
if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1) if(flt(doc.per_delivered, 2) < 100 && ["Sales", "Shopping Cart"].indexOf(doc.order_type)!==-1 && doc.drop_ship!=1)
cur_frm.add_custom_button(__('Delivery'), this.make_delivery_note).addClass("btn-primary"); cur_frm.add_custom_button(__('Delivery'), this.make_delivery_note).addClass("btn-primary");
// sales invoice // sales invoice
@ -51,6 +51,9 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary"); cur_frm.add_custom_button(__('Invoice'), this.make_sales_invoice).addClass("btn-primary");
} }
if(doc.drop_ship==1 && flt(doc.per_ordered, 2) < 100)
cur_frm.add_custom_button(__('Make Shipment'), cur_frm.cscript.make_drop_shipment);
} else { } else {
// un-stop // un-stop
cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Sales Order']); cur_frm.add_custom_button(__('Unstop'), cur_frm.cscript['Unstop Sales Order']);
@ -145,6 +148,12 @@ erpnext.selling.SalesOrderController = erpnext.selling.SellingController.extend(
frappe.set_route("Form", doclist[0].doctype, doclist[0].name); frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
} }
}); });
},
make_drop_shipment: function(){
frappe.model.open_mapped_doc({
method: "erpnext.selling.doctype.sales_order.sales_order.make_drop_shipment",
frm: cur_frm
})
} }
}); });

View File

@ -234,6 +234,7 @@
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"default": "Sales", "default": "Sales",
"depends_on": "eval:doc.drop_ship!=1",
"fieldname": "order_type", "fieldname": "order_type",
"fieldtype": "Select", "fieldtype": "Select",
"hidden": 0, "hidden": 0,
@ -254,6 +255,28 @@
"set_only_once": 0, "set_only_once": 0,
"unique": 0 "unique": 0
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "drop_ship",
"fieldtype": "Check",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Drop Ship",
"no_copy": 0,
"permlevel": 0,
"precision": "",
"print_hide": 0,
"read_only": 0,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -381,6 +404,7 @@
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
"collapsible": 0, "collapsible": 0,
"depends_on": "eval:doc.drop_ship!=1",
"description": "", "description": "",
"fieldname": "po_no", "fieldname": "po_no",
"fieldtype": "Data", "fieldtype": "Data",
@ -2036,6 +2060,29 @@
"unique": 0, "unique": 0,
"width": "100px" "width": "100px"
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "per_ordered",
"fieldtype": "Percent",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 1,
"in_list_view": 1,
"label": "% Ordered",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0,
"width": "100px"
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,
@ -2553,7 +2600,7 @@
"is_submittable": 1, "is_submittable": 1,
"issingle": 0, "issingle": 0,
"istable": 0, "istable": 0,
"modified": "2015-10-03 07:39:10.525609", "modified": "2015-10-15 15:27:34.592276",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order", "name": "Sales Order",

View File

@ -488,3 +488,57 @@ def get_events(start, end, filters=None):
"end": end "end": end
}, as_dict=True, update={"allDay": 0}) }, as_dict=True, update={"allDay": 0})
return data return data
@frappe.whitelist()
def make_drop_shipment(source_name, target_doc=None):
def postprocess(source, target):
set_missing_values(source, target)
def set_missing_values(source, target):
target.address_display = ""
target.contact_display = ""
target.contact_mobile = ""
target.contact_email = ""
target.ignore_pricing_rule = 1
target.run_method("set_missing_values")
target.run_method("calculate_taxes_and_totals")
def update_item(source, target, source_parent):
target.base_amount = (flt(source.qty) - flt(source.ordered_qty)) * flt(source.base_rate)
target.amount = (flt(source.qty) - flt(source.ordered_qty)) * flt(source.rate)
target.qty = flt(source.qty) - flt(source.ordered_qty)
doclist = get_mapped_doc("Sales Order", source_name, {
"Sales Order": {
"doctype": "Purchase Order",
"field_map": {
"address_display": "customer_address_display",
"contact_display": "customer_contact_display",
"contact_mobile": "customer_contact_mobile",
"contact_email": "customer_contact_email",
"contact_person": "customer_contact_person"
},
"validation": {
"docstatus": ["=", 1]
}
},
"Sales Order Item": {
"doctype": "Purchase Order Item",
"field_map": [
["name", "prevdoc_detail_docname"],
["parent", "prevdoc_docname"],
["parenttype", "prevdoc_doctype"],
["uom", "stock_uom"]
],
"postprocess": update_item,
"condition": lambda doc: doc.delivered_qty < doc.qty
},
"Sales Taxes and Charges": {
"doctype": "Purchase Taxes and Charges",
"add_if_empty": True
}
}, target_doc, postprocess)
return doclist

View File

@ -1,16 +1,16 @@
frappe.listview_settings['Sales Order'] = { frappe.listview_settings['Sales Order'] = {
add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed", add_fields: ["base_grand_total", "customer_name", "currency", "delivery_date", "per_delivered", "per_billed",
"status", "order_type"], "status", "order_type", "per_ordered", "drop_ship"],
get_indicator: function(doc) { get_indicator: function(doc) {
if(doc.status==="Stopped") { if(doc.status==="Stopped") {
return [__("Stopped"), "darkgrey", "status,=,Stopped"]; return [__("Stopped"), "darkgrey", "status,=,Stopped"];
} else if (doc.order_type !== "Maintenance" } else if (doc.order_type !== "Maintenance" && doc.drop_ship !=1
&& flt(doc.per_delivered, 2) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) { && flt(doc.per_delivered, 2) < 100 && frappe.datetime.get_diff(doc.delivery_date) < 0) {
// to bill & overdue // to bill & overdue
return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"]; return [__("Overdue"), "red", "per_delivered,<,100|delivery_date,<,Today|status,!=,Stopped"];
} else if (doc.order_type !== "Maintenance" } else if (doc.order_type !== "Maintenance" && doc.drop_ship !=1
&& flt(doc.per_delivered, 2) < 100 && doc.status!=="Stopped") { && flt(doc.per_delivered, 2) < 100 && doc.status!=="Stopped") {
// not delivered // not delivered
@ -20,22 +20,43 @@ frappe.listview_settings['Sales Order'] = {
return [__("To Deliver and Bill"), "orange", return [__("To Deliver and Bill"), "orange",
"per_delivered,<,100|per_billed,<,100|status,!=,Stopped"]; "per_delivered,<,100|per_billed,<,100|status,!=,Stopped"];
} else { } else {
// not billed // not delivered
return [__("To Deliver"), "orange", return [__("To Deliver"), "orange",
"per_delivered,<,100|per_billed,=,100|status,!=,Stopped"]; "per_delivered,<,100|per_billed,=,100|status,!=,Stopped"];
} }
} else if ((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100) } else if ((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100 ||
&& flt(doc.per_billed, 2) < 100 && doc.status!=="Stopped") { (doc.drop_ship == 1 && flt(doc.per_ordered, 2) == 100 ) ) && flt(doc.per_billed, 2) < 100
&& doc.status!=="Stopped") {
// to bill // to bill
return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped"]; return [__("To Bill"), "orange", "per_delivered,=,100|per_billed,<,100|status,!=,Stopped|per_ordered,<,100"];
} else if((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100) } else if((doc.order_type === "Maintenance" || flt(doc.per_delivered, 2) == 100)
&& flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") { && flt(doc.per_billed, 2) == 100 && doc.status!=="Stopped") {
return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"]; return [__("Completed"), "green", "per_delivered,=,100|per_billed,=,100|status,!=,Stopped"];
} else if ( doc.drop_ship == 1 && flt(doc.per_delivered, 2) < 100
&& frappe.datetime.get_diff(doc.delivery_date) < 0) {
// to bill & overdue
return [__("Overdue"), "red", "per_ordered,<,100|delivery_date,<,Today|status,!=,Stopped"];
} else if ( doc.drop_ship == 1 && flt(doc.per_ordered, 2) < 100 && doc.status!=="Stopped") {
// not ordered
if(flt(doc.per_billed, 2) < 100) {
// not delivered & not billed
return [__("To Order and Bill"), "orange",
"per_ordered,<,100|per_billed,<,100|status,!=,Stopped"];
} else {
// not ordered
return [__("To Deliver"), "orange",
"per_ordered,<,100|per_billed,=,100|status,!=,Stopped"];
}
} }
}, },
onload: function(listview) { onload: function(listview) {

View File

@ -917,6 +917,28 @@
"unique": 0, "unique": 0,
"width": "70px" "width": "70px"
}, },
{
"allow_on_submit": 0,
"bold": 0,
"collapsible": 0,
"fieldname": "ordered_qty",
"fieldtype": "Float",
"hidden": 0,
"ignore_user_permissions": 0,
"in_filter": 0,
"in_list_view": 0,
"label": "Ordered Qty",
"no_copy": 1,
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1,
"report_hide": 0,
"reqd": 0,
"search_index": 0,
"set_only_once": 0,
"unique": 0
},
{ {
"allow_on_submit": 0, "allow_on_submit": 0,
"bold": 0, "bold": 0,