[minor] renamed perpetual accounting to make_accounting_entry_for_every_stock_entry
diff --git a/accounts/doctype/accounts_settings/accounts_settings.py b/accounts/doctype/accounts_settings/accounts_settings.py
index a9aa679..5f0d276 100644
--- a/accounts/doctype/accounts_settings/accounts_settings.py
+++ b/accounts/doctype/accounts_settings/accounts_settings.py
@@ -13,18 +13,18 @@
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, ''))
diff --git a/accounts/doctype/accounts_settings/accounts_settings.txt b/accounts/doctype/accounts_settings/accounts_settings.txt
index b7ab69e..9dbed26 100644
--- a/accounts/doctype/accounts_settings/accounts_settings.txt
+++ b/accounts/doctype/accounts_settings/accounts_settings.txt
@@ -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.",
diff --git a/accounts/doctype/pos_setting/pos_setting.py b/accounts/doctype/pos_setting/pos_setting.py
index a3984a6..21d848f 100755
--- a/accounts/doctype/pos_setting/pos_setting.py
+++ b/accounts/doctype/pos_setting/pos_setting.py
@@ -34,6 +34,6 @@
(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)
\ No newline at end of file
diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt
index 0d4f71b..2420ad5 100755
--- a/accounts/doctype/pos_setting/pos_setting.txt
+++ b/accounts/doctype/pos_setting/pos_setting.txt
@@ -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",
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index 2c47ab3..33fa52c 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -212,15 +212,15 @@
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 @@
(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 @@
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 @@
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 @@
})
)
- 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(
diff --git a/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index c9b5e05..8826b3f 100644
--- a/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -14,9 +14,9 @@
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 @@
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 @@
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 @@
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])
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 7e7f7d4..dd53c7f 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -358,7 +358,7 @@
});
// 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: {
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index 6cb0bab..b31eda5 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -558,7 +558,7 @@
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 @@
)
# 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()
diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py
index 3d7959a..4f82efc 100644
--- a/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -298,7 +298,7 @@
"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 @@
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 @@
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 @@
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 @@
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 \
diff --git a/controllers/stock_controller.py b/controllers/stock_controller.py
index f3f61f9..9554913 100644
--- a/controllers/stock_controller.py
+++ b/controllers/stock_controller.py
@@ -12,7 +12,7 @@
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:
diff --git a/patches/august_2013/p01_auto_accounting_for_stock_patch.py b/patches/august_2013/p01_auto_accounting_for_stock_patch.py
new file mode 100644
index 0000000..212e5ae
--- /dev/null
+++ b/patches/august_2013/p01_auto_accounting_for_stock_patch.py
@@ -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()
\ No newline at end of file
diff --git a/patches/august_2013/p01_perpetual_accounting_patch.py b/patches/august_2013/p01_perpetual_accounting_patch.py
deleted file mode 100644
index 2f08259..0000000
--- a/patches/august_2013/p01_perpetual_accounting_patch.py
+++ /dev/null
@@ -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
\ No newline at end of file
diff --git a/patches/may_2013/p01_conversion_factor_and_aii.py b/patches/may_2013/p01_conversion_factor_and_aii.py
deleted file mode 100644
index 3821827..0000000
--- a/patches/may_2013/p01_conversion_factor_and_aii.py
+++ /dev/null
@@ -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
-
-
\ No newline at end of file
diff --git a/patches/may_2013/p05_update_cancelled_gl_entries.py b/patches/may_2013/p05_update_cancelled_gl_entries.py
index 1c9cc84..18cefc8 100644
--- a/patches/may_2013/p05_update_cancelled_gl_entries.py
+++ b/patches/may_2013/p05_update_cancelled_gl_entries.py
@@ -6,7 +6,7 @@
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'
diff --git a/patches/patch_list.py b/patches/patch_list.py
index 8dd4c97..9492c4f 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -201,7 +201,6 @@
"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",
diff --git a/public/js/controllers/stock_controller.js b/public/js/controllers/stock_controller.js
index f90317e..e4b0319 100644
--- a/public/js/controllers/stock_controller.js
+++ b/public/js/controllers/stock_controller.js
@@ -20,7 +20,7 @@
},
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,
diff --git a/setup/doctype/company/company.js b/setup/doctype/company/company.js
index 40e314c..a8358fa 100644
--- a/setup/doctype/company/company.js
+++ b/setup/doctype/company/company.js
@@ -59,7 +59,7 @@
}
}
-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": {
diff --git a/setup/doctype/company/company.txt b/setup/doctype/company/company.txt
index e147843..1ba1dde 100644
--- a/setup/doctype/company/company.txt
+++ b/setup/doctype/company/company.txt
@@ -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"
}
]
\ No newline at end of file
diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py
index 2dd1646..9659173 100644
--- a/setup/doctype/setup_control/setup_control.py
+++ b/setup/doctype/setup_control/setup_control.py
@@ -106,8 +106,8 @@
})
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"
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index f103879..550a447 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -33,8 +33,8 @@
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 @@
}
}
-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];
diff --git a/stock/doctype/delivery_note/test_delivery_note.py b/stock/doctype/delivery_note/test_delivery_note.py
index 43378a1..2b4bfa5 100644
--- a/stock/doctype/delivery_note/test_delivery_note.py
+++ b/stock/doctype/delivery_note/test_delivery_note.py
@@ -41,8 +41,8 @@
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 @@
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 @@
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 @@
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
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index 1040d64..8ebad15 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -10,7 +10,7 @@
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
diff --git a/stock/doctype/purchase_receipt/test_purchase_receipt.py b/stock/doctype/purchase_receipt/test_purchase_receipt.py
index a0c72d9..9bb1495 100644
--- a/stock/doctype/purchase_receipt/test_purchase_receipt.py
+++ b/stock/doctype/purchase_receipt/test_purchase_receipt.py
@@ -12,7 +12,7 @@
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 @@
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 @@
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 @@
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`")
diff --git a/stock/doctype/serial_no/serial_no.txt b/stock/doctype/serial_no/serial_no.txt
index a2fa18f..8500303 100644
--- a/stock/doctype/serial_no/serial_no.txt
+++ b/stock/doctype/serial_no/serial_no.txt
@@ -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",
@@ -168,14 +169,6 @@
"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",
"fieldtype": "Section Break",
@@ -317,6 +310,18 @@
},
{
"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",
"fieldtype": "Column Break",
"read_only": 0,
@@ -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
}
]
\ No newline at end of file
diff --git a/stock/doctype/stock_entry/stock_entry.js b/stock/doctype/stock_entry/stock_entry.js
index 01c28d8..d8983d5 100644
--- a/stock/doctype/stock_entry/stock_entry.js
+++ b/stock/doctype/stock_entry/stock_entry.js
@@ -38,7 +38,7 @@
}
};
- 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() {
diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py
index 10b2e75..cee231e 100644
--- a/stock/doctype/stock_entry/test_stock_entry.py
+++ b/stock/doctype/stock_entry/test_stock_entry.py
@@ -11,7 +11,7 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
["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])
diff --git a/stock/doctype/stock_entry_detail/stock_entry_detail.txt b/stock/doctype/stock_entry_detail/stock_entry_detail.txt
index a665edc..051eb7c 100644
--- a/stock/doctype/stock_entry_detail/stock_entry_detail.txt
+++ b/stock/doctype/stock_entry_detail/stock_entry_detail.txt
@@ -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",
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.js b/stock/doctype/stock_reconciliation/stock_reconciliation.js
index 1847864..7373648 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.js
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.js
@@ -12,7 +12,7 @@
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 @@
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");
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.py b/stock/doctype/stock_reconciliation/stock_reconciliation.py
index 6b2855a..f36daad 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.py
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.py
@@ -303,7 +303,7 @@
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:
diff --git a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
index df9e229..0434f82 100644
--- a/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
+++ b/stock/doctype/stock_reconciliation/test_stock_reconciliation.py
@@ -13,7 +13,7 @@
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 @@
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 @@
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 @@
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 @@
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):