mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-08 15:51:19 +00:00
Merge pull request #39189 from frappe/mergify/bp/version-14-hotfix/pr-39163
fix: Purchase information is not required for creating a composite asset (backport #39163)
This commit is contained in:
@@ -202,9 +202,9 @@
|
|||||||
"fieldname": "purchase_date",
|
"fieldname": "purchase_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Purchase Date",
|
"label": "Purchase Date",
|
||||||
|
"mandatory_depends_on": "eval:!doc.is_existing_asset",
|
||||||
"read_only": 1,
|
"read_only": 1,
|
||||||
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset",
|
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "disposal_date",
|
"fieldname": "disposal_date",
|
||||||
@@ -227,15 +227,15 @@
|
|||||||
"fieldname": "gross_purchase_amount",
|
"fieldname": "gross_purchase_amount",
|
||||||
"fieldtype": "Currency",
|
"fieldtype": "Currency",
|
||||||
"label": "Gross Purchase Amount",
|
"label": "Gross Purchase Amount",
|
||||||
|
"mandatory_depends_on": "eval:(!doc.is_composite_asset || doc.docstatus==1)",
|
||||||
"options": "Company:company:default_currency",
|
"options": "Company:company:default_currency",
|
||||||
"read_only_depends_on": "eval:!doc.is_existing_asset",
|
"read_only_depends_on": "eval:!doc.is_existing_asset"
|
||||||
"reqd": 1
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"fieldname": "available_for_use_date",
|
"fieldname": "available_for_use_date",
|
||||||
"fieldtype": "Date",
|
"fieldtype": "Date",
|
||||||
"label": "Available-for-use Date",
|
"label": "Available-for-use Date",
|
||||||
"reqd": 1
|
"mandatory_depends_on": "eval:(!doc.is_composite_asset || doc.docstatus==1)"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"default": "0",
|
"default": "0",
|
||||||
@@ -583,7 +583,7 @@
|
|||||||
"link_fieldname": "target_asset"
|
"link_fieldname": "target_asset"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"modified": "2023-12-21 16:46:20.732869",
|
"modified": "2024-01-05 17:36:53.131512",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Assets",
|
"module": "Assets",
|
||||||
"name": "Asset",
|
"name": "Asset",
|
||||||
|
|||||||
@@ -247,7 +247,12 @@ class Asset(AccountsController):
|
|||||||
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
||||||
|
|
||||||
if is_cwip_accounting_enabled(self.asset_category):
|
if is_cwip_accounting_enabled(self.asset_category):
|
||||||
if not self.is_existing_asset and not (self.purchase_receipt or self.purchase_invoice):
|
if (
|
||||||
|
not self.is_existing_asset
|
||||||
|
and not self.is_composite_asset
|
||||||
|
and not self.purchase_receipt
|
||||||
|
and not self.purchase_invoice
|
||||||
|
):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Please create purchase receipt or purchase invoice for the item {0}").format(
|
_("Please create purchase receipt or purchase invoice for the item {0}").format(
|
||||||
self.item_code
|
self.item_code
|
||||||
@@ -260,7 +265,7 @@ class Asset(AccountsController):
|
|||||||
and not frappe.db.get_value("Purchase Invoice", self.purchase_invoice, "update_stock")
|
and not frappe.db.get_value("Purchase Invoice", self.purchase_invoice, "update_stock")
|
||||||
):
|
):
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_("Update stock must be enable for the purchase invoice {0}").format(self.purchase_invoice)
|
_("Update stock must be enabled for the purchase invoice {0}").format(self.purchase_invoice)
|
||||||
)
|
)
|
||||||
|
|
||||||
if not self.calculate_depreciation:
|
if not self.calculate_depreciation:
|
||||||
|
|||||||
@@ -67,12 +67,12 @@ class AssetCategory(Document):
|
|||||||
if selected_key_type not in expected_key_types:
|
if selected_key_type not in expected_key_types:
|
||||||
frappe.throw(
|
frappe.throw(
|
||||||
_(
|
_(
|
||||||
"Row #{}: {} of {} should be {}. Please modify the account or select a different account."
|
"Row #{0}: {1} of {2} should be {3}. Please update the {1} or select a different account."
|
||||||
).format(
|
).format(
|
||||||
d.idx,
|
d.idx,
|
||||||
frappe.unscrub(key_to_match),
|
frappe.unscrub(key_to_match),
|
||||||
frappe.bold(selected_account),
|
frappe.bold(selected_account),
|
||||||
frappe.bold(expected_key_types),
|
frappe.bold(" or ".join(expected_key_types)),
|
||||||
),
|
),
|
||||||
title=_("Invalid Account"),
|
title=_("Invalid Account"),
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user