Merge branch 'responsive' of github.com:webnotes/erpnext into responsive

Conflicts:
	buying/doctype/purchase_order_item/purchase_order_item.txt
This commit is contained in:
Anand Doshi
2013-07-09 13:10:15 +05:30
22 changed files with 126 additions and 111 deletions

View File

@@ -34,7 +34,9 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
if(flt(doc.per_installed, 2) < 100 && doc.docstatus==1)
cur_frm.add_custom_button('Make Installation Note', this.make_installation_note);
if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
if (doc.docstatus==1) {
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
}
if(doc.docstatus==0 && !doc.__islocal) {
cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);

View File

@@ -28,6 +28,25 @@ class TestDeliveryNote(unittest.TestCase):
pr.run_method("calculate_taxes_and_totals")
pr.insert()
pr.submit()
def test_over_billing_against_dn(self):
from stock.doctype.delivery_note.delivery_note import make_sales_invoice
dn = webnotes.bean(copy=test_records[0]).insert()
self.assertRaises(webnotes.ValidationError, make_sales_invoice,
dn.doc.name)
dn = webnotes.bean("Delivery Note", dn.doc.name)
dn.submit()
si = make_sales_invoice(dn.doc.name)
self.assertEquals(len(si), len(dn.doclist))
# modify export_amount
si[1].export_rate = 200
self.assertRaises(webnotes.ValidationError, webnotes.bean(si).submit)
def test_delivery_note_no_gl_entry(self):
webnotes.conn.sql("""delete from `tabBin`""")

View File

