mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 22:18:27 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-07-03 13:30:42",
|
||||
"creation": "2012-12-03 10:25:00",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-12-03 10:20:11"
|
||||
"modified": "2013-01-04 13:14:40"
|
||||
},
|
||||
{
|
||||
"istable": 1,
|
||||
@@ -25,13 +25,13 @@
|
||||
"doctype": "DocType"
|
||||
},
|
||||
{
|
||||
"print_width": "100px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"search_index": 1,
|
||||
@@ -53,6 +53,7 @@
|
||||
"in_filter": 0
|
||||
},
|
||||
{
|
||||
"print_width": "300px",
|
||||
"oldfieldtype": "Text",
|
||||
"doctype": "DocField",
|
||||
"label": "Description",
|
||||
@@ -65,45 +66,59 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Recd Quantity",
|
||||
"oldfieldname": "received_qty",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "received_qty",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 1,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Accepted Quantity",
|
||||
"oldfieldname": "qty",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Rejected Quantity",
|
||||
"oldfieldname": "rejected_qty",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "rejected_qty",
|
||||
"fieldtype": "Currency",
|
||||
"search_index": 0,
|
||||
"permlevel": 0,
|
||||
"in_filter": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "UOM",
|
||||
"oldfieldname": "uom",
|
||||
"width": "100px",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "UOM"
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"doctype": "DocField",
|
||||
@@ -122,14 +137,13 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 0,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Rate",
|
||||
"oldfieldname": "import_rate",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "import_rate",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 0
|
||||
@@ -153,14 +167,13 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Rate *(Default Curr.)",
|
||||
"oldfieldname": "purchase_rate",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "purchase_rate",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 1,
|
||||
@@ -168,13 +181,13 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Amount (Default Curr.)",
|
||||
"oldfieldname": "amount",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 0,
|
||||
@@ -182,40 +195,26 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"doctype": "DocField",
|
||||
"label": "Accepted Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"width": "100px",
|
||||
"options": "Warehouse",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "UOM",
|
||||
"oldfieldname": "uom",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"reqd": 1,
|
||||
"options": "UOM"
|
||||
"options": "Warehouse"
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Conversion Factor",
|
||||
"oldfieldname": "conversion_factor",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Currency",
|
||||
"reqd": 1,
|
||||
@@ -223,6 +222,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"oldfieldtype": "Data",
|
||||
"doctype": "DocField",
|
||||
"label": "Stock UOM",
|
||||
@@ -237,7 +237,6 @@
|
||||
"print_hide": 0,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Text",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Serial No",
|
||||
"oldfieldname": "serial_no",
|
||||
@@ -258,22 +257,20 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Batch No",
|
||||
"oldfieldname": "batch_no",
|
||||
"trigger": "Client",
|
||||
"options": "Batch",
|
||||
"fieldname": "batch_no",
|
||||
"fieldtype": "Link",
|
||||
"options": "Batch",
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 1,
|
||||
"print_width": "100px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Rejected Warehouse",
|
||||
"oldfieldname": "rejected_warehouse",
|
||||
@@ -287,7 +284,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Date",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Required By",
|
||||
"oldfieldname": "schedule_date",
|
||||
@@ -299,7 +295,6 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Project Name",
|
||||
"options": "Project",
|
||||
@@ -312,7 +307,6 @@
|
||||
"print_hide": 1,
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "QA No",
|
||||
"oldfieldname": "qa_no",
|
||||
@@ -349,12 +343,12 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "100px",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Stock Qty",
|
||||
"oldfieldname": "stock_qty",
|
||||
"width": "100px",
|
||||
"trigger": "Client",
|
||||
"fieldname": "stock_qty",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 0
|
||||
@@ -362,7 +356,6 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Prevdoc Doctype",
|
||||
"oldfieldname": "prevdoc_doctype",
|
||||
@@ -374,9 +367,9 @@
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Link",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "PO No",
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
@@ -403,6 +396,7 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"label": "Raw Materials Supplied Cost",
|
||||
@@ -416,9 +410,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Item Tax Amount",
|
||||
"oldfieldname": "item_tax_amount",
|
||||
@@ -432,9 +426,9 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "150px",
|
||||
"no_copy": 0,
|
||||
"oldfieldtype": "Data",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Purchase Order Item No",
|
||||
"oldfieldname": "prevdoc_detail_docname",
|
||||
@@ -448,22 +442,23 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"permlevel": 1,
|
||||
"print_width": "100px",
|
||||
"default": "0.00",
|
||||
"oldfieldtype": "Currency",
|
||||
"doctype": "DocField",
|
||||
"no_copy": 1,
|
||||
"label": "Billed Quantity",
|
||||
"oldfieldname": "billed_qty",
|
||||
"width": "100px",
|
||||
"no_copy": 1,
|
||||
"fieldname": "billed_qty",
|
||||
"fieldtype": "Currency",
|
||||
"permlevel": 1
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"print_width": "80px",
|
||||
"no_copy": 1,
|
||||
"oldfieldtype": "Currency",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Valuation Rate",
|
||||
"oldfieldname": "valuation_rate",
|
||||
@@ -478,7 +473,6 @@
|
||||
"print_hide": 1,
|
||||
"description": "Tax detail table fetched from item master as a string and stored in this field.\nUsed for Taxes and Charges",
|
||||
"oldfieldtype": "Small Text",
|
||||
"colour": "White:FFF",
|
||||
"doctype": "DocField",
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
@@ -491,8 +485,8 @@
|
||||
},
|
||||
{
|
||||
"print_hide": 1,
|
||||
"oldfieldtype": "Check",
|
||||
"allow_on_submit": 1,
|
||||
"oldfieldtype": "Check",
|
||||
"doctype": "DocField",
|
||||
"label": "Page Break",
|
||||
"oldfieldname": "page_break",
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
# Please edit this list and import only required elements
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.doc import Document, addchild, removechild, getchildren, make_autoname, SuperDocType
|
||||
from webnotes.model.doclist import getlist, copy_doclist
|
||||
from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax
|
||||
from webnotes import session, form, is_testing, msgprint, errprint
|
||||
|
||||
set = webnotes.conn.set
|
||||
sql = webnotes.conn.sql
|
||||
get_value = webnotes.conn.get_value
|
||||
in_transaction = webnotes.conn.in_transaction
|
||||
convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
# -----------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, d, dl):
|
||||
self.doc, self.doclist = d, dl
|
||||
|
||||
# Get FIFO Rate from Stack
|
||||
# -------------------------
|
||||
def get_fifo_rate(self, fcfs_stack, qty):
|
||||
fcfs_val = 0
|
||||
withdraw = flt(qty)
|
||||
while withdraw:
|
||||
batch = fcfs_stack[0]
|
||||
if batch[0] <= withdraw:
|
||||
# not enough or exactly same qty in current batch, clear batch
|
||||
withdraw -= batch[0]
|
||||
fcfs_val += (flt(batch[0]) * flt(batch[1]))
|
||||
fcfs_stack.pop(0)
|
||||
else:
|
||||
# all from current batch
|
||||
fcfs_val += (flt(withdraw) * flt(batch[1]))
|
||||
batch[0] -= withdraw
|
||||
withdraw = 0
|
||||
fcfs_rate = flt(fcfs_val) / flt(qty)
|
||||
return fcfs_rate
|
||||
|
||||
# --------------------------------
|
||||
# get serializable inventory rate
|
||||
# --------------------------------
|
||||
def get_serializable_inventory_rate(self, serial_no):
|
||||
sr_nos = get_obj("Stock Ledger").get_sr_no_list(serial_no)
|
||||
tot = 0
|
||||
for s in sr_nos:
|
||||
serial_no = s.strip()
|
||||
tot += flt(webnotes.conn.get_value('Serial No', serial_no, 'purchase_rate'))
|
||||
return tot / len(sr_nos)
|
||||
|
||||
|
||||
# ---------------------
|
||||
# get valuation method
|
||||
# ---------------------
|
||||
def get_valuation_method(self, item_code):
|
||||
val_method = webnotes.conn.get_value('Item', item_code, 'valuation_method')
|
||||
if not val_method:
|
||||
val_method = get_defaults().get('valuation_method', 'FIFO')
|
||||
return val_method
|
||||
|
||||
|
||||
# Get Incoming Rate based on valuation method
|
||||
# --------------------------------------------
|
||||
def get_incoming_rate(self, posting_date, posting_time, item, warehouse, qty = 0, serial_no = ''):
|
||||
msgprint(1)
|
||||
in_rate = 0
|
||||
val_method = self.get_valuation_method(item)
|
||||
bin_obj = get_obj('Warehouse',warehouse).get_bin(item)
|
||||
if serial_no:
|
||||
in_rate = self.get_serializable_inventory_rate(serial_no)
|
||||
elif val_method == 'FIFO':
|
||||
in_rate = 0
|
||||
if qty:
|
||||
prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
|
||||
msgprint(prev_sle)
|
||||
fcfs_stack = eval(prev_sle.get('fcfs_stack', '[]') or '[]')
|
||||
msgprint(fcfs_stack)
|
||||
in_rate = fcfs_stack and self.get_fifo_rate(fcfs_stack, qty) or 0
|
||||
msgprint(in_rate)
|
||||
elif val_method == 'Moving Average':
|
||||
prev_sle = bin_obj.get_prev_sle(posting_date, posting_time)
|
||||
in_rate = prev_sle and prev_sle.get('valuation_rate', 0) or 0
|
||||
return in_rate
|
||||
@@ -130,6 +130,12 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// opening + diff = closing
|
||||
// adding opening, since diff already added to closing
|
||||
$.each(me.item_by_name, function(key, item) {
|
||||
item.closing += item.opening;
|
||||
});
|
||||
},
|
||||
|
||||
update_groups: function() {
|
||||
|
||||
Reference in New Issue
Block a user