From eb3bb0143126a101d0f984846425a58c57960fd9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Mon, 16 Apr 2012 13:41:06 +0530 Subject: [PATCH 01/13] Update erpnext/selling/doctype/sales_order/sales_order.js --- erpnext/selling/doctype/sales_order/sales_order.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/selling/doctype/sales_order/sales_order.js b/erpnext/selling/doctype/sales_order/sales_order.js index 3e0d783621..a2aaf8f00d 100644 --- a/erpnext/selling/doctype/sales_order/sales_order.js +++ b/erpnext/selling/doctype/sales_order/sales_order.js @@ -186,7 +186,7 @@ cur_frm.fields_dict['quotation_no'].get_query = function(doc) { if(doc.order_type) cond = ' ifnull(`tabQuotation`.order_type, "") = "'+doc.order_type+'" and'; if(doc.customer) cond += ' ifnull(`tabQuotation`.customer, "") = "'+doc.customer+'" and'; - return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` WHERE `tabQuotation`.company = "' + doc.company + '" and `tabQuotation`.`docstatus` = 1 and `tabQuotation`.status != "Order Lost" and %(cond)s `tabQuotation`.%(key)s LIKE "%s" ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond}); + return repl('SELECT DISTINCT name, customer, transaction_date FROM `tabQuotation` WHERE `tabQuotation`.company = "' + doc.company + '" and `tabQuotation`.`docstatus` = 1 and `tabQuotation`.status != "Order Lost" and %(cond)s `tabQuotation`.%(key)s LIKE "%s" ORDER BY `tabQuotation`.`name` DESC LIMIT 50', {cond:cond}); } From 5da9d56047bb52789731f5608ce586d0a5786c4c Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Tue, 17 Apr 2012 18:05:58 +0530 Subject: [PATCH 02/13] removed voucher date filter --- .../itemwise_sales_register/itemwise_sales_register.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js index d243717806..febc0ee996 100755 --- a/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js +++ b/erpnext/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js @@ -16,8 +16,8 @@ report.customize_filters = function() { this.hide_all_filters(); - filter_list = ['From Voucher Date', 'To Voucher Date', 'Debit To', 'From Posting Date', 'To Posting Date'] - for(var i=0;i Date: Wed, 18 Apr 2012 12:04:20 +0530 Subject: [PATCH 03/13] allow negative qty feature --- .../doctype/manage_account/manage_account.py | 5 +- erpnext/stock/doctype/bin/bin.py | 15 +- .../stock/doctype/stock_entry/stock_entry.py | 3 - .../stock_ledger_entry/stock_ledger_entry.txt | 767 +++++++++--------- 4 files changed, 415 insertions(+), 375 deletions(-) diff --git a/erpnext/setup/doctype/manage_account/manage_account.py b/erpnext/setup/doctype/manage_account/manage_account.py index 15700e89c4..7f9294b28e 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.py +++ b/erpnext/setup/doctype/manage_account/manage_account.py @@ -34,7 +34,8 @@ keydict = { 'valuation_method': 'default_valuation_method', 'date_format': 'date_format', 'currency_format':'default_currency_format', - 'account_url':'account_url' + 'account_url':'account_url', + 'allow_negative_stock' : 'allow_negative_stock' } class DocType: @@ -66,4 +67,4 @@ class DocType: get_last_day(get_first_day(ysd,0,11)).strftime('%Y-%m-%d')) def get_defaults(self): - return webnotes.conn.get_defaults() \ No newline at end of file + return webnotes.conn.get_defaults() diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index de2d1315c4..860653317b 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -185,8 +185,6 @@ class DocType: def get_moving_average_inventory_values(self, val_rate, in_rate, opening_qty, actual_qty, is_cancelled): if flt(in_rate) <= 0: # In case of delivery/stock issue in_rate = 0 or wrong incoming rate in_rate = val_rate - if in_rate and val_rate == 0: # First entry - val_rate = in_rate # val_rate is same as previous entry if : # 1. actual qty is negative(delivery note / stock entry) @@ -194,7 +192,11 @@ class DocType: # 3. val_rate is negative # Otherwise it will be calculated as per moving average elif actual_qty > 0 and (opening_qty + actual_qty) > 0 and is_cancelled == 'No' and ((opening_qty * val_rate) + (actual_qty * in_rate)) > 0: + if opening_qty < 0: + opening_qty = 0 val_rate = ((opening_qty *val_rate) + (actual_qty * in_rate)) / (opening_qty + actual_qty) + elif (opening_qty + actual_qty) <= 0: + val_rate = 0 stock_val = val_rate return val_rate, stock_val @@ -277,6 +279,11 @@ class DocType: # get valuation method val_method = get_obj('Valuation Control').get_valuation_method(self.doc.item_code) + # allow negative stock (only for moving average method) + from webnotes.utils import get_defaults + allow_negative_stock = get_defaults().get('allow_negative_stock', 0) + + # recalculate the balances for all stock ledger entries # after the prev sle sll = sql(""" @@ -289,10 +296,10 @@ class DocType: order by timestamp(posting_date, posting_time) asc, name asc""", \ (self.doc.item_code, self.doc.warehouse, \ prev_sle.get('posting_date','1900-01-01'), prev_sle.get('posting_time', '12:00')), as_dict = 1) - for sle in sll: # block if stock level goes negative on any date - self.validate_negative_stock(cqty, sle) + if val_method != 'Moving Average' or flt(allow_negative_stock) == 0: + self.validate_negative_stock(cqty, sle) stock_val, in_rate = 0, sle['incoming_rate'] # IN serial_nos = sle["serial_no"] and ("'"+"', '".join(cstr(sle["serial_no"]).split('\n')) \ diff --git a/erpnext/stock/doctype/stock_entry/stock_entry.py b/erpnext/stock/doctype/stock_entry/stock_entry.py index a6fbba02b0..a1cec399b0 100644 --- a/erpnext/stock/doctype/stock_entry/stock_entry.py +++ b/erpnext/stock/doctype/stock_entry/stock_entry.py @@ -265,9 +265,6 @@ class DocType(TransactionBase): if flt(d.transfer_qty) <= 0: msgprint("Transfer Quantity can not be less than or equal to zero at Row No " + cstr(d.idx)) raise Exception - if d.s_warehouse and flt(d.transfer_qty) > flt(d.actual_qty): - msgprint("Transfer Quantity is more than Available Qty at Row No " + cstr(d.idx)) - raise Exception def calc_amount(self): diff --git a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt index 823837a160..b9d982b883 100644 --- a/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt +++ b/erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.txt @@ -3,52 +3,59 @@ # These values are common in all dictionaries { - 'creation': '2010-08-08 17:09:25', + 'creation': '2009-05-12 16:46:51', 'docstatus': 0, - 'modified': '2011-06-02 15:42:37', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-04-18 11:59:34', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1309508840', - 'autoname': 'SLE/.########', - 'colour': 'White:FFF', + '_last_update': u'1334728856', + 'autoname': u'SLE/.########', + 'colour': u'White:FFF', 'doctype': 'DocType', 'hide_toolbar': 1, 'in_create': 1, - 'module': 'Stock', + 'module': u'Stock', 'name': '__common__', - 'section_style': 'Simple', - 'server_code_error': ' ', + 'section_style': u'Simple', + 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 53 + 'version': 54 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Stock Ledger Entry', - 'parentfield': 'fields', - 'parenttype': 'DocType' + 'parent': u'Stock Ledger Entry', + 'parentfield': u'fields', + 'parenttype': u'DocType' }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Stock Ledger Entry', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Stock Ledger Entry', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Stock Ledger Entry { 'doctype': 'DocType', - 'name': 'Stock Ledger Entry' + 'name': u'Stock Ledger Entry' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'All' }, # DocPerm @@ -56,392 +63,420 @@ 'amend': 0, 'cancel': 0, 'create': 0, - 'doctype': 'DocPerm', - 'idx': 1, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Material User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'Material User', + 'role': u'Material User', 'submit': 0, 'write': 0 }, # DocPerm { - 'doctype': 'DocPerm', - 'idx': 2, - 'permlevel': 1, - 'role': 'All' - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': 'DocPerm', - 'idx': 3, - 'permlevel': 1, - 'role': 'Material User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'doctype': 'DocPerm', - 'idx': 4, + 'doctype': u'DocPerm', 'permlevel': 2, - 'role': 'System Manager' + 'role': u'System Manager' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'item_code', - 'fieldtype': 'Link', - 'idx': 1, - 'in_filter': 1, - 'label': 'Item Code', - 'oldfieldname': 'item_code', - 'oldfieldtype': 'Link', - 'options': 'Item', - 'permlevel': 1, - 'reqd': 0, - 'search_index': 1, - 'width': '100px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'serial_no', - 'fieldtype': 'Text', - 'idx': 2, - 'in_filter': 0, - 'label': 'Serial No', - 'permlevel': 0, - 'search_index': 0, - 'width': '100px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'batch_no', - 'fieldtype': 'Data', - 'idx': 3, - 'label': 'Batch No', - 'oldfieldname': 'batch_no', - 'oldfieldtype': 'Data', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'warehouse', - 'fieldtype': 'Link', - 'idx': 4, - 'in_filter': 1, - 'label': 'Warehouse', - 'oldfieldname': 'warehouse', - 'oldfieldtype': 'Link', - 'options': 'Warehouse', - 'permlevel': 1, - 'search_index': 1, - 'width': '100px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'warehouse_type', - 'fieldtype': 'Select', - 'idx': 5, - 'in_filter': 1, - 'label': 'Warehouse Type', - 'oldfieldname': 'warehouse_type', - 'oldfieldtype': 'Select', - 'options': 'link:Warehouse Type', - 'permlevel': 1, - 'search_index': 0 - }, - - # DocField - { - 'description': 'The date at which current entry will get or has actually executed.', - 'doctype': 'DocField', - 'fieldname': 'posting_date', - 'fieldtype': 'Date', - 'idx': 6, - 'in_filter': 1, - 'label': 'Posting Date', - 'oldfieldname': 'posting_date', - 'oldfieldtype': 'Date', - 'permlevel': 1, - 'reqd': 0, - 'search_index': 1, - 'width': '100px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'posting_time', - 'fieldtype': 'Time', - 'idx': 7, - 'in_filter': 0, - 'label': 'Posting Time', - 'oldfieldname': 'posting_time', - 'oldfieldtype': 'Time', - 'permlevel': 1, - 'search_index': 1, - 'width': '100px' - }, - - # DocField - { - 'description': 'The date at which current entry is made in system.', - 'doctype': 'DocField', - 'fieldname': 'transaction_date', - 'fieldtype': 'Date', - 'idx': 8, - 'in_filter': 1, - 'label': 'Transaction Date', - 'oldfieldname': 'transaction_date', - 'oldfieldtype': 'Date', - 'permlevel': 1, - 'search_index': 0, - 'width': '100px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'voucher_type', - 'fieldtype': 'Data', - 'idx': 9, - 'in_filter': 1, - 'label': 'Voucher Type', - 'oldfieldname': 'voucher_type', - 'oldfieldtype': 'Data', - 'permlevel': 1, - 'search_index': 0, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'voucher_no', - 'fieldtype': 'Data', - 'idx': 10, - 'in_filter': 1, - 'label': 'Voucher No', - 'oldfieldname': 'voucher_no', - 'oldfieldtype': 'Data', - 'permlevel': 1, - 'search_index': 0, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'voucher_detail_no', - 'fieldtype': 'Data', - 'idx': 11, - 'label': 'Voucher Detail No', - 'oldfieldname': 'voucher_detail_no', - 'oldfieldtype': 'Data', - 'permlevel': 1, - 'width': '150px' - }, - - # DocField - { - 'colour': 'White:FFF', - 'doctype': 'DocField', - 'fieldname': 'actual_qty', - 'fieldtype': 'Currency', - 'idx': 12, - 'in_filter': 1, - 'label': 'Actual Quantity', - 'oldfieldname': 'actual_qty', - 'oldfieldtype': 'Currency', - 'permlevel': 1, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'incoming_rate', - 'fieldtype': 'Currency', - 'idx': 13, - 'label': 'Incoming Rate', - 'oldfieldname': 'incoming_rate', - 'oldfieldtype': 'Currency', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'stock_uom', - 'fieldtype': 'Data', - 'idx': 14, - 'label': 'Stock UOM', - 'oldfieldname': 'stock_uom', - 'oldfieldtype': 'Data', - 'permlevel': 1, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'bin_aqat', - 'fieldtype': 'Currency', - 'idx': 15, - 'in_filter': 1, - 'label': 'Bin Actual Qty After Transaction', - 'oldfieldname': 'bin_aqat', - 'oldfieldtype': 'Currency', - 'permlevel': 1, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'ma_rate', - 'fieldtype': 'Currency', - 'hidden': 1, - 'idx': 16, - 'label': 'Moving Average Rate', - 'oldfieldname': 'ma_rate', - 'oldfieldtype': 'Currency', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 1 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'fcfs_rate', - 'fieldtype': 'Currency', - 'hidden': 1, - 'idx': 17, - 'label': 'FIFO Rate', - 'oldfieldname': 'fcfs_rate', - 'oldfieldtype': 'Currency', - 'permlevel': 0, - 'print_hide': 1, - 'report_hide': 1 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'valuation_rate', - 'fieldtype': 'Currency', - 'idx': 18, - 'label': 'Valuation Rate', - 'oldfieldname': 'valuation_rate', - 'oldfieldtype': 'Currency', - 'permlevel': 0, - 'width': '150px' - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'stock_value', - 'fieldtype': 'Currency', - 'idx': 19, - 'label': 'Stock Value', - 'oldfieldname': 'stock_value', - 'oldfieldtype': 'Currency', - 'permlevel': 0 - }, - - # DocField - { - 'doctype': 'DocField', - 'fieldname': 'fcfs_stack', - 'fieldtype': 'Text', + 'doctype': u'DocField', + 'fieldname': u'item_code', + 'fieldtype': u'Link', 'hidden': 0, - 'idx': 20, + 'in_filter': 1, + 'label': u'Item Code', + 'oldfieldname': u'item_code', + 'oldfieldtype': u'Link', + 'options': u'Item', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'serial_no', + 'fieldtype': u'Text', 'in_filter': 0, - 'label': 'FIFO Stack', - 'oldfieldname': 'fcfs_stack', - 'oldfieldtype': 'Text', + 'label': u'Serial No', + 'permlevel': 0, + 'search_index': 0, + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'batch_no', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Batch No', + 'oldfieldname': u'batch_no', + 'oldfieldtype': u'Data', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'warehouse', + 'fieldtype': u'Link', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Warehouse', + 'oldfieldname': u'warehouse', + 'oldfieldtype': u'Link', + 'options': u'Warehouse', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'warehouse_type', + 'fieldtype': u'Select', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Warehouse Type', + 'oldfieldname': u'warehouse_type', + 'oldfieldtype': u'Select', + 'options': u'\nStores', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1 + }, + + # DocField + { + 'description': u'The date at which current entry will get or has actually executed.', + 'doctype': u'DocField', + 'fieldname': u'posting_date', + 'fieldtype': u'Date', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Posting Date', + 'oldfieldname': u'posting_date', + 'oldfieldtype': u'Date', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'posting_time', + 'fieldtype': u'Time', + 'hidden': 0, + 'in_filter': 0, + 'label': u'Posting Time', + 'oldfieldname': u'posting_time', + 'oldfieldtype': u'Time', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 0, + 'width': u'100px' + }, + + # DocField + { + 'description': u'The date at which current entry is made in system.', + 'doctype': u'DocField', + 'fieldname': u'transaction_date', + 'fieldtype': u'Date', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Transaction Date', + 'oldfieldname': u'transaction_date', + 'oldfieldtype': u'Date', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'voucher_type', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Voucher Type', + 'oldfieldname': u'voucher_type', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'voucher_no', + 'fieldtype': u'Data', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Voucher No', + 'oldfieldname': u'voucher_no', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'voucher_detail_no', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Voucher Detail No', + 'oldfieldname': u'voucher_detail_no', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'actual_qty', + 'fieldtype': u'Currency', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Actual Quantity', + 'oldfieldname': u'actual_qty', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'incoming_rate', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'Incoming Rate', + 'oldfieldname': u'incoming_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'stock_uom', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Stock UOM', + 'oldfieldname': u'stock_uom', + 'oldfieldtype': u'Data', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'bin_aqat', + 'fieldtype': u'Currency', + 'hidden': 0, + 'in_filter': 1, + 'label': u'Bin Actual Qty After Transaction', + 'oldfieldname': u'bin_aqat', + 'oldfieldtype': u'Currency', + 'permlevel': 1, + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'ma_rate', + 'fieldtype': u'Currency', + 'hidden': 1, + 'label': u'Moving Average Rate', + 'oldfieldname': u'ma_rate', + 'oldfieldtype': u'Currency', 'permlevel': 0, 'print_hide': 1, - 'report_hide': 0, + 'report_hide': 1, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'fcfs_rate', + 'fieldtype': u'Currency', + 'hidden': 1, + 'label': u'FIFO Rate', + 'oldfieldname': u'fcfs_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 1, + 'report_hide': 1, + 'reqd': 0 + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'valuation_rate', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'Valuation Rate', + 'oldfieldname': u'valuation_rate', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0, + 'width': u'150px' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'stock_value', + 'fieldtype': u'Currency', + 'hidden': 0, + 'label': u'Stock Value', + 'oldfieldname': u'stock_value', + 'oldfieldtype': u'Currency', + 'permlevel': 0, + 'print_hide': 0, + 'reqd': 0 + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'fcfs_stack', + 'fieldtype': u'Text', + 'hidden': 1, + 'in_filter': 0, + 'label': u'FIFO Stack', + 'oldfieldname': u'fcfs_stack', + 'oldfieldtype': u'Text', + 'permlevel': 2, + 'print_hide': 1, + 'report_hide': 1, + 'reqd': 0, 'search_index': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'company', - 'fieldtype': 'Data', - 'idx': 21, + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Select', + 'hidden': 0, 'in_filter': 1, - 'label': 'Company', - 'oldfieldname': 'company', - 'oldfieldtype': 'Data', + 'label': u'Company', + 'oldfieldname': u'company', + 'oldfieldtype': u'Data', + 'options': u'\nWeb Notes Technologies Pvt Ltd', 'permlevel': 1, - 'search_index': 0, - 'width': '150px' + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'150px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'fiscal_year', - 'fieldtype': 'Data', - 'idx': 22, + 'doctype': u'DocField', + 'fieldname': u'fiscal_year', + 'fieldtype': u'Data', + 'hidden': 0, 'in_filter': 1, - 'label': 'Fiscal Year', - 'oldfieldname': 'fiscal_year', - 'oldfieldtype': 'Data', + 'label': u'Fiscal Year', + 'oldfieldname': u'fiscal_year', + 'oldfieldtype': u'Data', 'permlevel': 1, - 'search_index': 0, - 'width': '150px' + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'150px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'is_cancelled', - 'fieldtype': 'Select', - 'idx': 23, + 'doctype': u'DocField', + 'fieldname': u'is_cancelled', + 'fieldtype': u'Select', + 'hidden': 0, 'in_filter': 1, - 'label': 'Is Cancelled', - 'oldfieldname': 'is_cancelled', - 'oldfieldtype': 'Select', - 'options': '\nYes\nNo', + 'label': u'Is Cancelled', + 'oldfieldname': u'is_cancelled', + 'oldfieldtype': u'Select', + 'options': u'\nYes\nNo', 'permlevel': 1, - 'search_index': 0, - 'width': '100px' + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'is_stock_entry', - 'fieldtype': 'Select', - 'idx': 24, + 'doctype': u'DocField', + 'fieldname': u'is_stock_entry', + 'fieldtype': u'Select', + 'hidden': 0, 'in_filter': 1, - 'label': 'Is Stock Entry', - 'oldfieldname': 'is_stock_entry', - 'oldfieldtype': 'Select', - 'options': '\nYes\nNo', + 'label': u'Is Stock Entry', + 'oldfieldname': u'is_stock_entry', + 'oldfieldtype': u'Select', + 'options': u'\nYes\nNo', 'permlevel': 1, - 'search_index': 0, - 'width': '100px' + 'print_hide': 0, + 'reqd': 0, + 'search_index': 1, + 'width': u'100px' } ] \ No newline at end of file From 4776d3e0973162d28d177d3950aeada46235e3a9 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Apr 2012 12:37:01 +0530 Subject: [PATCH 04/13] Update erpnext/production/doctype/bill_of_materials/bill_of_materials.js --- .../doctype/bill_of_materials/bill_of_materials.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/erpnext/production/doctype/bill_of_materials/bill_of_materials.js b/erpnext/production/doctype/bill_of_materials/bill_of_materials.js index ae61147538..c49a9bc501 100644 --- a/erpnext/production/doctype/bill_of_materials/bill_of_materials.js +++ b/erpnext/production/doctype/bill_of_materials/bill_of_materials.js @@ -157,3 +157,8 @@ cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = functi return 'SELECT DISTINCT `tabBill Of Materials`.`name`, `tabBill Of Materials`.`remarks` FROM `tabBill Of Materials` WHERE `tabBill Of Materials`.`item` = "' + d.item_code + '" AND `tabBill Of Materials`.`is_active` = "Yes" AND `tabBill Of Materials`.docstatus = 1 AND `tabBill Of Materials`.`name` like "%s" ORDER BY `tabBill Of Materials`.`name` LIMIT 50'; } +cur_frm.cscript.validate = function(doc, dt, dn) { + calculate_op_cost(doc, dt, dn); + calculate_rm_cost(doc, dt, dn); + calculate_total(doc); +} \ No newline at end of file From 97051ba79f3d173b757acdb8243fcb2d33062aaa Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Apr 2012 12:51:11 +0530 Subject: [PATCH 05/13] allow negative stock field in global defaults --- .../doctype/manage_account/manage_account.txt | 546 +++++++++--------- 1 file changed, 278 insertions(+), 268 deletions(-) diff --git a/erpnext/setup/doctype/manage_account/manage_account.txt b/erpnext/setup/doctype/manage_account/manage_account.txt index 4077afe76e..db1759c1c4 100644 --- a/erpnext/setup/doctype/manage_account/manage_account.txt +++ b/erpnext/setup/doctype/manage_account/manage_account.txt @@ -3,58 +3,58 @@ # These values are common in all dictionaries { - 'creation': '2010-08-08 17:09:09', + 'creation': '2010-09-20 11:59:26', 'docstatus': 0, - 'modified': '2012-01-20 11:25:18', - 'modified_by': 'Administrator', - 'owner': 'Administrator' + 'modified': '2012-04-18 12:48:57', + 'modified_by': u'Administrator', + 'owner': u'Administrator' }, # These values are common for all DocType { - '_last_update': '1323855502', + '_last_update': u'1323855502', 'allow_copy': 1, 'allow_email': 1, 'allow_print': 1, - 'colour': 'White:FFF', - 'default_print_format': 'Standard', + 'colour': u'White:FFF', + 'default_print_format': u'Standard', 'doctype': 'DocType', 'hide_toolbar': 0, 'in_create': 1, 'issingle': 1, - 'module': 'Setup', + 'module': u'Setup', 'name': '__common__', 'read_only': 1, - 'section_style': 'Tabbed', - 'server_code_error': ' ', + 'section_style': u'Tabbed', + 'server_code_error': u' ', 'show_in_menu': 1, - 'version': 517 + 'version': 518 }, # These values are common for all DocField { - 'doctype': 'DocField', + 'doctype': u'DocField', 'name': '__common__', - 'parent': 'Manage Account', - 'parentfield': 'fields', - 'parenttype': 'DocType', + 'parent': u'Manage Account', + 'parentfield': u'fields', + 'parenttype': u'DocType', 'permlevel': 0 }, # These values are common for all DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'name': '__common__', - 'parent': 'Manage Account', - 'parentfield': 'permissions', - 'parenttype': 'DocType', + 'parent': u'Manage Account', + 'parentfield': u'permissions', + 'parenttype': u'DocType', 'read': 1 }, # DocType, Manage Account { 'doctype': 'DocType', - 'name': 'Manage Account' + 'name': u'Manage Account' }, # DocPerm @@ -62,9 +62,9 @@ 'amend': 0, 'cancel': 0, 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'System Manager', + 'role': u'System Manager', 'submit': 0, 'write': 1 }, @@ -72,464 +72,474 @@ # DocPerm { 'create': 1, - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 0, - 'role': 'System Manager', + 'role': u'System Manager', 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 1, - 'role': 'System Manager', + 'role': u'All' + }, + + # DocPerm + { + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'System Manager', 'write': 1 }, # DocPerm { - 'doctype': 'DocPerm', - 'permlevel': 1, - 'role': 'All' - }, - - # DocPerm - { - 'doctype': 'DocPerm', + 'doctype': u'DocPerm', 'permlevel': 2, - 'role': 'System Manager', + 'role': u'System Manager', 'write': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'System' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'System' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Example: http://frappe.erpnext.com', - 'doctype': 'DocField', - 'fieldname': 'account_url', - 'fieldtype': 'Data', - 'label': 'Account URL' + 'colour': u'White:FFF', + 'description': u'Example: http://frappe.erpnext.com', + 'doctype': u'DocField', + 'fieldname': u'account_url', + 'fieldtype': u'Data', + 'label': u'Account URL' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break' + 'doctype': u'DocField', + 'fieldtype': u'Column Break' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'sms_sender_name', - 'fieldtype': 'Data', - 'label': 'SMS Sender Name' + 'doctype': u'DocField', + 'fieldname': u'sms_sender_name', + 'fieldtype': u'Data', + 'label': u'SMS Sender Name' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Company' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Company' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_company', - 'fieldtype': 'Link', - 'label': 'Default Company', - 'options': 'Company', + 'doctype': u'DocField', + 'fieldname': u'default_company', + 'fieldtype': u'Link', + 'label': u'Default Company', + 'options': u'Company', 'reqd': 0 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'current_fiscal_year', - 'fieldtype': 'Link', - 'label': 'Current Fiscal Year', - 'options': 'Fiscal Year', + 'doctype': u'DocField', + 'fieldname': u'current_fiscal_year', + 'fieldtype': u'Link', + 'label': u'Current Fiscal Year', + 'options': u'Fiscal Year', 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'date_format', - 'fieldtype': 'Select', - 'label': 'Date Format', - 'options': 'yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy' + 'doctype': u'DocField', + 'fieldname': u'date_format', + 'fieldtype': u'Select', + 'label': u'Date Format', + 'options': u'yyyy-mm-dd\ndd-mm-yyyy\ndd/mm/yyyy\nmm/dd/yyyy\nmm-dd-yyyy' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'width': u'50%' }, # DocField { - 'default': 'INR', - 'doctype': 'DocField', - 'fieldname': 'default_currency', - 'fieldtype': 'Select', - 'label': 'Default Currency', - 'options': 'link:Currency', + 'default': u'INR', + 'doctype': u'DocField', + 'fieldname': u'default_currency', + 'fieldtype': u'Select', + 'label': u'Default Currency', + 'options': u'link:Currency', 'reqd': 1 }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_currency_format', - 'fieldtype': 'Select', - 'label': 'Default Currency Format', - 'options': 'Lacs\nMillions' + 'doctype': u'DocField', + 'fieldname': u'default_currency_format', + 'fieldtype': u'Select', + 'label': u'Default Currency Format', + 'options': u'Lacs\nMillions' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_currency_fraction', - 'fieldtype': 'Data', - 'label': 'Default Currency Fraction' + 'doctype': u'DocField', + 'fieldname': u'default_currency_fraction', + 'fieldtype': u'Data', + 'label': u'Default Currency Fraction' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Stock' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Stock' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_item_group', - 'fieldtype': 'Link', - 'label': 'Default Item Group', - 'options': 'Item Group' + 'doctype': u'DocField', + 'fieldname': u'default_item_group', + 'fieldtype': u'Link', + 'label': u'Default Item Group', + 'options': u'Item Group' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'IGHelp', - 'options': 'To manage Item Groups, click here' + 'doctype': u'DocField', + 'fieldtype': u'HTML', + 'label': u'IGHelp', + 'options': u'To manage Item Groups, click here' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_stock_uom', - 'fieldtype': 'Link', - 'label': 'Default Stock UOM', - 'options': 'UOM' + 'doctype': u'DocField', + 'fieldname': u'default_stock_uom', + 'fieldtype': u'Link', + 'label': u'Default Stock UOM', + 'options': u'UOM' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_valuation_method', - 'fieldtype': 'Select', - 'label': 'Default Valuation Method', - 'options': 'FIFO\nMoving Average' + 'doctype': u'DocField', + 'fieldname': u'default_valuation_method', + 'fieldtype': u'Select', + 'label': u'Default Valuation Method', + 'options': u'FIFO\nMoving Average' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_warehouse_type', - 'fieldtype': 'Link', - 'label': 'Default Warehouse Type', - 'options': 'Warehouse Type' + 'colour': u'White:FFF', + 'description': u'Applicable only if valuation method is moving average', + 'doctype': u'DocField', + 'fieldname': u'allow_negative_stock', + 'fieldtype': u'Check', + 'label': u'Allow Negative Stock' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'auto_indent', - 'fieldtype': 'Check', - 'label': 'Raise Indent when stock reaches re-order level' + 'doctype': u'DocField', + 'fieldname': u'default_warehouse_type', + 'fieldtype': u'Link', + 'label': u'Default Warehouse Type', + 'options': u'Warehouse Type' }, # DocField { - 'default': '1', - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldname': u'auto_indent', + 'fieldtype': u'Check', + 'label': u'Raise Indent when stock reaches re-order level' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Percentage you are allowed to receive or deliver more against the quantity ordered.

For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units

', - 'doctype': 'DocField', - 'fieldname': 'tolerance', - 'fieldtype': 'Currency', - 'label': 'Allowance Percent' + 'default': u'1', + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'width': u'50%' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Stock level frozen up to this date, nobody can do / modify entry except authorized person', - 'doctype': 'DocField', - 'fieldname': 'stock_frozen_upto', - 'fieldtype': 'Date', - 'label': 'Stock Frozen Upto' + 'colour': u'White:FFF', + 'description': u'Percentage you are allowed to receive or deliver more against the quantity ordered.

For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units

', + 'doctype': u'DocField', + 'fieldname': u'tolerance', + 'fieldtype': u'Currency', + 'label': u'Allowance Percent' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Users with this role are allowed to do / modify stock entry before frozen date', - 'doctype': 'DocField', - 'fieldname': 'stock_auth_role', - 'fieldtype': 'Link', - 'label': 'Authorized Role (Frozen Entry)', - 'options': 'Role' + 'colour': u'White:FFF', + 'description': u'Stock level frozen up to this date, nobody can do / modify entry except authorized person', + 'doctype': u'DocField', + 'fieldname': u'stock_frozen_upto', + 'fieldtype': u'Date', + 'label': u'Stock Frozen Upto' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Accounts' + 'colour': u'White:FFF', + 'description': u'Users with this role are allowed to do / modify stock entry before frozen date', + 'doctype': u'DocField', + 'fieldname': u'stock_auth_role', + 'fieldtype': u'Link', + 'label': u'Authorized Role (Frozen Entry)', + 'options': u'Role' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Accounting entry frozen up to this date, nobody can do / modify entry except authorized person', - 'doctype': 'DocField', - 'fieldname': 'acc_frozen_upto', - 'fieldtype': 'Date', - 'label': 'Accounts Frozen Upto' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Accounts' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Users with this role are allowed to do / modify accounting entry before frozen date', - 'doctype': 'DocField', - 'fieldname': 'bde_auth_role', - 'fieldtype': 'Link', - 'label': 'Authourized Role (Frozen Entry)', - 'options': 'Role' + 'colour': u'White:FFF', + 'description': u'Accounting entry frozen up to this date, nobody can do / modify entry except authorized person', + 'doctype': u'DocField', + 'fieldname': u'acc_frozen_upto', + 'fieldtype': u'Date', + 'label': u'Accounts Frozen Upto' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'credit_controller', - 'fieldtype': 'Link', - 'label': 'Credit Controller', - 'options': 'Role' + 'colour': u'White:FFF', + 'description': u'Users with this role are allowed to do / modify accounting entry before frozen date', + 'doctype': u'DocField', + 'fieldname': u'bde_auth_role', + 'fieldtype': u'Link', + 'label': u'Authourized Role (Frozen Entry)', + 'options': u'Role' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break' + 'doctype': u'DocField', + 'fieldname': u'credit_controller', + 'fieldtype': u'Link', + 'label': u'Credit Controller', + 'options': u'Role' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'Account Info', - 'options': '
For more accounting defaults, Open Company
' + 'doctype': u'DocField', + 'fieldtype': u'Column Break' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Selling' + 'doctype': u'DocField', + 'fieldtype': u'HTML', + 'label': u'Account Info', + 'options': u'
For more accounting defaults, Open Company
' }, # DocField { - 'colour': 'White:FFF', - 'default': 'Customer Name', - 'doctype': 'DocField', - 'fieldname': 'cust_master_name', - 'fieldtype': 'Select', - 'label': 'Customer Master created by ', - 'options': 'Customer Name\nNaming Series' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Selling' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_customer_group', - 'fieldtype': 'Link', - 'label': 'Default Customer Group', - 'options': 'Customer Group' + 'colour': u'White:FFF', + 'default': u'Customer Name', + 'doctype': u'DocField', + 'fieldname': u'cust_master_name', + 'fieldtype': u'Select', + 'label': u'Customer Master created by ', + 'options': u'\nCustomer Name\nNaming Series' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'CGHelp', - 'options': 'To manage Customer Groups, click here' + 'doctype': u'DocField', + 'fieldname': u'default_customer_group', + 'fieldtype': u'Link', + 'label': u'Default Customer Group', + 'options': u'Customer Group' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_territory', - 'fieldtype': 'Link', - 'label': 'Default Territory', - 'options': 'Territory' + 'doctype': u'DocField', + 'fieldtype': u'HTML', + 'label': u'CGHelp', + 'options': u'To manage Customer Groups, click here' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'HTML', - 'label': 'TerritoryHelp', - 'options': 'To manage Territory, click here' + 'doctype': u'DocField', + 'fieldname': u'default_territory', + 'fieldtype': u'Link', + 'label': u'Default Territory', + 'options': u'Territory' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'doctype': u'DocField', + 'fieldtype': u'HTML', + 'label': u'TerritoryHelp', + 'options': u'To manage Territory, click here' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_price_list', - 'fieldtype': 'Link', - 'label': 'Default Price List', - 'options': 'Price List' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'width': u'50%' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_price_list_currency', - 'fieldtype': 'Link', - 'label': 'Default Price List Currency', - 'options': 'Currency' + 'doctype': u'DocField', + 'fieldname': u'default_price_list', + 'fieldtype': u'Link', + 'label': u'Default Price List', + 'options': u'Price List' }, # DocField { - 'colour': 'White:FFF', - 'default': 'No', - 'doctype': 'DocField', - 'fieldname': 'so_required', - 'fieldtype': 'Select', - 'label': 'Sales Order Required', - 'options': 'No\nYes' + 'doctype': u'DocField', + 'fieldname': u'default_price_list_currency', + 'fieldtype': u'Link', + 'label': u'Default Price List Currency', + 'options': u'Currency' }, # DocField { - 'colour': 'White:FFF', - 'default': 'No', - 'doctype': 'DocField', - 'fieldname': 'dn_required', - 'fieldtype': 'Select', - 'label': 'Delivery Note Required', - 'options': 'No\nYes' + 'colour': u'White:FFF', + 'default': u'No', + 'doctype': u'DocField', + 'fieldname': u'so_required', + 'fieldtype': u'Select', + 'label': u'Sales Order Required', + 'options': u'No\nYes' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'Buying' + 'colour': u'White:FFF', + 'default': u'No', + 'doctype': u'DocField', + 'fieldname': u'dn_required', + 'fieldtype': u'Select', + 'label': u'Delivery Note Required', + 'options': u'No\nYes' }, # DocField { - 'doctype': 'DocField', - 'fieldname': 'default_supplier_type', - 'fieldtype': 'Link', - 'label': 'Default Supplier Type', - 'options': 'Supplier Type' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'Buying' }, # DocField { - 'colour': 'White:FFF', - 'default': 'Supplier Name', - 'doctype': 'DocField', - 'fieldname': 'supp_master_name', - 'fieldtype': 'Select', - 'label': 'Supplier Master created by ', - 'options': 'Supplier Name\nNaming Series' + 'doctype': u'DocField', + 'fieldname': u'default_supplier_type', + 'fieldtype': u'Link', + 'label': u'Default Supplier Type', + 'options': u'Supplier Type' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Column Break', - 'width': '50%' + 'colour': u'White:FFF', + 'default': u'Supplier Name', + 'doctype': u'DocField', + 'fieldname': u'supp_master_name', + 'fieldtype': u'Select', + 'label': u'Supplier Master created by ', + 'options': u'Supplier Name\nNaming Series' }, # DocField { - 'colour': 'White:FFF', - 'default': 'No', - 'doctype': 'DocField', - 'fieldname': 'po_required', - 'fieldtype': 'Select', - 'label': 'Purchase Order Required', - 'options': 'No\nYes' + 'doctype': u'DocField', + 'fieldtype': u'Column Break', + 'width': u'50%' }, # DocField { - 'colour': 'White:FFF', - 'default': 'No', - 'doctype': 'DocField', - 'fieldname': 'pr_required', - 'fieldtype': 'Select', - 'label': 'Purchase Receipt Required', - 'options': 'No\nYes' + 'colour': u'White:FFF', + 'default': u'No', + 'doctype': u'DocField', + 'fieldname': u'po_required', + 'fieldtype': u'Select', + 'label': u'Purchase Order Required', + 'options': u'No\nYes' }, # DocField { - 'doctype': 'DocField', - 'fieldtype': 'Section Break', - 'label': 'HR', - 'options': '
HR
' + 'colour': u'White:FFF', + 'default': u'No', + 'doctype': u'DocField', + 'fieldname': u'pr_required', + 'fieldtype': u'Select', + 'label': u'Purchase Receipt Required', + 'options': u'No\nYes' }, # DocField { - 'colour': 'White:FFF', - 'description': 'Employee record is created using selected field. ', - 'doctype': 'DocField', - 'fieldname': 'emp_created_by', - 'fieldtype': 'Select', - 'label': 'Employee Records to be created by ', - 'options': '\nNaming Series\nEmployee Number' + 'doctype': u'DocField', + 'fieldtype': u'Section Break', + 'label': u'HR', + 'options': u'
HR
' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Employee record is created using selected field. ', + 'doctype': u'DocField', + 'fieldname': u'emp_created_by', + 'fieldtype': u'Select', + 'label': u'Employee Records to be created by ', + 'options': u'\nNaming Series\nEmployee Number' } ] \ No newline at end of file From 6da191de03a484b9283e98d31f34ba4df5059b72 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 18 Apr 2012 16:18:20 +0530 Subject: [PATCH 06/13] negative stock fixes --- erpnext/stock/doctype/bin/bin.py | 10 ++++++---- erpnext/stock/doctype/delivery_note/delivery_note.py | 9 --------- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/erpnext/stock/doctype/bin/bin.py b/erpnext/stock/doctype/bin/bin.py index 860653317b..8e1c949b6d 100644 --- a/erpnext/stock/doctype/bin/bin.py +++ b/erpnext/stock/doctype/bin/bin.py @@ -183,6 +183,7 @@ class DocType: # get moving average inventory values # ------------------------------------ def get_moving_average_inventory_values(self, val_rate, in_rate, opening_qty, actual_qty, is_cancelled): + #msgprint(actual_qty) if flt(in_rate) <= 0: # In case of delivery/stock issue in_rate = 0 or wrong incoming rate in_rate = val_rate @@ -191,9 +192,8 @@ class DocType: # 2. cancelled entry # 3. val_rate is negative # Otherwise it will be calculated as per moving average - elif actual_qty > 0 and (opening_qty + actual_qty) > 0 and is_cancelled == 'No' and ((opening_qty * val_rate) + (actual_qty * in_rate)) > 0: - if opening_qty < 0: - opening_qty = 0 + if actual_qty > 0 and (opening_qty + actual_qty) > 0 and is_cancelled == 'No' and ((opening_qty * val_rate) + (actual_qty * in_rate)) > 0: + opening_qty = opening_qty > 0 and opening_qty or 0 val_rate = ((opening_qty *val_rate) + (actual_qty * in_rate)) / (opening_qty + actual_qty) elif (opening_qty + actual_qty) <= 0: val_rate = 0 @@ -250,8 +250,10 @@ class DocType: # get stock value # ---------------- def get_stock_value(self, val_method, cqty, stock_val, serial_nos): - if val_method == 'Moving Average' or serial_nos: + if serial_nos: stock_val = flt(stock_val) * flt(cqty) + elif val_method == 'Moving Average': + stock_val = flt(cqty) > 0 and flt(stock_val) * flt(cqty) or 0 elif val_method == 'FIFO': stock_val = sum([flt(d[0])*flt(d[1]) for d in self.fcfs_bal]) return stock_val diff --git a/erpnext/stock/doctype/delivery_note/delivery_note.py b/erpnext/stock/doctype/delivery_note/delivery_note.py index 3d8a1011fc..aeccc43fa1 100644 --- a/erpnext/stock/doctype/delivery_note/delivery_note.py +++ b/erpnext/stock/doctype/delivery_note/delivery_note.py @@ -321,7 +321,6 @@ class DocType(TransactionBase): def on_submit(self): self.validate_packed_qty() set(self.doc, 'message', 'Items against your Order #%s have been delivered. Delivery #%s: ' % (self.doc.po_no, self.doc.name)) - self.check_qty_in_stock() # Check for Approving Authority get_obj('Authorization Control').validate_approving_authority(self.doc.doctype, self.doc.company, self.doc.grand_total, self) sl_obj = get_obj("Stock Ledger") @@ -360,14 +359,6 @@ class DocType(TransactionBase): webnotes.msgprint("Packing Error:\n" + err_msg, raise_exception=1) - # *********** Checks whether actual quantity is present in warehouse ************* - def check_qty_in_stock(self): - for d in getlist(self.doclist, 'packing_details'): - is_stock_item = sql("select is_stock_item from `tabItem` where name = '%s'" % d.item_code)[0][0] - if is_stock_item == 'Yes' and d.warehouse and flt(d.qty) > flt(d.actual_qty): - msgprint("For Item: " + cstr(d.item_code) + " at Warehouse: " + cstr(d.warehouse) + " Quantity: " + cstr(d.qty) +" is not Available. (Must be less than or equal to " + cstr(d.actual_qty) + " )") - raise Exception, "Validation Error" - # ON CANCEL From b50a7a5ff9f044475bcc877338f97a21c6e5039e Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 19 Apr 2012 12:00:49 +0530 Subject: [PATCH 07/13] Fix in rate fetching on get item details, when using inclusive rate --- .../sales_and_purchase_return_wizard.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py b/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py index 9b421d3e96..36f019bbae 100644 --- a/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py +++ b/erpnext/stock/doctype/sales_and_purchase_return_wizard/sales_and_purchase_return_wizard.py @@ -42,9 +42,9 @@ class DocType : def pull_item_details(self): if self.doc.return_type == 'Sales Return': if self.doc.delivery_note_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.basic_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.uom, t2.export_rate * t3.conversion_rate, t3.customer, t3.customer_name, t3.customer_address, t2.serial_no, t2.batch_no from `tabDelivery Note Packing Detail` t1, `tabDelivery Note Detail` t2, `tabDelivery Note` t3 where t1.parent = t3.name and t2.parent = t3.name and t1.parent_detail_docname = t2.name and t3.name = '%s' and t3.docstatus = 1" % self.doc.delivery_note_no) elif self.doc.sales_invoice_no: - det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.basic_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) + det = sql("select t1.name, t1.item_code, t1.description, t1.qty, t1.stock_uom, t1.export_rate * t2.conversion_rate, t2.customer, t2.customer_name, t2.customer_address, t1.serial_no from `tabRV Detail` t1, `tabReceivable Voucher` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.sales_invoice_no) elif self.doc.return_type == 'Purchase Return' and self.doc.purchase_receipt_no: det = sql("select t1.name, t1.item_code, t1.description, t1.received_qty, t1.uom, t1.purchase_rate, t2.supplier, t2.supplier_name, t2.supplier_address, t1.serial_no, t1.batch_no from `tabPurchase Receipt Detail` t1, `tabPurchase Receipt` t2 where t1.parent = t2.name and t2.name = '%s' and t2.docstatus = 1" % self.doc.purchase_receipt_no) From 40738aecfafb837434e7910658f2beb8c6ee2dbd Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 19 Apr 2012 13:55:45 +0530 Subject: [PATCH 08/13] removed msgprint --- erpnext/buying/doctype/purchase_common/purchase_common.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/erpnext/buying/doctype/purchase_common/purchase_common.js b/erpnext/buying/doctype/purchase_common/purchase_common.js index 89094e9a00..9afb710a37 100644 --- a/erpnext/buying/doctype/purchase_common/purchase_common.js +++ b/erpnext/buying/doctype/purchase_common/purchase_common.js @@ -368,11 +368,9 @@ cur_frm.cscript.calc_amount = function(doc, n) { tmp[rate_fld] = flt( flt(cl[i].purchase_ref_rate) - flt(flt(cl[i].purchase_ref_rate)*flt(cl[i].discount_rate)/100) ) set_multiple(tname, cl[i].name, tmp, fname); - msgprint(cl[i][rate_fld]) set_multiple(tname, cl[i].name, {'import_rate': flt(flt(cl[i][rate_fld]) / flt(doc.conversion_rate))}, fname); set_multiple(tname, cl[i].name, {'amount':flt(flt(cl[i].qty) * flt(cl[i][rate_fld]))}, fname); set_multiple(tname, cl[i].name, {'import_amount': flt(flt(cl[i].qty) * flt(cl[i][rate_fld]) / flt(doc.conversion_rate))}, fname); - msgprint(cl[i]['amount']) }else if( n==5){ tmp[rate_fld] = flt( flt(cl[i].import_ref_rate) - flt(flt(cl[i].import_ref_rate)*flt(cl[i].discount_rate)/100) ) * flt(doc.conversion_rate); set_multiple(tname, cl[i].name, {'purchase_ref_rate': flt(flt(cl[i].import_ref_rate) * flt(doc.conversion_rate))}, fname); From 776e8572a2ae0f751e9cb8e949f7d34e5252d3b0 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 19 Apr 2012 15:00:48 +0530 Subject: [PATCH 09/13] issue fixed in prod plan --- .../production_planning_tool/production_planning_tool.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py index 4e4832f780..2bec00f61d 100644 --- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py @@ -201,6 +201,7 @@ class DocType: def download_raw_materials(self): """ Create csv data for required raw material to produce finished goods""" + self.test = [] bom_dict = self.get_distinct_bom(action = 'download_rm') self.get_raw_materials(bom_dict) return self.get_csv() @@ -241,8 +242,9 @@ class DocType: def make_items_dict(self, item_list): + for i in item_list: - self.item_dict[i[0]] = [(flt(self.item_dict.get(i[1], 0)) + flt(i[1])), i[2], i[3]] + self.item_dict[i[0]] = [(flt(self.item_dict.get(i[0], [0])[0]) + flt(i[1])), i[2], i[3]] def get_csv(self): @@ -250,6 +252,7 @@ class DocType: for d in self.item_dict: item_qty= sql("select sum(indented_qty), sum(ordered_qty), sum(actual_qty) from `tabBin` where item_code = %s", d) item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0], flt(item_qty[0][0]), flt(item_qty[0][1]), flt(item_qty[0][2])]) + item_list.append(self.test) return item_list From 94329abd020a2a47fdcf6d256c6c76677c868b02 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Thu, 19 Apr 2012 16:08:33 +0530 Subject: [PATCH 10/13] modifed format for raw material report in prod plan --- .../production_planning_tool.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py index 2bec00f61d..272d13f6af 100644 --- a/erpnext/production/doctype/production_planning_tool/production_planning_tool.py +++ b/erpnext/production/doctype/production_planning_tool/production_planning_tool.py @@ -201,7 +201,6 @@ class DocType: def download_raw_materials(self): """ Create csv data for required raw material to produce finished goods""" - self.test = [] bom_dict = self.get_distinct_bom(action = 'download_rm') self.get_raw_materials(bom_dict) return self.get_csv() @@ -242,17 +241,22 @@ class DocType: def make_items_dict(self, item_list): - for i in item_list: self.item_dict[i[0]] = [(flt(self.item_dict.get(i[0], [0])[0]) + flt(i[1])), i[2], i[3]] def get_csv(self): - item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Indented Qty', 'Ordered Qty', 'Actual Qty']] + item_list = [['Item Code', 'Description', 'Stock UOM', 'Required Qty', 'Warehouse', 'Indented Qty', 'Ordered Qty', 'Actual Qty']] for d in self.item_dict: - item_qty= sql("select sum(indented_qty), sum(ordered_qty), sum(actual_qty) from `tabBin` where item_code = %s", d) - item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0], flt(item_qty[0][0]), flt(item_qty[0][1]), flt(item_qty[0][2])]) - item_list.append(self.test) + item_list.append([d, self.item_dict[d][1], self.item_dict[d][2], self.item_dict[d][0]]), + item_qty= sql("select warehouse, indented_qty, ordered_qty, actual_qty from `tabBin` where item_code = %s", d) + i_qty, o_qty, a_qty = 0,0,0 + for w in item_qty: + i_qty, o_qty, a_qty = i_qty + flt(w[1]), o_qty + flt(w[2]), a_qty + flt(w[3]) + item_list.append(['', '', '', '', w[0], flt(w[1]), flt(w[2]), flt(w[3])]) + if item_qty: + item_list.append(['', '', '', '', 'Total', i_qty, o_qty, a_qty]) + return item_list From 7c135ed2fc0c35ac2fca579a1abfff85f2e10b03 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Thu, 19 Apr 2012 17:58:56 +0530 Subject: [PATCH 11/13] projects date_format to be fetched from wn.boot.sysdefaults --- erpnext/projects/page/projects/projects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/projects/page/projects/projects.js b/erpnext/projects/page/projects/projects.js index 3778a34b61..1ffbe5af20 100644 --- a/erpnext/projects/page/projects/projects.js +++ b/erpnext/projects/page/projects/projects.js @@ -74,7 +74,7 @@ GanttChart.prototype.make_date = function(label,idx) { var w = this.make_filter(label,idx); var i = $a(w, 'input'); - var user_fmt = wn.control_panel.date_format; + var user_fmt = wn.boot.sysdefaults.date_format; if(!this.user_fmt)this.user_fmt = 'dd-mm-yy'; $(i).datepicker({ From b301251090f4daa372eef1a8d643cdd4dbd7b130 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Fri, 20 Apr 2012 11:51:27 +0530 Subject: [PATCH 12/13] Store base currency on client side --- erpnext/selling/doctype/sales_common/sales_common.js | 1 + 1 file changed, 1 insertion(+) diff --git a/erpnext/selling/doctype/sales_common/sales_common.js b/erpnext/selling/doctype/sales_common/sales_common.js index b257d6da51..a4a6fe6c43 100644 --- a/erpnext/selling/doctype/sales_common/sales_common.js +++ b/erpnext/selling/doctype/sales_common/sales_common.js @@ -140,6 +140,7 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) { //------------------------------------------------------------------ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, base_curr, callback) { + cur_frm.cscript.base_currency = base_curr; set_dynamic_label_par(doc, cdt, cdn, base_curr); set_dynamic_label_child(doc, cdt, cdn, base_curr); From a8d83b6c51655069f11824369a4ecefd3108b404 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 20 Apr 2012 14:02:44 +0530 Subject: [PATCH 13/13] update modified date --- erpnext/setup/doctype/global_defaults/global_defaults.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/erpnext/setup/doctype/global_defaults/global_defaults.txt b/erpnext/setup/doctype/global_defaults/global_defaults.txt index af93033450..5355c1008f 100644 --- a/erpnext/setup/doctype/global_defaults/global_defaults.txt +++ b/erpnext/setup/doctype/global_defaults/global_defaults.txt @@ -5,7 +5,7 @@ { 'creation': '2012-04-18 17:00:50', 'docstatus': 0, - 'modified': '2012-04-18 17:24:45', + 'modified': '2012-04-19 17:24:45', 'modified_by': u'Administrator', 'owner': u'Administrator' },