fixed asset fixes
diff --git a/erpnext/accounts/doctype/asset/asset.py b/erpnext/accounts/doctype/asset/asset.py
index def9ae9..d6547a6 100644
--- a/erpnext/accounts/doctype/asset/asset.py
+++ b/erpnext/accounts/doctype/asset/asset.py
@@ -101,7 +101,7 @@
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)
diff --git a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
index 7d9745b..2699f44 100644
--- a/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/erpnext/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -266,15 +266,18 @@
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 = \
diff --git a/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
index fff8982..35b83aa 100644
--- a/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
+++ b/erpnext/docs/user/manual/en/accounts/managing-fixed-assets.md
@@ -28,7 +28,7 @@
- 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