Merge branch 'master' of github.com:webnotes/erpnext into customer-login

This commit is contained in:
Anand Doshi
2013-09-02 11:13:32 +05:30
26 changed files with 196 additions and 195 deletions

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-03 10:45:46",
"docstatus": 0,
"modified": "2013-08-14 11:46:49",
"modified": "2013-08-30 16:21:38",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,7 +35,9 @@
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1
"read": 1,
"report": 1,
"submit": 0
},
{
"doctype": "DocType",
@@ -557,20 +559,6 @@
"read_only": 0,
"reqd": 1
},
{
"default": "No",
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
"description": "Select \"Yes\" if this item is to be sent to a customer or received from a supplier as a sample. Delivery notes and Purchase Receipts will update stock levels but there will be no invoice against this item.",
"doctype": "DocField",
"fieldname": "is_sample_item",
"fieldtype": "Select",
"label": "Allow Samples",
"oldfieldname": "is_sample_item",
"oldfieldtype": "Select",
"options": "Yes\nNo",
"read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
"doctype": "DocField",
@@ -878,9 +866,7 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"report": 1,
"role": "Material Master Manager",
"submit": 0,
"write": 1
},
{
@@ -888,9 +874,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"report": 1,
"role": "Material Manager",
"submit": 0,
"write": 0
},
{
@@ -898,21 +882,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
"report": 1,
"role": "Material User",
"submit": 0,
"write": 0
},
{
"doctype": "DocPerm",
"role": "Sales User"
},
{
"doctype": "DocPerm",
"role": "Purchase User"
},
{
"doctype": "DocPerm",
"role": "Accounts User"
}
]

View File

@@ -44,7 +44,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -82,7 +81,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -108,7 +106,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -128,7 +125,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -149,7 +145,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "Yes",
"is_sub_contracted_item": "Yes",
@@ -168,7 +163,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -188,7 +182,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",
@@ -209,7 +202,6 @@ test_records = [
"is_purchase_item": "Yes",
"is_sales_item": "Yes",
"is_service_item": "No",
"is_sample_item": "No",
"inspection_required": "No",
"is_pro_applicable": "No",
"is_sub_contracted_item": "No",

View File

@@ -293,7 +293,7 @@ class DocType(StockController):
self.doc.stock_value_difference = 0.0
for d in self.entries:
self.doc.stock_value_difference -= get_buying_amount(d.item_code, self.doc.doctype, self.doc.name,
self.doc.stock_value_difference -= get_buying_amount(self.doc.doctype, self.doc.name,
d.voucher_detail_no, stock_ledger_entries.get((d.item_code, d.warehouse), []))
webnotes.conn.set(self.doc, "stock_value_difference", self.doc.stock_value_difference)

View File

@@ -164,20 +164,18 @@ def validate_warehouse_user(warehouse):
webnotes.throw(_("Not allowed entry in Warehouse") \
+ ": " + warehouse, UserNotAllowedForWarehouse)
def get_buying_amount(item_code, voucher_type, voucher_no, voucher_detail_no,
stock_ledger_entries, item_sales_bom=None):
if item_sales_bom and item_sales_bom.get(item_code):
# sales bom item
buying_amount = 0.0
for bom_item in item_sales_bom[item_code]:
if bom_item.get("parent_detail_docname")==voucher_detail_no:
buying_amount += _get_buying_amount(voucher_type, voucher_no, voucher_detail_no, stock_ledger_entries)
return buying_amount
else:
# doesn't have sales bom
return _get_buying_amount(voucher_type, voucher_no, voucher_detail_no, stock_ledger_entries)
def get_sales_bom_buying_amount(item_code, warehouse, voucher_type, voucher_no, voucher_detail_no,
stock_ledger_entries, item_sales_bom):
# sales bom item
buying_amount = 0.0
for bom_item in item_sales_bom[item_code]:
if bom_item.get("parent_detail_docname")==voucher_detail_no:
buying_amount += get_buying_amount(voucher_type, voucher_no, voucher_detail_no,
stock_ledger_entries.get((bom_item.item_code, warehouse), []))
return buying_amount
def _get_buying_amount(voucher_type, voucher_no, item_row, stock_ledger_entries):
def get_buying_amount(voucher_type, voucher_no, item_row, stock_ledger_entries):
# IMP NOTE
# stock_ledger_entries should already be filtered by item_code and warehouse and
# sorted by posting_date desc, posting_time desc