mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-27 08:54:45 +00:00
Added default asset accounts in COA, CWIP account in asset category
This commit is contained in:
@@ -63,7 +63,10 @@ def get():
|
|||||||
},
|
},
|
||||||
_("Accumulated Depreciation"): {
|
_("Accumulated Depreciation"): {
|
||||||
"account_type": "Accumulated Depreciation"
|
"account_type": "Accumulated Depreciation"
|
||||||
}
|
},
|
||||||
|
_("CWIP Account"): {
|
||||||
|
"account_type": "Capital Work in Progress",
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_("Investments"): {
|
_("Investments"): {
|
||||||
"is_group": 1
|
"is_group": 1
|
||||||
@@ -81,6 +84,9 @@ def get():
|
|||||||
_("Cost of Goods Sold"): {
|
_("Cost of Goods Sold"): {
|
||||||
"account_type": "Cost of Goods Sold"
|
"account_type": "Cost of Goods Sold"
|
||||||
},
|
},
|
||||||
|
_("Expenses Included In Asset Valuation"): {
|
||||||
|
"account_type": "Expenses Included In Asset Valuation"
|
||||||
|
},
|
||||||
_("Expenses Included In Valuation"): {
|
_("Expenses Included In Valuation"): {
|
||||||
"account_type": "Expenses Included In Valuation"
|
"account_type": "Expenses Included In Valuation"
|
||||||
},
|
},
|
||||||
@@ -146,6 +152,9 @@ def get():
|
|||||||
_("Stock Received But Not Billed"): {
|
_("Stock Received But Not Billed"): {
|
||||||
"account_type": "Stock Received But Not Billed"
|
"account_type": "Stock Received But Not Billed"
|
||||||
},
|
},
|
||||||
|
_("Asset Received But Not Billed"): {
|
||||||
|
"account_type": "Asset Received But Not Billed"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_("Duties and Taxes"): {
|
_("Duties and Taxes"): {
|
||||||
"account_type": "Tax",
|
"account_type": "Tax",
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ def get():
|
|||||||
"account_type": "Accumulated Depreciation",
|
"account_type": "Accumulated Depreciation",
|
||||||
"account_number": "1780"
|
"account_number": "1780"
|
||||||
},
|
},
|
||||||
|
_("CWIP Account"): {
|
||||||
|
"account_type": "Capital Work in Progress",
|
||||||
|
"account_number": "1790"
|
||||||
|
},
|
||||||
"account_number": "1700"
|
"account_number": "1700"
|
||||||
},
|
},
|
||||||
_("Investments"): {
|
_("Investments"): {
|
||||||
@@ -108,6 +112,10 @@ def get():
|
|||||||
"account_type": "Cost of Goods Sold",
|
"account_type": "Cost of Goods Sold",
|
||||||
"account_number": "5111"
|
"account_number": "5111"
|
||||||
},
|
},
|
||||||
|
_("Expenses Included In Asset Valuation"): {
|
||||||
|
"account_type": "Expenses Included In Asset Valuation",
|
||||||
|
"account_number": "5112"
|
||||||
|
},
|
||||||
_("Expenses Included In Valuation"): {
|
_("Expenses Included In Valuation"): {
|
||||||
"account_type": "Expenses Included In Valuation",
|
"account_type": "Expenses Included In Valuation",
|
||||||
"account_number": "5118"
|
"account_number": "5118"
|
||||||
@@ -228,6 +236,10 @@ def get():
|
|||||||
"account_type": "Stock Received But Not Billed",
|
"account_type": "Stock Received But Not Billed",
|
||||||
"account_number": "2210"
|
"account_number": "2210"
|
||||||
},
|
},
|
||||||
|
_("Asset Received But Not Billed"): {
|
||||||
|
"account_type": "Asset Received But Not Billed",
|
||||||
|
"account_number": "2211"
|
||||||
|
},
|
||||||
"account_number": "2200"
|
"account_number": "2200"
|
||||||
},
|
},
|
||||||
_("Duties and Taxes"): {
|
_("Duties and Taxes"): {
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ from erpnext.accounts.general_ledger import get_round_off_account_and_cost_cente
|
|||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_invoice,\
|
from erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_invoice,\
|
||||||
unlink_inter_company_invoice
|
unlink_inter_company_invoice
|
||||||
|
from erpnext.assets.doctype.asset_category.asset_category import get_cwip_account
|
||||||
|
|
||||||
form_grid_templates = {
|
form_grid_templates = {
|
||||||
"items": "templates/form_grid/item_grid.html"
|
"items": "templates/form_grid/item_grid.html"
|
||||||
@@ -423,7 +424,7 @@ class PurchaseInvoice(BuyingController):
|
|||||||
"credit": flt(item.rm_supp_cost)
|
"credit": flt(item.rm_supp_cost)
|
||||||
}, warehouse_account[self.supplier_warehouse]["account_currency"]))
|
}, warehouse_account[self.supplier_warehouse]["account_currency"]))
|
||||||
|
|
||||||
elif item.is_fixed_asset and not self.update_stock:
|
elif item.is_fixed_asset:
|
||||||
asset_accounts = self.get_company_default(["asset_received_but_not_billed",
|
asset_accounts = self.get_company_default(["asset_received_but_not_billed",
|
||||||
"expenses_included_in_asset_valuation", "capital_work_in_progress_account"])
|
"expenses_included_in_asset_valuation", "capital_work_in_progress_account"])
|
||||||
|
|
||||||
@@ -432,7 +433,6 @@ class PurchaseInvoice(BuyingController):
|
|||||||
|
|
||||||
if not self.update_stock:
|
if not self.update_stock:
|
||||||
asset_rbnb_currency = get_account_currency(asset_accounts[0])
|
asset_rbnb_currency = get_account_currency(asset_accounts[0])
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": asset_accounts[0],
|
"account": asset_accounts[0],
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
@@ -442,10 +442,10 @@ class PurchaseInvoice(BuyingController):
|
|||||||
if asset_rbnb_currency == self.company_currency else asset_amount)
|
if asset_rbnb_currency == self.company_currency else asset_amount)
|
||||||
}))
|
}))
|
||||||
else:
|
else:
|
||||||
cwip_account_currency = get_account_currency(asset_accounts[2])
|
cwip_account = get_cwip_account(item.item_code, self.company) or asset_accounts[2]
|
||||||
|
cwip_account_currency = get_account_currency(cwip_account)
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": asset_accounts[2],
|
"account": cwip_account,
|
||||||
"against": self.supplier,
|
"against": self.supplier,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
"debit": base_asset_amount,
|
"debit": base_asset_amount,
|
||||||
@@ -453,18 +453,18 @@ class PurchaseInvoice(BuyingController):
|
|||||||
if cwip_account_currency == self.company_currency else asset_amount)
|
if cwip_account_currency == self.company_currency else asset_amount)
|
||||||
}))
|
}))
|
||||||
|
|
||||||
asset_eiiav_currency = get_account_currency(asset_accounts[0])
|
if item.item_tax_amount:
|
||||||
gl_entries.append(self.get_gl_dict({
|
asset_eiiav_currency = get_account_currency(asset_accounts[0])
|
||||||
"account": asset_accounts[1],
|
gl_entries.append(self.get_gl_dict({
|
||||||
"against": self.supplier,
|
"account": asset_accounts[1],
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"against": self.supplier,
|
||||||
"cost_center": item.cost_center,
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
"credit": item.item_tax_amount,
|
"cost_center": item.cost_center,
|
||||||
"credit_in_account_currency": (item.item_tax_amount
|
"credit": item.item_tax_amount,
|
||||||
if asset_eiiav_currency == self.company_currency else
|
"credit_in_account_currency": (item.item_tax_amount
|
||||||
item.item_tax_amount / self.conversion_rate)
|
if asset_eiiav_currency == self.company_currency else
|
||||||
}))
|
item.item_tax_amount / self.conversion_rate)
|
||||||
|
}))
|
||||||
else:
|
else:
|
||||||
gl_entries.append(
|
gl_entries.append(
|
||||||
self.get_gl_dict({
|
self.get_gl_dict({
|
||||||
|
|||||||
@@ -40,5 +40,16 @@ frappe.ui.form.on('Asset Category', {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
frm.set_query('capital_work_in_progress_account', 'accounts', function(doc, cdt, cdn) {
|
||||||
|
var d = locals[cdt][cdn];
|
||||||
|
return {
|
||||||
|
"filters": {
|
||||||
|
"account_type": "Capital Work in Progress",
|
||||||
|
"is_group": 0,
|
||||||
|
"company": d.company_name
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -13,3 +13,10 @@ class AssetCategory(Document):
|
|||||||
for field in ("total_number_of_depreciations", "frequency_of_depreciation"):
|
for field in ("total_number_of_depreciations", "frequency_of_depreciation"):
|
||||||
if cint(self.get(field))<1:
|
if cint(self.get(field))<1:
|
||||||
frappe.throw(_("{0} must be greater than 0").format(self.meta.get_label(field)), frappe.MandatoryError)
|
frappe.throw(_("{0} must be greater than 0").format(self.meta.get_label(field)), frappe.MandatoryError)
|
||||||
|
|
||||||
|
def get_cwip_account(item_code, company):
|
||||||
|
asset_category = frappe.db.get_value('Item', item_code, 'asset_category')
|
||||||
|
cwip_account = frappe.db.get_value('Asset Category Account',
|
||||||
|
{'parent': asset_category, 'company_name': company}, 'capital_work_in_progress_account')
|
||||||
|
|
||||||
|
return cwip_account or None
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -72,6 +73,7 @@
|
|||||||
"reqd": 1,
|
"reqd": 1,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -103,6 +105,7 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -134,6 +137,39 @@
|
|||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_bulk_edit": 0,
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"columns": 0,
|
||||||
|
"fieldname": "capital_work_in_progress_account",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_global_search": 0,
|
||||||
|
"in_list_view": 1,
|
||||||
|
"in_standard_filter": 0,
|
||||||
|
"label": "Capital Work In Progress Account",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Account",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"remember_last_selected_value": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"translatable": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
@@ -147,7 +183,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-11-28 16:54:12.252271",
|
"modified": "2018-05-08 11:41:09.678234",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Category Account",
|
"name": "Asset Category Account",
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ class Company(NestedSet):
|
|||||||
self._set_default_account("round_off_account", "Round Off")
|
self._set_default_account("round_off_account", "Round Off")
|
||||||
self._set_default_account("accumulated_depreciation_account", "Accumulated Depreciation")
|
self._set_default_account("accumulated_depreciation_account", "Accumulated Depreciation")
|
||||||
self._set_default_account("depreciation_expense_account", "Depreciation")
|
self._set_default_account("depreciation_expense_account", "Depreciation")
|
||||||
|
self._set_default_account("capital_work_in_progress_account", "Capital Work in Progress")
|
||||||
|
self._set_default_account("asset_received_but_not_billed", "Asset Received But Not Billed")
|
||||||
|
self._set_default_account("expenses_included_in_asset_valuation", "Expenses Included In Asset Valuation")
|
||||||
|
|
||||||
if self.enable_perpetual_inventory:
|
if self.enable_perpetual_inventory:
|
||||||
self._set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed")
|
self._set_default_account("stock_received_but_not_billed", "Stock Received But Not Billed")
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ from erpnext.controllers.buying_controller import BuyingController
|
|||||||
from erpnext.accounts.utils import get_account_currency
|
from erpnext.accounts.utils import get_account_currency
|
||||||
from frappe.desk.notifications import clear_doctype_notifications
|
from frappe.desk.notifications import clear_doctype_notifications
|
||||||
from erpnext.buying.utils import check_for_closed_status
|
from erpnext.buying.utils import check_for_closed_status
|
||||||
|
from erpnext.assets.doctype.asset_category.asset_category import get_cwip_account
|
||||||
|
|
||||||
form_grid_templates = {
|
form_grid_templates = {
|
||||||
"items": "templates/form_grid/item_grid.html"
|
"items": "templates/form_grid/item_grid.html"
|
||||||
@@ -258,12 +259,14 @@ class PurchaseReceipt(BuyingController):
|
|||||||
"asset_received_but_not_billed"])
|
"asset_received_but_not_billed"])
|
||||||
|
|
||||||
# CWIP entry
|
# CWIP entry
|
||||||
|
cwip_account = get_cwip_account(d.item_code, self.company) or asset_accounts[0]
|
||||||
|
|
||||||
asset_amount = flt(d.net_amount) + flt(d.item_tax_amount/self.conversion_rate)
|
asset_amount = flt(d.net_amount) + flt(d.item_tax_amount/self.conversion_rate)
|
||||||
base_asset_amount = flt(d.base_net_amount + d.item_tax_amount)
|
base_asset_amount = flt(d.base_net_amount + d.item_tax_amount)
|
||||||
|
|
||||||
cwip_account_currency = get_account_currency(asset_accounts[0])
|
cwip_account_currency = get_account_currency(cwip_account)
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": asset_accounts[0],
|
"account": cwip_account,
|
||||||
"against": asset_accounts[1],
|
"against": asset_accounts[1],
|
||||||
"cost_center": d.cost_center,
|
"cost_center": d.cost_center,
|
||||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||||
|
|||||||
Reference in New Issue
Block a user