Added default asset accounts in COA, CWIP account in asset category
This commit is contained in:
parent
255cd44aba
commit
f41e1ed191
@ -63,7 +63,10 @@ def get():
|
||||
},
|
||||
_("Accumulated Depreciation"): {
|
||||
"account_type": "Accumulated Depreciation"
|
||||
}
|
||||
},
|
||||
_("CWIP Account"): {
|
||||
"account_type": "Capital Work in Progress",
|
||||
}
|
||||
},
|
||||
_("Investments"): {
|
||||
"is_group": 1
|
||||
@ -81,6 +84,9 @@ def get():
|
||||
_("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"): {
|
||||
"account_type": "Expenses Included In Valuation"
|
||||
},
|
||||
@ -146,6 +152,9 @@ def get():
|
||||
_("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"): {
|
||||
"account_type": "Tax",
|
||||
|
@ -85,6 +85,10 @@ def get():
|
||||
"account_type": "Accumulated Depreciation",
|
||||
"account_number": "1780"
|
||||
},
|
||||
_("CWIP Account"): {
|
||||
"account_type": "Capital Work in Progress",
|
||||
"account_number": "1790"
|
||||
},
|
||||
"account_number": "1700"
|
||||
},
|
||||
_("Investments"): {
|
||||
@ -108,6 +112,10 @@ def get():
|
||||
"account_type": "Cost of Goods Sold",
|
||||
"account_number": "5111"
|
||||
},
|
||||
_("Expenses Included In Asset Valuation"): {
|
||||
"account_type": "Expenses Included In Asset Valuation",
|
||||
"account_number": "5112"
|
||||
},
|
||||
_("Expenses Included In Valuation"): {
|
||||
"account_type": "Expenses Included In Valuation",
|
||||
"account_number": "5118"
|
||||
@ -228,6 +236,10 @@ def get():
|
||||
"account_type": "Stock Received But Not Billed",
|
||||
"account_number": "2210"
|
||||
},
|
||||
_("Asset Received But Not Billed"): {
|
||||
"account_type": "Asset Received But Not Billed",
|
||||
"account_number": "2211"
|
||||
},
|
||||
"account_number": "2200"
|
||||
},
|
||||
_("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 erpnext.accounts.doctype.sales_invoice.sales_invoice import validate_inter_company_party, update_linked_invoice,\
|
||||
unlink_inter_company_invoice
|
||||
from erpnext.assets.doctype.asset_category.asset_category import get_cwip_account
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@ -423,7 +424,7 @@ class PurchaseInvoice(BuyingController):
|
||||
"credit": flt(item.rm_supp_cost)
|
||||
}, 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",
|
||||
"expenses_included_in_asset_valuation", "capital_work_in_progress_account"])
|
||||
|
||||
@ -432,7 +433,6 @@ class PurchaseInvoice(BuyingController):
|
||||
|
||||
if not self.update_stock:
|
||||
asset_rbnb_currency = get_account_currency(asset_accounts[0])
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": asset_accounts[0],
|
||||
"against": self.supplier,
|
||||
@ -442,10 +442,10 @@ class PurchaseInvoice(BuyingController):
|
||||
if asset_rbnb_currency == self.company_currency else asset_amount)
|
||||
}))
|
||||
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({
|
||||
"account": asset_accounts[2],
|
||||
"account": cwip_account,
|
||||
"against": self.supplier,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||
"debit": base_asset_amount,
|
||||
@ -453,18 +453,18 @@ class PurchaseInvoice(BuyingController):
|
||||
if cwip_account_currency == self.company_currency else asset_amount)
|
||||
}))
|
||||
|
||||
asset_eiiav_currency = get_account_currency(asset_accounts[0])
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": asset_accounts[1],
|
||||
"against": self.supplier,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||
"cost_center": item.cost_center,
|
||||
"credit": item.item_tax_amount,
|
||||
"credit_in_account_currency": (item.item_tax_amount
|
||||
if asset_eiiav_currency == self.company_currency else
|
||||
item.item_tax_amount / self.conversion_rate)
|
||||
}))
|
||||
|
||||
if item.item_tax_amount:
|
||||
asset_eiiav_currency = get_account_currency(asset_accounts[0])
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": asset_accounts[1],
|
||||
"against": self.supplier,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||
"cost_center": item.cost_center,
|
||||
"credit": item.item_tax_amount,
|
||||
"credit_in_account_currency": (item.item_tax_amount
|
||||
if asset_eiiav_currency == self.company_currency else
|
||||
item.item_tax_amount / self.conversion_rate)
|
||||
}))
|
||||
else:
|
||||
gl_entries.append(
|
||||
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"):
|
||||
if cint(self.get(field))<1:
|
||||
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,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@ -72,6 +73,7 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@ -103,6 +105,7 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
@ -134,6 +137,39 @@
|
||||
"reqd": 0,
|
||||
"search_index": 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
|
||||
}
|
||||
],
|
||||
@ -147,7 +183,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2017-11-28 16:54:12.252271",
|
||||
"modified": "2018-05-08 11:41:09.678234",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Assets",
|
||||
"name": "Asset Category Account",
|
||||
|
@ -168,6 +168,9 @@ class Company(NestedSet):
|
||||
self._set_default_account("round_off_account", "Round Off")
|
||||
self._set_default_account("accumulated_depreciation_account", "Accumulated 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:
|
||||
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 frappe.desk.notifications import clear_doctype_notifications
|
||||
from erpnext.buying.utils import check_for_closed_status
|
||||
from erpnext.assets.doctype.asset_category.asset_category import get_cwip_account
|
||||
|
||||
form_grid_templates = {
|
||||
"items": "templates/form_grid/item_grid.html"
|
||||
@ -258,12 +259,14 @@ class PurchaseReceipt(BuyingController):
|
||||
"asset_received_but_not_billed"])
|
||||
|
||||
# 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)
|
||||
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({
|
||||
"account": asset_accounts[0],
|
||||
"account": cwip_account,
|
||||
"against": asset_accounts[1],
|
||||
"cost_center": d.cost_center,
|
||||
"remarks": self.get("remarks") or _("Accounting Entry for Asset"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user