Inspection required before delivery isn't working for item variants (#9362)

* makes `copy_attributes_to_variant` to not ignore "Table"

* fixes test cases - `test_auto_material_request` and `test_auto_material_request_for_variant`

* adds test case - tables in templates should be copied to variants

* [ci] use deprecated trusty build for now
This commit is contained in:
tundebabzy
2017-07-04 11:13:02 +01:00
committed by Makarand Bauskar
parent 5e4c8ecd62
commit 6015f0f2ec
3 changed files with 67 additions and 12 deletions

View File

@@ -85,12 +85,7 @@ class TestStockEntry(unittest.TestCase):
self._test_auto_material_request("_Test Item Warehouse Group Wise Reorder", warehouse="_Test Warehouse Group-C1 - _TC")
def _test_auto_material_request(self, item_code, material_request_type="Purchase", warehouse="_Test Warehouse - _TC"):
item = frappe.get_doc("Item", item_code)
if item.variant_of:
template = frappe.get_doc("Item", item.variant_of)
else:
template = item
variant = frappe.get_doc("Item", item_code)
projected_qty, actual_qty = frappe.db.get_value("Bin", {"item_code": item_code,
"warehouse": warehouse}, ["projected_qty", "actual_qty"]) or [0, 0]
@@ -105,10 +100,10 @@ class TestStockEntry(unittest.TestCase):
frappe.db.set_value("Stock Settings", None, "auto_indent", 1)
# update re-level qty so that it is more than projected_qty
if projected_qty >= template.reorder_levels[0].warehouse_reorder_level:
template.reorder_levels[0].warehouse_reorder_level += projected_qty
template.reorder_levels[0].material_request_type = material_request_type
template.save()
if projected_qty >= variant.reorder_levels[0].warehouse_reorder_level:
variant.reorder_levels[0].warehouse_reorder_level += projected_qty
variant.reorder_levels[0].material_request_type = material_request_type
variant.save()
from erpnext.stock.reorder_item import reorder_item
mr_list = reorder_item()