[minor] renamed perpetual accounting to make_accounting_entry_for_every_stock_entry

This commit is contained in:
Nabin Hait 2013-08-28 19:24:52 +05:30
parent 2e296fa46f
commit d85d63bb81
30 changed files with 138 additions and 187 deletions

View File

@ -13,18 +13,18 @@ class DocType:
self.doc, self.doclist = d, dl
def validate(self):
self.validate_perpetual_accounting()
self.validate_auto_accounting_for_stock()
def validate_perpetual_accounting(self):
if cint(self.doc.perpetual_accounting) == 1:
def validate_auto_accounting_for_stock(self):
if cint(self.doc.auto_accounting_for_stock) == 1:
previous_val = cint(webnotes.conn.get_value("Accounts Settings",
None, "perpetual_accounting"))
if cint(self.doc.perpetual_accounting) != previous_val:
None, "auto_accounting_for_stock"))
if cint(self.doc.auto_accounting_for_stock) != previous_val:
from accounts.utils import validate_stock_and_account_balance, \
create_stock_in_hand_jv
validate_stock_and_account_balance()
create_stock_in_hand_jv(reverse=cint(self.doc.perpetual_accounting) < previous_val)
create_stock_in_hand_jv(reverse=cint(self.doc.auto_accounting_for_stock) < previous_val)
def on_update(self):
for key in ["perpetual_accounting"]:
for key in ["auto_accounting_for_stock"]:
webnotes.conn.set_default(key, self.doc.fields.get(key, ''))

View File

@ -2,7 +2,7 @@
{
"creation": "2013-06-24 15:49:57",
"docstatus": 0,
"modified": "2013-08-01 17:35:16",
"modified": "2013-08-28 18:55:43",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -42,9 +42,9 @@
"default": "1",
"description": "If enabled, the system will post accounting entries for inventory automatically.",
"doctype": "DocField",
"fieldname": "perpetual_accounting",
"fieldname": "auto_accounting_for_stock",
"fieldtype": "Check",
"label": "Enable Perpetual Accounting for Inventory"
"label": "Make Accounting Entry For Every Stock Entry"
},
{
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except role specified below.",

View File

@ -34,6 +34,6 @@ class DocType:
(res[0][0], self.doc.company), raise_exception=1)
def validate_expense_account(self):
if cint(webnotes.defaults.get_global_default("perpetual_accounting")) \
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
and not self.doc.expense_account:
msgprint(_("Expense Account is mandatory"), raise_exception=1)

View File

