mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-04 05:58:27 +00:00
@@ -37,19 +37,24 @@
|
|||||||
"Capital Equipments": {
|
"Capital Equipments": {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
"Computers": {
|
"Electronic Equipments": {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
"Furniture and Fixture": {
|
"Furnitures and Fixtures": {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
"Office Equipments": {
|
"Office Equipments": {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
"Plant and Machinery": {
|
"Plants and Machineries": {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
"Accumulated Depreciations": {}
|
"Buildings": {
|
||||||
|
"account_type": "Fixed Asset"
|
||||||
|
},
|
||||||
|
"Accumulated Depreciations": {
|
||||||
|
"account_type": "Accumulated Depreciation"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"Investments": {
|
"Investments": {
|
||||||
"is_group": 1
|
"is_group": 1
|
||||||
@@ -72,67 +77,37 @@
|
|||||||
},
|
},
|
||||||
"Stock Adjustment": {
|
"Stock Adjustment": {
|
||||||
"account_type": "Stock Adjustment"
|
"account_type": "Stock Adjustment"
|
||||||
},
|
}
|
||||||
"account_type": "Expense Account"
|
}
|
||||||
},
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
},
|
||||||
"Indirect Expenses": {
|
"Indirect Expenses": {
|
||||||
"Administrative Expenses": {
|
"Administrative Expenses": {},
|
||||||
"account_type": "Expense Account"
|
"Commission on Sales": {},
|
||||||
},
|
|
||||||
"Commission on Sales": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Depreciation": {
|
"Depreciation": {
|
||||||
"account_type": "Expense Account"
|
"account_type": "Depreciation"
|
||||||
},
|
|
||||||
"Entertainment Expenses": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
},
|
||||||
|
"Entertainment Expenses": {},
|
||||||
"Freight and Forwarding Charges": {
|
"Freight and Forwarding Charges": {
|
||||||
"account_type": "Chargeable"
|
"account_type": "Chargeable"
|
||||||
},
|
},
|
||||||
"Legal Expenses": {
|
"Legal Expenses": {},
|
||||||
"account_type": "Expense Account"
|
"Marketing Expenses": {},
|
||||||
},
|
"Miscellaneous Expenses": {},
|
||||||
"Marketing Expenses": {
|
"Office Maintenance Expenses": {},
|
||||||
"account_type": "Chargeable"
|
"Office Rent": {},
|
||||||
},
|
"Postal Expenses": {},
|
||||||
"Miscellaneous Expenses": {
|
"Print and Stationary": {},
|
||||||
"account_type": "Chargeable"
|
|
||||||
},
|
|
||||||
"Office Maintenance Expenses": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Office Rent": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Postal Expenses": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Print and Stationary": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Rounded Off": {
|
"Rounded Off": {
|
||||||
"account_type": "Expense Account"
|
"account_type": "Round Off"
|
||||||
},
|
},
|
||||||
"Salary": {
|
"Salary": {},
|
||||||
"account_type": "Expense Account"
|
"Sales Expenses": {},
|
||||||
},
|
"Telephone Expenses": {},
|
||||||
"Sales Expenses": {
|
"Travel Expenses": {},
|
||||||
"account_type": "Expense Account"
|
"Utility Expenses": {},
|
||||||
},
|
"Write Off": {},
|
||||||
"Telephone Expenses": {
|
"Exchange Gain/Loss": {},
|
||||||
"account_type": "Expense Account"
|
"Gain/Loss on Asset Disposal": {}
|
||||||
},
|
|
||||||
"Travel Expenses": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"Utility Expenses": {
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
|
||||||
"account_type": "Expense Account"
|
|
||||||
},
|
},
|
||||||
"root_type": "Expense"
|
"root_type": "Expense"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -41,18 +41,24 @@ def get():
|
|||||||
_("Capital Equipments"): {
|
_("Capital Equipments"): {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
_("Computers"): {
|
_("Electronic Equipments"): {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
_("Furniture and Fixture"): {
|
_("Furnitures and Fixtures"): {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
_("Office Equipments"): {
|
_("Office Equipments"): {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
_("Plant and Machinery"): {
|
_("Plants and Machineries"): {
|
||||||
"account_type": "Fixed Asset"
|
"account_type": "Fixed Asset"
|
||||||
},
|
},
|
||||||
|
_("Buildings"): {
|
||||||
|
"account_type": "Fixed Asset"
|
||||||
|
},
|
||||||
|
_("Softwares"): {
|
||||||
|
"account_type": "Fixed Asset"
|
||||||
|
},
|
||||||
_("Accumulated Depreciation"): {
|
_("Accumulated Depreciation"): {
|
||||||
"account_type": "Accumulated Depreciation"
|
"account_type": "Accumulated Depreciation"
|
||||||
}
|
}
|
||||||
@@ -109,7 +115,10 @@ def get():
|
|||||||
_("Sales Expenses"): {},
|
_("Sales Expenses"): {},
|
||||||
_("Telephone Expenses"): {},
|
_("Telephone Expenses"): {},
|
||||||
_("Travel Expenses"): {},
|
_("Travel Expenses"): {},
|
||||||
_("Utility Expenses"): {}
|
_("Utility Expenses"): {},
|
||||||
|
_("Write Off"): {},
|
||||||
|
_("Exchange Gain/Loss"): {},
|
||||||
|
_("Gain/Loss on Asset Disposal"): {}
|
||||||
},
|
},
|
||||||
"root_type": "Expense"
|
"root_type": "Expense"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ class Asset(Document):
|
|||||||
def validate(self):
|
def validate(self):
|
||||||
self.status = self.get_status()
|
self.status = self.get_status()
|
||||||
self.validate_item()
|
self.validate_item()
|
||||||
|
self.set_missing_values()
|
||||||
self.validate_asset_values()
|
self.validate_asset_values()
|
||||||
self.set_depreciation_settings()
|
|
||||||
self.make_depreciation_schedule()
|
self.make_depreciation_schedule()
|
||||||
self.validate_expected_value_after_useful_life()
|
self.validate_expected_value_after_useful_life()
|
||||||
# Validate depreciation related accounts
|
# Validate depreciation related accounts
|
||||||
@@ -41,10 +41,18 @@ class Asset(Document):
|
|||||||
frappe.throw(_("Item {0} must be a Fixed Asset Item").format(self.item_code))
|
frappe.throw(_("Item {0} must be a Fixed Asset Item").format(self.item_code))
|
||||||
elif item.is_stock_item:
|
elif item.is_stock_item:
|
||||||
frappe.throw(_("Item {0} must be a non-stock item").format(self.item_code))
|
frappe.throw(_("Item {0} must be a non-stock item").format(self.item_code))
|
||||||
|
|
||||||
|
def set_missing_values(self):
|
||||||
|
if self.item_code:
|
||||||
|
item_details = get_item_details(self.item_code)
|
||||||
|
for field, value in item_details.items():
|
||||||
|
if not self.get(field):
|
||||||
|
self.set(field, value)
|
||||||
|
|
||||||
|
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||||
|
flt(self.opening_accumulated_depreciation))
|
||||||
|
|
||||||
def validate_asset_values(self):
|
def validate_asset_values(self):
|
||||||
self.value_after_depreciation = flt(self.gross_purchase_amount) - flt(self.opening_accumulated_depreciation)
|
|
||||||
|
|
||||||
if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
|
if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
|
||||||
frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
|
frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
|
||||||
|
|
||||||
@@ -77,15 +85,6 @@ class Asset(Document):
|
|||||||
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
|
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
|
||||||
and not self.next_depreciation_date):
|
and not self.next_depreciation_date):
|
||||||
frappe.throw(_("Please set Next Depreciation Date"))
|
frappe.throw(_("Please set Next Depreciation Date"))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def set_depreciation_settings(self):
|
|
||||||
asset_category = frappe.get_doc("Asset Category", self.asset_category)
|
|
||||||
|
|
||||||
for field in ("depreciation_method", "total_number_of_depreciations", "frequency_of_depreciation"):
|
|
||||||
if not self.get(field):
|
|
||||||
self.set(field, asset_category.get(field))
|
|
||||||
|
|
||||||
def make_depreciation_schedule(self):
|
def make_depreciation_schedule(self):
|
||||||
self.schedules = []
|
self.schedules = []
|
||||||
|
|||||||
@@ -519,7 +519,7 @@ class JournalEntry(AccountsController):
|
|||||||
|
|
||||||
if (d.party_type, d.party) not in party_balance:
|
if (d.party_type, d.party) not in party_balance:
|
||||||
party_balance[(d.party_type, d.party)] = get_balance_on(party_type=d.party_type,
|
party_balance[(d.party_type, d.party)] = get_balance_on(party_type=d.party_type,
|
||||||
party=d.party, date=self.posting_date)
|
party=d.party, date=self.posting_date, company=self.company)
|
||||||
|
|
||||||
d.account_balance = account_balance[d.account]
|
d.account_balance = account_balance[d.account]
|
||||||
d.party_balance = party_balance[(d.party_type, d.party)]
|
d.party_balance = party_balance[(d.party_type, d.party)]
|
||||||
@@ -553,6 +553,7 @@ def get_default_bank_cash_account(company, account_type=None, mode_of_payment=No
|
|||||||
"account_currency": account_details.account_currency,
|
"account_currency": account_details.account_currency,
|
||||||
"account_type": account_details.account_type
|
"account_type": account_details.account_type
|
||||||
})
|
})
|
||||||
|
else: return frappe._dict()
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_payment_entry_against_order(dt, dn, amount=None, debit_in_account_currency=None, journal_entry=False, bank_account=None):
|
def get_payment_entry_against_order(dt, dn, amount=None, debit_in_account_currency=None, journal_entry=False, bank_account=None):
|
||||||
@@ -754,7 +755,7 @@ def get_party_account_and_balance(company, party_type, party):
|
|||||||
account = get_party_account(party_type, party, company)
|
account = get_party_account(party_type, party, company)
|
||||||
|
|
||||||
account_balance = get_balance_on(account=account)
|
account_balance = get_balance_on(account=account)
|
||||||
party_balance = get_balance_on(party_type=party_type, party=party)
|
party_balance = get_balance_on(party_type=party_type, party=party, company=company)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"account": account,
|
"account": account,
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ class PaymentEntry(AccountsController):
|
|||||||
if self.party:
|
if self.party:
|
||||||
if not self.party_balance:
|
if not self.party_balance:
|
||||||
self.party_balance = get_balance_on(party_type=self.party_type,
|
self.party_balance = get_balance_on(party_type=self.party_type,
|
||||||
party=self.party, date=self.posting_date)
|
party=self.party, date=self.posting_date, company=self.company)
|
||||||
|
|
||||||
if not self.party_account:
|
if not self.party_account:
|
||||||
party_account = get_party_account(self.party_type, self.party, self.company)
|
party_account = get_party_account(self.party_type, self.party, self.company)
|
||||||
@@ -251,7 +251,7 @@ class PaymentEntry(AccountsController):
|
|||||||
self.unallocated_amount = party_amount - self.total_allocated_amount
|
self.unallocated_amount = party_amount - self.total_allocated_amount
|
||||||
|
|
||||||
def set_difference_amount(self):
|
def set_difference_amount(self):
|
||||||
base_unallocated_amount = self.unallocated_amount * \
|
base_unallocated_amount = flt(self.unallocated_amount) * \
|
||||||
(self.source_exchange_rate if self.payment_type=="Receive" else self.target_exchange_rate)
|
(self.source_exchange_rate if self.payment_type=="Receive" else self.target_exchange_rate)
|
||||||
|
|
||||||
base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount)
|
base_party_amount = flt(self.base_total_allocated_amount) + flt(base_unallocated_amount)
|
||||||
@@ -669,9 +669,10 @@ def get_payment_entry(dt, dn, party_amount=None, bank_account=None, bank_amount=
|
|||||||
"outstanding_amount": outstanding_amount,
|
"outstanding_amount": outstanding_amount,
|
||||||
"allocated_amount": outstanding_amount
|
"allocated_amount": outstanding_amount
|
||||||
})
|
})
|
||||||
|
|
||||||
pe.setup_party_account_field()
|
pe.setup_party_account_field()
|
||||||
pe.set_missing_values()
|
pe.set_missing_values()
|
||||||
pe.set_exchange_rate()
|
if bank:
|
||||||
pe.set_amounts()
|
pe.set_exchange_rate()
|
||||||
|
pe.set_amounts()
|
||||||
return pe
|
return pe
|
||||||
@@ -53,7 +53,7 @@ def validate_fiscal_year(date, fiscal_year, label=_("Date"), doc=None):
|
|||||||
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
|
throw(_("{0} '{1}' not in Fiscal Year {2}").format(label, formatdate(date), fiscal_year))
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def get_balance_on(account=None, date=None, party_type=None, party=None, in_account_currency=True):
|
def get_balance_on(account=None, date=None, party_type=None, party=None, company=None, in_account_currency=True):
|
||||||
if not account and frappe.form_dict.get("account"):
|
if not account and frappe.form_dict.get("account"):
|
||||||
account = frappe.form_dict.get("account")
|
account = frappe.form_dict.get("account")
|
||||||
if not date and frappe.form_dict.get("date"):
|
if not date and frappe.form_dict.get("date"):
|
||||||
@@ -110,6 +110,9 @@ def get_balance_on(account=None, date=None, party_type=None, party=None, in_acco
|
|||||||
if party_type and party:
|
if party_type and party:
|
||||||
cond.append("""gle.party_type = "%s" and gle.party = "%s" """ %
|
cond.append("""gle.party_type = "%s" and gle.party = "%s" """ %
|
||||||
(frappe.db.escape(party_type), frappe.db.escape(party, percent=False)))
|
(frappe.db.escape(party_type), frappe.db.escape(party, percent=False)))
|
||||||
|
|
||||||
|
if company:
|
||||||
|
cond.append("""gle.company = "%s" """ % (frappe.db.escape(company, percent=False)))
|
||||||
|
|
||||||
if account or (party_type and party):
|
if account or (party_type and party):
|
||||||
if in_account_currency:
|
if in_account_currency:
|
||||||
|
|||||||
@@ -179,6 +179,7 @@ erpnext.production_order = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frm.fields_dict.source_warehouse.get_query = company_filter;
|
||||||
frm.fields_dict.fg_warehouse.get_query = company_filter;
|
frm.fields_dict.fg_warehouse.get_query = company_filter;
|
||||||
frm.fields_dict.wip_warehouse.get_query = company_filter;
|
frm.fields_dict.wip_warehouse.get_query = company_filter;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -20,7 +20,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 1,
|
||||||
"label": "Receipt Document Type",
|
"label": "Receipt Document Type",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
@@ -124,7 +124,7 @@
|
|||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 0,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 1,
|
"in_list_view": 0,
|
||||||
"label": "Posting Date",
|
"label": "Posting Date",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 0,
|
||||||
@@ -173,7 +173,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 1,
|
"istable": 1,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2016-07-11 03:28:01.870042",
|
"modified": "2016-07-20 10:49:34.228751",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Landed Cost Purchase Receipt",
|
"name": "Landed Cost Purchase Receipt",
|
||||||
@@ -182,5 +182,6 @@
|
|||||||
"quick_entry": 0,
|
"quick_entry": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
|
"sort_order": "ASC",
|
||||||
"track_seen": 0
|
"track_seen": 0
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user