fixed asset fixes

This commit is contained in:
Nabin Hait 2016-03-29 11:41:46 +05:30
parent 7de15321c9
commit fb03b96992
3 changed files with 7 additions and 4 deletions

View File

@ -101,7 +101,7 @@ class Asset(Document):
d.db_set("journal_entry", None)
total_depreciation_amount += flt(d.depreciation_amount)
self.db_set("current_value", (self.current_value - total_depreciation_amount))
self.db_set("current_value", (self.current_value + total_depreciation_amount))
def validate_depreciation_settings_in_company(self):
company = frappe.get_doc("Company", self.company)

View File

@ -266,15 +266,18 @@ class PurchaseInvoice(BuyingController):
frappe.throw(_("Purchase Date of asset {0} does not match with Purchase Invoice date")
.format(d.asset))
if asset.supplier != self.supplier:
if asset.supplier and asset.supplier != self.supplier:
frappe.throw(_("Supplier of asset {0} does not match with the supplier in the Purchase Invoice").format(d.asset))
if asset.status != "Available":
if asset.status != "Submitted":
frappe.throw(_("Row #{0}: Asset {1} is already {2}")
.format(d.idx, d.asset, asset.status))
frappe.db.set_value("Asset", asset.name, "purchase_invoice",
(self.name if self.docstatus==1 else None))
if self.docstatus==1 and not asset.supplier:
frappe.db.set_value("Asset", asset.name, "supplier", self.supplier)
def make_gl_entries(self):
auto_accounting_for_stock = \

View File

@ -28,7 +28,7 @@ Explanation of the fields:
- Double Declining Method: An accelerated method of depreciation, it results in higher depreciation expense in the earlier years of ownership.
8. Number of Depreciations: The number of depreciations during the useful life. In case of existing assets which are partially depreciated, mention the number of pending depreciations.
9. Number of Months in a Period: The number of months between two depreciations.
10. Next Depreciation Date: Mention the next depreciation date, even if it is the first one.
10. Next Depreciation Date: Mention the next depreciation date, even if it is the first one. If depreciation already completed, leave it blank.
### Depreciations