fix to packing slip (validation)

This commit is contained in:
Rushabh Mehta
2014-05-26 13:05:19 +05:30
parent 9f399f139b
commit b15d760406
3 changed files with 213 additions and 211 deletions

View File

@@ -88,7 +88,7 @@ cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
// Calculate Net Weight of Package // Calculate Net Weight of Package
cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) { cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) {
var net_weight_pkg = 0; var net_weight_pkg = 0;
doc.net_weight_uom = ps_detail?ps_detail[0].weight_uom:''; doc.net_weight_uom = (ps_detail && ps_detail.length) ? ps_detail[0].weight_uom : '';
doc.gross_weight_uom = doc.net_weight_uom; doc.gross_weight_uom = doc.net_weight_uom;
for(var i=0; i<ps_detail.length; i++) { for(var i=0; i<ps_detail.length; i++) {

View File

@@ -20,7 +20,7 @@
"read_only": 0 "read_only": 0
}, },
{ {
"description": "Indicates that the package is a part of this delivery", "description": "Indicates that the package is a part of this delivery (Only Draft)",
"fieldname": "delivery_note", "fieldname": "delivery_note",
"fieldtype": "Link", "fieldtype": "Link",
"in_list_view": 1, "in_list_view": 1,
@@ -63,8 +63,8 @@
"description": "Identification of the package for the delivery (for print)", "description": "Identification of the package for the delivery (for print)",
"fieldname": "from_case_no", "fieldname": "from_case_no",
"fieldtype": "Data", "fieldtype": "Data",
"label": "From Package No.",
"in_list_view": 1, "in_list_view": 1,
"label": "From Package No.",
"no_copy": 1, "no_copy": 1,
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
@@ -81,8 +81,8 @@
"description": "If more than one package of the same type (for print)", "description": "If more than one package of the same type (for print)",
"fieldname": "to_case_no", "fieldname": "to_case_no",
"fieldtype": "Data", "fieldtype": "Data",
"label": "To Package No.",
"in_list_view": 1, "in_list_view": 1,
"label": "To Package No.",
"no_copy": 1, "no_copy": 1,
"permlevel": 0, "permlevel": 0,
"read_only": 0, "read_only": 0,
@@ -180,7 +180,7 @@
"icon": "icon-suitcase", "icon": "icon-suitcase",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2014-05-06 08:20:35.134198", "modified": "2014-05-26 03:19:59.409839",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Packing Slip", "name": "Packing Slip",

View File

@@ -54,10 +54,12 @@ class PackingSlip(Document):
res = frappe.db.sql("""SELECT name FROM `tabPacking Slip` res = frappe.db.sql("""SELECT name FROM `tabPacking Slip`
WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND
(from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s ((from_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s)
OR to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s OR (to_case_no BETWEEN %(from_case_no)s AND %(to_case_no)s)
OR %(from_case_no)s BETWEEN from_case_no AND to_case_no) OR (%(from_case_no)s BETWEEN from_case_no AND to_case_no))
""", self.as_dict()) """, {"delivery_note":self.delivery_note,
"from_case_no":self.from_case_no,
"to_case_no":self.to_case_no}, debug=1)
if res: if res:
frappe.throw(_("""Case No(s) already in use. Try from Case No {0}""").format(self.get_recommended_case_no())) frappe.throw(_("""Case No(s) already in use. Try from Case No {0}""").format(self.get_recommended_case_no()))