Ejemplo n.º 1
0
    def validate(self):
        super(PurchaseOrder, self).validate()

        self.set_status()

        # apply tax withholding only if checked and applicable
        self.set_tax_withholding()

        self.validate_supplier()
        self.validate_schedule_date()
        validate_for_items(self)
        self.check_on_hold_or_closed_status()

        self.validate_uom_is_integer("uom", "qty")
        self.validate_uom_is_integer("stock_uom", "stock_qty")

        self.validate_with_previous_doc()
        self.validate_for_subcontracting()
        self.validate_minimum_order_qty()
        self.validate_bom_for_subcontracting_items()
        self.create_raw_materials_supplied("supplied_items")
        self.set_received_qty_for_drop_ship_items()
        validate_inter_company_party(self.doctype, self.supplier, self.company,
                                     self.inter_company_order_reference)
        self.reset_default_field_value("set_warehouse", "items", "warehouse")
Ejemplo n.º 2
0
    def validate(self):
        super(BuyingController, self).validate()
        if getattr(self, "supplier", None) and not self.supplier_name:
            self.supplier_name = frappe.db.get_value("Supplier", self.supplier,
                                                     "supplier_name")

        self.validate_items()
        self.set_qty_as_per_stock_uom()
        self.validate_stock_or_nonstock_items()
        self.validate_warehouse()

        if self.doctype == "Purchase Invoice":
            self.validate_purchase_receipt_if_update_stock()

        if self.doctype == "Purchase Receipt" or (
                self.doctype == "Purchase Invoice" and self.update_stock):
            # self.validate_purchase_return()
            self.validate_rejected_warehouse()
            self.validate_accepted_rejected_qty()
            validate_for_items(self)

            #sub-contracting
            self.validate_for_subcontracting()
            self.create_raw_materials_supplied("supplied_items")
            self.set_landed_cost_voucher_amount()

        if self.doctype in ("Purchase Receipt", "Purchase Invoice"):
            self.update_valuation_rate("items")
Ejemplo n.º 3
0
	def validate(self):
		super(BuyingController, self).validate()
		if getattr(self, "supplier", None) and not self.supplier_name:
			self.supplier_name = frappe.db.get_value("Supplier", self.supplier, "supplier_name")

		self.set_qty_as_per_stock_uom()
		self.validate_stock_or_nonstock_items()
		self.validate_warehouse()

		if self.doctype=="Purchase Invoice":
			self.validate_purchase_receipt_if_update_stock()

		if self.doctype=="Purchase Receipt" or (self.doctype=="Purchase Invoice" and self.update_stock):
			# self.validate_purchase_return()
			self.validate_rejected_warehouse()
			self.validate_accepted_rejected_qty()
			validate_for_items(self)

			#sub-contracting
			self.validate_for_subcontracting()
			self.create_raw_materials_supplied("supplied_items")
			self.set_landed_cost_voucher_amount()

		if self.doctype in ("Purchase Receipt", "Purchase Invoice"):
			self.update_valuation_rate("items")
Ejemplo n.º 4
0
    def validate(self):
        self.validate_duplicate_supplier()
        self.validate_supplier_list()
        validate_for_items(self)
        super(RequestforQuotation, self).set_qty_as_per_stock_uom()
        self.update_email_id()

        if self.docstatus < 1:
            # after amend and save, status still shows as cancelled, until submit
            frappe.db.set(self, "status", "Draft")
Ejemplo n.º 5
0
	def validate(self):
		super(SupplierQuotation, self).validate()

		if not self.status:
			self.status = "Draft"

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

		validate_for_items(self)
		self.validate_with_previous_doc()
		self.validate_uom_is_integer("uom", "qty")
Ejemplo n.º 6
0
    def validate(self):
        super(SupplierQuotation, self).validate()

        if not self.status:
            self.status = "Draft"

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

        validate_for_items(self)
        self.validate_with_previous_doc()
        self.validate_uom_is_integer("uom", "qty")
    def validate(self):
        super(MaterialRequest, self).validate()

        self.validate_schedule_date()
        self.validate_uom_is_integer("uom", "qty")

        if not self.status:
            self.status = "Draft"

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

        validate_for_items(self)
Ejemplo n.º 8
0
    def validate(self):
        super(PurchaseOrder, self).validate()

        self.set_status()
        validate_for_items(self)
        self.check_for_closed_status()

        self.validate_uom_is_integer("uom", "qty")
        self.validate_uom_is_integer("stock_uom", ["qty", "required_qty"])

        self.validate_with_previous_doc()
        self.validate_for_subcontracting()
        self.validate_minimum_order_qty()
        self.create_raw_materials_supplied("supplied_items")
        self.set_received_qty_for_drop_ship_items()
