Merge branch 'master' of github.com:webnotes/erpnext
diff --git a/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt b/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
index 6459a0b..79b17c2 100644
--- a/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
+++ b/stock/DocType Mapper/Delivery Note-Packing Slip/Delivery Note-Packing Slip.txt
@@ -1,71 +1,78 @@
[
{
- "owner": "Administrator",
+ "creation": "2012-02-02 11:50:33",
"docstatus": 0,
- "creation": "2012-02-22 15:45:56",
+ "modified": "2013-04-05 16:08:22",
"modified_by": "Administrator",
- "modified": "2012-02-22 15:45:56"
+ "owner": "Administrator"
},
{
- "name": "__common__",
- "parent": "Delivery Note-Packing Slip",
"doctype": "Table Mapper Detail",
- "parenttype": "DocType Mapper",
- "parentfield": "table_mapper_details"
- },
- {
"name": "__common__",
"parent": "Delivery Note-Packing Slip",
+ "parentfield": "table_mapper_details",
+ "parenttype": "DocType Mapper"
+ },
+ {
"doctype": "Field Mapper Detail",
- "parenttype": "DocType Mapper",
- "parentfield": "field_mapper_details"
- },
- {
"name": "__common__",
- "to_doctype": "Packing Slip",
- "module": "Stock",
+ "parent": "Delivery Note-Packing Slip",
+ "parentfield": "field_mapper_details",
+ "parenttype": "DocType Mapper"
+ },
+ {
"doctype": "DocType Mapper",
+ "from_doctype": "Delivery Note",
+ "module": "Stock",
+ "name": "__common__",
"ref_doc_submitted": 0,
- "from_doctype": "Delivery Note"
+ "to_doctype": "Packing Slip"
},
{
- "name": "Delivery Note-Packing Slip",
- "doctype": "DocType Mapper"
+ "doctype": "DocType Mapper",
+ "name": "Delivery Note-Packing Slip"
},
{
+ "doctype": "Field Mapper Detail",
+ "from_field": "name",
"map": "Yes",
"match_id": 0,
- "to_field": "delivery_note",
- "doctype": "Field Mapper Detail",
- "from_field": "name"
+ "to_field": "delivery_note"
},
{
+ "doctype": "Field Mapper Detail",
+ "from_field": "qty",
"map": "No",
"match_id": 1,
- "to_field": "qty",
- "doctype": "Field Mapper Detail",
- "from_field": "qty"
+ "to_field": "qty"
},
{
+ "doctype": "Field Mapper Detail",
+ "from_field": "naming_series",
"map": "No",
"match_id": 0,
- "to_field": "naming_series",
- "doctype": "Field Mapper Detail",
- "from_field": "naming_series"
+ "to_field": "naming_series"
},
{
- "match_id": 0,
+ "doctype": "Field Mapper Detail",
+ "from_field": "name",
+ "map": "Yes",
+ "match_id": 1,
+ "to_field": "dn_detail"
+ },
+ {
"doctype": "Table Mapper Detail",
"from_table": "Delivery Note",
+ "match_id": 0,
"to_table": "Packing Slip",
"validation_logic": "docstatus=0"
},
{
- "match_id": 1,
- "to_field": "item_details",
"doctype": "Table Mapper Detail",
"from_field": "delivery_note_details",
"from_table": "Delivery Note Item",
+ "match_id": 1,
+ "to_field": "item_details",
"to_table": "Packing Slip Item",
"validation_logic": "IFNULL(packed_qty, 0) < IFNULL(qty, 0)"
}
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index b579195..0fc7875 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -194,9 +194,7 @@
if self.doc.name:
self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
-
- self.validate_is_stock_item()
-
+
def check_non_asset_warehouse(self):
if self.doc.is_asset_item == "Yes":
existing_qty = sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
@@ -216,14 +214,6 @@
}
return ret
- def validate_is_stock_item(self):
- if not self.doc.fields.get("__islocal"):
- if webnotes.conn.get_value("Item", self.doc.name, "is_stock_item")=="Yes" and \
- ((not self.doc.is_stock_item) or self.doc.is_stock_item == "No"):
- if self.check_if_sle_exists() == "exists":
- webnotes.msgprint(self.meta.get_label("is_stock_item") + ": "
- + _("""Cannot change to Yes. Reason: Stock Ledger Entries exist for""")
- + """ "%s" """ % self.doc.name, raise_exception=True)
def check_if_sle_exists(self):
sle = sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name)
@@ -245,13 +235,14 @@
get_slideshow(self)
def cant_change(self):
- vals = webnotes.conn.get_value("Item", self.doc.name,
- ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True)
+ if not self.doc.fields.get("__islocal"):
+ vals = webnotes.conn.get_value("Item", self.doc.name,
+ ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True)
- if (vals.has_serial_no != self.doc.has_serial_no or
- vals.is_stock_item != self.doc.is_stock_item or
- vals.valuation_method != self.doc.valuation_method):
- if self.check_if_sle_exists():
- webnotes.msgprint(_("As there are existing stock transactions for this item, \
- you can not change the values of 'Has Serial No', 'Is Stock Item' and \
- 'Valuation Method'"), raise_exception=1)
\ No newline at end of file
+ if vals and (vals.has_serial_no != self.doc.has_serial_no or
+ vals.is_stock_item != self.doc.is_stock_item or
+ vals.valuation_method != self.doc.valuation_method):
+ if self.check_if_sle_exists():
+ webnotes.msgprint(_("As there are existing stock transactions for this \
+ item, you can not change the values of 'Has Serial No', \
+ 'Is Stock Item' and 'Valuation Method'"), raise_exception=1)
\ No newline at end of file
diff --git a/stock/doctype/packing_slip/packing_slip.js b/stock/doctype/packing_slip/packing_slip.js
index 93fae94..4c20289 100644
--- a/stock/doctype/packing_slip/packing_slip.js
+++ b/stock/doctype/packing_slip/packing_slip.js
@@ -99,7 +99,7 @@
cur_frm.cscript.validate_duplicate_items = function(doc, ps_detail) {
for(var i=0; i<ps_detail.length; i++) {
for(var j=0; j<ps_detail.length; j++) {
- if(i!=j && ps_detail[i].item_code==ps_detail[j].item_code) {
+ if(i!=j && ps_detail[i].dn_detail && ps_detail[i].dn_detail==ps_detail[j].dn_detail) {
msgprint("You have entered duplicate items. Please rectify and try again.");
validated = false;
return;
diff --git a/stock/doctype/packing_slip/packing_slip.py b/stock/doctype/packing_slip/packing_slip.py
index 72682b2..fb2fd53 100644
--- a/stock/doctype/packing_slip/packing_slip.py
+++ b/stock/doctype/packing_slip/packing_slip.py
@@ -128,6 +128,7 @@
"""
item['recommended_qty'] = (flt(item['qty']) - flt(item['packed_qty'])) / no_of_cases
item['specified_qty'] = flt(ps_item_qty[item['item_code']])
+ if not item['packed_qty']: item['packed_qty'] = 0
webnotes.msgprint("""
Invalid Quantity specified (%(specified_qty)s %(stock_uom)s).
diff --git a/stock/doctype/packing_slip/packing_slip.txt b/stock/doctype/packing_slip/packing_slip.txt
index ac25189..32ac16b 100644
--- a/stock/doctype/packing_slip/packing_slip.txt
+++ b/stock/doctype/packing_slip/packing_slip.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:28",
+ "creation": "2013-03-07 18:50:31",
"docstatus": 0,
- "modified": "2013-01-22 14:56:40",
+ "modified": "2013-04-05 15:40:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -48,12 +48,14 @@
"doctype": "DocField",
"fieldname": "packing_slip_details",
"fieldtype": "Section Break",
- "label": "Packing Slip Items"
+ "label": "Packing Slip Items",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break0",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "Indicates that the package is a part of this delivery",
@@ -62,12 +64,14 @@
"fieldtype": "Link",
"label": "Delivery Note",
"options": "Delivery Note",
+ "read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "column_break1",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -77,17 +81,20 @@
"no_copy": 0,
"options": "PS",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "section_break0",
- "fieldtype": "Section Break"
+ "fieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "Identification of the package for the delivery (for print)",
@@ -96,13 +103,15 @@
"fieldtype": "Data",
"label": "From Package No.",
"no_copy": 1,
+ "read_only": 0,
"reqd": 1,
"width": "50px"
},
{
"doctype": "DocField",
"fieldname": "column_break3",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "If more than one package of the same type (for print)",
@@ -111,26 +120,30 @@
"fieldtype": "Data",
"label": "To Package No.",
"no_copy": 1,
+ "read_only": 0,
"width": "50px"
},
{
"doctype": "DocField",
"fieldname": "package_item_details",
"fieldtype": "Section Break",
- "label": "Package Item Details"
+ "label": "Package Item Details",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "item_details",
"fieldtype": "Table",
"label": "Items",
- "options": "Packing Slip Item"
+ "options": "Packing Slip Item",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "package_weight_details",
"fieldtype": "Section Break",
- "label": "Package Weight Details"
+ "label": "Package Weight Details",
+ "read_only": 0
},
{
"description": "The net weight of this package. (calculated automatically as sum of net weight of items)",
@@ -144,15 +157,17 @@
{
"doctype": "DocField",
"fieldname": "net_weight_uom",
- "fieldtype": "Data",
+ "fieldtype": "Link",
"label": "Net Weight UOM",
"no_copy": 1,
+ "options": "UOM",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "column_break4",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "The gross weight of the package. Usually net weight + packaging material weight. (for print)",
@@ -160,7 +175,8 @@
"fieldname": "gross_weight_pkg",
"fieldtype": "Float",
"label": "Gross Weight",
- "no_copy": 1
+ "no_copy": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -168,13 +184,15 @@
"fieldtype": "Link",
"label": "Gross Weight UOM",
"no_copy": 1,
- "options": "UOM"
+ "options": "UOM",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "misc_details",
"fieldtype": "Section Break",
- "label": "Misc Details"
+ "label": "Misc Details",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -194,7 +212,8 @@
"fieldtype": "Date",
"label": "Amendment Date",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocPerm",
diff --git a/stock/doctype/packing_slip_item/packing_slip_item.txt b/stock/doctype/packing_slip_item/packing_slip_item.txt
index 40ff066..a9d2fdf 100644
--- a/stock/doctype/packing_slip_item/packing_slip_item.txt
+++ b/stock/doctype/packing_slip_item/packing_slip_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:28:02",
+ "creation": "2013-03-07 11:42:59",
"docstatus": 0,
- "modified": "2013-03-07 07:03:26",
+ "modified": "2013-04-05 16:06:40",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -32,6 +32,7 @@
"label": "Item Code",
"options": "Item",
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -50,6 +51,7 @@
"fieldtype": "Float",
"label": "Quantity",
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -85,6 +87,14 @@
"doctype": "DocField",
"fieldname": "page_break",
"fieldtype": "Check",
- "label": "Page Break"
+ "label": "Page Break",
+ "read_only": 0
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "dn_detail",
+ "fieldtype": "Data",
+ "hidden": 1,
+ "label": "DN Detail"
}
]
\ No newline at end of file