@ -2,7 +2,7 @@
{
"creation": "2013-05-24 12:15:51",
"docstatus": 0,
"modified": "2013-08-09 16:35:03",
"modified": "2013-08-28 19:13:42",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -163,7 +163,7 @@
"reqd": 1
},
{
"depends_on": "eval:sys_defaults.perpetual_accounting",
"depends_on": "eval:sys_defaults.auto_accounting_for_stock",
"doctype": "DocField",
"fieldname": "expense_account",
"fieldtype": "Link",

View File

@ -212,15 +212,15 @@ class DocType(BuyingController):
raise Exception
def set_against_expense_account(self):
perpetual_accounting = cint(webnotes.defaults.get_global_default("perpetual_accounting"))
auto_accounting_for_stock = cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
if perpetual_accounting:
if auto_accounting_for_stock:
stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
against_accounts = []
stock_items = self.get_stock_items()
for item in self.doclist.get({"parentfield": "entries"}):
if perpetual_accounting and item.item_code in stock_items:
if auto_accounting_for_stock and item.item_code in stock_items:
# in case of auto inventory accounting, against expense account is always
# Stock Received But Not Billed for a stock item
item.expense_head = stock_not_billed_account
@ -234,7 +234,7 @@ class DocType(BuyingController):
(item.item_code or item.item_name), raise_exception=1)
elif item.expense_head not in against_accounts:
# if no perpetual_accounting or not a stock item
# if no auto_accounting_for_stock or not a stock item
against_accounts.append(item.expense_head)
self.doc.against_expense_account = ",".join(against_accounts)
@ -317,8 +317,8 @@ class DocType(BuyingController):
self.update_prevdoc_status()
def make_gl_entries(self):
perpetual_accounting = \
cint(webnotes.defaults.get_global_default("perpetual_accounting"))
auto_accounting_for_stock = \
cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
gl_entries = []
@ -355,15 +355,15 @@ class DocType(BuyingController):
valuation_tax += (tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.tax_amount)
# item gl entries
stock_item_and_perpetual_accounting = False
stock_item_and_auto_accounting_for_stock = False
stock_items = self.get_stock_items()
for item in self.doclist.get({"parentfield": "entries"}):
if perpetual_accounting and item.item_code in stock_items:
if auto_accounting_for_stock and item.item_code in stock_items:
if flt(item.valuation_rate):
# if auto inventory accounting enabled and stock item,
# then do stock related gl entries
# expense will be booked in sales invoice
stock_item_and_perpetual_accounting = True
stock_item_and_auto_accounting_for_stock = True
valuation_amt = (flt(item.amount, self.precision("amount", item)) +
flt(item.item_tax_amount, self.precision("item_tax_amount", item)) +
@ -390,7 +390,7 @@ class DocType(BuyingController):
})
)
if stock_item_and_perpetual_accounting and valuation_tax:
if stock_item_and_auto_accounting_for_stock and valuation_tax:
# credit valuation tax amount in "Expenses Included In Valuation"
# this will balance out valuation amount included in cost of goods sold
gl_entries.append(

View File

@ -14,9 +14,9 @@ test_dependencies = ["Item", "Cost Center"]
test_ignore = ["Serial No"]
class TestPurchaseInvoice(unittest.TestCase):
def test_gl_entries_without_perpetual_accounting(self):
webnotes.defaults.set_global_default("perpetual_accounting", 0)
self.assertTrue(not cint(webnotes.defaults.get_global_default("perpetual_accounting")))
def test_gl_entries_without_auto_accounting_for_stock(self):
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
self.assertTrue(not cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")))
wrapper = webnotes.bean(copy=test_records[0])
wrapper.run_method("calculate_taxes_and_totals")
@ -41,9 +41,9 @@ class TestPurchaseInvoice(unittest.TestCase):
for d in gl_entries:
self.assertEqual([d.debit, d.credit], expected_gl_entries.get(d.account))
def test_gl_entries_with_perpetual_accounting(self):
webnotes.defaults.set_global_default("perpetual_accounting", 1)
self.assertEqual(cint(webnotes.defaults.get_global_default("perpetual_accounting")), 1)
def test_gl_entries_with_auto_accounting_for_stock(self):
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
self.assertEqual(cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")), 1)
pi = webnotes.bean(copy=test_records[1])
pi.run_method("calculate_taxes_and_totals")
@ -68,11 +68,11 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEquals(expected_values[i][1], gle.debit)
self.assertEquals(expected_values[i][2], gle.credit)
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
def test_gl_entries_with_aia_for_non_stock_items(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)
pi = webnotes.bean(copy=test_records[1])
pi.doclist[1].item_code = "_Test Non Stock Item"
@ -99,7 +99,7 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEquals(expected_values[i][1], gle.debit)
self.assertEquals(expected_values[i][2], gle.credit)
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
def test_purchase_invoice_calculation(self):
wrapper = webnotes.bean(copy=test_records[0])

View File

@ -358,7 +358,7 @@ cur_frm.set_query("income_account", "entries", function(doc) {
});
// expense account
if (sys_defaults.perpetual_accounting) {
if (sys_defaults.auto_accounting_for_stock) {
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
return {
filters: {

View File

@ -558,7 +558,7 @@ class DocType(SellingController):
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2),
update_outstanding=update_outstanding, merge_entries=False)
if cint(webnotes.defaults.get_global_default("perpetual_accounting")) \
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
and cint(self.doc.update_stock):
self.update_gl_entries_after()
@ -603,7 +603,7 @@ class DocType(SellingController):
)
# expense account gl entries
if cint(webnotes.defaults.get_global_default("perpetual_accounting")) \
if cint(webnotes.defaults.get_global_default("auto_accounting_for_stock")) \
and cint(self.doc.update_stock):
gl_entries += self.get_gl_entries_for_stock()

View File

@ -298,7 +298,7 @@ class TestSalesInvoice(unittest.TestCase):
"Batched for Billing")
def test_sales_invoice_gl_entry_without_aii(self):
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
self.clear_stock_account_balance()
si = webnotes.bean(copy=test_records[1])
si.insert()
@ -332,7 +332,7 @@ class TestSalesInvoice(unittest.TestCase):
def atest_pos_gl_entry_with_aii(self):
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
webnotes.defaults.set_global_default("perpetual_accounting", 1)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
old_default_company = webnotes.conn.get_default("company")
webnotes.conn.set_default("company", "_Test Company")
@ -392,11 +392,11 @@ class TestSalesInvoice(unittest.TestCase):
self.assertFalse(get_stock_and_account_difference([si.doclist[1].warehouse]))
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
webnotes.conn.set_default("company", old_default_company)
def atest_sales_invoice_gl_entry_with_aii_no_item_code(self):
webnotes.defaults.set_global_default("perpetual_accounting", 1)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
si_copy = webnotes.copy_doclist(test_records[1])
si_copy[1]["item_code"] = None
@ -420,10 +420,10 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(expected_values[i][1], gle.debit)
self.assertEquals(expected_values[i][2], gle.credit)
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
def atest_sales_invoice_gl_entry_with_aii_non_stock_item(self):
webnotes.defaults.set_global_default("perpetual_accounting", 1)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 1)
si_copy = webnotes.copy_doclist(test_records[1])
si_copy[1]["item_code"] = "_Test Non Stock Item"
@ -447,7 +447,7 @@ class TestSalesInvoice(unittest.TestCase):
self.assertEquals(expected_values[i][1], gle.debit)
self.assertEquals(expected_values[i][2], gle.credit)
webnotes.defaults.set_global_default("perpetual_accounting", 0)
webnotes.defaults.set_global_default("auto_accounting_for_stock", 0)
def _insert_purchase_receipt(self):
from stock.doctype.purchase_receipt.test_purchase_receipt import test_records \

View File

@ -12,7 +12,7 @@ from accounts.general_ledger import make_gl_entries, delete_gl_entries
class StockController(AccountsController):
def make_gl_entries(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 self.doc.docstatus==1:

View File

@ -0,0 +1,9 @@
import webnotes
from webnotes.utils import cint
def execute():
import patches.september_2012.repost_stock
patches.september_2012.repost_stock.execute()
import patches.march_2013.p08_create_aii_accounts
patches.march_2013.p08_create_aii_accounts.execute()

View File

@ -1,39 +0,0 @@
import webnotes
from webnotes.utils import cint
def execute():
import patches.september_2012.repost_stock
patches.september_2012.repost_stock.execute()
import patches.march_2013.p08_create_aii_accounts
patches.march_2013.p08_create_aii_accounts.execute()
copy_perpetual_accounting_settings()
set_missing_cost_center()
def set_missing_cost_center():
reload_docs = [
["stock", "doctype", "serial_no"],
["stock", "doctype", "stock_reconciliation"],
["stock", "doctype", "stock_entry"]
]
for d in reload_docs:
webnotes.reload_doc(d[0], d[1], d[2])
if cint(webnotes.defaults.get_global_default("perpetual_accounting")):
for dt in ["Serial No", "Stock Reconciliation", "Stock Entry"]:
webnotes.conn.sql("""update `tab%s` t1, tabCompany t2
set t1.cost_center=t2.cost_center where t1.company = t2.name""" % dt)
def copy_perpetual_accounting_settings():
webnotes.reload_doc("accounts", "doctype", "accounts_settings")
aii_enabled = cint(webnotes.conn.get_value("Global Defaults", None,
"auto_inventory_accounting"))
if aii_enabled:
try:
bean= webnotes.bean("Account Settings")
bean.doc.perpetual_accounting = aii_enabled
bean.save()
except:
pass

View File

@ -1,28 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
import webnotes
from webnotes.utils import cint
from accounts.utils import create_stock_in_hand_jv
def execute():
webnotes.conn.auto_commit_on_many_writes = True
aii_enabled = cint(webnotes.defaults.get_global_default("perpetual_accounting"))
if aii_enabled:
create_stock_in_hand_jv(reverse = True)
webnotes.conn.sql("""update `tabPurchase Invoice Item` pi_item
set conversion_factor = (select ifnull(if(conversion_factor=0, 1, conversion_factor), 1)
from `tabUOM Conversion Detail`
where parent = pi_item.item_code and uom = pi_item.uom limit 1
)
where ifnull(conversion_factor, 0)=0""")
if aii_enabled:
create_stock_in_hand_jv()
webnotes.conn.auto_commit_on_many_writes = False

View File

@ -6,7 +6,7 @@ import webnotes
from webnotes.utils import cint
def execute():
aii_enabled = cint(webnotes.defaults.get_global_default("perpetual_accounting"))
aii_enabled = cint(webnotes.defaults.get_global_default("auto_accounting_for_stock"))
if aii_enabled:
webnotes.conn.sql("""update `tabGL Entry` gle set is_cancelled = 'Yes'

View File

@ -201,7 +201,6 @@ patch_list = [
"patches.april_2013.rebuild_sales_browser",
"patches.may_2013.p01_selling_net_total_export",
"patches.may_2013.repost_stock_for_no_posting_time",
"patches.may_2013.p01_conversion_factor_and_aii",
"patches.may_2013.p02_update_valuation_rate",
"patches.may_2013.p03_update_support_ticket",
"patches.may_2013.p04_reorder_level",

View File

@ -20,7 +20,7 @@ erpnext.stock.StockController = wn.ui.form.Controller.extend({
},
show_general_ledger: function() {
var me = this;
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("perpetual_accounting"))) {
if(this.frm.doc.docstatus===1 && cint(wn.defaults.get_default("auto_accounting_for_stock"))) {
cur_frm.add_custom_button('Accounting Ledger', function() {
wn.route_options = {
"voucher_no": me.frm.doc.name,

View File

@ -59,7 +59,7 @@ cur_frm.fields_dict.receivables_group.get_query = function(doc) {
}
}
if (sys_defaults.perpetual_accounting) {
if (sys_defaults.auto_accounting_for_stock) {
cur_frm.fields_dict["stock_adjustment_account"].get_query = function(doc) {
return {
"filters": {

View File

@ -2,7 +2,7 @@
{
"creation": "2013-04-10 08:35:39",
"docstatus": 0,
"modified": "2013-08-05 17:23:52",
"modified": "2013-08-28 19:15:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@ -25,20 +25,13 @@
"permlevel": 0
},
{
"amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Company",
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
"read": 1,
"report": 1,
"role": "System Manager",
"submit": 0,
"write": 1
"read": 1
},
{
"doctype": "DocType",
@ -228,9 +221,9 @@
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "perpetual_accounting_settings",
"fieldname": "auto_accounting_for_stock_settings",
"fieldtype": "Section Break",
"label": "Perpetual Accounting Settings",
"label": "Auto Accounting For Stock Settings",
"read_only": 0
},
{
@ -355,6 +348,17 @@
"read_only": 1
},
{
"doctype": "DocPerm"
"amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
"report": 1,
"role": "System Manager",
"submit": 0,
"write": 1
},
{
"doctype": "DocPerm",
"role": "All"
}
]

View File

@ -106,8 +106,8 @@ class DocType:
})
global_defaults.save()
webnotes.conn.set_value("Accounts Settings", None, "perpetual_accounting", 1)
webnotes.conn.set_default("perpetual_accounting", 1)
webnotes.conn.set_value("Accounts Settings", None, "auto_accounting_for_stock", 1)
webnotes.conn.set_default("auto_accounting_for_stock", 1)
stock_settings = webnotes.bean("Stock Settings")
stock_settings.doc.item_naming_by = "Item Code"

View File

@ -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];

View File

@ -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

View File

@ -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

View File

@ -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`")

View File

@ -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
}
]

View File

@ -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() {

View File

@ -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])

View File

@ -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",

View File

@ -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");

View File

@ -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:

View File

@ -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):