mirror of
https://github.com/frappe/erpnext.git
synced 2026-03-02 18:14:50 +00:00
fix: validate if journal entry linked to schedule is in draft
(cherry picked from commit d5edca2022)
This commit is contained in:
@@ -128,6 +128,12 @@ class AssetDepreciationSchedule(Document):
|
||||
def cancel_depreciation_entries(self):
|
||||
for d in self.get("depreciation_schedule"):
|
||||
if d.journal_entry:
|
||||
if d.journal_entry == "Draft":
|
||||
frappe.throw(
|
||||
_(
|
||||
"Cannot cancel Asset Depreciation Schedule {0} as it has a draft journal entry {1}."
|
||||
).format(self.name, d.journal_entry)
|
||||
)
|
||||
frappe.get_doc("Journal Entry", d.journal_entry).cancel()
|
||||
|
||||
def on_cancel(self):
|
||||
|
||||
@@ -1,56 +0,0 @@
|
||||
[
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Price List",
|
||||
"price_list_rate": 100,
|
||||
"valid_from": "2017-04-18",
|
||||
"valid_upto": "2017-04-26"
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Price List Rest of the World",
|
||||
"price_list_rate": 10
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item 2",
|
||||
"price_list": "_Test Price List Rest of the World",
|
||||
"price_list_rate": 20,
|
||||
"valid_from": "2017-04-18",
|
||||
"valid_upto": "2017-04-26",
|
||||
"customer": "_Test Customer",
|
||||
"uom": "_Test UOM"
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"price_list": "_Test Price List",
|
||||
"price_list_rate": 1000,
|
||||
"valid_from": "2017-04-10",
|
||||
"valid_upto": "2017-04-17"
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item Home Desktop Manufactured",
|
||||
"price_list": "_Test Price List",
|
||||
"price_list_rate": 1000,
|
||||
"valid_from": "2017-04-10",
|
||||
"valid_upto": "2017-04-17"
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Buying Price List",
|
||||
"price_list_rate": 100,
|
||||
"supplier": "_Test Supplier"
|
||||
},
|
||||
{
|
||||
"doctype": "Item Price",
|
||||
"item_code": "_Test Item",
|
||||
"price_list": "_Test Selling Price List",
|
||||
"price_list_rate": 200,
|
||||
"customer": "_Test Customer"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user