mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
[minor] renamed perpetual accounting to make_accounting_entry_for_every_stock_entry
This commit is contained in:
@@ -33,8 +33,8 @@ erpnext.stock.DeliveryNoteController = erpnext.selling.SellingController.extend(
|
||||
|
||||
set_print_hide(doc, dt, dn);
|
||||
|
||||
// unhide expense_account and cost_center is perpetual_accounting enabled
|
||||
var aii_enabled = cint(sys_defaults.perpetual_accounting)
|
||||
// unhide expense_account and cost_center is auto_accounting_for_stock enabled
|
||||
var aii_enabled = cint(sys_defaults.auto_accounting_for_stock)
|
||||
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(["expense_account", "cost_center"], aii_enabled);
|
||||
|
||||
if (this.frm.doc.docstatus===0) {
|
||||
@@ -191,7 +191,7 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
|
||||
}
|
||||
}
|
||||
|
||||
if (sys_defaults.perpetual_accounting) {
|
||||
if (sys_defaults.auto_accounting_for_stock) {
|
||||
|
||||
cur_frm.cscript.expense_account = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
|
||||
@@ -41,8 +41,8 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
|
||||
def test_delivery_note_no_gl_entry(self):
|
||||
self.clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("perpetual_accounting")), 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 0)
|
||||
|
||||
self._insert_purchase_receipt()
|
||||
|
||||
@@ -66,8 +66,8 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
def test_delivery_note_gl_entry(self):
|
||||
self.clear_stock_account_balance()
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("perpetual_accounting")), 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
|
||||
webnotes.conn.set_value("Item", "_Test Item", "valuation_method", "FIFO")
|
||||
|
||||
self._insert_purchase_receipt()
|
||||
@@ -119,11 +119,11 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
dn.cancel()
|
||||
self.assertFalse(get_gl_entries("Delivery Note", dn.doc.name))
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def test_delivery_note_gl_entry_packing_item(self):
|
||||
self.clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
self._insert_purchase_receipt()
|
||||
self._insert_purchase_receipt("_Test Item Home Desktop 100")
|
||||
@@ -158,7 +158,7 @@ class TestDeliveryNote(unittest.TestCase):
|
||||
dn.cancel()
|
||||
self.assertFalse(get_gl_entries("Delivery Note", dn.doc.name))
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def test_serialized(self):
|
||||
from stock.doctype.stock_entry.test_stock_entry import make_serialized_item
|
||||
|
||||
@@ -10,7 +10,7 @@ from webnotes.utils import flt
|
||||
|
||||
class TestMaterialRequest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def test_make_purchase_order(self):
|
||||
from stock.doctype.material_request.material_request import make_purchase_order
|
||||
|
||||
@@ -12,7 +12,7 @@ from accounts.utils import get_stock_and_account_difference
|
||||
|
||||
class TestPurchaseReceipt(unittest.TestCase):
|
||||
def test_make_purchase_invoice(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
self._clear_stock_account_balance()
|
||||
from stock.doctype.purchase_receipt.purchase_receipt import make_purchase_invoice
|
||||
|
||||
@@ -33,7 +33,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
self.assertRaises(webnotes.ValidationError, webnotes.bean(pi).submit)
|
||||
|
||||
def test_purchase_receipt_no_gl_entry(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
self._clear_stock_account_balance()
|
||||
pr = webnotes.bean(copy=test_records[0])
|
||||
pr.insert()
|
||||
@@ -53,8 +53,8 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
self.assertFalse(get_gl_entries("Purchase Receipt", pr.doc.name))
|
||||
|
||||
def test_purchase_receipt_gl_entry(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("perpetual_accounting")), 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
|
||||
|
||||
self._clear_stock_account_balance()
|
||||
|
||||
@@ -84,7 +84,7 @@ class TestPurchaseReceipt(unittest.TestCase):
|
||||
pr.cancel()
|
||||
self.assertFalse(get_gl_entries("Purchase Receipt", pr.doc.name))
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def _clear_stock_account_balance(self):
|
||||
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-16 10:59:15",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-21 13:37:01",
|
||||
"modified": "2013-08-28 19:13:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -35,7 +35,8 @@
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"write": 1
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@@ -167,14 +168,6 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:sys_defaults.perpetual_accounting",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"label": "Cost Center",
|
||||
"options": "Cost Center"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_details",
|
||||
@@ -315,6 +308,18 @@
|
||||
"no_copy": 1,
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "is_cancelled",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 1,
|
||||
"label": "Is Cancelled",
|
||||
"oldfieldname": "is_cancelled",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nYes\nNo",
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break5",
|
||||
@@ -445,22 +450,23 @@
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "Material Manager",
|
||||
"submit": 0
|
||||
"role": "Material Master Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "Material User",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User"
|
||||
"role": "Material Manager",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Material User",
|
||||
"write": 0
|
||||
}
|
||||
]
|
||||
@@ -38,7 +38,7 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
}
|
||||
};
|
||||
|
||||
if(cint(wn.defaults.get_default("perpetual_accounting"))) {
|
||||
if(cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
|
||||
this.frm.add_fetch("company", "stock_adjustment_account", "expense_adjustment_account");
|
||||
|
||||
this.frm.fields_dict["expense_adjustment_account"].get_query = function() {
|
||||
|
||||
@@ -11,7 +11,7 @@ from stock.doctype.stock_ledger_entry.stock_ledger_entry import *
|
||||
|
||||
class TestStockEntry(unittest.TestCase):
|
||||
def tearDown(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
if hasattr(self, "old_default_company"):
|
||||
webnotes.conn.set_default("company", self.old_default_company)
|
||||
|
||||
@@ -50,7 +50,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
def test_material_receipt_gl_entry(self):
|
||||
self._clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
mr = webnotes.bean(copy=test_records[0])
|
||||
mr.insert()
|
||||
@@ -80,7 +80,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
def test_material_issue_gl_entry(self):
|
||||
self._clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
self._insert_material_receipt()
|
||||
|
||||
@@ -115,7 +115,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
def test_material_transfer_gl_entry(self):
|
||||
self._clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
self._insert_material_receipt()
|
||||
|
||||
@@ -149,7 +149,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
|
||||
def test_repack_no_change_in_valuation(self):
|
||||
self._clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
self._insert_material_receipt()
|
||||
|
||||
@@ -166,11 +166,11 @@ class TestStockEntry(unittest.TestCase):
|
||||
order by account desc""", repack.doc.name, as_dict=1)
|
||||
self.assertFalse(gl_entries)
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def test_repack_with_change_in_valuation(self):
|
||||
self._clear_stock_account_balance()
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
self._insert_material_receipt()
|
||||
|
||||
@@ -188,7 +188,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
["Stock Adjustment - _TC", 0.0, 1000.0],
|
||||
])
|
||||
)
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle):
|
||||
expected_sle.sort(key=lambda x: x[0])
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-29 18:22:12",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-08-25 21:00:24",
|
||||
"modified": "2013-08-28 19:15:55",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -145,7 +145,7 @@
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:sys_defaults.perpetual_accounting",
|
||||
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expense_account",
|
||||
"fieldtype": "Link",
|
||||
@@ -154,7 +154,7 @@
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"depends_on": "eval:sys_defaults.perpetual_accounting",
|
||||
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
|
||||
@@ -12,7 +12,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
set_default_expense_account: function() {
|
||||
var me = this;
|
||||
|
||||
if (sys_defaults.perpetual_accounting && !this.frm.doc.expense_account) {
|
||||
if (sys_defaults.auto_accounting_for_stock && !this.frm.doc.expense_account) {
|
||||
return this.frm.call({
|
||||
method: "accounts.utils.get_company_default",
|
||||
args: {
|
||||
@@ -28,7 +28,7 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
|
||||
setup: function() {
|
||||
var me = this;
|
||||
if (sys_defaults.perpetual_accounting) {
|
||||
if (sys_defaults.auto_accounting_for_stock) {
|
||||
this.frm.add_fetch("company", "stock_adjustment_account", "expense_account");
|
||||
this.frm.add_fetch("company", "cost_center", "cost_center");
|
||||
|
||||
|
||||
@@ -303,7 +303,7 @@ class DocType(StockController):
|
||||
|
||||
|
||||
def validate_expense_account(self):
|
||||
if not cint(webnotes.defaults.get_global_default("perpetual_accounting")):
|
||||
if not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
return
|
||||
|
||||
if not self.doc.expense_account:
|
||||
|
||||
@@ -13,7 +13,7 @@ from accounts.utils import get_fiscal_year, get_stock_and_account_difference, ge
|
||||
|
||||
class TestStockReconciliation(unittest.TestCase):
|
||||
def test_reco_for_fifo(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
# [[qty, valuation_rate, posting_date,
|
||||
# posting_time, expected_stock_value, bin_qty, bin_valuation]]
|
||||
input_data = [
|
||||
@@ -57,7 +57,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
|
||||
|
||||
def test_reco_for_moving_average(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
# [[qty, valuation_rate, posting_date,
|
||||
# posting_time, expected_stock_value, bin_qty, bin_valuation]]
|
||||
input_data = [
|
||||
@@ -103,7 +103,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
self.assertFalse(gl_entries)
|
||||
|
||||
def test_reco_fifo_gl_entries(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
# [[qty, valuation_rate, posting_date, posting_time, stock_in_hand_debit]]
|
||||
input_data = [
|
||||
@@ -133,10 +133,10 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
stock_reco.cancel()
|
||||
self.assertFalse(get_stock_and_account_difference(["_Test Account Stock In Hand - _TC"]))
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
def test_reco_moving_average_gl_entries(self):
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 1)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
|
||||
|
||||
# [[qty, valuation_rate, posting_date,
|
||||
# posting_time, stock_in_hand_debit]]
|
||||
@@ -166,7 +166,7 @@ class TestStockReconciliation(unittest.TestCase):
|
||||
stock_reco.cancel()
|
||||
self.assertFalse(get_stock_and_account_difference(["_Test Warehouse - _TC"]))
|
||||
|
||||
webnotes.defaults.set_global_default("perpetual_accounting", 0)
|
||||
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
|
||||
|
||||
|
||||
def cleanup_data(self):
|
||||
|
||||
Reference in New Issue
Block a user