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

Conflicts:
	selling/doctype/quotation/quotation.py
	utilities/transaction_base.py
This commit is contained in:
Anand Doshi
2013-07-10 20:55:15 +05:30
205 changed files with 2528 additions and 1496 deletions

View File

@@ -15,7 +15,10 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.fields_dict['item'].get_query = function(doc, cdt, cdn) {
return erpnext.queries.item({
'ifnull(tabItem.is_stock_item, "No")': 'Yes'
})
return {
query:"controllers.queries.item_query",
filters:{
'is_stock_item': 'Yes'
}
}
}

View File

@@ -31,11 +31,7 @@ class DocType:
def validate(self):
if not self.doc.stock_uom:
self.doc.stock_uom = webnotes.conn.get_value('Item', self.doc.item_code, 'stock_uom')
if not self.doc.warehouse_type:
self.doc.warehouse_type = webnotes.conn.get_value("Warehouse", self.doc.warehouse,
"warehouse_type")
self.validate_mandatory()
self.doc.projected_qty = flt(self.doc.actual_qty) + flt(self.doc.ordered_qty) + \

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:25",
"docstatus": 0,
"modified": "2013-01-23 16:53:15",
"modified": "2013-07-10 18:32:13",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -45,25 +45,19 @@
"fieldname": "warehouse",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Data",
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Data"
},
{
"doctype": "DocField",
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -76,6 +70,7 @@
"fieldname": "reserved_qty",
"fieldtype": "Float",
"in_filter": 0,
"in_list_view": 1,
"label": "Reserved Quantity",
"oldfieldname": "reserved_qty",
"oldfieldtype": "Currency",
@@ -87,6 +82,7 @@
"fieldname": "actual_qty",
"fieldtype": "Float",
"in_filter": 1,
"in_list_view": 1,
"label": "Actual Quantity",
"oldfieldname": "actual_qty",
"oldfieldtype": "Currency",
@@ -98,6 +94,7 @@
"fieldname": "ordered_qty",
"fieldtype": "Float",
"in_filter": 0,
"in_list_view": 1,
"label": "Ordered Quantity",
"oldfieldname": "ordered_qty",
"oldfieldtype": "Currency",

View File

@@ -106,12 +106,12 @@ cur_frm.cscript.new_contact = function(){
// ***************** Get project name *****************
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
var cond = '';
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
return repl('SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND %(cond)s `tabProject`.name LIKE "%s" \
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
return {
query: "controllers.queries.get_project_name",
filters: {
'customer': doc.customer
}
}
}
cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
@@ -122,7 +122,9 @@ cur_frm.cscript.serial_no = function(doc, cdt, cdn) {
}
cur_frm.fields_dict['transporter_name'].get_query = function(doc) {
return 'SELECT DISTINCT `tabSupplier`.`name` FROM `tabSupplier` WHERE `tabSupplier`.supplier_type = "transporter" AND `tabSupplier`.docstatus != 2 AND `tabSupplier`.%(key)s LIKE "%s" ORDER BY `tabSupplier`.`name` LIMIT 50';
return{
filters: { 'supplier_type': "transporter" }
}
}
cur_frm.cscript['Make Packing Slip'] = function() {
@@ -135,7 +137,9 @@ cur_frm.cscript['Make Packing Slip'] = function() {
//get query select Territory
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
return{
filters: { 'is_group': "No" }
}
}
var set_print_hide= function(doc, cdt, cdn){
@@ -223,11 +227,11 @@ if (sys_defaults.auto_inventory_accounting) {
// expense account
cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').get_query = function(doc) {
return {
"query": "accounts.utils.get_account_list",
"filters": {
filters: {
"is_pl_account": "Yes",
"debit_or_credit": "Debit",
"company": doc.company
"company": doc.company,
"group_or_ledger": "Ledger"
}
}
}
@@ -246,8 +250,11 @@ if (sys_defaults.auto_inventory_accounting) {
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return {
query: "accounts.utils.get_cost_center_list",
filters: { company: doc.company}
filters: {
'company_name': doc.company,
'group_or_ledger': "Ledger"
}
}
}
}

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"modified": "2013-07-09 12:42:09",
"modified": "2013-07-10 14:54:07",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -29,6 +29,7 @@
"doctype": "DocField",
"fieldname": "barcode",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Barcode",
"print_hide": 1,
"read_only": 0
@@ -38,6 +39,7 @@
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -53,6 +55,7 @@
"fieldname": "customer_item_code",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 0,
"label": "Customer's Item Code",
"print_hide": 1,
"read_only": 1
@@ -61,6 +64,7 @@
"doctype": "DocField",
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
@@ -74,6 +78,7 @@
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Small Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Small Text",
@@ -82,11 +87,19 @@
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "quantity_and_rate",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Quantity and Rate"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
@@ -99,6 +112,7 @@
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"in_list_view": 0,
"label": "UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
@@ -113,6 +127,7 @@
"doctype": "DocField",
"fieldname": "ref_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Price List Rate",
"no_copy": 0,
"oldfieldname": "ref_rate",
@@ -129,6 +144,7 @@
"doctype": "DocField",
"fieldname": "adj_rate",
"fieldtype": "Float",
"in_list_view": 0,
"label": "Discount (%)",
"oldfieldname": "adj_rate",
"oldfieldtype": "Float",
@@ -141,6 +157,7 @@
"doctype": "DocField",
"fieldname": "export_rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "export_rate",
"oldfieldtype": "Currency",
@@ -155,6 +172,7 @@
"doctype": "DocField",
"fieldname": "export_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"oldfieldname": "export_amount",
"oldfieldtype": "Currency",
@@ -169,6 +187,7 @@
"doctype": "DocField",
"fieldname": "base_ref_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Price List Rate (Company Currency)",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
@@ -183,6 +202,7 @@
"doctype": "DocField",
"fieldname": "basic_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Rate (Company Currency)",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
@@ -197,6 +217,7 @@
"doctype": "DocField",
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Amount (Company Currency)",
"oldfieldname": "amount",
"oldfieldtype": "Currency",
@@ -207,10 +228,18 @@
"reqd": 0,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Warehouse and Reference"
},
{
"doctype": "DocField",
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
@@ -225,6 +254,7 @@
"fieldname": "serial_no",
"fieldtype": "Text",
"in_filter": 1,
"in_list_view": 1,
"label": "Serial No",
"no_copy": 1,
"oldfieldname": "serial_no",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:00",
"docstatus": 0,
"modified": "2013-03-07 07:03:20",
"modified": "2013-07-10 14:54:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -28,6 +28,7 @@
"doctype": "DocField",
"fieldname": "parent_item",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Parent Item",
"oldfieldname": "parent_item",
"oldfieldtype": "Link",
@@ -39,6 +40,7 @@
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -50,6 +52,7 @@
"fieldname": "item_name",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
@@ -60,6 +63,7 @@
"fieldname": "parent_detail_docname",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 0,
"label": "Parent Detail docname",
"no_copy": 1,
"oldfieldname": "parent_detail_docname",
@@ -71,6 +75,7 @@
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
@@ -82,6 +87,7 @@
"doctype": "DocField",
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
@@ -91,6 +97,7 @@
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Qty",
"oldfieldname": "qty",
"oldfieldtype": "Currency",

View File

@@ -51,39 +51,64 @@ cur_frm.cscript.item_code = function(doc) {
cur_frm.fields_dict['default_bom'].get_query = function(doc) {
//var d = locals[this.doctype][this.docname];
return 'SELECT DISTINCT `tabBOM`.`name` FROM `tabBOM` WHERE `tabBOM`.`item` = "' + doc.item_code + '" AND ifnull(`tabBOM`.`is_active`, 0) = 0 and `tabBOM`.docstatus != 2 AND `tabBOM`.%(key)s LIKE "%s" ORDER BY `tabBOM`.`name` LIMIT 50'
return{
filters:{
'item': doc.item_code,
'is_active': 0
}
}
}
// Expense Account
// ---------------------------------
cur_frm.fields_dict['purchase_account'].get_query = function(doc){
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Debit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
return{
filters:{
'debit_or_credit': "Debit",
'group_or_ledger': "Ledger"
}
}
}
// Income Account
// --------------------------------
cur_frm.fields_dict['default_income_account'].get_query = function(doc) {
return 'SELECT DISTINCT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`debit_or_credit`="Credit" AND `tabAccount`.`group_or_ledger`="Ledger" AND `tabAccount`.`docstatus`!=2 AND `tabAccount`.`account_type` ="Income Account" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50'
return{
filters:{
'debit_or_credit': "Credit",
'group_or_ledger': "Ledger",
'account_type': "Income Account"
}
}
}
// Purchase Cost Center
// -----------------------------
cur_frm.fields_dict['cost_center'].get_query = function(doc) {
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'
return{
filters:{ 'group_or_ledger': "Ledger" }
}
}
// Sales Cost Center
// -----------------------------
cur_frm.fields_dict['default_sales_cost_center'].get_query = function(doc) {
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50'
return{
filters:{ 'group_or_ledger': "Ledger" }
}
}
cur_frm.fields_dict['item_tax'].grid.get_field("tax_type").get_query = function(doc, cdt, cdn) {
return 'SELECT `tabAccount`.`name` FROM `tabAccount` WHERE `tabAccount`.`account_type` in ("Tax", "Chargeable") and `tabAccount`.`docstatus` != 2 and `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.`name` DESC LIMIT 50'
return{
filters:[
['Account', 'account_type', 'in', 'Tax, Chargeable'],
['Account', 'docstatus', '!=', 2]
]
}
}
cur_frm.cscript.tax_type = function(doc, cdt, cdn){
@@ -94,10 +119,11 @@ cur_frm.cscript.tax_type = function(doc, cdt, cdn){
//get query select item group
cur_frm.fields_dict['item_group'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabItem Group`.`name`,`tabItem Group`.`parent_item_group` \
FROM `tabItem Group` WHERE `tabItem Group`.`docstatus`!= 2 AND \
`tabItem Group`.%(key)s LIKE "%s" ORDER BY `tabItem Group`.`name` \
ASC LIMIT 50'
return {
filters: [
['Item Group', 'docstatus', '!=', 2]
]
}
}
// for description from attachment
@@ -137,10 +163,12 @@ cur_frm.fields_dict['ref_rate_details'].grid.onrowadd = function(doc, cdt, cdn){
}
cur_frm.fields_dict.item_customer_details.grid.get_field("customer_name").get_query =
erpnext.utils.customer_query;
function(doc,cdt,cdn) {
return{ query:"controllers.queries.customer_query" } }
cur_frm.fields_dict.item_supplier_details.grid.get_field("supplier").get_query =
erpnext.utils.supplier_query;
function(doc,cdt,cdn) {
return{ query:"controllers.queries.supplier_query" } }
cur_frm.cscript.on_remove_attachment = function(doc) {
if(!inList(cur_frm.fields_dict.image.df.options.split("\n"), doc.image)) {

View File

@@ -51,7 +51,6 @@ class DocType(DocListController):
self.fill_customer_code()
self.check_item_tax()
self.validate_barcode()
self.check_non_asset_warehouse()
self.cant_change()
self.validate_item_type_for_reorder()
@@ -185,18 +184,7 @@ class DocType(DocListController):
if duplicate:
msgprint("Barcode: %s already used in item: %s" %
(self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
def check_non_asset_warehouse(self):
if not self.doc.__islocal and self.doc.is_asset_item == "Yes":
existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
for e in existing_qty:
msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." %
(e[1],e[0]))
if existing_qty:
self.doc.is_asset_item = 'No'
msgprint(_("""Please transfer the above quantities to an asset warehouse \
before changing this item to an asset item"""), raise_exception=1)
def cant_change(self):
if not self.doc.fields.get("__islocal"):
vals = webnotes.conn.get_value("Item", self.doc.name,

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-08 15:37:16",
"docstatus": 0,
"modified": "2013-03-21 17:29:45",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -19,6 +19,7 @@
{
"doctype": "DocField",
"in_filter": 1,
"in_list_view": 1,
"name": "__common__",
"parent": "Item Customer Detail",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-02 16:29:48",
"docstatus": 0,
"modified": "2013-06-11 18:27:55",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -17,6 +17,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Item Price",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:01",
"docstatus": 0,
"modified": "2013-03-07 07:03:22",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -16,6 +16,7 @@
{
"doctype": "DocField",
"fieldtype": "Data",
"in_list_view": 1,
"name": "__common__",
"oldfieldtype": "Data",
"parent": "Item Quality Inspection Parameter",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 11:42:59",
"docstatus": 0,
"modified": "2013-03-19 12:22:44",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -16,6 +16,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Item Reorder",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:01",
"docstatus": 0,
"modified": "2013-03-07 07:03:22",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -14,6 +14,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Item Supplier",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:01",
"docstatus": 0,
"modified": "2013-03-07 07:03:22",
"modified": "2013-07-10 14:54:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -14,6 +14,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Item Tax",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:01",
"docstatus": 0,
"modified": "2013-03-07 07:03:22",
"modified": "2013-07-10 14:54:10",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -15,6 +15,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Item Website Specification",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"modified": "2013-03-07 07:03:23",
"modified": "2013-07-10 14:54:10",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -14,6 +14,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Landed Cost Item",
"parentfield": "fields",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"modified": "2013-03-07 07:03:23",
"modified": "2013-07-10 14:54:10",
"modified_by": "Administrator",
"owner": "wasim@webnotestech.com"
},
@@ -14,6 +14,7 @@
},
{
"doctype": "DocField",
"in_list_view": 1,
"name": "__common__",
"parent": "Landed Cost Purchase Receipt",
"parentfield": "fields",

View File

@@ -20,5 +20,12 @@ if(!doc.currency){doc.currency = sys_defaults.currency;}
cur_frm.fields_dict['landed_cost_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type = "Tax" OR tabAccount.account_type = "Chargeable" or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.name LIKE "%s"';
return{
filters:[
['Account', 'group_or_ledger', '=', 'Ledger'],
['Account', 'account_type', 'in', 'Tax, Chargeable'],
['Account', 'is_pl_account', '=', 'Yes'],
['Account', 'debit_or_credit', '=', 'Debit']
]
}
}

View File

@@ -254,12 +254,13 @@ def make_purchase_order(source_name, target_doclist=None):
},
"Material Request Item": {
"doctype": "Purchase Order Item",
"field_map": {
"name": "prevdoc_detail_docname",
"parent": "prevdoc_docname",
"parenttype": "prevdoc_doctype",
"uom": "stock_uom"
},
"field_map": [
["name", "prevdoc_detail_docname"],
["parent", "prevdoc_docname"],
["parenttype", "prevdoc_doctype"],
["uom", "stock_uom"],
["uom", "uom"]
],
"postprocess": update_item
}
}, target_doclist, set_missing_values)

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:02",
"docstatus": 0,
"modified": "2013-07-09 11:37:12",
"modified": "2013-07-10 14:54:10",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -30,6 +30,7 @@
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -44,6 +45,7 @@
"doctype": "DocField",
"fieldname": "schedule_date",
"fieldtype": "Date",
"in_list_view": 1,
"label": "Required Date",
"no_copy": 1,
"oldfieldname": "schedule_date",
@@ -57,6 +59,7 @@
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
@@ -64,10 +67,18 @@
"reqd": 1,
"width": "250px"
},
{
"doctype": "DocField",
"fieldname": "quantity_and_warehouse",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Quantity and Warehouse"
},
{
"doctype": "DocField",
"fieldname": "warehouse",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
@@ -82,6 +93,7 @@
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"no_copy": 0,
"oldfieldname": "qty",
@@ -94,6 +106,7 @@
"doctype": "DocField",
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Stock UOM",
"no_copy": 0,
"oldfieldname": "uom",
@@ -108,6 +121,7 @@
"doctype": "DocField",
"fieldname": "lead_time_date",
"fieldtype": "Date",
"in_list_view": 0,
"label": "Lead Time Date",
"no_copy": 1,
"oldfieldname": "lead_time_date",
@@ -120,6 +134,7 @@
"fieldname": "item_name",
"fieldtype": "Data",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",

View File

@@ -15,17 +15,18 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.fields_dict['delivery_note'].get_query = function(doc, cdt, cdn) {
return 'SELECT name FROM `tabDelivery Note` WHERE docstatus=0 AND %(key)s LIKE "%s"';
return{
filters:{ 'docstatus': 0}
}
}
cur_frm.fields_dict['item_details'].grid.get_field('item_code').get_query =
function(doc, cdt, cdn) {
var query = 'SELECT name, item_name, description FROM `tabItem` WHERE name IN ( \
SELECT item_code FROM `tabDelivery Note Item` dnd \
WHERE parent="' + doc.delivery_note + '" AND IFNULL(qty, 0) > IFNULL(packed_qty, 0)) \
AND %(key)s LIKE "%s" LIMIT 50';
return query;
return {
query: "stock.doctype.packing_slip.packing_slip.item_details",
filters:{ 'delivery_note': doc.delivery_note}
}
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {

View File

@@ -171,4 +171,15 @@ class DocType:
ch.item_name = item.item_name
ch.stock_uom = item.stock_uom
ch.qty = flt(item.qty) - flt(item.packed_qty)
self.update_item_details()
self.update_item_details()
def item_details(doctype, txt, searchfield, start, page_len, filters):
from controllers.queries import get_match_cond
return webnotes.conn.sql("""select name, item_name, description from `tabItem`
where name in ( select item_code FROM `tabDelivery Note Item`
where parent= %s
and ifnull(qty, 0) > ifnull(packed_qty, 0))
and %s like "%s" %s
limit %s, %s """ % ("%s", searchfield, "%s",
get_match_cond(doctype, searchfield), "%s", "%s"),
(filters["delivery_note"], "%%%s%%" % txt, start, page_len))

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-04-08 13:10:16",
"docstatus": 0,
"modified": "2013-04-11 15:06:05",
"modified": "2013-07-10 14:54:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -29,6 +29,7 @@
"doctype": "DocField",
"fieldname": "item_code",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Item Code",
"options": "Item",
"print_width": "100px",
@@ -40,6 +41,7 @@
"doctype": "DocField",
"fieldname": "item_name",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Name",
"print_width": "200px",
"read_only": 1,
@@ -49,6 +51,7 @@
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Quantity",
"print_width": "100px",
"read_only": 0,
@@ -59,6 +62,7 @@
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"in_list_view": 0,
"label": "UOM",
"print_width": "100px",
"read_only": 1,
@@ -68,6 +72,7 @@
"doctype": "DocField",
"fieldname": "net_weight",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Net Weight",
"print_width": "100px",
"read_only": 0,
@@ -77,6 +82,7 @@
"doctype": "DocField",
"fieldname": "weight_uom",
"fieldtype": "Link",
"in_list_view": 0,
"label": "Weight UOM",
"options": "UOM",
"print_width": "100px",
@@ -87,6 +93,7 @@
"doctype": "DocField",
"fieldname": "page_break",
"fieldtype": "Check",
"in_list_view": 1,
"label": "Page Break",
"read_only": 0
},
@@ -95,6 +102,7 @@
"fieldname": "dn_detail",
"fieldtype": "Data",
"hidden": 1,
"in_list_view": 1,
"label": "DN Detail",
"read_only": 0
}

View File

@@ -116,11 +116,15 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc
}
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
return{
filters:{ 'supplier': doc.supplier}
}
}
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
return{
filters:{ 'supplier': doc.supplier}
}
}
cur_frm.cscript.new_contact = function(){
@@ -131,15 +135,19 @@ cur_frm.cscript.new_contact = function(){
}
cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
return 'SELECT `tabProject`.name FROM `tabProject` \
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
return{
filters:[
['project', 'status', 'not in', 'Completed, Cancelled']
]
}
}
cur_frm.fields_dict['purchase_receipt_details'].grid.get_field('batch_no').get_query= function(doc, cdt, cdn) {
var d = locals[cdt][cdn];
if(d.item_code){
return "SELECT tabBatch.name, tabBatch.description FROM tabBatch WHERE tabBatch.docstatus != 2 AND tabBatch.item = '"+ d.item_code +"' AND `tabBatch`.`name` like '%s' ORDER BY `tabBatch`.`name` DESC LIMIT 50"
return{
filters:{'item': d.item_code}
}
}
else{
alert("Please enter Item Code.");
@@ -156,11 +164,19 @@ cur_frm.cscript.select_print_heading = function(doc,cdt,cdn){
}
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
return{
filters:[
['Print Heading', 'docstatus', '!=', '2']
]
}
}
cur_frm.fields_dict.purchase_receipt_details.grid.get_field("qa_no").get_query = function(doc) {
return 'SELECT `tabQuality Inspection`.name FROM `tabQuality Inspection` WHERE `tabQuality Inspection`.docstatus = 1 AND `tabQuality Inspection`.%(key)s LIKE "%s"';
return {
filters: {
'docstatus': 1
}
}
}
cur_frm.cscript.on_submit = function(doc, cdt, cdn) {

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"modified": "2013-07-09 12:20:50",
"modified": "2013-07-10 14:54:16",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -30,6 +30,7 @@
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -45,6 +46,7 @@
"fieldname": "item_name",
"fieldtype": "Data",
"in_filter": 0,
"in_list_view": 0,
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
@@ -57,6 +59,7 @@
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
@@ -65,11 +68,19 @@
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "received_and_accepted",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Received and Accepted"
},
{
"default": "0.00",
"doctype": "DocField",
"fieldname": "received_qty",
"fieldtype": "Float",
"in_list_view": 0,
"label": "Recd Quantity",
"oldfieldname": "received_qty",
"oldfieldtype": "Currency",
@@ -84,6 +95,7 @@
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Accepted Quantity",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
@@ -97,6 +109,7 @@
"fieldname": "rejected_qty",
"fieldtype": "Float",
"in_filter": 0,
"in_list_view": 0,
"label": "Rejected Quantity",
"oldfieldname": "rejected_qty",
"oldfieldtype": "Currency",
@@ -110,6 +123,7 @@
"doctype": "DocField",
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 0,
"label": "UOM",
"oldfieldname": "uom",
"oldfieldtype": "Link",
@@ -120,10 +134,18 @@
"reqd": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "rate_and_amount",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Rate and Amount"
},
{
"doctype": "DocField",
"fieldname": "import_ref_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Price List Rate",
"options": "currency",
"print_hide": 1,
@@ -133,6 +155,7 @@
"doctype": "DocField",
"fieldname": "discount_rate",
"fieldtype": "Float",
"in_list_view": 0,
"label": "Discount %",
"print_hide": 1,
"read_only": 0
@@ -142,6 +165,7 @@
"doctype": "DocField",
"fieldname": "import_rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Rate",
"oldfieldname": "import_rate",
"oldfieldtype": "Currency",
@@ -155,6 +179,7 @@
"doctype": "DocField",
"fieldname": "import_amount",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Amount",
"oldfieldname": "import_amount",
"oldfieldtype": "Currency",
@@ -165,6 +190,7 @@
"doctype": "DocField",
"fieldname": "purchase_ref_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Price List Rate (Company Currency)",
"options": "Company:company:default_currency",
"print_hide": 1,
@@ -175,6 +201,7 @@
"doctype": "DocField",
"fieldname": "purchase_rate",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Rate (Company Currency)",
"oldfieldname": "purchase_rate",
"oldfieldtype": "Currency",
@@ -190,6 +217,7 @@
"doctype": "DocField",
"fieldname": "amount",
"fieldtype": "Currency",
"in_list_view": 0,
"label": "Amount (Company Currency)",
"oldfieldname": "amount",
"oldfieldtype": "Currency",
@@ -200,11 +228,19 @@
"reqd": 0,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "warehouse_and_reference",
"fieldtype": "Section Break",
"in_list_view": 0,
"label": "Warehouse and Reference"
},
{
"doctype": "DocField",
"fieldname": "warehouse",
"fieldtype": "Link",
"hidden": 0,
"in_list_view": 0,
"label": "Accepted Warehouse",
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
@@ -218,6 +254,7 @@
"doctype": "DocField",
"fieldname": "conversion_factor",
"fieldtype": "Float",
"in_list_view": 0,
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Currency",
@@ -231,6 +268,7 @@
"doctype": "DocField",
"fieldname": "stock_uom",
"fieldtype": "Data",
"in_list_view": 0,
"label": "Stock UOM",
"oldfieldname": "stock_uom",
"oldfieldtype": "Data",
@@ -245,6 +283,7 @@
"fieldname": "serial_no",
"fieldtype": "Text",
"in_filter": 1,
"in_list_view": 1,
"label": "Serial No",
"no_copy": 1,
"oldfieldname": "serial_no",

View File

@@ -46,7 +46,9 @@ cur_frm.add_fetch('customer', 'territory', 'territory')
// territory
// ----------
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
return{
filters:{'is_group': "No"}
}
}
// Supplier
@@ -59,11 +61,22 @@ cur_frm.cscript.supplier = function(doc,dt,dn) {
//item code
//----------
cur_frm.fields_dict['item_code'].get_query = function(doc,cdt,cdn) {
return erpnext.queries.item({
'ifnull(tabItem.has_serial_no, "No")': 'Yes'
});
return{
query:"controllers.queries.item_query",
filters:{
'has_serial_no': 'Yes'
}
}
}
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
return{
query:"controllers.queries.customer_query"
}
}
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) {
return{
query:"controllers.queries.supplier_query"
}
}

View File

@@ -56,7 +56,9 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
this.frm.fields_dict.delivery_note_no.get_query;
this.frm.fields_dict.purchase_receipt_no.get_query = function() {
return { query: "stock.doctype.stock_entry.stock_entry.query_purchase_return_doc" };
return {
filters:{ 'docstatus': 1 }
};
};
this.frm.fields_dict.mtn_details.grid.get_field('item_code').get_query = function() {
@@ -81,8 +83,10 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
return {
"query": "accounts.utils.get_account_list",
"filters": { "company": me.frm.doc.company }
filters: {
"company": me.frm.doc.company,
"group_or_ledger": "Ledger"
}
}
}
}
@@ -280,9 +284,12 @@ cur_frm.cscript.supplier = function(doc,cdt,cdn){
}
cur_frm.fields_dict['production_order'].get_query = function(doc) {
return 'select name from `tabProduction Order` \
where docstatus = 1 and qty > ifnull(produced_qty,0) AND %(key)s like "%s%%" \
order by name desc limit 50';
return{
filters:[
['Production Order', 'docstatus', '=', 1],
['Production Order', 'qty', '>','`tabProduction Order`.produced_qty']
]
}
}
cur_frm.cscript.purpose = function(doc, cdt, cdn) {
@@ -307,17 +314,21 @@ cur_frm.fields_dict['mtn_details'].grid.get_field('batch_no').get_query = functi
var d = locals[cdt][cdn];
if(d.item_code) {
if (d.s_warehouse) {
return "select batch_no from `tabStock Ledger Entry` sle \
where item_code = '" + d.item_code + "' and warehouse = '" + d.s_warehouse +
"' and ifnull(is_cancelled, 'No') = 'No' and batch_no like '%s' \
and exists(select * from `tabBatch` where \
name = sle.batch_no and expiry_date >= '" + doc.posting_date +
"' and docstatus != 2) group by batch_no having sum(actual_qty) > 0 \
order by batch_no desc limit 50";
return{
query: "stock.doctype.stock_entry.stock_entry.get_batch_no",
filters:{
'item_code': d.item_code,
's_warehouse': d.s_warehouse,
'posting_date': doc.posting_date
}
}
} else {
return "SELECT name FROM tabBatch WHERE docstatus != 2 AND item = '" +
d.item_code + "' and expiry_date >= '" + doc.posting_date +
"' AND name like '%s' ORDER BY name DESC LIMIT 50";
return{
filters:[
['Batch', 'item', '=', d.item_code],
['Batch', 'expiry_date', '>=', doc.posting_date]
]
}
}
} else {
msgprint("Please enter Item Code to get batch no");
@@ -374,6 +385,8 @@ cur_frm.cscript.validate_items = function(doc) {
}
}
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
return{ query:"controllers.queries.customer_query" } }
cur_frm.fields_dict.supplier.get_query = erpnext.utils.supplier_query;
cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) {
return{ query:"controllers.queries.supplier_query" } }

View File

@@ -25,6 +25,7 @@ from webnotes.model.code import get_obj
from webnotes import msgprint, _
from stock.utils import get_incoming_rate
from stock.stock_ledger import get_previous_sle
from controllers.queries import get_match_cond
import json
sql = webnotes.conn.sql
@@ -718,24 +719,31 @@ def get_production_order_details(production_order):
return result and result[0] or {}
def query_sales_return_doc(doctype, txt, searchfield, start, page_len, filters):
from controllers.queries import get_match_cond
conditions = ""
if doctype == "Sales Invoice":
conditions = "and update_stock=1"
return webnotes.conn.sql("""select name, customer, customer_name
from `tab%s` where docstatus = 1
and (`%s` like %%(txt)s or `customer` like %%(txt)s) %s
and (`%s` like %%(txt)s
or `customer` like %%(txt)s) %s %s
order by name, customer, customer_name
limit %s""" % (doctype, searchfield, conditions, "%(start)s, %(page_len)s"),
{"txt": "%%%s%%" % txt, "start": start, "page_len": page_len}, as_list=True)
limit %s""" % (doctype, searchfield, conditions,
get_match_cond(doctype, searchfield), "%(start)s, %(page_len)s"),
{"txt": "%%%s%%" % txt, "start": start, "page_len": page_len},
as_list=True)
def query_purchase_return_doc(doctype, txt, searchfield, start, page_len, filters):
from controllers.queries import get_match_cond
return webnotes.conn.sql("""select name, supplier, supplier_name
from `tab%s` where docstatus = 1
and (`%s` like %%(txt)s or `supplier` like %%(txt)s)
and (`%s` like %%(txt)s
or `supplier` like %%(txt)s) %s
order by name, supplier, supplier_name
limit %s""" % (doctype, searchfield, "%(start)s, %(page_len)s"),
{"txt": "%%%s%%" % txt, "start": start, "page_len": page_len}, as_list=True)
limit %s""" % (doctype, searchfield, get_match_cond(doctype, searchfield),
"%(start)s, %(page_len)s"), {"txt": "%%%s%%" % txt, "start":
start, "page_len": page_len}, as_list=True)
def query_return_item(doctype, txt, searchfield, start, page_len, filters):
txt = txt.replace("%", "")
@@ -761,6 +769,26 @@ def query_return_item(doctype, txt, searchfield, start, page_len, filters):
return result[start:start+page_len]
def get_batch_no(doctype, txt, searchfield, start, page_len, filters):
from controllers.queries import get_match_cond
return webnotes.conn.sql("""select batch_no from `tabStock Ledger Entry` sle
where item_code = '%(item_code)s'
and warehouse = '%(s_warehouse)s'
and ifnull(is_cancelled, 'No') = 'No'
and batch_no like '%(txt)s'
and exists(select * from `tabBatch`
where name = sle.batch_no
and expiry_date >= %(posting_date)s
and docstatus != 2)
%(mcond)s
group by batch_no having sum(actual_qty) > 0
order by batch_no desc
limit %(start)s, %(page_len)s """ % {'item_code': filters['item_code'],
's_warehouse': filters['s_warehouse'], 'posting_date': filters['posting_date'],
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
"start": start, "page_len": page_len})
def get_stock_items_for_return(ref_doclist, parentfields):
"""return item codes filtered from doclist, which are stock items"""
if isinstance(parentfields, basestring):

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-29 18:22:12",
"docstatus": 0,
"modified": "2013-03-29 19:43:04",
"modified": "2013-07-10 14:54:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -30,6 +30,7 @@
"fieldname": "s_warehouse",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Source Warehouse",
"no_copy": 1,
"oldfieldname": "s_warehouse",
@@ -42,6 +43,7 @@
"fieldname": "t_warehouse",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Target Warehouse",
"no_copy": 1,
"oldfieldname": "t_warehouse",
@@ -54,6 +56,7 @@
"fieldname": "item_code",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Item Code",
"oldfieldname": "item_code",
"oldfieldtype": "Link",
@@ -66,6 +69,7 @@
"doctype": "DocField",
"fieldname": "description",
"fieldtype": "Text",
"in_list_view": 1,
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
@@ -77,6 +81,7 @@
"doctype": "DocField",
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Qty",
"oldfieldname": "qty",
"oldfieldtype": "Currency",
@@ -87,6 +92,7 @@
"doctype": "DocField",
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 0,
"label": "UOM",
"oldfieldname": "uom",
"oldfieldtype": "Link",
@@ -98,6 +104,7 @@
"doctype": "DocField",
"fieldname": "incoming_rate",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Valuation Rate",
"oldfieldname": "incoming_rate",
"oldfieldtype": "Currency",

View File

@@ -222,9 +222,6 @@ class DocType:
def make_entry(self, args):
args.update({"doctype": "Stock Ledger Entry"})
if args.get("warehouse"):
args["warehouse_type"] = webnotes.conn.get_value('Warehouse' , args["warehouse"],
'warehouse_type')
sle = webnotes.bean([args])
sle.ignore_permissions = 1
sle.insert()

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-10 16:34:30",
"docstatus": 0,
"modified": "2013-01-22 14:57:24",
"modified": "2013-07-10 14:54:23",
"modified_by": "Administrator",
"owner": "Administrator"
},

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-01-29 19:25:42",
"docstatus": 0,
"modified": "2013-07-05 14:56:15",
"modified": "2013-07-10 18:34:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -91,18 +91,6 @@
"search_index": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Select",
"in_filter": 1,
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Select",
"options": "link:Warehouse Type",
"read_only": 1,
"search_index": 0
},
{
"description": "The date at which current entry will get or has actually executed.",
"doctype": "DocField",

View File

@@ -46,9 +46,9 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
this.frm.fields_dict["expense_account"].get_query = function() {
return {
"query": "accounts.utils.get_account_list",
"filters": {
"company": me.frm.doc.company
'company': me.frm.doc.company,
'group_or_ledger': 'Ledger'
}
}
}

View File

@@ -15,7 +15,9 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
cur_frm.fields_dict['item_code'].get_query = function(doc) {
return erpnext.queries.item_std();
return {
query: "controllers.queries.item_std"
}
}
//==================== Get Items Stock UOM =====================================================

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:04",
"docstatus": 0,
"modified": "2013-03-07 07:03:34",
"modified": "2013-07-10 14:54:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -29,6 +29,7 @@
"doctype": "DocField",
"fieldname": "uom",
"fieldtype": "Link",
"in_list_view": 0,
"label": "UOM",
"oldfieldname": "uom",
"oldfieldtype": "Link",
@@ -38,6 +39,7 @@
"doctype": "DocField",
"fieldname": "conversion_factor",
"fieldtype": "Float",
"in_list_view": 1,
"label": "Conversion Factor",
"oldfieldname": "conversion_factor",
"oldfieldtype": "Float"

View File

@@ -2,19 +2,16 @@ test_records = [
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 1",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company"
}],
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse 2",
"warehouse_type": "_Test Warehouse Type",
"company": "_Test Company 1"
}]
]

View File

@@ -27,7 +27,12 @@ class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
def autoname(self):
suffix = " - " + webnotes.conn.get_value("Company", self.doc.company, "abbr")
if not self.doc.warehouse_name.endswith(suffix):
self.doc.name = self.doc.warehouse_name + suffix
def get_bin(self, item_code, warehouse=None):
warehouse = warehouse or self.doc.name
bin = sql("select name from tabBin where item_code = %s and \
@@ -47,15 +52,7 @@ class DocType:
bin_obj = get_obj('Bin', bin)
return bin_obj
def validate_asset(self, item_code):
if webnotes.conn.get_value("Item", item_code, "is_asset_item") == 'Yes' \
and self.doc.warehouse_type != 'Fixed Asset':
msgprint("""Fixed Asset Item %s can only be transacted in a
Fixed Asset type Warehouse""" % item_code, raise_exception=1)
def update_bin(self, args):
self.validate_asset(args.get("item_code"))
is_stock_item = webnotes.conn.get_value('Item', args.get("item_code"), 'is_stock_item')
if is_stock_item == 'Yes':
bin = self.get_bin(args.get("item_code"))
@@ -68,14 +65,7 @@ class DocType:
def validate(self):
if self.doc.email_id and not validate_email_add(self.doc.email_id):
msgprint("Please enter valid Email Id", raise_exception=1)
if not self.doc.warehouse_type:
msgprint("Warehouse Type is Mandatory", raise_exception=1)
wt = sql("select warehouse_type from `tabWarehouse` where name ='%s'" % self.doc.name)
if wt and cstr(self.doc.warehouse_type) != cstr(wt[0][0]):
sql("""update `tabStock Ledger Entry` set warehouse_type = %s
where warehouse = %s""", (self.doc.warehouse_type, self.doc.name))
def merge_warehouses(self):
webnotes.conn.auto_commit_on_many_writes = 1

View File

@@ -2,20 +2,18 @@
{
"creation": "2013-03-07 18:50:32",
"docstatus": 0,
"modified": "2013-07-05 15:02:12",
"modified": "2013-07-10 18:46:40",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_rename": 1,
"autoname": "field:warehouse_name",
"description": "A logical Warehouse against which stock entries are made.",
"doctype": "DocType",
"document_type": "Master",
"icon": "icon-building",
"module": "Stock",
"name": "__common__",
"search_fields": "warehouse_type"
"name": "__common__"
},
{
"doctype": "DocField",
@@ -57,19 +55,6 @@
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "warehouse_type",
"fieldtype": "Link",
"in_filter": 1,
"in_list_view": 1,
"label": "Warehouse Type",
"oldfieldname": "warehouse_type",
"oldfieldtype": "Link",
"options": "Warehouse Type",
"permlevel": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "company",
@@ -80,12 +65,13 @@
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"reqd": 1,
"search_index": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_4",
"fieldtype": "Column Break",
"fieldtype": "Section Break",
"permlevel": 0
},
{

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-02-22 01:28:05",
"docstatus": 0,
"modified": "2013-03-07 07:03:34",
"modified": "2013-07-10 14:54:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -17,6 +17,7 @@
"doctype": "DocField",
"fieldname": "user",
"fieldtype": "Link",
"in_list_view": 1,
"label": "User",
"name": "__common__",
"options": "Profile",

View File

@@ -123,11 +123,6 @@ wn.module_page["Stock"] = [
"doctype":"Brand",
"label": wn._("Brand"),
"description": wn._("Brand master.")
},
{
"label": wn._("Warehouse Type"),
"doctype":"Warehouse Type",
"description": wn._("Types of warehouse")
}
]
},