style: format code with black
This commit is contained in:
@@ -12,11 +12,12 @@ from erpnext.stock.doctype.quality_inspection.test_quality_inspection import (
|
||||
|
||||
class TestItemVariant(unittest.TestCase):
|
||||
def test_tables_in_template_copied_to_variant(self):
|
||||
fields = [{'field_name': 'quality_inspection_template'}]
|
||||
fields = [{"field_name": "quality_inspection_template"}]
|
||||
set_item_variant_settings(fields)
|
||||
variant = make_item_variant()
|
||||
self.assertEqual(variant.get("quality_inspection_template"), "_Test QC Template")
|
||||
|
||||
|
||||
def create_variant_with_tables(item, args):
|
||||
if isinstance(args, str):
|
||||
args = json.loads(args)
|
||||
@@ -27,14 +28,11 @@ def create_variant_with_tables(item, args):
|
||||
template.save()
|
||||
|
||||
variant = frappe.new_doc("Item")
|
||||
variant.variant_based_on = 'Item Attribute'
|
||||
variant.variant_based_on = "Item Attribute"
|
||||
variant_attributes = []
|
||||
|
||||
for d in template.attributes:
|
||||
variant_attributes.append({
|
||||
"attribute": d.attribute,
|
||||
"attribute_value": args.get(d.attribute)
|
||||
})
|
||||
variant_attributes.append({"attribute": d.attribute, "attribute_value": args.get(d.attribute)})
|
||||
|
||||
variant.set("attributes", variant_attributes)
|
||||
copy_attributes_to_variant(template, variant)
|
||||
@@ -42,6 +40,7 @@ def create_variant_with_tables(item, args):
|
||||
|
||||
return variant
|
||||
|
||||
|
||||
def make_item_variant():
|
||||
frappe.delete_doc_if_exists("Item", "_Test Variant Item-XSL", force=1)
|
||||
variant = create_variant_with_tables("_Test Variant Item", '{"Test Size": "Extra Small"}')
|
||||
@@ -50,6 +49,7 @@ def make_item_variant():
|
||||
variant.save()
|
||||
return variant
|
||||
|
||||
|
||||
def make_quality_inspection_template():
|
||||
qc_template = "_Test QC Template"
|
||||
if frappe.db.exists("Quality Inspection Template", qc_template):
|
||||
@@ -59,10 +59,13 @@ def make_quality_inspection_template():
|
||||
qc.quality_inspection_template_name = qc_template
|
||||
|
||||
create_quality_inspection_parameter("Moisture")
|
||||
qc.append('item_quality_inspection_parameter', {
|
||||
"specification": "Moisture",
|
||||
"value": "< 5%",
|
||||
})
|
||||
qc.append(
|
||||
"item_quality_inspection_parameter",
|
||||
{
|
||||
"specification": "Moisture",
|
||||
"value": "< 5%",
|
||||
},
|
||||
)
|
||||
|
||||
qc.insert()
|
||||
return qc.name
|
||||
|
||||
Reference in New Issue
Block a user