fix to packing slip (validation)
This commit is contained in:
parent
9f399f139b
commit
b15d760406
@ -8,7 +8,7 @@ cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query =
|
||||
cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query =
|
||||
function(doc, cdt, cdn) {
|
||||
return {
|
||||
query: "erpnext.stock.doctype.packing_slip.packing_slip.item_details",
|
||||
@ -53,7 +53,7 @@ cur_frm.cscript.validate_case_nos = function(doc) {
|
||||
} else if(cint(doc.to_case_no) < cint(doc.from_case_no)) {
|
||||
msgprint(__("'To Case No.' cannot be less than 'From Case No.'"));
|
||||
validated = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -88,7 +88,7 @@ cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
|
||||
// Calculate Net Weight of Package
|
||||
cur_frm.cscript.calc_net_total_pkg = function(doc, ps_detail) {
|
||||
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;
|
||||
|
||||
for(var i=0; i<ps_detail.length; i++) {
|
||||
|
@ -1,262 +1,262 @@
|
||||
{
|
||||
"autoname": "PS.#######",
|
||||
"creation": "2013-04-11 15:32:24",
|
||||
"description": "Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Transaction",
|
||||
"autoname": "PS.#######",
|
||||
"creation": "2013-04-11 15:32:24",
|
||||
"description": "Generate packing slips for packages to be delivered. Used to notify package number, package contents and its weight.",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Transaction",
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "packing_slip_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Packing Slip Items",
|
||||
"permlevel": 0,
|
||||
"fieldname": "packing_slip_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Packing Slip Items",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "Indicates that the package is a part of this delivery",
|
||||
"fieldname": "delivery_note",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Delivery Note",
|
||||
"options": "Delivery Note",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"description": "Indicates that the package is a part of this delivery (Only Draft)",
|
||||
"fieldname": "delivery_note",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Delivery Note",
|
||||
"options": "Delivery Note",
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 0,
|
||||
"options": "PS-",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"fieldname": "naming_series",
|
||||
"fieldtype": "Select",
|
||||
"label": "Series",
|
||||
"no_copy": 0,
|
||||
"options": "PS-",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "section_break0",
|
||||
"fieldtype": "Section Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break2",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "Identification of the package for the delivery (for print)",
|
||||
"fieldname": "from_case_no",
|
||||
"fieldtype": "Data",
|
||||
"label": "From Package No.",
|
||||
"in_list_view": 1,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"description": "Identification of the package for the delivery (for print)",
|
||||
"fieldname": "from_case_no",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "From Package No.",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"width": "50px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break3",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "If more than one package of the same type (for print)",
|
||||
"fieldname": "to_case_no",
|
||||
"fieldtype": "Data",
|
||||
"label": "To Package No.",
|
||||
"in_list_view": 1,
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"description": "If more than one package of the same type (for print)",
|
||||
"fieldname": "to_case_no",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "To Package No.",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 0,
|
||||
"width": "50px"
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "package_item_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Package Item Details",
|
||||
"permlevel": 0,
|
||||
"fieldname": "package_item_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Package Item Details",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "get_items",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Items",
|
||||
"fieldname": "get_items",
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Items",
|
||||
"permlevel": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "item_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Items",
|
||||
"options": "Packing Slip Item",
|
||||
"permlevel": 0,
|
||||
"fieldname": "item_details",
|
||||
"fieldtype": "Table",
|
||||
"label": "Items",
|
||||
"options": "Packing Slip Item",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "package_weight_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Package Weight Details",
|
||||
"permlevel": 0,
|
||||
"fieldname": "package_weight_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Package Weight Details",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "The net weight of this package. (calculated automatically as sum of net weight of items)",
|
||||
"fieldname": "net_weight_pkg",
|
||||
"fieldtype": "Float",
|
||||
"label": "Net Weight",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"description": "The net weight of this package. (calculated automatically as sum of net weight of items)",
|
||||
"fieldname": "net_weight_pkg",
|
||||
"fieldtype": "Float",
|
||||
"label": "Net Weight",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "net_weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "Net Weight UOM",
|
||||
"no_copy": 1,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"fieldname": "net_weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "Net Weight UOM",
|
||||
"no_copy": 1,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"read_only": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"fieldname": "column_break4",
|
||||
"fieldtype": "Column Break",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)",
|
||||
"fieldname": "gross_weight_pkg",
|
||||
"fieldtype": "Float",
|
||||
"label": "Gross Weight",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)",
|
||||
"fieldname": "gross_weight_pkg",
|
||||
"fieldtype": "Float",
|
||||
"label": "Gross Weight",
|
||||
"no_copy": 1,
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "gross_weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "Gross Weight UOM",
|
||||
"no_copy": 1,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"fieldname": "gross_weight_uom",
|
||||
"fieldtype": "Link",
|
||||
"label": "Gross Weight UOM",
|
||||
"no_copy": 1,
|
||||
"options": "UOM",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "misc_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Misc Details",
|
||||
"permlevel": 0,
|
||||
"fieldname": "misc_details",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Misc Details",
|
||||
"permlevel": 0,
|
||||
"read_only": 0
|
||||
},
|
||||
},
|
||||
{
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Packing Slip",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"ignore_restrictions": 1,
|
||||
"label": "Amended From",
|
||||
"no_copy": 1,
|
||||
"options": "Packing Slip",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
}
|
||||
],
|
||||
"icon": "icon-suitcase",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2014-05-06 08:20:35.134198",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Packing Slip",
|
||||
"owner": "Administrator",
|
||||
],
|
||||
"icon": "icon-suitcase",
|
||||
"idx": 1,
|
||||
"is_submittable": 1,
|
||||
"modified": "2014-05-26 03:19:59.409839",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Stock",
|
||||
"name": "Packing Slip",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material User",
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material Master Manager",
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material Master Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material Manager",
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Material Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"submit": 1,
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Sales Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"read_only_onload": 1,
|
||||
],
|
||||
"read_only_onload": 1,
|
||||
"search_fields": "delivery_note"
|
||||
}
|
||||
}
|
@ -54,10 +54,12 @@ class PackingSlip(Document):
|
||||
|
||||
res = frappe.db.sql("""SELECT name FROM `tabPacking Slip`
|
||||
WHERE delivery_note = %(delivery_note)s AND docstatus = 1 AND
|
||||
(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 %(from_case_no)s BETWEEN from_case_no AND to_case_no)
|
||||
""", self.as_dict())
|
||||
((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 (%(from_case_no)s BETWEEN from_case_no AND to_case_no))
|
||||
""", {"delivery_note":self.delivery_note,
|
||||
"from_case_no":self.from_case_no,
|
||||
"to_case_no":self.to_case_no}, debug=1)
|
||||
|
||||
if res:
|
||||
frappe.throw(_("""Case No(s) already in use. Try from Case No {0}""").format(self.get_recommended_case_no()))
|
||||
|
Loading…
x
Reference in New Issue
Block a user