fix: test cases
This commit is contained in:
parent
4389cf0c48
commit
c7b916ac46
@ -89,7 +89,7 @@ erpnext.accounts.SalesInvoiceController = erpnext.selling.SellingController.exte
|
||||
}, __('Create'));
|
||||
}
|
||||
|
||||
if (doc.docstatus == 1) {
|
||||
if (doc.docstatus === 1) {
|
||||
cur_frm.add_custom_button(__('Maintenance Schedule'), function () {
|
||||
cur_frm.cscript.make_maintenance_schedule();
|
||||
}, __('Create'));
|
||||
|
@ -7,46 +7,45 @@ import frappe
|
||||
from frappe.custom.doctype.custom_field.custom_field import create_custom_fields
|
||||
|
||||
def execute():
|
||||
create_stock_entry_types()
|
||||
create_stock_entry_types()
|
||||
|
||||
company = frappe.get_cached_value("Company", {'country': 'India'}, 'name')
|
||||
if company:
|
||||
pass
|
||||
# add_gst_hsn_code_field()
|
||||
company = frappe.db.get_value("Company", {'country': 'India'}, 'name')
|
||||
if company:
|
||||
add_gst_hsn_code_field()
|
||||
|
||||
def create_stock_entry_types():
|
||||
frappe.reload_doc('stock', 'doctype', 'stock_entry_type')
|
||||
frappe.reload_doc('stock', 'doctype', 'stock_entry')
|
||||
frappe.reload_doc('stock', 'doctype', 'stock_entry_type')
|
||||
frappe.reload_doc('stock', 'doctype', 'stock_entry')
|
||||
|
||||
for purpose in ["Material Issue", "Material Receipt", "Material Transfer",
|
||||
"Material Transfer for Manufacture", "Material Consumption for Manufacture", "Manufacture",
|
||||
"Repack", "Subcontract", "Stock Out", "Stock In"]:
|
||||
for purpose in ["Material Issue", "Material Receipt", "Material Transfer",
|
||||
"Material Transfer for Manufacture", "Material Consumption for Manufacture", "Manufacture",
|
||||
"Repack", "Subcontract", "Stock Out", "Stock In"]:
|
||||
|
||||
ste_type = frappe.get_doc({
|
||||
'doctype': 'Stock Entry Type',
|
||||
'name': purpose,
|
||||
'purpose': purpose
|
||||
})
|
||||
ste_type = frappe.get_doc({
|
||||
'doctype': 'Stock Entry Type',
|
||||
'name': purpose,
|
||||
'purpose': purpose
|
||||
})
|
||||
|
||||
try:
|
||||
ste_type.insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
try:
|
||||
ste_type.insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
frappe.db.sql(" UPDATE `tabStock Entry` set stock_entry_type = purpose ")
|
||||
frappe.db.sql(" UPDATE `tabStock Entry` set stock_entry_type = purpose ")
|
||||
|
||||
def add_gst_hsn_code_field():
|
||||
custom_fields = {
|
||||
'Stock Entry Detail': [dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
||||
fieldtype='Data', fetch_from='item_code.gst_hsn_code',
|
||||
insert_after='description', allow_on_submit=1, print_hide=0)]
|
||||
}
|
||||
custom_fields = {
|
||||
'Stock Entry Detail': [dict(fieldname='gst_hsn_code', label='HSN/SAC',
|
||||
fieldtype='Data', fetch_from='item_code.gst_hsn_code',
|
||||
insert_after='description', allow_on_submit=1, print_hide=0)]
|
||||
}
|
||||
|
||||
create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch, update=True)
|
||||
create_custom_fields(custom_fields, ignore_validate = frappe.flags.in_patch, update=True)
|
||||
|
||||
frappe.db.sql(""" update `tabStock Entry Detail`, `tabItem`
|
||||
SET
|
||||
`tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
|
||||
Where
|
||||
`tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
|
||||
""")
|
||||
frappe.db.sql(""" update `tabStock Entry Detail`, `tabItem`
|
||||
SET
|
||||
`tabStock Entry Detail`.gst_hsn_code = `tabItem`.gst_hsn_code
|
||||
Where
|
||||
`tabItem`.name = `tabStock Entry Detail`.item_code and `tabItem`.gst_hsn_code is not null
|
||||
""")
|
@ -1,6 +1,5 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_events_in_timeline": 0,
|
||||
"allow_guest_to_view": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
@ -20,7 +19,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "sales_person",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -57,7 +55,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "contact_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
@ -93,7 +90,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "allocated_percentage",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
@ -122,40 +118,6 @@
|
||||
"unique": 0,
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Item Group",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Item Group",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
@ -163,7 +125,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "allocated_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
@ -200,8 +161,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_from": "item_group.commission_rate",
|
||||
"fetch_if_empty": 1,
|
||||
"fieldname": "commission_rate",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
@ -234,7 +193,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "incentives",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
@ -273,7 +231,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2019-03-15 00:06:59.441936",
|
||||
"modified": "2018-09-17 13:03:14.755974",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Selling",
|
||||
"name": "Sales Team",
|
||||
@ -286,4 +244,4 @@
|
||||
"track_changes": 1,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "gs",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -53,7 +52,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "item_group_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
@ -88,7 +86,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "parent_item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -124,7 +121,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Only leaf nodes are allowed in transaction",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "is_group",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
@ -159,71 +155,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "commission_rate",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"label": "Commission Rate",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "image",
|
||||
"fieldtype": "Attach Image",
|
||||
"hidden": 1,
|
||||
@ -256,7 +187,36 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_global_search": 0,
|
||||
"in_list_view": 0,
|
||||
"in_standard_filter": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"remember_last_selected_value": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"translatable": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_bulk_edit": 0,
|
||||
"allow_in_quick_entry": 0,
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fieldname": "defaults",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -289,7 +249,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "item_group_defaults",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@ -324,7 +283,6 @@
|
||||
"collapsible": 0,
|
||||
"collapsible_depends_on": "",
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "sec_break_taxes",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -357,7 +315,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "taxes",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@ -391,7 +348,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "sb9",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
@ -424,7 +380,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "Check this if you want to show in website",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "show_in_website",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
@ -457,7 +412,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "show_in_website",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "route",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
@ -490,7 +444,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "weightage",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
@ -525,7 +478,6 @@
|
||||
"columns": 0,
|
||||
"depends_on": "show_in_website",
|
||||
"description": "Show this slideshow at the top of the page",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "slideshow",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
@ -560,7 +512,6 @@
|
||||
"columns": 0,
|
||||
"depends_on": "show_in_website",
|
||||
"description": "HTML / Banner that will show on the top of product list.",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text Editor",
|
||||
"hidden": 0,
|
||||
@ -593,7 +544,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"depends_on": "show_in_website",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "website_specifications",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
@ -626,7 +576,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "lft",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
@ -660,7 +609,6 @@
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "rgt",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
@ -695,7 +643,6 @@
|
||||
"collapsible": 0,
|
||||
"columns": 0,
|
||||
"description": "",
|
||||
"fetch_if_empty": 0,
|
||||
"fieldname": "old_parent",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
@ -736,7 +683,7 @@
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 3,
|
||||
"modified": "2019-03-15 00:05:25.816002",
|
||||
"modified": "2018-11-23 15:17:28.003933",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Setup",
|
||||
"name": "Item Group",
|
||||
@ -867,4 +814,4 @@
|
||||
"track_changes": 0,
|
||||
"track_seen": 0,
|
||||
"track_views": 0
|
||||
}
|
||||
}
|
||||
|
@ -92,6 +92,8 @@ def install(country=None):
|
||||
{'doctype': 'Stock Entry Type', 'name': 'Subcontract', 'purpose': 'Subcontract'},
|
||||
{'doctype': 'Stock Entry Type', 'name': 'Material Transfer for Manufacture', 'purpose': 'Material Transfer for Manufacture'},
|
||||
{'doctype': 'Stock Entry Type', 'name': 'Material Consumption for Manufacture', 'purpose': 'Material Consumption for Manufacture'},
|
||||
{'doctype': 'Stock Entry Type', 'name': 'Stock Out', 'purpose': 'Stock Out'},
|
||||
{'doctype': 'Stock Entry Type', 'name': 'Stock In', 'purpose': 'Stock In'},
|
||||
|
||||
# Designation
|
||||
{'doctype': 'Designation', 'designation_name': _('CEO')},
|
||||
|
@ -202,6 +202,7 @@ def split_batch(batch_no, item_code, warehouse, qty, new_batch_id=None):
|
||||
),
|
||||
]
|
||||
))
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.insert()
|
||||
stock_entry.submit()
|
||||
|
||||
|
@ -67,7 +67,10 @@ class TestBatch(unittest.TestCase):
|
||||
rate = 10
|
||||
)
|
||||
]
|
||||
)).insert()
|
||||
))
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.insert()
|
||||
stock_entry.submit()
|
||||
|
||||
self.assertTrue(stock_entry.items[0].batch_no)
|
||||
@ -136,7 +139,10 @@ class TestBatch(unittest.TestCase):
|
||||
s_warehouse=receipt.items[0].warehouse,
|
||||
)
|
||||
]
|
||||
)).insert()
|
||||
))
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.insert()
|
||||
stock_entry.submit()
|
||||
|
||||
# assert same batch is selected
|
||||
@ -193,7 +199,10 @@ class TestBatch(unittest.TestCase):
|
||||
allow_zero_valuation_rate = 1
|
||||
)
|
||||
]
|
||||
)).insert()
|
||||
))
|
||||
|
||||
stock_entry.set_stock_entry_type()
|
||||
stock_entry.insert()
|
||||
stock_entry.submit()
|
||||
|
||||
def test_batch_name_with_naming_series(self):
|
||||
|
@ -96,6 +96,8 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
se.set_stock_entry_type()
|
||||
se.insert()
|
||||
se.submit()
|
||||
|
||||
@ -388,6 +390,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
# check for stopped status of Material Request
|
||||
se = frappe.copy_doc(se_doc)
|
||||
se.set_stock_entry_type()
|
||||
se.insert()
|
||||
mr.update_status('Stopped')
|
||||
self.assertRaises(frappe.InvalidStatusError, se.submit)
|
||||
@ -395,6 +398,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
mr.update_status('Submitted')
|
||||
se = frappe.copy_doc(se_doc)
|
||||
se.set_stock_entry_type()
|
||||
se.insert()
|
||||
se.submit()
|
||||
|
||||
@ -528,7 +532,7 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
|
||||
#testing bin requested qty after issuing stock against material request
|
||||
self.assertEqual(_get_requested_qty(), existing_requested_qty)
|
||||
|
||||
|
||||
def test_material_request_type_manufacture(self):
|
||||
mr = frappe.copy_doc(test_records[1]).insert()
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
@ -541,20 +545,20 @@ class TestMaterialRequest(unittest.TestCase):
|
||||
po = frappe.get_doc("Work Order", prod_order[0])
|
||||
po.wip_warehouse = "_Test Warehouse 1 - _TC"
|
||||
po.submit()
|
||||
|
||||
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
self.assertEqual(completed_qty + po.qty, mr.items[0].ordered_qty)
|
||||
|
||||
new_requested_qty = frappe.db.sql("""select indented_qty from `tabBin` where \
|
||||
item_code= %s and warehouse= %s """, (mr.items[0].item_code, mr.items[0].warehouse))[0][0]
|
||||
|
||||
|
||||
self.assertEqual(requested_qty - po.qty, new_requested_qty)
|
||||
|
||||
|
||||
po.cancel()
|
||||
|
||||
mr = frappe.get_doc("Material Request", mr.name)
|
||||
self.assertEqual(completed_qty, mr.items[0].ordered_qty)
|
||||
|
||||
|
||||
new_requested_qty = frappe.db.sql("""select indented_qty from `tabBin` where \
|
||||
item_code= %s and warehouse= %s """, (mr.items[0].item_code, mr.items[0].warehouse))[0][0]
|
||||
self.assertEqual(requested_qty, new_requested_qty)
|
||||
|
@ -106,7 +106,7 @@ frappe.ui.form.on('Stock Entry', {
|
||||
frappe.call({
|
||||
doc: frm.doc,
|
||||
method: "set_items_for_stock_in",
|
||||
callback: function(r) {
|
||||
callback: function() {
|
||||
refresh_field('items');
|
||||
}
|
||||
});
|
||||
|
@ -62,6 +62,7 @@ class StockEntry(StockController):
|
||||
self.validate_inspection()
|
||||
self.validate_fg_completed_qty()
|
||||
self.set_job_card_data()
|
||||
self.set_purpose_for_stock_entry()
|
||||
|
||||
if not self.from_bom:
|
||||
self.fg_completed_qty = 0.0
|
||||
@ -486,10 +487,15 @@ class StockEntry(StockController):
|
||||
self.total_amount = sum([flt(item.amount) for item in self.get("items")])
|
||||
|
||||
def set_stock_entry_type(self):
|
||||
if not self.stock_entry_type and self.purpose:
|
||||
if self.purpose:
|
||||
self.stock_entry_type = frappe.get_cached_value('Stock Entry Type',
|
||||
{'purpose': self.purpose}, 'name')
|
||||
|
||||
def set_purpose_for_stock_entry(self):
|
||||
if self.stock_entry_type and not self.purpose:
|
||||
self.purpose = frappe.get_cached_value('Stock Entry Type',
|
||||
self.stock_entry_type, 'purpose')
|
||||
|
||||
def validate_purchase_order(self):
|
||||
"""Throw exception if more raw material is transferred against Purchase Order than in
|
||||
the raw materials supplied table"""
|
||||
@ -1248,12 +1254,10 @@ def move_sample_to_retention_warehouse(company, items):
|
||||
if stock_entry.get('items'):
|
||||
return stock_entry.as_dict()
|
||||
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_stock_in_entry(source_name, target_doc=None):
|
||||
def set_missing_values(source, target):
|
||||
target.purpose = 'Stock In'
|
||||
target.stock_entry_type = ''
|
||||
target.set_stock_entry_type()
|
||||
|
||||
def update_item(source_doc, target_doc, source_parent):
|
||||
|
@ -2,15 +2,14 @@ frappe.listview_settings['Stock Entry'] = {
|
||||
add_fields: ["`tabStock Entry`.`from_warehouse`", "`tabStock Entry`.`to_warehouse`",
|
||||
"`tabStock Entry`.`purpose`", "`tabStock Entry`.`work_order`", "`tabStock Entry`.`bom_no`"],
|
||||
get_indicator: function (doc) {
|
||||
debugger
|
||||
if (doc.docstatus === 0) {
|
||||
return [__("Draft"), "red", "docstatus,=,0"];
|
||||
|
||||
} else if (doc.purpose == 'Stock Out' && doc.per_transferred < 100) {
|
||||
} else if (doc.purpose === 'Stock Out' && doc.per_transferred < 100) {
|
||||
// not delivered & overdue
|
||||
return [__("Goods In Transit"), "grey", "per_transferred,<,100"];
|
||||
|
||||
} else if (doc.purpose == 'Stock Out' && doc.per_transferred == 100) {
|
||||
} else if (doc.purpose === 'Stock Out' && doc.per_transferred === 100) {
|
||||
return [__("Goods Transferred"), "green", "per_transferred,=,100"];
|
||||
} else if (doc.docstatus === 2) {
|
||||
return [__("Canceled"), "red", "docstatus,=,2"];
|
||||
|
@ -1,113 +1,107 @@
|
||||
[
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 50.0,
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse - _TC",
|
||||
"transfer_qty": 50.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
],
|
||||
"stock_entry_type": "Material Receipt",
|
||||
"purpose": "Material Receipt"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 40.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 40.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
],
|
||||
"posting_date": "2013-01-25",
|
||||
"purpose": "Material Issue",
|
||||
"stock_entry_type": "Material Issue"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 45.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"transfer_qty": 45.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
],
|
||||
"posting_date": "2013-01-25",
|
||||
"purpose": "Material Transfer",
|
||||
"stock_entry_type": "Material Transfer"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 50.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 50.0,
|
||||
"uom": "_Test UOM"
|
||||
},
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 5000,
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"parentfield": "items",
|
||||
"qty": 1,
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse - _TC",
|
||||
"transfer_qty": 1,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
],
|
||||
"purpose": "Repack",
|
||||
"stock_entry_type": "Repack"
|
||||
}
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"stock_entry_type": "Material Receipt",
|
||||
"purpose": "Material Receipt",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 50.0,
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse - _TC",
|
||||
"transfer_qty": 50.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"posting_date": "2013-01-25",
|
||||
"purpose": "Material Issue",
|
||||
"stock_entry_type": "Material Issue",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 40.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 40.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"posting_date": "2013-01-25",
|
||||
"purpose": "Material Transfer",
|
||||
"stock_entry_type": "Material Transfer",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 45.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse 1 - _TC",
|
||||
"transfer_qty": 45.0,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"company": "_Test Company",
|
||||
"doctype": "Stock Entry",
|
||||
"purpose": "Repack",
|
||||
"stock_entry_type": "Repack",
|
||||
"items": [
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 100,
|
||||
"item_code": "_Test Item",
|
||||
"parentfield": "items",
|
||||
"qty": 50.0,
|
||||
"s_warehouse": "_Test Warehouse - _TC",
|
||||
"stock_uom": "_Test UOM",
|
||||
"transfer_qty": 50.0,
|
||||
"uom": "_Test UOM"
|
||||
},
|
||||
{
|
||||
"conversion_factor": 1.0,
|
||||
"cost_center": "_Test Cost Center - _TC",
|
||||
"doctype": "Stock Entry Detail",
|
||||
"expense_account": "Stock Adjustment - _TC",
|
||||
"basic_rate": 5000,
|
||||
"item_code": "_Test Item Home Desktop 100",
|
||||
"parentfield": "items",
|
||||
"qty": 1,
|
||||
"stock_uom": "_Test UOM",
|
||||
"t_warehouse": "_Test Warehouse - _TC",
|
||||
"transfer_qty": 1,
|
||||
"uom": "_Test UOM"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user