示例#1
0
	def raise_production_orders(self):
		"""It will raise production order (Draft) for all distinct FG items"""
		self.validate_data()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", "planned_qty")

		items = self.get_production_items()

		pro_list = []
		frappe.flags.mute_messages = True

		for key in items:
			production_order = self.create_production_order(items[key])
			if production_order:
				pro_list.append(production_order)

		frappe.flags.mute_messages = False

		if pro_list:
			pro_list = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
				(p, p) for p in pro_list]
			msgprint(_("{0} created").format(comma_and(pro_list)))
		else :
			msgprint(_("No Production Orders created"))
示例#2
0
文件: bom.py 项目: BIANBS/erpnext
	def validate(self):
		self.clear_operations()
		self.validate_main_item()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", "qty")

		self.validate_operations()
		self.validate_materials()
		self.set_bom_material_details()
		self.calculate_cost()
示例#3
0
	def validate(self):
		self.validate_production_item()
		if self.bom_no:
			validate_bom_no(self.production_item, self.bom_no)

		self.validate_sales_order()
		self.validate_warehouse()
		self.calculate_operating_cost()
		self.validate_qty()
		self.validate_operation_time()
		self.status = self.get_status()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
示例#4
0
	def validate(self):
		if self.docstatus == 0:
			self.status = "Draft"

		from erpnext.utilities import validate_status
		validate_status(self.status, ["Draft", "Submitted", "Stopped",
			"In Process", "Completed", "Cancelled"])

		self.validate_bom_no()
		self.validate_sales_order()
		self.validate_warehouse()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
示例#5
0
	def validate(self):
		# if not self.route:
		self.route = frappe.scrub(self.name).replace('_', '-')
		self.clear_operations()
		self.validate_main_item()
		self.validate_currency()
		self.set_conversion_rate()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", "qty", "BOM Item")

		self.validate_materials()
		self.set_bom_material_details()
		self.validate_operations()
		self.calculate_cost()
	def raise_production_order(self):
		"""It will raise production order (Draft) for all distinct FG items"""
		self.validate_data()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", "planned_qty")

		items = self.get_distinct_items_and_boms()[1]
		pro = self.create_production_order(items)
		if pro:
			pro = ["""<a href="#Form/Production Order/%s" target="_blank">%s</a>""" % \
				(p, p) for p in pro]
			msgprint(_("{0} created").format(comma_and(pro)))
		else :
			msgprint(_("No Production Orders created"))
示例#7
0
	def validate(self):
		"""
			* Validate existence of submitted Delivery Note
			* Case nos do not overlap
			* Check if packed qty doesn't exceed actual qty of delivery note

			It is necessary to validate case nos before checking quantity
		"""
		self.validate_delivery_note()
		self.validate_items_mandatory()
		self.validate_case_nos()
		self.validate_qty()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", "qty")
		validate_uom_is_integer(self, "weight_uom", "net_weight")
示例#8
0
	def validate(self):
		self.validate_production_item()
		if self.bom_no:
			validate_bom_no(self.production_item, self.bom_no)

		self.validate_sales_order()
		self.set_default_warehouse()
		self.validate_warehouse_belongs_to_company()
		self.calculate_operating_cost()
		self.validate_qty()
		self.validate_operation_time()
		self.status = self.get_status()

		validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])

		self.set_required_items(reset_only_qty = len(self.get("required_items")))
示例#9
0
    def validate(self):
        if self.docstatus == 0:
            self.status = "Draft"

        from erpnext.utilities import validate_status
        validate_status(self.status, [
            "Draft", "Submitted", "Stopped", "In Process", "Completed",
            "Cancelled"
        ])

        self.validate_bom_no()
        self.validate_sales_order()
        self.validate_warehouse()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
示例#10
0
	def validate(self):
		self.validate_production_item()
		if self.bom_no:
			validate_bom_no(self.production_item, self.bom_no)

		self.validate_sales_order()
		self.set_default_warehouse()
		self.validate_warehouse_belongs_to_company()
		self.calculate_operating_cost()
		self.validate_qty()
		self.validate_operation_time()
		self.status = self.get_status()

		validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])

		self.set_required_items(reset_only_qty = len(self.get("required_items")))
示例#11
0
    def validate(self):
        """
			* Validate existence of submitted Delivery Note
			* Case nos do not overlap
			* Check if packed qty doesn't exceed actual qty of delivery note

			It is necessary to validate case nos before checking quantity
		"""
        self.validate_delivery_note()
        self.validate_items_mandatory()
        self.validate_case_nos()
        self.validate_qty()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", "qty")
        validate_uom_is_integer(self, "weight_uom", "net_weight")
示例#12
0
    def validate(self):
        # if not self.route:
        self.route = frappe.scrub(self.name).replace('_', '-')
        self.clear_operations()
        self.validate_main_item()
        self.validate_currency()
        self.set_conversion_rate()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", "stock_qty", "BOM Item")

        self.update_stock_qty()
        self.set_bom_material_details()
        self.validate_materials()
        self.validate_operations()
        self.calculate_cost()
