mirror of
https://github.com/frappe/erpnext.git
synced 2026-04-14 12:25:09 +00:00
fix: post gl entry on completion date of asset repair
This commit is contained in:
@@ -74,6 +74,7 @@
|
|||||||
"fieldname": "completion_date",
|
"fieldname": "completion_date",
|
||||||
"fieldtype": "Datetime",
|
"fieldtype": "Datetime",
|
||||||
"label": "Completion Date",
|
"label": "Completion Date",
|
||||||
|
"mandatory_depends_on": "eval:doc.repair_status==\"Completed\"",
|
||||||
"no_copy": 1
|
"no_copy": 1
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -249,7 +250,7 @@
|
|||||||
"index_web_pages_for_search": 1,
|
"index_web_pages_for_search": 1,
|
||||||
"is_submittable": 1,
|
"is_submittable": 1,
|
||||||
"links": [],
|
"links": [],
|
||||||
"modified": "2025-06-29 22:30:00.589597",
|
"modified": "2025-07-29 15:14:34.044564",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset Repair",
|
"name": "Asset Repair",
|
||||||
@@ -287,6 +288,7 @@
|
|||||||
"write": 1
|
"write": 1
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"row_format": "Dynamic",
|
||||||
"sort_field": "modified",
|
"sort_field": "modified",
|
||||||
"sort_order": "DESC",
|
"sort_order": "DESC",
|
||||||
"states": [],
|
"states": [],
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class AssetRepair(AccountsController):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def validate_dates(self):
|
def validate_dates(self):
|
||||||
if self.completion_date and (self.failure_date > self.completion_date):
|
if self.completion_date and (getdate(self.failure_date) > getdate(self.completion_date)):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Completion Date can not be before Failure Date. Please adjust the dates accordingly.")
|
_("Completion Date can not be before Failure Date. Please adjust the dates accordingly.")
|
||||||
)
|
)
|
||||||
@@ -303,7 +303,7 @@ class AssetRepair(AccountsController):
|
|||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"posting_date": getdate(),
|
"posting_date": self.completion_date,
|
||||||
"against_voucher_type": "Purchase Invoice",
|
"against_voucher_type": "Purchase Invoice",
|
||||||
"against_voucher": self.purchase_invoice,
|
"against_voucher": self.purchase_invoice,
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
@@ -322,7 +322,7 @@ class AssetRepair(AccountsController):
|
|||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"posting_date": getdate(),
|
"posting_date": self.completion_date,
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -356,7 +356,7 @@ class AssetRepair(AccountsController):
|
|||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"posting_date": getdate(),
|
"posting_date": self.completion_date,
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
},
|
},
|
||||||
item=self,
|
item=self,
|
||||||
@@ -373,7 +373,7 @@ class AssetRepair(AccountsController):
|
|||||||
"voucher_type": self.doctype,
|
"voucher_type": self.doctype,
|
||||||
"voucher_no": self.name,
|
"voucher_no": self.name,
|
||||||
"cost_center": self.cost_center,
|
"cost_center": self.cost_center,
|
||||||
"posting_date": getdate(),
|
"posting_date": self.completion_date,
|
||||||
"against_voucher_type": "Stock Entry",
|
"against_voucher_type": "Stock Entry",
|
||||||
"against_voucher": stock_entry.name,
|
"against_voucher": stock_entry.name,
|
||||||
"company": self.company,
|
"company": self.company,
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.utils import add_months, flt, get_first_day, nowdate, nowtime, today
|
from frappe.utils import add_days, add_months, flt, get_first_day, nowdate, nowtime, today
|
||||||
|
|
||||||
from erpnext.assets.doctype.asset.asset import (
|
from erpnext.assets.doctype.asset.asset import (
|
||||||
get_asset_account,
|
get_asset_account,
|
||||||
@@ -359,6 +359,7 @@ def create_asset_repair(**args):
|
|||||||
|
|
||||||
if args.submit:
|
if args.submit:
|
||||||
asset_repair.repair_status = "Completed"
|
asset_repair.repair_status = "Completed"
|
||||||
|
asset_repair.completion_date = add_days(args.failure_date, 1)
|
||||||
asset_repair.cost_center = frappe.db.get_value("Company", asset.company, "cost_center")
|
asset_repair.cost_center = frappe.db.get_value("Company", asset.company, "cost_center")
|
||||||
|
|
||||||
if args.stock_consumption:
|
if args.stock_consumption:
|
||||||
|
|||||||
Reference in New Issue
Block a user