Skip to content

Commit

Permalink
Merge pull request #37730 from frappe/mergify/copy/version-14/pr-37725
Browse files Browse the repository at this point in the history
chore: allow wip_composite_asset in the MR PO PR PI flow (copy #37723) (copy #37725)
  • Loading branch information
anandbaburajan authored Oct 27, 2023
2 parents 8e4e4a9 + 6a6a5b0 commit cfb9d8c
Show file tree
Hide file tree
Showing 8 changed files with 51 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1676,6 +1676,7 @@ def update_item(obj, target, source_parent):
"po_detail": "purchase_order_item",
"material_request": "material_request",
"material_request_item": "material_request_item",
"wip_composite_asset": "wip_composite_asset",
},
"postprocess": update_item,
"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty),
Expand Down
14 changes: 11 additions & 3 deletions erpnext/assets/doctype/asset/asset.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,11 @@
"read_only": 1
},
{
"depends_on": "eval:!(doc.is_composite_asset && !doc.capitalized_in)",
"fieldname": "gross_purchase_amount",
"fieldtype": "Currency",
"label": "Gross Purchase Amount",
"options": "Company:company:default_currency",
"read_only": 1,
"read_only_depends_on": "eval:!doc.is_existing_asset",
"reqd": 1
},
Expand Down Expand Up @@ -413,6 +413,7 @@
"fieldtype": "Column Break"
},
{
"depends_on": "eval:!doc.is_composite_asset && !doc.is_existing_asset",
"fieldname": "purchase_receipt",
"fieldtype": "Link",
"label": "Purchase Receipt",
Expand All @@ -430,6 +431,7 @@
"read_only": 1
},
{
"depends_on": "eval:!doc.is_composite_asset && !doc.is_existing_asset",
"fieldname": "purchase_invoice",
"fieldtype": "Link",
"label": "Purchase Invoice",
Expand Down Expand Up @@ -493,10 +495,11 @@
"read_only": 1
},
{
"depends_on": "eval.doc.asset_quantity",
"fieldname": "asset_quantity",
"fieldtype": "Int",
"label": "Asset Quantity",
"read_only_depends_on": "eval:!doc.is_existing_asset && !doc.is_composite_asset"
"read_only": 1
},
{
"fieldname": "depr_entry_posting_status",
Expand Down Expand Up @@ -555,9 +558,14 @@
"link_doctype": "Journal Entry",
"link_fieldname": "reference_name",
"table_fieldname": "accounts"
},
{
"group": "Asset Capitalization",
"link_doctype": "Asset Capitalization",
"link_fieldname": "target_asset"
}
],
"modified": "2023-10-03 23:28:26.732269",
"modified": "2023-10-27 17:03:46.629617",
"modified_by": "Administrator",
"module": "Assets",
"name": "Asset",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -832,12 +832,8 @@ def get_items_tagged_to_wip_composite_asset(asset):
"amount",
]

pi_items = frappe.get_all(
"Purchase Invoice Item", filters={"wip_composite_asset": asset}, fields=fields
)

pr_items = frappe.get_all(
"Purchase Receipt Item", filters={"wip_composite_asset": asset}, fields=fields
)

return pi_items + pr_items
return pr_items
2 changes: 2 additions & 0 deletions erpnext/buying/doctype/purchase_order/purchase_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,7 @@ def update_item(obj, target, source_parent):
"material_request_item": "material_request_item",
"sales_order": "sales_order",
"sales_order_item": "sales_order_item",
"wip_composite_asset": "wip_composite_asset",
},
"postprocess": update_item,
"condition": lambda doc: abs(doc.received_qty) < abs(doc.qty)
Expand Down Expand Up @@ -600,6 +601,7 @@ def update_item(obj, target, source_parent):
"field_map": {
"name": "po_detail",
"parent": "purchase_order",
"wip_composite_asset": "wip_composite_asset",
},
"postprocess": update_item,
"condition": lambda doc: (doc.base_amount == 0 or abs(doc.billed_amt) < abs(doc.amount)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@
"billed_amt",
"accounting_details",
"expense_account",
"column_break_fyqr",
"wip_composite_asset",
"manufacture_details",
"manufacturer",
"manufacturer_part_no",
Expand Down Expand Up @@ -897,13 +899,23 @@
"fieldname": "apply_tds",
"fieldtype": "Check",
"label": "Apply TDS"
},
{
"fieldname": "wip_composite_asset",
"fieldtype": "Link",
"label": "WIP Composite Asset",
"options": "Asset"
},
{
"fieldname": "column_break_fyqr",
"fieldtype": "Column Break"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-09-13 16:22:40.825092",
"modified": "2023-10-27 15:50:42.655573",
"modified_by": "Administrator",
"module": "Buying",
"name": "Purchase Order Item",
Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/doctype/material_request/material_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def select_item(d):
["uom", "uom"],
["sales_order", "sales_order"],
["sales_order_item", "sales_order_item"],
["wip_composite_asset", "wip_composite_asset"],
],
"postprocess": update_item,
"condition": select_item,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@
"rate",
"col_break3",
"amount",
"accounting_details_section",
"expense_account",
"column_break_glru",
"wip_composite_asset",
"manufacture_details",
"manufacturer",
"manufacturer_part_no",
Expand All @@ -50,11 +54,10 @@
"lead_time_date",
"sales_order",
"sales_order_item",
"col_break4",
"production_plan",
"material_request_plan_item",
"job_card_item",
"col_break4",
"expense_account",
"section_break_46",
"page_break"
],
Expand Down Expand Up @@ -455,13 +458,28 @@
"label": "Job Card Item",
"no_copy": 1,
"print_hide": 1
},
{
"fieldname": "accounting_details_section",
"fieldtype": "Section Break",
"label": "Accounting Details"
},
{
"fieldname": "column_break_glru",
"fieldtype": "Column Break"
},
{
"fieldname": "wip_composite_asset",
"fieldtype": "Link",
"label": "WIP Composite Asset",
"options": "Asset"
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2023-05-07 20:23:31.250252",
"modified": "2023-10-27 15:53:41.444236",
"modified_by": "Administrator",
"module": "Stock",
"name": "Material Request Item",
Expand Down
1 change: 1 addition & 0 deletions erpnext/stock/doctype/purchase_receipt/purchase_receipt.py
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,7 @@ def get_pending_qty(item_row):
"is_fixed_asset": "is_fixed_asset",
"asset_location": "asset_location",
"asset_category": "asset_category",
"wip_composite_asset": "wip_composite_asset",
},
"postprocess": update_item,
"filter": lambda d: get_pending_qty(d)[0] <= 0
Expand Down

0 comments on commit cfb9d8c

Please sign in to comment.