def validate_item(self, item_code, row_num):
		from stock.utils import validate_end_of_life, validate_is_stock_item, \
			validate_cancelled_item
		
		# using try except to catch all validation msgs and display together
		
		try:
			item = webnotes.doc("Item", item_code)
			
			# end of life and stock item
			validate_end_of_life(item_code, item.end_of_life, verbose=0)
			validate_is_stock_item(item_code, item.is_stock_item, verbose=0)
		
			# item should not be serialized
			if item.has_serial_no == "Yes":
				raise webnotes.ValidationError, (_("Serialized Item: '") + item_code +
					_("""' can not be managed using Stock Reconciliation.\
					You can add/delete Serial No directly, \
					to modify stock of this item."""))
		
			# docstatus should be < 2
			validate_cancelled_item(item_code, item.docstatus, verbose=0)
				
		except Exception, e:
			self.validation_messages.append(_("Row # ") + ("%d: " % (row_num+2)) + cstr(e))
	def validate_item(self, item_code, row_num):
		from stock.utils import validate_end_of_life, validate_is_stock_item, \
			validate_cancelled_item

		# using try except to catch all validation msgs and display together

		try:
			item = webnotes.doc("Item", item_code)
			if not item:
				raise webnotes.ValidationError, (_("Item: {0} not found in the system").format(item_code))

			# end of life and stock item
			validate_end_of_life(item_code, item.end_of_life, verbose=0)
			validate_is_stock_item(item_code, item.is_stock_item, verbose=0)

			# item should not be serialized
			if item.has_serial_no == "Yes":
				raise webnotes.ValidationError, (_("Serialized item: {0} can not be managed \
					using Stock Reconciliation, use Stock Entry instead").format(item_code))

			# item managed batch-wise not allowed
			if item.has_batch_no == "Yes":
				raise webnotes.ValidationError, (_("Item: {0} managed batch-wise, can not be \
					reconciled using Stock Reconciliation, instead use Stock Entry").format(item_code))

			# docstatus should be < 2
			validate_cancelled_item(item_code, item.docstatus, verbose=0)

		except Exception, e:
			self.validation_messages.append(_("Row # ") + ("%d: " % (row_num)) + cstr(e))
Exemple #3
0
	def validate_item(self, item_code, row_num):
		from stock.utils import validate_end_of_life, validate_is_stock_item, \
			validate_cancelled_item
		
		# using try except to catch all validation msgs and display together
		
		try:
			item = webnotes.doc("Item", item_code)
			
			# end of life and stock item
			validate_end_of_life(item_code, item.end_of_life, verbose=0)
			validate_is_stock_item(item_code, item.is_stock_item, verbose=0)
		
			# item should not be serialized
			if item.has_serial_no == "Yes":
				raise webnotes.ValidationError, (_("Serialized Item: '") + item_code +
					_("""' can not be managed using Stock Reconciliation.\
					You can add/delete Serial No directly, \
					to modify stock of this item."""))
		
			# docstatus should be < 2
			validate_cancelled_item(item_code, item.docstatus, verbose=0)
				
		except Exception, e:
			self.validation_messages.append(_("Row # ") + ("%d: " % (row_num+2)) + cstr(e))
Exemple #4
0
    def validate_item(self, item_code, row_num):
        from stock.utils import validate_end_of_life, validate_is_stock_item, \
         validate_cancelled_item

        # using try except to catch all validation msgs and display together

        try:
            item = webnotes.doc("Item", item_code)
            if not item:
                raise webnotes.ValidationError, (
                    _("Item: {0} not found in the system").format(item_code))

            # end of life and stock item
            validate_end_of_life(item_code, item.end_of_life, verbose=0)
            validate_is_stock_item(item_code, item.is_stock_item, verbose=0)

            # item should not be serialized
            if item.has_serial_no == "Yes":
                raise webnotes.ValidationError, (
                    _("Serialized item: {0} can not be managed \
					using Stock Reconciliation, use Stock Entry instead").format(item_code))

            # item managed batch-wise not allowed
            if item.has_batch_no == "Yes":
                raise webnotes.ValidationError, (
                    _("Item: {0} managed batch-wise, can not be \
					reconciled using Stock Reconciliation, instead use Stock Entry").format(
                        item_code))

            # docstatus should be < 2
            validate_cancelled_item(item_code, item.docstatus, verbose=0)

        except Exception, e:
            self.validation_messages.append(
                _("Row # ") + ("%d: " % (row_num)) + cstr(e))