Ejemplo n.º 9
0
	def validate(self):
		super(MaterialRequest, self).validate()

		self.validate_schedule_date()
		self.validate_uom_is_integer("uom", "qty")

		if not self.status:
			self.status = "Draft"

		from erpnext.controllers.status_updater import validate_status
		validate_status(self.status, 
			["Draft", "Submitted", "Stopped", "Cancelled", "Pending",
			"Partially Ordered", "Ordered", "Issued", "Transferred"])

		validate_for_items(self)
Ejemplo n.º 10
0
	def validate(self):
		super(PurchaseOrder, self).validate()

		self.set_status()
		validate_for_items(self)
		self.check_for_closed_status()

		self.validate_uom_is_integer("uom", "qty")
		self.validate_uom_is_integer("stock_uom", ["qty", "required_qty"])

		self.validate_with_previous_doc()
		self.validate_for_subcontracting()
		self.validate_minimum_order_qty()
		self.create_raw_materials_supplied("supplied_items")
		self.set_received_qty_for_drop_ship_items()
Ejemplo n.º 11
0
	def validate(self):
		super(StockRequisition, self).validate()

		self.validate_schedule_date()
		self.validate_uom_is_integer("uom", "qty")

		if not self.status:
			self.status = "Draft"

		from erpnext.controllers.status_updater import validate_status
		validate_status(self.status,
			["Draft", "Submitted", "Stopped", "Cancelled", "Pending",
			"Partially Ordered", "Ordered", "Issued", "Transferred"])

		validate_for_items(self)
Ejemplo n.º 12
0
	def validate(self):
		super(MaterialRequest, self).validate()

		self.validate_schedule_date()
		self.check_for_on_hold_or_closed_status('Sales Order', 'sales_order')
		self.validate_uom_is_integer("uom", "qty")

		if not self.status:
			self.status = "Draft"

		from erpnext.controllers.status_updater import validate_status
		validate_status(self.status,
			["Draft", "Submitted", "Stopped", "Cancelled", "Pending",
			"Partially Ordered", "Ordered", "Issued", "Transferred", "Received"])

		validate_for_items(self)

		self.set_title()
Ejemplo n.º 13
0
	def validate(self):
		super(PurchaseOrder, self).validate()

		self.set_status()

		self.validate_supplier()
		self.validate_schedule_date()
		validate_for_items(self)
		self.check_on_hold_or_closed_status()

		self.validate_uom_is_integer("uom", "qty")
		self.validate_uom_is_integer("stock_uom", "stock_qty")

		self.validate_with_previous_doc()
		self.validate_for_subcontracting()
		self.validate_minimum_order_qty()
		self.validate_bom_for_subcontracting_items()
		self.create_raw_materials_supplied("supplied_items")
		self.set_received_qty_for_drop_ship_items()
		validate_inter_company_party(self.doctype, self.supplier, self.company, self.inter_company_order_reference)
Ejemplo n.º 14
0
    def validate(self):
        super(MaterialRequest, self).validate()

        self.validate_schedule_date()
        self.check_for_on_hold_or_closed_status("Sales Order", "sales_order")
        self.validate_uom_is_integer("uom", "qty")
        self.validate_material_request_type()

        if not self.status:
            self.status = "Draft"

        from erpnext.controllers.status_updater import validate_status

        validate_status(
            self.status,
            [
                "Draft",
                "Submitted",
                "Stopped",
                "Cancelled",
                "Pending",
                "Partially Ordered",
                "Ordered",
                "Issued",
                "Transferred",
                "Received",
            ],
        )

        validate_for_items(self)

        self.set_title()
        # self.validate_qty_against_so()
        # NOTE: Since Item BOM and FG quantities are combined, using current data, it cannot be validated
        # Though the creation of Material Request from a Production Plan can be rethought to fix this

        self.reset_default_field_value("set_warehouse", "items", "warehouse")
        self.reset_default_field_value("set_from_warehouse", "items",
                                       "from_warehouse")
Ejemplo n.º 15
0
 def validate(self):
     self.validate_duplicate_supplier()
     self.validate_supplier_list()
     validate_for_items(self)
     super(RequestforQuotation, self).set_qty_as_per_stock_uom()
     self.update_email_id()
Ejemplo n.º 16
0
	def validate(self):
		self.validate_duplicate_supplier()
		self.validate_supplier_list()
		validate_for_items(self)
		self.update_email_id()
Ejemplo n.º 17
0
 def validate(self):
     self.validate_duplicate_supplier()
     self.validate_supplier_list()
     validate_for_items(self)
     self.update_email_id()