Merge branch 'develop' into validate-project-dates
This commit is contained in:
commit
a2abc879c9
@ -921,6 +921,7 @@
|
||||
"fieldtype": "Table",
|
||||
"hide_days": 1,
|
||||
"hide_seconds": 1,
|
||||
"label": "Sales Taxes and Charges",
|
||||
"oldfieldname": "other_charges",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Sales Taxes and Charges"
|
||||
@ -2133,7 +2134,7 @@
|
||||
"link_fieldname": "consolidated_invoice"
|
||||
}
|
||||
],
|
||||
"modified": "2022-11-17 17:17:10.883487",
|
||||
"modified": "2022-12-05 16:18:14.532114",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Sales Invoice",
|
||||
|
@ -635,6 +635,10 @@ class TestWorkOrder(FrappeTestCase):
|
||||
bom.submit()
|
||||
bom_name = bom.name
|
||||
|
||||
ste1 = test_stock_entry.make_stock_entry(
|
||||
item_code=rm1, target="_Test Warehouse - _TC", qty=32, basic_rate=5000.0
|
||||
)
|
||||
|
||||
work_order = make_wo_order_test_record(
|
||||
item=fg_item, skip_transfer=True, planned_start_date=now(), qty=1
|
||||
)
|
||||
@ -659,11 +663,29 @@ class TestWorkOrder(FrappeTestCase):
|
||||
work_order.insert()
|
||||
work_order.submit()
|
||||
self.assertEqual(work_order.has_batch_no, 1)
|
||||
ste1 = frappe.get_doc(make_stock_entry(work_order.name, "Manufacture", 30))
|
||||
batches = frappe.get_all("Batch", filters={"reference_name": work_order.name})
|
||||
self.assertEqual(len(batches), 3)
|
||||
batches = [batch.name for batch in batches]
|
||||
|
||||
ste1 = frappe.get_doc(make_stock_entry(work_order.name, "Manufacture", 10))
|
||||
for row in ste1.get("items"):
|
||||
if row.is_finished_item:
|
||||
self.assertEqual(row.item_code, fg_item)
|
||||
self.assertEqual(row.qty, 10)
|
||||
self.assertTrue(row.batch_no in batches)
|
||||
batches.remove(row.batch_no)
|
||||
|
||||
ste1.submit()
|
||||
|
||||
remaining_batches = []
|
||||
ste1 = frappe.get_doc(make_stock_entry(work_order.name, "Manufacture", 20))
|
||||
for row in ste1.get("items"):
|
||||
if row.is_finished_item:
|
||||
self.assertEqual(row.item_code, fg_item)
|
||||
self.assertEqual(row.qty, 10)
|
||||
remaining_batches.append(row.batch_no)
|
||||
|
||||
self.assertEqual(sorted(remaining_batches), sorted(batches))
|
||||
|
||||
frappe.db.set_value("Manufacturing Settings", None, "make_serial_no_batch_from_work_order", 0)
|
||||
|
||||
|
@ -1545,6 +1545,7 @@ class StockEntry(StockController):
|
||||
"reference_name": self.pro_doc.name,
|
||||
"reference_doctype": self.pro_doc.doctype,
|
||||
"qty_to_produce": (">", 0),
|
||||
"batch_qty": ("=", 0),
|
||||
}
|
||||
|
||||
fields = ["qty_to_produce as qty", "produced_qty", "name"]
|
||||
@ -2238,14 +2239,14 @@ class StockEntry(StockController):
|
||||
d.qty -= process_loss_dict[d.item_code][1]
|
||||
|
||||
def set_serial_no_batch_for_finished_good(self):
|
||||
args = {}
|
||||
serial_nos = ""
|
||||
if self.pro_doc.serial_no:
|
||||
self.get_serial_nos_for_fg(args)
|
||||
serial_nos = self.get_serial_nos_for_fg()
|
||||
|
||||
for row in self.items:
|
||||
if row.is_finished_item and row.item_code == self.pro_doc.production_item:
|
||||
if args.get("serial_no"):
|
||||
row.serial_no = "\n".join(args["serial_no"][0 : cint(row.qty)])
|
||||
if serial_nos:
|
||||
row.serial_no = "\n".join(serial_nos[0 : cint(row.qty)])
|
||||
|
||||
def get_serial_nos_for_fg(self, args):
|
||||
fields = [
|
||||
@ -2258,14 +2259,14 @@ class StockEntry(StockController):
|
||||
filters = [
|
||||
["Stock Entry", "work_order", "=", self.work_order],
|
||||
["Stock Entry", "purpose", "=", "Manufacture"],
|
||||
["Stock Entry", "docstatus", "=", 1],
|
||||
["Stock Entry", "docstatus", "<", 2],
|
||||
["Stock Entry Detail", "item_code", "=", self.pro_doc.production_item],
|
||||
]
|
||||
|
||||
stock_entries = frappe.get_all("Stock Entry", fields=fields, filters=filters)
|
||||
|
||||
if self.pro_doc.serial_no:
|
||||
args["serial_no"] = self.get_available_serial_nos(stock_entries)
|
||||
return self.get_available_serial_nos(stock_entries)
|
||||
|
||||
def get_available_serial_nos(self, stock_entries):
|
||||
used_serial_nos = []
|
||||
|
Loading…
Reference in New Issue
Block a user