@@ -124,6 +124,9 @@ class TestMaterialRequest(unittest.TestCase):
po_doclist[0].supplier = "_Test Supplier"
po_doclist[1].qty = 27.0
po_doclist[2].qty = 1.5
po_doclist[1].schedule_date = "2013-07-09"
po_doclist[2].schedule_date = "2013-07-09"
# check for stopped status of Material Request
po = webnotes.bean(copy=po_doclist)

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"modified": "2013-03-07 07:03:25",
"modified": "2013-07-09 11:37:12",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,20 +25,6 @@
"doctype": "DocType",
"name": "Material Request Item"
},
{
"allow_on_submit": 0,
"doctype": "DocField",
"fieldname": "schedule_date",
"fieldtype": "Date",
"label": "Required Date",
"no_copy": 1,
"oldfieldname": "schedule_date",
"oldfieldtype": "Date",
"print_hide": 0,
"print_width": "100px",
"reqd": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "item_code",
@@ -53,6 +39,20 @@
"search_index": 1,
"width": "100px"
},
{
"allow_on_submit": 0,
"doctype": "DocField",
"fieldname": "schedule_date",
"fieldtype": "Date",
"label": "Required Date",
"no_copy": 1,
"oldfieldname": "schedule_date",
"oldfieldtype": "Date",
"print_hide": 0,
"print_width": "100px",
"reqd": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "description",

View File

@@ -103,7 +103,7 @@ class DocType(BuyingController):
},
"Purchase Order Item": {
"ref_dn_field": "prevdoc_detail_docname",
"compare_fields": [["export_rate", "="], ["project_name", "="], ["warehouse", "="],
"compare_fields": [["import_rate", "="], ["project_name", "="], ["warehouse", "="],
["uom", "="], ["item_code", "="]],
"is_child_table": True
}

View File

@@ -22,7 +22,7 @@ import webnotes.defaults
from webnotes.utils import cint
class TestPurchaseReceipt(unittest.TestCase):
def test_make_purchase_invocie(self):
def test_make_purchase_invoice(self):
from stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
pr = webnotes.bean(copy=test_records[0]).insert()
@@ -37,6 +37,10 @@ class TestPurchaseReceipt(unittest.TestCase):
self.assertEquals(pi[0]["doctype"], "Purchase Invoice")
self.assertEquals(len(pi), len(pr.doclist))
# modify import_rate
pi[1].import_rate = 200
self.assertRaises(webnotes.ValidationError, webnotes.bean(pi).submit)
def test_purchase_receipt_no_gl_entry(self):
pr = webnotes.bean(copy=test_records[0])
pr.run_method("calculate_taxes_and_totals")

View File

@@ -103,6 +103,8 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
this.toggle_enable_bom();
if (this.frm.doc.docstatus==1) {
this.show_stock_ledger();
if(wn.boot.auto_inventory_accounting)
this.show_general_ledger();
}
if(this.frm.doc.docstatus === 1 &&

View File

@@ -1,26 +1,5 @@
wn.query_reports["Batch-Wise Balance History"] = {
"filters": [
{
"fieldname":"item_code",
"label": "Item",
"fieldtype": "Link",
"options": "Item",
"width": "80"
},
{
"fieldname":"warehouse",
"label": "Warehouse",
"fieldtype": "Link",
"options": "Warehouse",
"width": "80"
},
{
"fieldname":"batch_no",
"label": "Batch",
"fieldtype": "Link",
"options": "Batch",
"width": "80"
},
{
"fieldname":"from_date",
"label": "From Date",

View File

@@ -49,15 +49,6 @@ def get_columns(filters):
def get_conditions(filters):
conditions = ""
if filters.get("item_code"):
conditions += " and item_code='%s'" % filters["item_code"]
if filters.get("warehouse"):
conditions += " and warehouse='%s'" % filters["warehouse"]
if filters.get("batch_no"):
conditions += " and batch_no='%s'" % filters["batch_no"]
if not filters.get("from_date"):
webnotes.msgprint("Please enter From Date", raise_exception=1)
@@ -100,8 +91,6 @@ def get_item_warehouse_batch_map(filters):
return iwb_map
def get_item_details(filters):
if filters.get("item_code"):
conditions = " and name = '%s'" % filters["item_code"]
item_map = {}
for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
item_map.setdefault(d.name, d)

View File

@@ -1,19 +1,5 @@
wn.query_reports["Warehouse-Wise Stock Balance"] = {
"filters": [
{
"fieldname":"item_code",
"label": "Item",
"fieldtype": "Link",
"options": "Item",
"width": "80"
},
{
"fieldname":"warehouse",
"label": "Warehouse",
"fieldtype": "Link",
"options": "Warehouse",
"width": "80"
},
{
"fieldname":"from_date",
"label": "From Date",

View File

@@ -26,34 +26,29 @@ def execute(filters=None):
iwb_map = get_item_warehouse_map(filters)
data = []
for item in sorted(iwb_map):
for wh in sorted(iwb_map[item]):
qty_dict = iwb_map[item][wh]
data.append([item, item_map[item]["item_name"],
item_map[item]["description"], wh,
qty_dict.opening_qty, qty_dict.in_qty,
qty_dict.out_qty, qty_dict.bal_qty
])
for company in sorted(iwb_map):
for item in sorted(iwb_map[company]):
for wh in sorted(iwb_map[company][item]):
qty_dict = iwb_map[company][item][wh]
data.append([item, item_map[item]["item_name"],
item_map[item]["description"], wh,
qty_dict.opening_qty, qty_dict.in_qty,
qty_dict.out_qty, qty_dict.bal_qty, company
])
return columns, data
def get_columns(filters):
"""return columns based on filters"""
columns = ["Item:Link/Item:100"] + ["Item Name::150"] + ["Description::150"] + \
["Warehouse:Link/Warehouse:100"] + ["Opening Qty::90"] + \
["In Qty::80"] + ["Out Qty::80"] + ["Balance Qty::90"]
columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", \
"Warehouse:Link/Warehouse:100", "Opening Qty::90", \
"In Qty::80", "Out Qty::80", "Balance Qty::90", "Company:Link/Company:100"]
return columns
def get_conditions(filters):
conditions = ""
if filters.get("item_code"):
conditions += " and item_code='%s'" % filters["item_code"]
if filters.get("warehouse"):
conditions += " and warehouse='%s'" % filters["warehouse"]
if not filters.get("from_date"):
webnotes.msgprint("Please enter From Date", raise_exception=1)
@@ -68,7 +63,7 @@ def get_conditions(filters):
def get_stock_ledger_entries(filters):
conditions = get_conditions(filters)
return webnotes.conn.sql("""select item_code, warehouse,
posting_date, actual_qty
posting_date, actual_qty, company
from `tabStock Ledger Entry`
where ifnull(is_cancelled, 'No') = 'No' %s order by item_code, warehouse""" %
conditions, as_dict=1)
@@ -78,10 +73,11 @@ def get_item_warehouse_map(filters):
iwb_map = {}
for d in sle:
iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, webnotes._dict({\
iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\
setdefault(d.warehouse, webnotes._dict({\
"opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
}))
qty_dict = iwb_map[d.item_code][d.warehouse]
qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
if d.posting_date < filters["from_date"]:
qty_dict.opening_qty += flt(d.actual_qty)
elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
@@ -95,8 +91,6 @@ def get_item_warehouse_map(filters):
return iwb_map
def get_item_details(filters):
if filters.get("item_code"):
conditions = " and name = '%s'" % filters["item_code"]
item_map = {}
for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
item_map.setdefault(d.name, d)