fix: BOM - clear Quality Inspection Template according to Inspection Quality Required
Squashed commit of the following: commit b73fa210b234d2c8067db2c32f94f362b89afe5a Author: Florian HENRY <florian.henry@open-concept.pro> Date: Mon Mar 14 08:30:24 2022 +0100 add json tes commit 984d015a7d9aceb6ea64be7ed9f1cc0caa356714 Author: Florian HENRY <florian.henry@open-concept.pro> Date: Mon Mar 14 08:30:06 2022 +0100 better test commit 42061146658598da02eda7cb781bd2cf44c8ca34 Author: Florian HENRY <florian.henry@open-concept.pro> Date: Fri Mar 11 16:12:57 2022 +0100 update test commit 6259c0957566600b044fcd4a5e14e69cdff71020 Author: Florian HENRY <florian.henry@open-concept.pro> Date: Fri Mar 11 13:59:13 2022 +0100 update test commit cbc4ad9566f6f7f01dd622651458fea309d80954 Merge: faa44b3fdd 94d0f8d4e7 Author: Florian HENRY <florian.henry@open-concept.pro> Date: Fri Mar 11 12:46:48 2022 +0100 Merge branch 'develop' of https://github.com/frappe/erpnext into dev_fix_30190 commit faa44b3fdd983adfc04bbf04a7ebfef114501bb3 Author: Florian HENRY <florian.henry@open-concept.pro> Date: Fri Mar 11 12:03:35 2022 +0100 fix: clear Quality Inspection Template according to Inspection Quality Required
This commit is contained in:
parent
f1a7e3b9ad
commit
9415229e8d
@ -170,6 +170,7 @@ class BOM(WebsiteGenerator):
|
||||
frappe.throw(_("Please select a Company first."), title=_("Mandatory"))
|
||||
|
||||
self.clear_operations()
|
||||
self.clear_inspection()
|
||||
self.validate_main_item()
|
||||
self.validate_currency()
|
||||
self.set_conversion_rate()
|
||||
@ -425,6 +426,10 @@ class BOM(WebsiteGenerator):
|
||||
if not self.with_operations:
|
||||
self.set('operations', [])
|
||||
|
||||
def clear_inspection(self):
|
||||
if not self.inspection_required:
|
||||
self.set('quality_inspection_template', None)
|
||||
|
||||
def validate_main_item(self):
|
||||
""" Validate main FG item"""
|
||||
item = self.get_item_det(self.item)
|
||||
|
@ -26,6 +26,9 @@ class TestBOM(FrappeTestCase):
|
||||
if not frappe.get_value('Item', '_Test Item'):
|
||||
make_test_records('Item')
|
||||
|
||||
if not frappe.get_value('Quality Inspection Template', '_Test Quality Inspection Template'):
|
||||
make_test_records('Quality Inspection_Template')
|
||||
|
||||
def test_get_items(self):
|
||||
from erpnext.manufacturing.doctype.bom.bom import get_bom_items_as_dict
|
||||
items_dict = get_bom_items_as_dict(bom=get_default_bom(),
|
||||
@ -495,6 +498,22 @@ class TestBOM(FrappeTestCase):
|
||||
self.assertNotEqual(amendment.name, version.name)
|
||||
self.assertEqual(int(version.name.split("-")[-1]), 2)
|
||||
|
||||
def test_clear_inpection_quality(self):
|
||||
|
||||
bom = frappe.copy_doc(test_records[2])
|
||||
bom.is_active = 0
|
||||
bom.quality_inspection_template = "_Test Quality Inspection Template"
|
||||
bom.inspection_required = 1
|
||||
bom.save()
|
||||
|
||||
self.assertEqual(bom.quality_inspection_template, '_Test Quality Inspection Template')
|
||||
|
||||
bom.inspection_required = 0
|
||||
bom.save()
|
||||
bom.load_from_db()
|
||||
|
||||
self.assertEqual(bom.quality_inspection_template, None)
|
||||
|
||||
|
||||
def get_default_bom(item_code="_Test FG Item 2"):
|
||||
return frappe.db.get_value("BOM", {"item": item_code, "is_active": 1, "is_default": 1})
|
||||
|
@ -0,0 +1,12 @@
|
||||
[
|
||||
{
|
||||
"quality_inspection_template_name" : "_Test Quality Inspection Template",
|
||||
"item_quality_inspection_parameter" : [
|
||||
{
|
||||
"specification": "_Test Param",
|
||||
"doctype": "Item Quality Inspection Parameter",
|
||||
"parentfield": "item_quality_inspection_parameter"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user