Merge pull request #14092 from rohitwaghchaure/enterprise_develop_asset_fixes_for_perpetual

[Fix] Asset gl entry not creating for non perpetual
This commit is contained in:
rohitwaghchaure
2018-05-16 18:21:20 +05:30
committed by GitHub
7 changed files with 152 additions and 88 deletions

View File

@@ -639,10 +639,10 @@ class AccountsController(TransactionBase):
frappe.throw(_("Row #{0}: Asset {1} must be submitted").format(d.idx, d.asset))
elif self.doctype == "Purchase Invoice":
if asset.status != "Submitted":
frappe.throw(_("Row #{0}: Asset {1} is already {2}")
.format(d.idx, d.asset, asset.status))
elif getdate(asset.purchase_date) != getdate(self.posting_date):
# if asset.status != "Submitted":
# frappe.throw(_("Row #{0}: Asset {1} is already {2}")
# .format(d.idx, d.asset, asset.status))
if getdate(asset.purchase_date) != getdate(self.posting_date):
frappe.throw(_("Row #{0}: Posting Date must be same as purchase date {1} of asset {2}").format(d.idx, asset.purchase_date, d.asset))
elif asset.is_existing_asset:
frappe.throw(_("Row #{0}: Purchase Invoice cannot be made against an existing asset {1}").format(d.idx, d.asset))

View File

@@ -33,6 +33,10 @@ class StockController(AccountsController):
items, warehouses = self.get_items_and_warehouses()
update_gl_entries_after(self.posting_date, self.posting_time, warehouses, items,
warehouse_account)
elif self.doctype in ['Purchase Receipt', 'Purchase Invoice']:
gl_entries = []
gl_entries = self.get_asset_gl_entry(gl_entries)
make_gl_entries(gl_entries, from_repost=from_repost)
def get_gl_entries(self, warehouse_account=None, default_expense_account=None,
default_cost_center=None):