From 1f69f92d2f871b81e02fe74e2129041947e4c935 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 29 Jun 2012 13:25:08 +0530 Subject: [PATCH] supplier part number in purchase order --- .../purchase_common/purchase_common.py | 10 ++++++++- .../purchase_order_item.txt | 21 +++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.py b/erpnext/buying/doctype/purchase_common/purchase_common.py index fd02b02128..7240a2d229 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.py +++ b/erpnext/buying/doctype/purchase_common/purchase_common.py @@ -131,7 +131,7 @@ class DocType(TransactionBase): 'warehouse': wh, 'item_tax_rate': json.dumps(t), 'batch_no': '', - 'discount_rate': 0 + 'discount_rate': 0 } # get min_order_qty from item @@ -170,6 +170,14 @@ class DocType(TransactionBase): 'import_rate': 0, }) + if obj.doc.doctype == 'Purchase Order': + supplier_part_no = webnotes.conn.sql("""\ + select supplier_part_no from `tabItem Supplier` + where parent = %s and parenttype = 'Item' and + supplier = %s""", (arg['item_code'], obj.doc.supplier)) + if supplier_part_no and supplier_part_no[0][0]: + ret['supplier_part_no'] = supplier_part_no[0][0] + return ret # Get Available Qty at Warehouse diff --git a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt index 499cdefc11..73a6f0165f 100755 --- a/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt +++ b/erpnext/buying/doctype/purchase_order_item/purchase_order_item.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:50', + 'creation': '2012-05-15 12:14:38', 'docstatus': 0, - 'modified': '2012-03-27 14:35:50', + 'modified': '2012-06-29 13:05:33', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -22,7 +22,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 65 + 'version': 1 }, # These values are common for all DocField @@ -74,6 +74,19 @@ 'trigger': u'Client' }, + # DocField + { + 'colour': u'White:FFF', + 'description': u'If Supplier Part Number exists for given Item, it gets stored here', + 'doctype': u'DocField', + 'fieldname': u'supplier_part_no', + 'fieldtype': u'Data', + 'hidden': 1, + 'label': u'Supplier Part Number', + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', @@ -453,4 +466,4 @@ 'permlevel': 0, 'print_hide': 1 } -] +] \ No newline at end of file