fix: feat: multiple changes related to subcontracting inward

This commit is contained in:
Mihir Kandoi
2025-10-21 23:50:28 +05:30
parent d9fa9c6b3d
commit 9f3cb4b783
16 changed files with 525 additions and 168 deletions

View File

@@ -60,6 +60,14 @@ frappe.ui.form.on("Subcontracting Inward Order", {
};
});
frm.set_query("bom", "items", () => {
return {
filters: {
is_active: 1,
},
};
});
frm.set_query("set_delivery_warehouse", () => {
return {
filters: {

View File

@@ -275,10 +275,13 @@ class SubcontractingInwardOrder(SubcontractingController):
d.precision("qty"),
)
for item in self.get("received_items")
if item.reference_name == d.name and item.is_customer_provided_item
if item.reference_name == d.name and item.is_customer_provided_item and item.required_qty
]
)
qty = int(qty) if frappe.get_cached_value("UOM", d.stock_uom, "must_be_whole_number") else qty
qty = min(
int(qty) if frappe.get_cached_value("UOM", d.stock_uom, "must_be_whole_number") else qty,
d.qty - d.produced_qty,
)
item_details.update({"qty": qty, "max_producible_qty": qty})
item_list.append(item_details)

View File

@@ -66,6 +66,7 @@ class IntegrationTestSubcontractingInwardOrder(IntegrationTestCase):
"transfer_qty": 5,
"uom": "Nos",
"conversion_factor": 1,
"against_fg": scio.items[0].name,
},
)
rm_in.submit()

View File

@@ -46,6 +46,7 @@
"in_global_search": 1,
"label": "Item Name",
"print_hide": 1,
"read_only": 1,
"reqd": 1
},
{
@@ -185,7 +186,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-10-14 10:29:29.256455",
"modified": "2025-10-18 18:04:04.204651",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Inward Order Item",

View File

@@ -22,7 +22,9 @@
"column_break_16",
"consumed_qty",
"work_order_qty",
"returned_qty"
"returned_qty",
"section_break_yhve",
"rate"
],
"fields": [
{
@@ -32,7 +34,8 @@
"in_list_view": 1,
"label": "Item Code",
"options": "Item",
"read_only": 1
"read_only": 1,
"reqd": 1
},
{
"columns": 2,
@@ -70,7 +73,8 @@
"fieldname": "reference_name",
"fieldtype": "Data",
"label": "Reference Name",
"read_only": 1
"read_only": 1,
"reqd": 1
},
{
"fieldname": "section_break_13",
@@ -116,7 +120,6 @@
},
{
"default": "0",
"depends_on": "eval:doc.returned_qty",
"fieldname": "returned_qty",
"fieldtype": "Float",
"label": "Returned Qty",
@@ -128,7 +131,7 @@
{
"allow_on_submit": 1,
"default": "0",
"depends_on": "eval:doc.work_order_qty",
"depends_on": "eval:!(!doc.is_customer_provided_item && doc.is_additional_item)",
"fieldname": "work_order_qty",
"fieldtype": "Float",
"label": "Work Order Qty",
@@ -146,7 +149,6 @@
"reqd": 1
},
{
"depends_on": "eval:!doc.is_customer_provided_item",
"fieldname": "warehouse",
"fieldtype": "Link",
"label": "Warehouse",
@@ -166,11 +168,27 @@
},
{
"default": "0",
"depends_on": "eval:!doc.bom_detail_no",
"fieldname": "is_additional_item",
"fieldtype": "Check",
"label": "Is Additional Item",
"read_only": 1
},
{
"depends_on": "eval:doc.is_customer_provided_item",
"fieldname": "section_break_yhve",
"fieldtype": "Section Break"
},
{
"default": "0",
"fieldname": "rate",
"fieldtype": "Currency",
"label": "Rate",
"mandatory_depends_on": "eval:doc.is_customer_provided_item",
"no_copy": 1,
"non_negative": 1,
"options": "Company:company:default_currency",
"read_only": 1,
"read_only_depends_on": "eval:doc.is_customer_provided_item"
}
],
"grid_page_length": 50,
@@ -178,7 +196,7 @@
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2025-10-14 10:18:58.905093",
"modified": "2025-10-21 23:44:18.302327",
"modified_by": "Administrator",
"module": "Subcontracting",
"name": "Subcontracting Inward Order Received Item",

View File

@@ -19,12 +19,13 @@ class SubcontractingInwardOrderReceivedItem(Document):
consumed_qty: DF.Float
is_additional_item: DF.Check
is_customer_provided_item: DF.Check
main_item_code: DF.Link | None
main_item_code: DF.Link
parent: DF.Data
parentfield: DF.Data
parenttype: DF.Data
rate: DF.Currency
received_qty: DF.Float
reference_name: DF.Data | None
reference_name: DF.Data
required_qty: DF.Float
returned_qty: DF.Float
rm_item_code: DF.Link