[cleanup] remove is_pro_applicable
This commit is contained in:
parent
18f0dd0a6d
commit
a305c29b0e
@ -329,9 +329,6 @@ class ProductionOrder(Document):
|
|||||||
frappe.delete_doc("Time Log", time_log.name)
|
frappe.delete_doc("Time Log", time_log.name)
|
||||||
|
|
||||||
def validate_production_item(self):
|
def validate_production_item(self):
|
||||||
if not frappe.db.get_value("Item", self.production_item, "is_pro_applicable"):
|
|
||||||
frappe.throw(_("Item is not allowed to have Production Order."), ProductionNotApplicableError)
|
|
||||||
|
|
||||||
if frappe.db.get_value("Item", self.production_item, "has_variants"):
|
if frappe.db.get_value("Item", self.production_item, "has_variants"):
|
||||||
frappe.throw(_("Production Order cannot be raised against a Item Template"), ItemHasVariantError)
|
frappe.throw(_("Production Order cannot be raised against a Item Template"), ItemHasVariantError)
|
||||||
|
|
||||||
|
@ -125,12 +125,6 @@ class TestProductionOrder(unittest.TestCase):
|
|||||||
self.assertEqual(prod_order.planned_operating_cost, cost*2)
|
self.assertEqual(prod_order.planned_operating_cost, cost*2)
|
||||||
|
|
||||||
def test_production_item(self):
|
def test_production_item(self):
|
||||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", 0)
|
|
||||||
|
|
||||||
prod_order = make_prod_order_test_record(item="_Test FG Item", qty=1, do_not_save=True)
|
|
||||||
self.assertRaises(ProductionNotApplicableError, prod_order.save)
|
|
||||||
|
|
||||||
frappe.db.set_value("Item", "_Test FG Item", "is_pro_applicable", 1)
|
|
||||||
frappe.db.set_value("Item", "_Test FG Item", "end_of_life", "2000-1-1")
|
frappe.db.set_value("Item", "_Test FG Item", "end_of_life", "2000-1-1")
|
||||||
|
|
||||||
self.assertRaises(frappe.ValidationError, prod_order.save)
|
self.assertRaises(frappe.ValidationError, prod_order.save)
|
||||||
|
@ -36,7 +36,7 @@ class ProductionPlanningTool(Document):
|
|||||||
so_filter += " and so.project = %(project)s"
|
so_filter += " and so.project = %(project)s"
|
||||||
|
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
item_filter += " and item.name = %(item)s"
|
item_filter += " and so_item.item_code = %(item)s"
|
||||||
|
|
||||||
open_so = frappe.db.sql("""
|
open_so = frappe.db.sql("""
|
||||||
select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
|
select distinct so.name, so.transaction_date, so.customer, so.base_grand_total
|
||||||
@ -44,14 +44,14 @@ class ProductionPlanningTool(Document):
|
|||||||
where so_item.parent = so.name
|
where so_item.parent = so.name
|
||||||
and so.docstatus = 1 and so.status != "Stopped"
|
and so.docstatus = 1 and so.status != "Stopped"
|
||||||
and so.company = %(company)s
|
and so.company = %(company)s
|
||||||
and so_item.qty > so_item.delivered_qty {0}
|
and so_item.qty > so_item.delivered_qty {0} {1}
|
||||||
and (exists (select name from `tabItem` item where item.name=so_item.item_code
|
and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code
|
||||||
and ((item.is_pro_applicable = 1 or item.is_sub_contracted_item = 1) {1}))
|
and bom.is_active = 1)
|
||||||
or exists (select name from `tabPacked Item` pi
|
or exists (select name from `tabPacked Item` pi
|
||||||
where pi.parent = so.name and pi.parent_item = so_item.item_code
|
where pi.parent = so.name and pi.parent_item = so_item.item_code
|
||||||
and exists (select name from `tabItem` item where item.name=pi.item_code
|
and exists (select name from `tabBOM` bom where bom.item=pi.item_code
|
||||||
and (item.is_pro_applicable = 1 or item.is_sub_contracted_item = 1) {2})))
|
and bom.is_active = 1)))
|
||||||
""".format(so_filter, item_filter, item_filter), {
|
""".format(so_filter, item_filter), {
|
||||||
"from_date": self.from_date,
|
"from_date": self.from_date,
|
||||||
"to_date": self.to_date,
|
"to_date": self.to_date,
|
||||||
"customer": self.customer,
|
"customer": self.customer,
|
||||||
@ -86,7 +86,7 @@ class ProductionPlanningTool(Document):
|
|||||||
mr_filter += " and mr_item.warehouse = %(warehouse)s"
|
mr_filter += " and mr_item.warehouse = %(warehouse)s"
|
||||||
|
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
item_filter += " and item.name = %(item)s"
|
item_filter += " and mr_item.item_code = %(item)s"
|
||||||
|
|
||||||
pending_mr = frappe.db.sql("""
|
pending_mr = frappe.db.sql("""
|
||||||
select distinct mr.name, mr.transaction_date
|
select distinct mr.name, mr.transaction_date
|
||||||
@ -94,9 +94,9 @@ class ProductionPlanningTool(Document):
|
|||||||
where mr_item.parent = mr.name
|
where mr_item.parent = mr.name
|
||||||
and mr.material_request_type = "Manufacture"
|
and mr.material_request_type = "Manufacture"
|
||||||
and mr.docstatus = 1
|
and mr.docstatus = 1
|
||||||
and mr_item.qty > mr_item.ordered_qty {0}
|
and mr_item.qty > ifnull(mr_item.ordered_qty,0) {0} {1}
|
||||||
and (exists (select name from `tabItem` item where item.name=mr_item.item_code
|
and (exists (select name from `tabBOM` bom where bom.item=mr_item.item_code
|
||||||
and (item.is_pro_applicable = 1 or item.is_sub_contracted_item = 1 {1})))
|
and bom.is_active = 1))
|
||||||
""".format(mr_filter, item_filter), {
|
""".format(mr_filter, item_filter), {
|
||||||
"from_date": self.from_date,
|
"from_date": self.from_date,
|
||||||
"to_date": self.to_date,
|
"to_date": self.to_date,
|
||||||
@ -137,8 +137,8 @@ class ProductionPlanningTool(Document):
|
|||||||
(qty - delivered_qty) as pending_qty
|
(qty - delivered_qty) as pending_qty
|
||||||
from `tabSales Order Item` so_item
|
from `tabSales Order Item` so_item
|
||||||
where parent in (%s) and docstatus = 1 and qty > delivered_qty
|
where parent in (%s) and docstatus = 1 and qty > delivered_qty
|
||||||
and exists (select * from `tabItem` item where item.name=so_item.item_code
|
and exists (select name from `tabBOM` bom where bom.item=so_item.item_code
|
||||||
and item.is_pro_applicable = 1) %s""" % \
|
and bom.is_active = 1) %s""" % \
|
||||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||||
|
|
||||||
if self.fg_item:
|
if self.fg_item:
|
||||||
@ -151,8 +151,8 @@ class ProductionPlanningTool(Document):
|
|||||||
where so_item.parent = pi.parent and so_item.docstatus = 1
|
where so_item.parent = pi.parent and so_item.docstatus = 1
|
||||||
and pi.parent_item = so_item.item_code
|
and pi.parent_item = so_item.item_code
|
||||||
and so_item.parent in (%s) and so_item.qty > so_item.delivered_qty
|
and so_item.parent in (%s) and so_item.qty > so_item.delivered_qty
|
||||||
and exists (select * from `tabItem` item where item.name=pi.item_code
|
and exists (select name from `tabBOM` bom where bom.item=pi.item_code
|
||||||
and item.is_pro_applicable = 1) %s""" % \
|
and bom.is_active = 1) %s""" % \
|
||||||
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
|
||||||
|
|
||||||
self.add_items(items + packed_items)
|
self.add_items(items + packed_items)
|
||||||
@ -171,8 +171,8 @@ class ProductionPlanningTool(Document):
|
|||||||
(qty - ordered_qty) as pending_qty
|
(qty - ordered_qty) as pending_qty
|
||||||
from `tabMaterial Request Item` mr_item
|
from `tabMaterial Request Item` mr_item
|
||||||
where parent in (%s) and docstatus = 1 and qty > ordered_qty
|
where parent in (%s) and docstatus = 1 and qty > ordered_qty
|
||||||
and exists (select * from `tabItem` item where item.name=mr_item.item_code
|
and exists (select name from `tabBOM` bom where bom.item=mr_item.item_code
|
||||||
and item.is_pro_applicable = 1) %s""" % \
|
and bom.is_active = 1) %s""" % \
|
||||||
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
(", ".join(["%s"] * len(mr_list)), item_condition), tuple(mr_list), as_dict=1)
|
||||||
|
|
||||||
self.add_items(items)
|
self.add_items(items)
|
||||||
@ -324,7 +324,6 @@ class ProductionPlanningTool(Document):
|
|||||||
fb.description, fb.stock_uom, it.min_order_qty
|
fb.description, fb.stock_uom, it.min_order_qty
|
||||||
from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` it
|
from `tabBOM Explosion Item` fb, `tabBOM` bom, `tabItem` it
|
||||||
where bom.name = fb.parent and it.name = fb.item_code
|
where bom.name = fb.parent and it.name = fb.item_code
|
||||||
and (is_pro_applicable = 0 or ifnull(default_bom, "")="")
|
|
||||||
and (is_sub_contracted_item = 0 or ifnull(default_bom, "")="")
|
and (is_sub_contracted_item = 0 or ifnull(default_bom, "")="")
|
||||||
and is_stock_item = 1
|
and is_stock_item = 1
|
||||||
and fb.docstatus<2 and bom.name=%s
|
and fb.docstatus<2 and bom.name=%s
|
||||||
|
@ -4,7 +4,7 @@ import frappe
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
|
fields = ("is_stock_item", "is_asset_item", "has_batch_no", "has_serial_no",
|
||||||
"inspection_required", "is_pro_applicable", "is_sub_contracted_item")
|
"inspection_required", "is_sub_contracted_item")
|
||||||
|
|
||||||
|
|
||||||
# convert to 1 or 0
|
# convert to 1 or 0
|
||||||
|
@ -15,6 +15,7 @@ erpnext.ItemSelector = Class.extend({
|
|||||||
}
|
}
|
||||||
me.dialog.show();
|
me.dialog.show();
|
||||||
me.render_items();
|
me.render_items();
|
||||||
|
setTimeout(function() { me.dialog.input.focus(); }, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -238,9 +238,9 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
||||||
|
|
||||||
make_item("_Test Service Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Service Product Bundle", {"is_stock_item": 0})
|
||||||
make_item("_Test Service Product Bundle Item 1", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Service Product Bundle Item 1", {"is_stock_item": 0})
|
||||||
make_item("_Test Service Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Service Product Bundle Item 2", {"is_stock_item": 0})
|
||||||
|
|
||||||
make_product_bundle("_Test Service Product Bundle",
|
make_product_bundle("_Test Service Product Bundle",
|
||||||
["_Test Service Product Bundle Item 1", "_Test Service Product Bundle Item 2"])
|
["_Test Service Product Bundle Item 1", "_Test Service Product Bundle Item 2"])
|
||||||
@ -254,9 +254,9 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
from erpnext.selling.doctype.product_bundle.test_product_bundle import make_product_bundle
|
||||||
|
|
||||||
make_item("_Test Mix Product Bundle", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Mix Product Bundle", {"is_stock_item": 0})
|
||||||
make_item("_Test Mix Product Bundle Item 1", {"is_stock_item": 1})
|
make_item("_Test Mix Product Bundle Item 1", {"is_stock_item": 1})
|
||||||
make_item("_Test Mix Product Bundle Item 2", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Mix Product Bundle Item 2", {"is_stock_item": 0})
|
||||||
|
|
||||||
make_product_bundle("_Test Mix Product Bundle",
|
make_product_bundle("_Test Mix Product Bundle",
|
||||||
["_Test Mix Product Bundle Item 1", "_Test Mix Product Bundle Item 2"])
|
["_Test Mix Product Bundle Item 1", "_Test Mix Product Bundle Item 2"])
|
||||||
@ -265,7 +265,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
|
|
||||||
def test_auto_insert_price(self):
|
def test_auto_insert_price(self):
|
||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
make_item("_Test Item for Auto Price List", {"is_stock_item": 0, "is_pro_applicable": 0})
|
make_item("_Test Item for Auto Price List", {"is_stock_item": 0})
|
||||||
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
|
frappe.db.set_value("Stock Settings", None, "auto_insert_price_list_rate_if_missing", 1)
|
||||||
|
|
||||||
item_price = frappe.db.get_value("Item Price", {"price_list": "_Test Price List",
|
item_price = frappe.db.get_value("Item Price", {"price_list": "_Test Price List",
|
||||||
@ -299,7 +299,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
from erpnext.stock.doctype.item.test_item import make_item
|
from erpnext.stock.doctype.item.test_item import make_item
|
||||||
from erpnext.buying.doctype.purchase_order.purchase_order import update_status
|
from erpnext.buying.doctype.purchase_order.purchase_order import update_status
|
||||||
|
|
||||||
po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "delivered_by_supplier": 1,
|
po_item = make_item("_Test Item for Drop Shipping", {"is_stock_item": 1, "delivered_by_supplier": 1,
|
||||||
'default_supplier': '_Test Supplier',
|
'default_supplier': '_Test Supplier',
|
||||||
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
"expense_account": "_Test Account Cost for Goods Sold - _TC",
|
||||||
"cost_center": "_Test Cost Center - _TC"
|
"cost_center": "_Test Cost Center - _TC"
|
||||||
@ -333,7 +333,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
existing_ordered_qty = bin[0].ordered_qty if bin else 0.0
|
existing_ordered_qty = bin[0].ordered_qty if bin else 0.0
|
||||||
existing_reserved_qty = bin[0].reserved_qty if bin else 0.0
|
existing_reserved_qty = bin[0].reserved_qty if bin else 0.0
|
||||||
|
|
||||||
bin = frappe.get_all("Bin", filters={"item_code": dn_item.item_code,
|
bin = frappe.get_all("Bin", filters={"item_code": dn_item.item_code,
|
||||||
"warehouse": "_Test Warehouse - _TC"}, fields=["reserved_qty"])
|
"warehouse": "_Test Warehouse - _TC"}, fields=["reserved_qty"])
|
||||||
|
|
||||||
existing_reserved_qty_for_dn_item = bin[0].reserved_qty if bin else 0.0
|
existing_reserved_qty_for_dn_item = bin[0].reserved_qty if bin else 0.0
|
||||||
@ -341,7 +341,7 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
#create so, po and partial dn
|
#create so, po and partial dn
|
||||||
so = make_sales_order(item_list=so_items, do_not_submit=True)
|
so = make_sales_order(item_list=so_items, do_not_submit=True)
|
||||||
so.submit()
|
so.submit()
|
||||||
|
|
||||||
po = make_purchase_order_for_drop_shipment(so.name, '_Test Supplier')
|
po = make_purchase_order_for_drop_shipment(so.name, '_Test Supplier')
|
||||||
po.submit()
|
po.submit()
|
||||||
|
|
||||||
@ -420,10 +420,10 @@ class TestSalesOrder(unittest.TestCase):
|
|||||||
so.items[0].margin_type = 'Percentage'
|
so.items[0].margin_type = 'Percentage'
|
||||||
so.items[0].margin_rate_or_amount = 25
|
so.items[0].margin_rate_or_amount = 25
|
||||||
so.insert()
|
so.insert()
|
||||||
|
|
||||||
new_so = frappe.copy_doc(so)
|
new_so = frappe.copy_doc(so)
|
||||||
new_so.save(ignore_permissions=True)
|
new_so.save(ignore_permissions=True)
|
||||||
|
|
||||||
self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
|
self.assertEquals(new_so.get("items")[0].rate, flt((price_list_rate*25)/100 + price_list_rate))
|
||||||
new_so.items[0].margin_rate_or_amount = 25
|
new_so.items[0].margin_rate_or_amount = 25
|
||||||
new_so.submit()
|
new_so.submit()
|
||||||
|
@ -277,7 +277,6 @@ def create_items(args):
|
|||||||
is_sales_item = args.get("is_sales_item_" + str(i))
|
is_sales_item = args.get("is_sales_item_" + str(i))
|
||||||
is_purchase_item = args.get("is_purchase_item_" + str(i))
|
is_purchase_item = args.get("is_purchase_item_" + str(i))
|
||||||
is_stock_item = item_group!=_("Services")
|
is_stock_item = item_group!=_("Services")
|
||||||
is_pro_applicable = item_group!=_("Services")
|
|
||||||
default_warehouse = ""
|
default_warehouse = ""
|
||||||
if is_stock_item:
|
if is_stock_item:
|
||||||
default_warehouse = frappe.db.get_value("Warehouse", filters={
|
default_warehouse = frappe.db.get_value("Warehouse", filters={
|
||||||
@ -293,7 +292,6 @@ def create_items(args):
|
|||||||
"description": item,
|
"description": item,
|
||||||
"show_in_website": 1,
|
"show_in_website": 1,
|
||||||
"is_stock_item": is_stock_item and 1 or 0,
|
"is_stock_item": is_stock_item and 1 or 0,
|
||||||
"is_pro_applicable": is_pro_applicable and 1 or 0,
|
|
||||||
"item_group": item_group,
|
"item_group": item_group,
|
||||||
"stock_uom": args.get("item_uom_" + str(i)),
|
"stock_uom": args.get("item_uom_" + str(i)),
|
||||||
"default_warehouse": default_warehouse
|
"default_warehouse": default_warehouse
|
||||||
|
@ -1683,26 +1683,24 @@
|
|||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
"collapsible": 0,
|
"collapsible": 0,
|
||||||
"default": "",
|
|
||||||
"depends_on": "",
|
"depends_on": "",
|
||||||
"description": "",
|
"fieldname": "default_bom",
|
||||||
"fieldname": "is_pro_applicable",
|
"fieldtype": "Link",
|
||||||
"fieldtype": "Check",
|
|
||||||
"hidden": 0,
|
"hidden": 0,
|
||||||
"ignore_user_permissions": 0,
|
"ignore_user_permissions": 1,
|
||||||
"ignore_xss_filter": 0,
|
"ignore_xss_filter": 0,
|
||||||
"in_filter": 0,
|
"in_filter": 0,
|
||||||
"in_list_view": 0,
|
"in_list_view": 0,
|
||||||
"label": "Allow Production Order",
|
"label": "Default BOM",
|
||||||
"length": 0,
|
"length": 0,
|
||||||
"no_copy": 0,
|
"no_copy": 1,
|
||||||
"oldfieldname": "is_pro_applicable",
|
"oldfieldname": "default_bom",
|
||||||
"oldfieldtype": "Select",
|
"oldfieldtype": "Link",
|
||||||
"options": "",
|
"options": "BOM",
|
||||||
"permlevel": 0,
|
"permlevel": 0,
|
||||||
"print_hide": 0,
|
"print_hide": 0,
|
||||||
"print_hide_if_no_value": 0,
|
"print_hide_if_no_value": 0,
|
||||||
"read_only": 0,
|
"read_only": 1,
|
||||||
"report_hide": 0,
|
"report_hide": 0,
|
||||||
"reqd": 0,
|
"reqd": 0,
|
||||||
"search_index": 0,
|
"search_index": 0,
|
||||||
@ -1762,34 +1760,6 @@
|
|||||||
"set_only_once": 0,
|
"set_only_once": 0,
|
||||||
"unique": 0
|
"unique": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"allow_on_submit": 0,
|
|
||||||
"bold": 0,
|
|
||||||
"collapsible": 0,
|
|
||||||
"depends_on": "",
|
|
||||||
"fieldname": "default_bom",
|
|
||||||
"fieldtype": "Link",
|
|
||||||
"hidden": 0,
|
|
||||||
"ignore_user_permissions": 1,
|
|
||||||
"ignore_xss_filter": 0,
|
|
||||||
"in_filter": 0,
|
|
||||||
"in_list_view": 0,
|
|
||||||
"label": "Default BOM",
|
|
||||||
"length": 0,
|
|
||||||
"no_copy": 1,
|
|
||||||
"oldfieldname": "default_bom",
|
|
||||||
"oldfieldtype": "Link",
|
|
||||||
"options": "BOM",
|
|
||||||
"permlevel": 0,
|
|
||||||
"print_hide": 0,
|
|
||||||
"print_hide_if_no_value": 0,
|
|
||||||
"read_only": 1,
|
|
||||||
"report_hide": 0,
|
|
||||||
"reqd": 0,
|
|
||||||
"search_index": 0,
|
|
||||||
"set_only_once": 0,
|
|
||||||
"unique": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"allow_on_submit": 0,
|
"allow_on_submit": 0,
|
||||||
"bold": 0,
|
"bold": 0,
|
||||||
@ -2235,7 +2205,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 1,
|
"max_attachments": 1,
|
||||||
"modified": "2016-04-15 11:18:48.948958",
|
"modified": "2016-04-15 04:53:25.076425",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Stock",
|
"module": "Stock",
|
||||||
"name": "Item",
|
"name": "Item",
|
||||||
@ -2402,6 +2372,7 @@
|
|||||||
"write": 0
|
"write": 0
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"quick_entry": 0,
|
||||||
"read_only": 0,
|
"read_only": 0,
|
||||||
"read_only_onload": 0,
|
"read_only_onload": 0,
|
||||||
"search_fields": "item_name,description,item_group,customer_code",
|
"search_fields": "item_name,description,item_group,customer_code",
|
||||||
|
@ -54,7 +54,7 @@ class Item(WebsiteGenerator):
|
|||||||
self.description = self.item_name
|
self.description = self.item_name
|
||||||
|
|
||||||
self.publish_in_hub = 1
|
self.publish_in_hub = 1
|
||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
super(Item, self).validate()
|
super(Item, self).validate()
|
||||||
|
|
||||||
@ -348,9 +348,6 @@ class Item(WebsiteGenerator):
|
|||||||
frappe.throw(_("Conversion factor for default Unit of Measure must be 1 in row {0}").format(d.idx))
|
frappe.throw(_("Conversion factor for default Unit of Measure must be 1 in row {0}").format(d.idx))
|
||||||
|
|
||||||
def validate_item_type(self):
|
def validate_item_type(self):
|
||||||
if self.is_pro_applicable == 1 and self.is_stock_item==0:
|
|
||||||
self.is_pro_applicable = 0
|
|
||||||
|
|
||||||
if self.has_serial_no == 1 and self.is_stock_item == 0:
|
if self.has_serial_no == 1 and self.is_stock_item == 0:
|
||||||
msgprint(_("'Has Serial No' can not be 'Yes' for non-stock item"), raise_exception=1)
|
msgprint(_("'Has Serial No' can not be 'Yes' for non-stock item"), raise_exception=1)
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ def make_purchase_order(source_name, target_doc=None):
|
|||||||
}, target_doc, postprocess)
|
}, target_doc, postprocess)
|
||||||
|
|
||||||
return doclist
|
return doclist
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_request_for_quotation(source_name, target_doc=None):
|
def make_request_for_quotation(source_name, target_doc=None):
|
||||||
doclist = get_mapped_doc("Material Request", source_name, {
|
doclist = get_mapped_doc("Material Request", source_name, {
|
||||||
@ -363,8 +363,8 @@ def raise_production_orders(material_request):
|
|||||||
errors =[]
|
errors =[]
|
||||||
production_orders = []
|
production_orders = []
|
||||||
for d in mr.items:
|
for d in mr.items:
|
||||||
if (d.qty - d.ordered_qty) >0 :
|
if (d.qty - d.ordered_qty) >0:
|
||||||
if frappe.db.get_value("Item", d.item_code, "is_pro_applicable"):
|
if frappe.db.get_value("BOM", {"item": d.item_code, "is_default": 1}):
|
||||||
prod_order = frappe.new_doc("Production Order")
|
prod_order = frappe.new_doc("Production Order")
|
||||||
prod_order.production_item = d.item_code
|
prod_order.production_item = d.item_code
|
||||||
prod_order.qty = d.qty - d.ordered_qty
|
prod_order.qty = d.qty - d.ordered_qty
|
||||||
|
Loading…
x
Reference in New Issue
Block a user