[get_query] to server side

This commit is contained in:
Saurabh
2013-07-09 16:34:50 +05:30
65 changed files with 921 additions and 1207 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']);
@@ -248,6 +250,7 @@ if (sys_defaults.auto_inventory_accounting) {
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return {
filters: {
'company_name': doc.company,
'group_or_ledger': "Ledger"

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:09",
"docstatus": 0,
"modified": "2013-07-08 17:46:45",
"modified": "2013-07-09 12:48:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -212,34 +212,12 @@
"search_index": 1,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "challan_no",
"fieldtype": "Data",
"hidden": 1,
"label": "Challan No",
"oldfieldname": "challan_no",
"oldfieldtype": "Data",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "challan_date",
"fieldtype": "Date",
"hidden": 1,
"label": "Challan Date",
"oldfieldname": "challan_date",
"oldfieldtype": "Date",
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "po_no",
"fieldtype": "Data",
"hidden": 1,
"label": "P.O. No",
"label": "Customer's Purchase Order No",
"no_copy": 0,
"oldfieldname": "po_no",
"oldfieldtype": "Data",
@@ -254,7 +232,7 @@
"fieldname": "po_date",
"fieldtype": "Data",
"hidden": 1,
"label": "P.O. Date",
"label": "Customer's Purchase Order Date",
"no_copy": 0,
"oldfieldname": "po_date",
"oldfieldtype": "Data",
@@ -267,7 +245,7 @@
"doctype": "DocField",
"fieldname": "sec_break25",
"fieldtype": "Section Break",
"label": "Price List and Currency",
"label": "Currency and Price List",
"options": "icon-tag",
"read_only": 0
},
@@ -390,19 +368,29 @@
"print_hide": 1,
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_31",
"fieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "net_total_export",
"fieldtype": "Currency",
"label": "Net Total (Export)",
"label": "Net Total",
"options": "currency",
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_33",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "net_total",
"fieldtype": "Currency",
"label": "Net Total*",
"label": "Net Total (Company Currency)",
"no_copy": 0,
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
@@ -413,14 +401,6 @@
"reqd": 0,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "recalculate_values",
"fieldtype": "Button",
"label": "Re-Calculate Values",
"oldfieldtype": "Button",
"read_only": 0
},
{
"doctype": "DocField",
"fieldname": "taxes",
@@ -490,24 +470,11 @@
"doctype": "DocField",
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total (Export)",
"label": "Taxes and Charges Total",
"options": "company",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "other_charges_total",
"fieldtype": "Currency",
"label": "Taxes and Charges Total",
"oldfieldname": "other_charges_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "column_break_47",
@@ -515,12 +482,16 @@
},
{
"doctype": "DocField",
"fieldname": "calculate_charges",
"fieldtype": "Button",
"label": "Calculate Charges",
"oldfieldtype": "Button",
"fieldname": "other_charges_total",
"fieldtype": "Currency",
"label": "Taxes and Charges Total (Company Currency)",
"oldfieldname": "other_charges_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0
"print_width": "150px",
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
@@ -536,7 +507,7 @@
"doctype": "DocField",
"fieldname": "grand_total_export",
"fieldtype": "Currency",
"label": "Grand Total (Export)",
"label": "Grand Total",
"no_copy": 0,
"oldfieldname": "grand_total_export",
"oldfieldtype": "Currency",
@@ -551,7 +522,7 @@
"doctype": "DocField",
"fieldname": "rounded_total_export",
"fieldtype": "Currency",
"label": "Rounded Total (Export)",
"label": "Rounded Total",
"no_copy": 0,
"oldfieldname": "rounded_total_export",
"oldfieldtype": "Currency",
@@ -566,7 +537,7 @@
"doctype": "DocField",
"fieldname": "in_words_export",
"fieldtype": "Data",
"label": "In Words (Export)",
"label": "In Words",
"no_copy": 0,
"oldfieldname": "in_words_export",
"oldfieldtype": "Data",
@@ -586,7 +557,7 @@
"doctype": "DocField",
"fieldname": "grand_total",
"fieldtype": "Currency",
"label": "Grand Total",
"label": "Grand Total (Company Currency)",
"no_copy": 0,
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
@@ -601,7 +572,7 @@
"doctype": "DocField",
"fieldname": "rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total",
"label": "Rounded Total (Company Currency)",
"no_copy": 0,
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
@@ -616,7 +587,7 @@
"doctype": "DocField",
"fieldname": "in_words",
"fieldtype": "Data",
"label": "In Words",
"label": "In Words (Company Currency)",
"no_copy": 0,
"oldfieldname": "in_words",
"oldfieldtype": "Data",
@@ -690,7 +661,7 @@
"doctype": "DocField",
"fieldname": "lr_no",
"fieldtype": "Data",
"label": "LR No",
"label": "Vehicle No",
"no_copy": 0,
"oldfieldname": "lr_no",
"oldfieldtype": "Data",
@@ -706,7 +677,7 @@
"doctype": "DocField",
"fieldname": "lr_date",
"fieldtype": "Date",
"label": "LR Date",
"label": "Vehicle Dispatch Date",
"no_copy": 0,
"oldfieldname": "lr_date",
"oldfieldtype": "Date",

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

@@ -2,7 +2,7 @@
{
"creation": "2013-04-22 13:15:44",
"docstatus": 0,
"modified": "2013-07-08 17:46:21",
"modified": "2013-07-09 12:42:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -169,7 +169,7 @@
"doctype": "DocField",
"fieldname": "base_ref_rate",
"fieldtype": "Currency",
"label": "Price List Rate*",
"label": "Price List Rate (Company Currency)",
"oldfieldname": "base_ref_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -183,7 +183,7 @@
"doctype": "DocField",
"fieldname": "basic_rate",
"fieldtype": "Currency",
"label": "Rate*",
"label": "Rate (Company Currency)",
"oldfieldname": "basic_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -197,7 +197,7 @@
"doctype": "DocField",
"fieldname": "amount",
"fieldtype": "Currency",
"label": "Amount*",
"label": "Amount (Company Currency)",
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",

View File

@@ -2,7 +2,7 @@
{
"creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-07-08 16:18:00",
"modified": "2013-07-09 11:39:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -79,6 +79,35 @@
"print_hide": 1,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "amended_from",
"fieldtype": "Data",
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Data",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"width": "150px"
},
{
"description": "Select the relevant company name if you have multiple companies",
"doctype": "DocField",
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"print_hide": 1,
"print_width": "150px",
"reqd": 1,
"search_index": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "items",
@@ -130,22 +159,6 @@
"search_index": 1,
"width": "100px"
},
{
"description": "Select the relevant company name if you have multiple companies",
"doctype": "DocField",
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"print_hide": 1,
"print_width": "150px",
"reqd": 1,
"search_index": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "fiscal_year",
@@ -224,19 +237,6 @@
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "amended_from",
"fieldtype": "Data",
"label": "Amended From",
"no_copy": 1,
"oldfieldname": "amended_from",
"oldfieldtype": "Data",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "remark",

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

@@ -2,7 +2,7 @@
{
"creation": "2013-05-21 16:16:39",
"docstatus": 0,
"modified": "2013-07-08 17:46:13",
"modified": "2013-07-09 12:50:25",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -172,7 +172,7 @@
"fieldname": "challan_no",
"fieldtype": "Data",
"hidden": 1,
"label": "Challan No",
"label": "Supplier Shipment No",
"no_copy": 1,
"oldfieldname": "challan_no",
"oldfieldtype": "Data",
@@ -186,7 +186,7 @@
"fieldname": "challan_date",
"fieldtype": "Date",
"hidden": 1,
"label": "Challan Date",
"label": "Supplier Shipment Date",
"no_copy": 1,
"oldfieldname": "challan_date",
"oldfieldtype": "Date",
@@ -195,58 +195,11 @@
"reqd": 0,
"width": "100px"
},
{
"doctype": "DocField",
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
},
{
"allow_on_submit": 1,
"doctype": "DocField",
"fieldname": "purchase_receipt_details",
"fieldtype": "Table",
"label": "Purchase Receipt Items",
"oldfieldname": "purchase_receipt_details",
"oldfieldtype": "Table",
"options": "Purchase Receipt Item",
"print_hide": 0,
"reqd": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"oldfieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "get_current_stock",
"fieldtype": "Button",
"label": "Get Current Stock",
"oldfieldtype": "Button",
"options": "get_current_stock",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_18",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "recalculate_values",
"fieldtype": "Button",
"label": "Re-Calculate Values",
"oldfieldtype": "Button"
},
{
"doctype": "DocField",
"fieldname": "currency_price_list",
"fieldtype": "Section Break",
"label": "Currency & Price List",
"label": "Currency and Price List",
"options": "icon-tag"
},
{
@@ -308,6 +261,71 @@
"label": "Price List Exchange Rate",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
"oldfieldtype": "Section Break",
"options": "icon-shopping-cart"
},
{
"allow_on_submit": 1,
"doctype": "DocField",
"fieldname": "purchase_receipt_details",
"fieldtype": "Table",
"label": "Purchase Receipt Items",
"oldfieldname": "purchase_receipt_details",
"oldfieldtype": "Table",
"options": "Purchase Receipt Item",
"print_hide": 0,
"reqd": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
"oldfieldtype": "Section Break"
},
{
"doctype": "DocField",
"fieldname": "net_total_import",
"fieldtype": "Currency",
"label": "Net Total",
"oldfieldname": "net_total_import",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "get_current_stock",
"fieldtype": "Button",
"label": "Get Current Stock",
"oldfieldtype": "Button",
"options": "get_current_stock",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break_27",
"fieldtype": "Column Break"
},
{
"doctype": "DocField",
"fieldname": "net_total",
"fieldtype": "Currency",
"label": "Net Total (Company Currency)",
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"reqd": 1,
"width": "150px"
},
{
"description": "Add / Edit Taxes and Charges",
"doctype": "DocField",
@@ -328,15 +346,6 @@
"options": "Purchase Taxes and Charges Master",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "get_tax_detail",
"fieldtype": "Button",
"label": "Get Tax Detail",
"oldfieldtype": "Button",
"options": "get_purchase_tax_details",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "purchase_tax_details",
@@ -346,14 +355,6 @@
"oldfieldtype": "Table",
"options": "Purchase Taxes and Charges"
},
{
"doctype": "DocField",
"fieldname": "calculate_tax",
"fieldtype": "Button",
"label": "Calculate Tax",
"oldfieldtype": "Button",
"print_hide": 1
},
{
"doctype": "DocField",
"fieldname": "tax_calculation",
@@ -371,22 +372,11 @@
"oldfieldtype": "Section Break",
"options": "icon-money"
},
{
"doctype": "DocField",
"fieldname": "net_total_import",
"fieldtype": "Currency",
"label": "Net Total (Import)",
"oldfieldname": "net_total_import",
"oldfieldtype": "Currency",
"options": "currency",
"print_hide": 1,
"read_only": 1
},
{
"doctype": "DocField",
"fieldname": "other_charges_added_import",
"fieldtype": "Currency",
"label": "Taxes and Charges Added (Import)",
"label": "Taxes and Charges Added",
"oldfieldname": "other_charges_added_import",
"oldfieldtype": "Currency",
"options": "currency",
@@ -397,7 +387,7 @@
"doctype": "DocField",
"fieldname": "other_charges_deducted_import",
"fieldtype": "Currency",
"label": "Taxes and Charges Deducted (Import)",
"label": "Taxes and Charges Deducted",
"oldfieldname": "other_charges_deducted_import",
"oldfieldtype": "Currency",
"options": "currency",
@@ -408,7 +398,7 @@
"doctype": "DocField",
"fieldname": "grand_total_import",
"fieldtype": "Currency",
"label": "Grand Total (Import)",
"label": "Grand Total",
"oldfieldname": "grand_total_import",
"oldfieldtype": "Currency",
"options": "currency",
@@ -419,7 +409,7 @@
"doctype": "DocField",
"fieldname": "in_words_import",
"fieldtype": "Data",
"label": "In Words (Import)",
"label": "In Words",
"oldfieldname": "in_words_import",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -432,25 +422,11 @@
"print_width": "50%",
"width": "50%"
},
{
"doctype": "DocField",
"fieldname": "net_total",
"fieldtype": "Currency",
"label": "Net Total",
"oldfieldname": "net_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "150px",
"read_only": 1,
"reqd": 1,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "other_charges_added",
"fieldtype": "Currency",
"label": "Taxes and Charges Added",
"label": "Taxes and Charges Added (Company Currency)",
"oldfieldname": "other_charges_added",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -461,7 +437,7 @@
"doctype": "DocField",
"fieldname": "other_charges_deducted",
"fieldtype": "Currency",
"label": "Taxes and Charges Deducted",
"label": "Taxes and Charges Deducted (Company Currency)",
"oldfieldname": "other_charges_deducted",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -472,7 +448,7 @@
"doctype": "DocField",
"fieldname": "total_tax",
"fieldtype": "Currency",
"label": "Total Tax",
"label": "Total Tax (Company Currency)",
"oldfieldname": "total_tax",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -483,7 +459,7 @@
"doctype": "DocField",
"fieldname": "grand_total",
"fieldtype": "Currency",
"label": "Grand Total",
"label": "Grand Total (Company Currency)",
"oldfieldname": "grand_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -494,7 +470,7 @@
"doctype": "DocField",
"fieldname": "rounded_total",
"fieldtype": "Currency",
"label": "Rounded Total",
"label": "Rounded Total (Company Currency)",
"oldfieldname": "rounded_total",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -506,7 +482,7 @@
"doctype": "DocField",
"fieldname": "in_words",
"fieldtype": "Data",
"label": "In Words",
"label": "In Words (Company Currency)",
"oldfieldname": "in_words",
"oldfieldtype": "Data",
"print_hide": 1,

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

@@ -2,7 +2,7 @@
{
"creation": "2013-05-24 19:29:10",
"docstatus": 0,
"modified": "2013-07-08 17:46:17",
"modified": "2013-07-09 12:20:50",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -124,7 +124,7 @@
"doctype": "DocField",
"fieldname": "import_ref_rate",
"fieldtype": "Currency",
"label": "Ref Rate ",
"label": "Price List Rate",
"options": "currency",
"print_hide": 1,
"read_only": 0
@@ -165,7 +165,7 @@
"doctype": "DocField",
"fieldname": "purchase_ref_rate",
"fieldtype": "Currency",
"label": "Price List Rate*",
"label": "Price List Rate (Company Currency)",
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 0
@@ -175,7 +175,7 @@
"doctype": "DocField",
"fieldname": "purchase_rate",
"fieldtype": "Currency",
"label": "Rate*",
"label": "Rate (Company Currency)",
"oldfieldname": "purchase_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -190,7 +190,7 @@
"doctype": "DocField",
"fieldname": "amount",
"fieldtype": "Currency",
"label": "Amount*",
"label": "Amount (Company Currency)",
"oldfieldname": "amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
@@ -314,7 +314,7 @@
"doctype": "DocField",
"fieldname": "qa_no",
"fieldtype": "Link",
"label": "QA No",
"label": "Quality Inspection",
"no_copy": 1,
"oldfieldname": "qa_no",
"oldfieldtype": "Link",
@@ -378,7 +378,7 @@
"fieldtype": "Link",
"hidden": 0,
"in_filter": 1,
"label": "PO No",
"label": "Purchase Order",
"no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
@@ -396,7 +396,7 @@
"fieldtype": "Date",
"hidden": 1,
"in_filter": 1,
"label": "PO Date",
"label": "Purchase Order Date",
"no_copy": 1,
"oldfieldname": "prevdoc_date",
"oldfieldtype": "Date",

View File

@@ -107,6 +107,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 &&
@@ -387,4 +389,4 @@ cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
return{ query:"controllers.queries.customer_query" } }
cur_frm.fields_dict.supplier.get_query = function(doc,cdt,cdn) {
return{ query:"controllers.queries.supplier_query" } }
return{ query:"controllers.queries.supplier_query" } }

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)