Is Fixed Asset and Asset Category field added in Item
This commit is contained in:
parent
21f443e37c
commit
2dec0db3bd
@ -430,6 +430,58 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"fieldname": "is_fixed_asset",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Is Fixed Asset",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"allow_on_submit": 0,
|
||||||
|
"bold": 0,
|
||||||
|
"collapsible": 0,
|
||||||
|
"depends_on": "is_fixed_asset",
|
||||||
|
"fieldname": "asset_category",
|
||||||
|
"fieldtype": "Link",
|
||||||
|
"hidden": 0,
|
||||||
|
"ignore_user_permissions": 0,
|
||||||
|
"ignore_xss_filter": 0,
|
||||||
|
"in_filter": 0,
|
||||||
|
"in_list_view": 0,
|
||||||
|
"label": "Asset Category",
|
||||||
|
"length": 0,
|
||||||
|
"no_copy": 0,
|
||||||
|
"options": "Asset Category",
|
||||||
|
"permlevel": 0,
|
||||||
|
"precision": "",
|
||||||
|
"print_hide": 0,
|
||||||
|
"print_hide_if_no_value": 0,
|
||||||
|
"read_only": 0,
|
||||||
|
"report_hide": 0,
|
||||||
|
"reqd": 0,
|
||||||
|
"search_index": 0,
|
||||||
|
"set_only_once": 0,
|
||||||
|
"unique": 0
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -2307,7 +2359,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2016-07-06 16:00:45.561339",
|
"modified": "2016-07-06 16:00:45.561349",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
|
@ -86,6 +86,7 @@ class Item(WebsiteGenerator):
|
|||||||
self.validate_variant_attributes()
|
self.validate_variant_attributes()
|
||||||
self.validate_website_image()
|
self.validate_website_image()
|
||||||
self.make_thumbnail()
|
self.make_thumbnail()
|
||||||
|
self.validate_fixed_asset()
|
||||||
|
|
||||||
if not self.get("__islocal"):
|
if not self.get("__islocal"):
|
||||||
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
|
self.old_item_group = frappe.db.get_value(self.doctype, self.name, "item_group")
|
||||||
@ -221,6 +222,14 @@ class Item(WebsiteGenerator):
|
|||||||
|
|
||||||
self.thumbnail = file_doc.thumbnail_url
|
self.thumbnail = file_doc.thumbnail_url
|
||||||
|
|
||||||
|
def validate_fixed_asset(self):
|
||||||
|
if self.is_fixed_asset:
|
||||||
|
if self.is_stock_item:
|
||||||
|
frappe.throw(_("Fixed Asset Item must be a non-stock item."))
|
||||||
|
|
||||||
|
if not self.asset_category:
|
||||||
|
frappe.throw(_("Asset Category is mandatory for Fixed Asset item"))
|
||||||
|
|
||||||
def get_context(self, context):
|
def get_context(self, context):
|
||||||
context.show_search=True
|
context.show_search=True
|
||||||
context.search_link = '/product_search'
|
context.search_link = '/product_search'
|
||||||
|
Loading…
Reference in New Issue
Block a user