fix: Purchase date and amount is not mandatory for composite asset creation
This commit is contained in:
parent
fe43dab4d7
commit
c34f09c503
@ -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",
|
||||||
@ -590,7 +590,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",
|
||||||
|
@ -57,7 +57,7 @@ class Asset(AccountsController):
|
|||||||
asset_owner: DF.Literal["", "Company", "Supplier", "Customer"]
|
asset_owner: DF.Literal["", "Company", "Supplier", "Customer"]
|
||||||
asset_owner_company: DF.Link | None
|
asset_owner_company: DF.Link | None
|
||||||
asset_quantity: DF.Int
|
asset_quantity: DF.Int
|
||||||
available_for_use_date: DF.Date
|
available_for_use_date: DF.Date | None
|
||||||
booked_fixed_asset: DF.Check
|
booked_fixed_asset: DF.Check
|
||||||
calculate_depreciation: DF.Check
|
calculate_depreciation: DF.Check
|
||||||
capitalized_in: DF.Link | None
|
capitalized_in: DF.Link | None
|
||||||
@ -92,7 +92,7 @@ class Asset(AccountsController):
|
|||||||
number_of_depreciations_booked: DF.Int
|
number_of_depreciations_booked: DF.Int
|
||||||
opening_accumulated_depreciation: DF.Currency
|
opening_accumulated_depreciation: DF.Currency
|
||||||
policy_number: DF.Data | None
|
policy_number: DF.Data | None
|
||||||
purchase_date: DF.Date
|
purchase_date: DF.Date | None
|
||||||
purchase_invoice: DF.Link | None
|
purchase_invoice: DF.Link | None
|
||||||
purchase_receipt: DF.Link | None
|
purchase_receipt: DF.Link | None
|
||||||
purchase_receipt_amount: DF.Currency
|
purchase_receipt_amount: DF.Currency
|
||||||
@ -316,7 +316,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 and not 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
|
||||||
@ -329,7 +334,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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user