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

This commit is contained in:
Nabin Hait
2013-07-01 18:28:26 +05:30
33 changed files with 210 additions and 123 deletions

View File

@@ -25,6 +25,7 @@ from webnotes import msgprint, _
from webnotes.model.controller import DocListController
class PriceListCurrencyMismatch(Exception): pass
class WarehouseNotSet(Exception): pass
class DocType(DocListController):
def autoname(self):
@@ -39,7 +40,8 @@ class DocType(DocListController):
def validate(self):
if not self.doc.stock_uom:
msgprint(_("Please enter Default Unit of Measure"), raise_exception=1)
self.check_warehouse_is_set_for_stock_item()
self.check_stock_uom_with_bin()
self.validate_conversion_factor()
self.add_default_uom_in_conversion_factor_table()
@@ -60,6 +62,11 @@ class DocType(DocListController):
self.validate_name_with_item_group()
self.update_website()
def check_warehouse_is_set_for_stock_item(self):
if self.doc.is_stock_item=="Yes" and not self.doc.default_warehouse:
webnotes.msgprint(_("Default Warehouse is mandatory for Stock Item."),
raise_exception=WarehouseNotSet)
def add_default_uom_in_conversion_factor_table(self):
uom_conv_list = [d.uom for d in self.doclist.get({"parentfield": "uom_conversion_details"})]
if self.doc.stock_uom not in uom_conv_list:

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-03 10:45:46",
"docstatus": 0,
"modified": "2013-06-26 21:39:46",
"modified": "2013-07-01 11:45:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -205,11 +205,11 @@
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
"description": "Mandatory if Stock Item is \"Yes\"",
"description": "Mandatory if Stock Item is \"Yes\". Also the default warehouse where reserved quantity is set from Sales Order.",
"doctype": "DocField",
"fieldname": "default_warehouse",
"fieldtype": "Link",
"label": "Default Reserved Warehouse",
"label": "Default Warehouse",
"oldfieldname": "default_warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",

View File

@@ -35,6 +35,13 @@ class TestItem(unittest.TestCase):
item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD"
self.assertRaises(PriceListCurrencyMismatch, item.insert)
def test_default_warehouse(self):
from stock.doctype.item.item import WarehouseNotSet
item = webnotes.bean(copy=test_records[0])
item.doc.is_stock_item = "Yes"
item.doc.default_warehouse = None
self.assertRaises(WarehouseNotSet, item.insert)
test_records = [
[{
@@ -77,6 +84,7 @@ test_records = [
"item_name": "_Test Item Home Desktop 100",
"description": "_Test Item Home Desktop 100",
"item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse",
"is_stock_item": "Yes",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -101,6 +109,7 @@ test_records = [
"item_name": "_Test Item Home Desktop 200",
"description": "_Test Item Home Desktop 200",
"item_group": "_Test Item Group Desktops",
"default_warehouse": "_Test Warehouse",
"is_stock_item": "Yes",
"is_asset_item": "No",
"has_batch_no": "No",
@@ -140,6 +149,7 @@ test_records = [
"description": "_Test FG Item",
"item_group": "_Test Item Group Desktops",
"is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse",
"is_asset_item": "No",
"has_batch_no": "No",
"has_serial_no": "No",
@@ -178,6 +188,7 @@ test_records = [
"description": "_Test Serialized Item",
"item_group": "_Test Item Group Desktops",
"is_stock_item": "Yes",
"default_warehouse": "_Test Warehouse",
"is_asset_item": "No",
"has_batch_no": "No",
"has_serial_no": "Yes",

View File

@@ -121,8 +121,6 @@ class DocType(DocListController):
self.doc.posting_time = '00:00'
def on_doctype_update(self):
webnotes.msgprint(webnotes.conn.sql("""show index from `tabStock Ledger Entry`
where Key_name="posting_sort_index" """))
if not webnotes.conn.sql("""show index from `tabStock Ledger Entry`
where Key_name="posting_sort_index" """):
webnotes.conn.commit()

View File

@@ -48,8 +48,6 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
return {
"query": "accounts.utils.get_account_list",
"filters": {
"is_pl_account": "Yes",
"debit_or_credit": "Debit",
"company": me.frm.doc.company
}
}

View File

@@ -4,6 +4,7 @@
wn.module_page["Stock"] = [
{
title: wn._("Documents"),
top: true,
icon: "icon-copy",
items: [
{

View File

@@ -22,10 +22,7 @@ wn.pages['stock-ledger'].onload = function(wrapper) {
});
new erpnext.StockLedger(wrapper);
wrapper.appframe.add_home_breadcrumb()
wrapper.appframe.add_module_icon("Stock")
wrapper.appframe.add_breadcrumb("icon-bar-chart")
}
wn.require("app/js/stock_grid_report.js");