示例#13
0
	def validate(self):
		if self.docstatus == 0:
			self.status = "Draft"

		from erpnext.controllers.status_updater import validate_status
		validate_status(self.status, ["Draft", "Submitted", "Stopped",
			"In Process", "Completed", "Cancelled"])

		if self.bom_no:
			validate_bom_no(self.production_item, self.bom_no)

		self.validate_sales_order()
		self.validate_warehouse()
		self.calculate_operating_cost()
		self.validate_delivery_date()

		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
示例#14
0
    def validate(self):
        if self.docstatus == 0:
            self.status = "Draft"

        from erpnext.controllers.status_updater import validate_status
        validate_status(self.status, [
            "Draft", "Submitted", "Stopped", "In Process", "Completed",
            "Cancelled"
        ])

        if self.bom_no:
            validate_bom_no(self.production_item, self.bom_no)

        self.validate_sales_order()
        self.validate_warehouse()
        self.calculate_operating_cost()
        self.validate_delivery_date()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", ["qty", "produced_qty"])
    def raise_production_orders(self):
        """It will raise production order (Draft) for all distinct Items"""
        self.validate_data()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", "planned_qty")

        items = self.get_production_items()

        pro_list = []
        for key in items:
            production_order = self.create_production_order(items[key])
            if production_order:
                pro_list.append(production_order)

        if pro_list:
            pro_list = ["""<a href="#Form/Work Order/%s" target="_blank">%s</a>""" % \
             (p, p) for p in pro_list]
            frappe.msgprint(_("{0} created").format(comma_and(pro_list)))
        else:
            frappe.msgprint(_("No Work Orders created"))
示例#16
0
	def validate_uom_is_interger(self):
		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "uom", "qty", "BOM Item")
		validate_uom_is_integer(self, "stock_uom", "stock_qty", "BOM Item")
示例#17
0
	def validate_uom_is_interger(self):
		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "uom", "qty", "Collect Production Item Materials")
		validate_uom_is_integer(self, "stock_uom", "stock_qty", "Collect Production Item Materials")
示例#18
0
	def validate(self):
		self.validate_main_item()
		self.validate_child_items()
		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "uom", "qty")
 def validate(self):
     self.validate_main_item()
     self.validate_child_items()
     from erpnext.utilities.transaction_base import validate_uom_is_integer
     validate_uom_is_integer(self, "uom", "qty")
示例#20
0
文件: bom.py 项目: PawanMeh/erpnext
	def validate_uom_is_interger(self):
		from erpnext.utilities.transaction_base import validate_uom_is_integer
		validate_uom_is_integer(self, "uom", "qty", "BOM Item")
		validate_uom_is_integer(self, "stock_uom", "stock_qty", "BOM Item")
    def raise_stock_entries(self):
        """It will raise a stock entries of purpose manufacture for all distinct FG items"""

        self.validate_data()

        from erpnext.utilities.transaction_base import validate_uom_is_integer
        validate_uom_is_integer(self, "stock_uom", "planned_qty")

        #frappe.flags.mute_messages = False

        items = self.get_manufacture_items()

        allow_negative_stock = cint(
            frappe.db.get_value("Stock Settings", None,
                                "allow_negative_stock"))

        se_list = []

        for key in items:
            i = items[key]
            se = self.make_stock_entry(items[key])
            if se:

                #check quantities in stock for each BOM items before insert and submit
                for d in se.items:
                    previous_sle = get_previous_sle({
                        "item_code":
                        d.item_code,
                        "warehouse":
                        d.s_warehouse or d.t_warehouse,
                        "posting_date":
                        nowdate(),
                        "posting_time":
                        nowtime()
                    })

                    # get actual stock at source warehouse
                    d.actual_qty = previous_sle.get(
                        "qty_after_transaction") or 0

                    # validate qty before submit
                    if d.s_warehouse and not allow_negative_stock and d.actual_qty < d.transfer_qty:
                        frappe.throw(_(
                            "For manufacturing item {0} you need {3} x {2} in warehouse {1}"
                        ).format(i['manufacture_item'],
                                 frappe.bold(d.s_warehouse),
                                 frappe.bold(d.item_code),
                                 frappe.bold(d.transfer_qty)) + '<br>' +
                                     _("Available qty is {0}, you need {1}"
                                       ).format(frappe.bold(d.actual_qty),
                                                frappe.bold(d.transfer_qty)),
                                     NegativeStockError,
                                     title=_('Insufficient Stock'))

                se_list.append(se)

        if se_list:
            for se in se_list:
                se.insert()
                se.submit()
            se_list = [
                """<a href="#Form/Stock Entry/%s" target="_blank">%s</a>""" %
                (p.name, p.title) for p in se_list
            ]
            msgprint(
                _("Created {0} stock entries:<br />{1}").format(
                    len(se_list), "<br/>".join(se_list)))
        else:
            msgprint(_("No Stock Entry created"))