Compare commits

...

4 Commits

Author SHA1 Message Date
Diptanil Saha
21cada2f00 Update manufacturing_settings.json 2025-01-09 16:52:43 +05:30
diptanilsaha
f2cd075133 fix: typo in manufacturing settings
(cherry picked from commit a9b761f862)

# Conflicts:
#	erpnext/manufacturing/doctype/manufacturing_settings/manufacturing_settings.json
2025-01-09 10:57:45 +00:00
rohitwaghchaure
c331a4fa84 Merge pull request #45185 from frappe/mergify/bp/version-14-hotfix/pr-45180
fix: do not add ordered items from Quotation to new Sales Order (backport #45180)
2025-01-09 16:27:15 +05:30
Rohit Waghchaure
d42173beb5 fix: do not add ordered items from Quotation to new Sales Order
(cherry picked from commit 2e930eb97b)
2025-01-09 09:09:56 +00:00
3 changed files with 75 additions and 4 deletions

View File

@@ -201,14 +201,49 @@
"description": "In the case of 'Use Multi-Level BOM' in a work order, if the user wishes to add sub-assembly costs to Finished Goods items without using a job card as well the scrap items, then this option needs to be enable.",
"fieldname": "set_op_cost_and_scrape_from_sub_assemblies",
"fieldtype": "Check",
"label": "Set Operating Cost / Scrape Items From Sub-assemblies"
"label": "Set Operating Cost / Scrap Items From Sub-assemblies"
},
{
"default": "0",
"depends_on": "eval: doc.material_consumption",
"fieldname": "get_rm_cost_from_consumption_entry",
"fieldtype": "Check",
"label": "Get Raw Materials Cost from Consumption Entry"
},
{
"fieldname": "bom_and_work_order_tab",
"fieldtype": "Tab Break",
"label": "BOM and Production"
},
{
"fieldname": "bom_section",
"fieldtype": "Section Break",
"label": "BOM"
},
{
"fieldname": "column_break_lhyt",
"fieldtype": "Column Break"
},
{
"default": "0",
"description": "If enabled then system will manufacture Sub-assembly against the Job Card (operation).",
"fieldname": "manufacture_sub_assembly_in_operation",
"fieldtype": "Check",
"label": "Manufacture Sub-assembly in Operation"
},
{
"default": "0",
"depends_on": "eval:doc.backflush_raw_materials_based_on == \"BOM\"",
"fieldname": "validate_components_quantities_per_bom",
"fieldtype": "Check",
"label": "Validate Components and Quantities Per BOM"
}
],
"icon": "icon-wrench",
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2023-12-28 16:37:44.874096",
"modified": "2025-01-09 16:02:23.326763",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing Settings",
@@ -226,4 +261,4 @@
"sort_order": "DESC",
"states": [],
"track_changes": 1
}
}

View File

@@ -322,7 +322,11 @@ def _make_sales_order(source_name, target_doc=None, ignore_permissions=False):
2. If selections: Is Alternative Item/Has Alternative Item: Map if selected and adequate qty
3. If selections: Simple row: Map if adequate qty
"""
has_qty = item.qty > 0
balance_qty = item.qty - ordered_items.get(item.item_code, 0.0)
if balance_qty <= 0:
return False
has_qty = balance_qty
if not selected_rows:
return not item.is_alternative

View File

@@ -30,6 +30,38 @@ class TestQuotation(FrappeTestCase):
self.assertTrue(sales_order.get("payment_schedule"))
def test_do_not_add_ordered_items_in_new_sales_order(self):
from erpnext.selling.doctype.quotation.quotation import make_sales_order
from erpnext.stock.doctype.item.test_item import make_item
item = make_item("_Test Item for Quotation for SO", {"is_stock_item": 1})
quotation = make_quotation(qty=5, do_not_submit=True)
quotation.append(
"items",
{
"item_code": item.name,
"qty": 5,
"rate": 100,
"conversion_factor": 1,
"uom": item.stock_uom,
"warehouse": "_Test Warehouse - _TC",
"stock_uom": item.stock_uom,
},
)
quotation.submit()
sales_order = make_sales_order(quotation.name)
sales_order.delivery_date = nowdate()
self.assertEqual(len(sales_order.items), 2)
sales_order.remove(sales_order.items[1])
sales_order.submit()
sales_order = make_sales_order(quotation.name)
self.assertEqual(len(sales_order.items), 1)
self.assertEqual(sales_order.items[0].item_code, item.name)
self.assertEqual(sales_order.items[0].qty, 5.0)
def test_gross_profit(self):
from erpnext.stock.doctype.item.test_item import make_item
from erpnext.stock.doctype.stock_entry.stock_entry_utils import make_stock_entry