Example #1
0
 def validate(self):
     self.status = self.get_status()
     self.validate_item()
     self.set_missing_values()
     self.validate_asset_values()
     if self.calculate_depreciation:
         self.make_depreciation_schedule()
         self.set_accumulated_depreciation()
         get_depreciation_accounts(self)
     if self.get("schedules"):
         self.validate_expected_value_after_useful_life()
Example #2
0
	def validate(self):
		self.status = self.get_status()
		self.validate_item()
		self.set_missing_values()
		self.validate_asset_values()
		if self.calculate_depreciation:
			self.make_depreciation_schedule()
			self.set_accumulated_depreciation()
			get_depreciation_accounts(self)
		if self.get("schedules"):
			self.validate_expected_value_after_useful_life()
Example #3
0
def make_journal_entry(asset_name):
	asset = frappe.get_doc("Asset", asset_name)
	fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
		get_depreciation_accounts(asset)

	depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
		["depreciation_cost_center", "series_for_depreciation_entry"])
	depreciation_cost_center = asset.cost_center or depreciation_cost_center

	je = frappe.new_doc("Journal Entry")
	je.voucher_type = "Depreciation Entry"
	je.naming_series = depreciation_series
	je.company = asset.company
	je.remark = "Depreciation Entry against asset {0}".format(asset_name)

	je.append("accounts", {
		"account": depreciation_expense_account,
		"reference_type": "Asset",
		"reference_name": asset.name,
		"cost_center": depreciation_cost_center
	})

	je.append("accounts", {
		"account": accumulated_depreciation_account,
		"reference_type": "Asset",
		"reference_name": asset.name
	})

	return je
Example #4
0
def make_journal_entry(asset_name):
	asset = frappe.get_doc("Asset", asset_name)
	fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
		get_depreciation_accounts(asset)

	depreciation_cost_center, depreciation_series = frappe.db.get_value("Company", asset.company,
		["depreciation_cost_center", "series_for_depreciation_entry"])
	depreciation_cost_center = asset.cost_center or depreciation_cost_center

	je = frappe.new_doc("Journal Entry")
	je.voucher_type = "Depreciation Entry"
	je.naming_series = depreciation_series
	je.company = asset.company
	je.remark = "Depreciation Entry against asset {0}".format(asset_name)

	je.append("accounts", {
		"account": depreciation_expense_account,
		"reference_type": "Asset",
		"reference_name": asset.name,
		"cost_center": depreciation_cost_center
	})

	je.append("accounts", {
		"account": accumulated_depreciation_account,
		"reference_type": "Asset",
		"reference_name": asset.name
	})

	return je
	def make_depreciation_entry(self):
		asset = frappe.get_doc("Asset", self.asset)
		fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
			get_depreciation_accounts(asset)

		depreciation_cost_center, depreciation_series = frappe.get_cached_value('Company',  asset.company, 
			["depreciation_cost_center", "series_for_depreciation_entry"])

		je = frappe.new_doc("Journal Entry")
		je.voucher_type = "Depreciation Entry"
		je.naming_series = depreciation_series
		je.posting_date = self.date
		je.company = self.company
		je.remark = "Depreciation Entry against {0} worth {1}".format(self.asset, self.difference_amount)

		je.append("accounts", {
			"account": accumulated_depreciation_account,
			"credit_in_account_currency": self.difference_amount,
			"cost_center": depreciation_cost_center or self.cost_center
		})

		je.append("accounts", {
			"account": depreciation_expense_account,
			"debit_in_account_currency": self.difference_amount,
			"cost_center": depreciation_cost_center or self.cost_center
		})

		je.flags.ignore_permissions = True
		je.submit()

		self.db_set("journal_entry", je.name)
    def make_depreciation_entry(self):
        asset = frappe.get_doc("Asset", self.asset)
        fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
         get_depreciation_accounts(asset)

        depreciation_cost_center, depreciation_series = frappe.get_cached_value(
            'Company', asset.company,
            ["depreciation_cost_center", "series_for_depreciation_entry"])

        je = frappe.new_doc("Journal Entry")
        je.voucher_type = "Depreciation Entry"
        je.naming_series = depreciation_series
        je.posting_date = self.date
        je.company = self.company
        je.remark = "Depreciation Entry against {0} worth {1}".format(
            self.asset, self.difference_amount)

        je.append(
            "accounts", {
                "account": accumulated_depreciation_account,
                "credit_in_account_currency": self.difference_amount,
                "cost_center": depreciation_cost_center or self.cost_center
            })

        je.append(
            "accounts", {
                "account": depreciation_expense_account,
                "debit_in_account_currency": self.difference_amount,
                "cost_center": depreciation_cost_center or self.cost_center
            })

        je.flags.ignore_permissions = True
        je.submit()

        self.db_set("journal_entry", je.name)
Example #7
0
    def make_depreciation_entry(self):
        asset = frappe.get_doc("Asset", self.asset)
        (
            fixed_asset_account,
            accumulated_depreciation_account,
            depreciation_expense_account,
        ) = get_depreciation_accounts(asset)

        depreciation_cost_center, depreciation_series = frappe.get_cached_value(
            "Company", asset.company,
            ["depreciation_cost_center", "series_for_depreciation_entry"])

        je = frappe.new_doc("Journal Entry")
        je.voucher_type = "Depreciation Entry"
        je.naming_series = depreciation_series
        je.posting_date = self.date
        je.company = self.company
        je.remark = "Depreciation Entry against {0} worth {1}".format(
            self.asset, self.difference_amount)
        je.finance_book = self.finance_book

        credit_entry = {
            "account": accumulated_depreciation_account,
            "credit_in_account_currency": self.difference_amount,
            "cost_center": depreciation_cost_center or self.cost_center,
        }

        debit_entry = {
            "account": depreciation_expense_account,
            "debit_in_account_currency": self.difference_amount,
            "cost_center": depreciation_cost_center or self.cost_center,
        }

        accounting_dimensions = get_checks_for_pl_and_bs_accounts()

        for dimension in accounting_dimensions:
            if dimension.get("mandatory_for_bs"):
                credit_entry.update({
                    dimension["fieldname"]:
                    self.get(dimension["fieldname"])
                    or dimension.get("default_dimension")
                })

            if dimension.get("mandatory_for_pl"):
                debit_entry.update({
                    dimension["fieldname"]:
                    self.get(dimension["fieldname"])
                    or dimension.get("default_dimension")
                })

        je.append("accounts", credit_entry)
        je.append("accounts", debit_entry)

        je.flags.ignore_permissions = True
        je.submit()

        self.db_set("journal_entry", je.name)