Beispiel #1
0
    def validate(self):
        self._prev = frappe._dict(
            {
                "contact_date": frappe.db.get_value("Opportunity", self.name, "contact_date")
                if (not cint(self.get("__islocal")))
                else None,
                "contact_by": frappe.db.get_value("Opportunity", self.name, "contact_by")
                if (not cint(self.get("__islocal")))
                else None,
            }
        )

        self.make_new_lead_if_required()

        if not self.enquiry_from:
            frappe.throw(_("Opportunity From field is mandatory"))

        self.set_status()
        self.validate_item_details()
        self.validate_uom_is_integer("uom", "qty")
        self.validate_lead_cust()
        self.validate_cust_name()

        if not self.title:
            self.title = self.customer_name

        from erpnext.accounts.utils import validate_fiscal_year

        validate_fiscal_year(self.transaction_date, self.fiscal_year, _("Opportunity Date"), self)
Beispiel #2
0
	def validate_and_set_fiscal_year(self):
		if not self.fiscal_year:
			self.fiscal_year = get_fiscal_year(self.posting_date, company=self.company)[0]
		else:
			from erpnext.accounts.utils import validate_fiscal_year
			validate_fiscal_year(self.posting_date, self.fiscal_year, self.company,
				self.meta.get_label("posting_date"), self)
	def validate(self):
		validate_fiscal_year(self.inst_date, self.fiscal_year, _("Installation Date"), self)
		self.validate_installation_date()
		self.check_item_table()

		from erpnext.controllers.selling_controller import check_active_sales_items
		check_active_sales_items(self)
Beispiel #4
0
	def validate(self):
		validate_fiscal_year(self.inst_date, self.fiscal_year, _("Installation Date"), self)
		self.validate_installation_date()
		self.check_item_table()

		from erpnext.controllers.selling_controller import check_active_sales_items
		check_active_sales_items(self)
	def validate_and_set_fiscal_year(self):
		if not self.fiscal_year:
			self.fiscal_year = get_fiscal_year(self.posting_date, company=self.company)[0]
		else:
			from erpnext.accounts.utils import validate_fiscal_year
			validate_fiscal_year(self.posting_date, self.fiscal_year, self.company,
				self.meta.get_label("posting_date"), self)
Beispiel #6
0
    def validate(self):
        self.pro_doc = None
        if self.production_order:
            self.pro_doc = frappe.get_doc('Production Order',
                                          self.production_order)

        self.validate_posting_time()
        self.validate_purpose()
        validate_fiscal_year(self.posting_date, self.fiscal_year,
                             self.meta.get_label("posting_date"), self)
        self.validate_item()
        self.set_transfer_qty()
        self.validate_uom_is_integer("uom", "qty")
        self.validate_uom_is_integer("stock_uom", "transfer_qty")
        self.validate_warehouse()
        self.validate_production_order()
        self.get_stock_and_rate()
        self.validate_bom()
        self.validate_finished_goods()
        self.validate_return_reference_doc()
        self.validate_with_material_request()
        self.validate_valuation_rate()
        self.set_total_incoming_outgoing_value()
        self.set_total_amount()
        self.validate_batch()
Beispiel #7
0
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_sanctioned_amount()
		self.validate_expense_approver()
		self.validate_task()
		self.calculate_total_amount()
		set_employee_name(self)
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_sanctioned_amount()
		self.validate_expense_approver()
		self.calculate_total_amount()
		set_employee_name(self)
		if self.task and not self.project:
			self.project = frappe.db.get_value("Task", self.task, "project")
	def validate(self):
		from erpnext.utilities import validate_status
		from erpnext.accounts.utils import validate_fiscal_year
		validate_status(self.status, ["Present", "Absent", "Half Day"])
		validate_fiscal_year(self.att_date, self.fiscal_year, _("Attendance Date"), self)
		self.validate_att_date()
		self.validate_duplicate_record()
		self.check_leave_record()
Beispiel #10
0
	def validate(self):
		from erpnext.controllers.status_updater import validate_status
		from erpnext.accounts.utils import validate_fiscal_year
		validate_status(self.status, ["Present", "Absent", "Half Day"])
		validate_fiscal_year(self.att_date, self.fiscal_year, _("Attendance Date"), self)
		self.validate_att_date()
		self.validate_duplicate_record()
		self.check_leave_record()
Beispiel #11
0
	def validate(self):
		from erpnext.stock.utils import validate_warehouse_company
		self.validate_mandatory()
		self.validate_item()
		validate_warehouse_company(self.warehouse, self.company)
		self.scrub_posting_time()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
Beispiel #12
0
 def validate(self):
     validate_fiscal_year(self.posting_date, self.fiscal_year,
                          _("Posting Date"), self)
     self.validate_sanctioned_amount()
     self.validate_expense_approver()
     self.calculate_total_amount()
     set_employee_name(self)
     if self.task and not self.project:
         self.project = frappe.db.get_value("Task", self.task, "project")
Beispiel #13
0
    def validate(self):
        self.set_status()
        self.validate_item_details()
        self.validate_uom_is_integer("uom", "qty")
        self.validate_lead_cust()

        from erpnext.accounts.utils import validate_fiscal_year
        validate_fiscal_year(self.doc.transaction_date, self.doc.fiscal_year,
                             "Opportunity Date")
	def validate(self):
		dates = []
		for d in self.get("leave_block_list_dates"):
			# validate fiscal year
			validate_fiscal_year(d.block_date, self.year, _("Block Date"))

			# date is not repeated
			if d.block_date in dates:
				frappe.msgprint(_("Date is repeated") + ":" + d.block_date, raise_exception=1)
			dates.append(d.block_date)
Beispiel #15
0
	def validate(self):
		from erpnext.stock.utils import validate_warehouse_company
		self.validate_mandatory()
		self.validate_item()
		validate_warehouse_company(self.warehouse, self.company)
		self.scrub_posting_time()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year,
			self.meta.get_label("posting_date"))
Beispiel #16
0
    def validate_date_with_fiscal_year(self):
        if self.meta.get_field("fiscal_year"):
            date_field = ""
            if self.meta.get_field("posting_date"):
                date_field = "posting_date"
            elif self.meta.get_field("transaction_date"):
                date_field = "transaction_date"

            if date_field and self.get(date_field):
                validate_fiscal_year(self.get(date_field), self.fiscal_year, self.meta.get_label(date_field), self)
 def validate(self):
     dates = []
     for d in self.get("leave_block_list_dates"):
         # validate fiscal year
         validate_fiscal_year(d.block_date, self.year, _("Block Date"))
         # date is not repeated
         if d.block_date in dates:
             frappe.msgprint(_("Date is repeated") + ":" + d.block_date,
                             raise_exception=1)
         dates.append(d.block_date)
Beispiel #18
0
    def validate_date_with_fiscal_year(self):
        if self.meta.get_field("fiscal_year"):
            date_field = ""
            if self.meta.get_field("posting_date"):
                date_field = "posting_date"
            elif self.meta.get_field("transaction_date"):
                date_field = "transaction_date"

            if date_field and self.get(date_field):
                validate_fiscal_year(self.get(date_field), self.fiscal_year,
                                     self.meta.get_label(date_field), self)
Beispiel #19
0
	def validate(self):
		self.flags.ignore_submit_comment = True
		from erpnext.stock.utils import validate_warehouse_company
		self.validate_mandatory()
		self.validate_item()
		self.validate_batch()
		validate_warehouse_company(self.warehouse, self.company)
		self.scrub_posting_time()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
Beispiel #20
0
    def validate(self):
        dates = []
        for d in self.doclist.get({"doctype": "Leave Block List Date"}):
            # validate fiscal year
            validate_fiscal_year(d.block_date, self.doc.year, _("Block Date"))

            # date is not repeated
            if d.block_date in dates:
                frappe.msgprint(_("Date is repeated") + ":" + d.block_date,
                                raise_exception=1)
            dates.append(d.block_date)
	def validate(self):
		self.flags.ignore_submit_comment = True
		from erpnext.stock.utils import validate_warehouse_company
		self.validate_mandatory()
		self.validate_item()
		self.validate_batch()
		validate_warehouse_company(self.warehouse, self.company)
		self.scrub_posting_time()
		self.validate_and_set_fiscal_year()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
Beispiel #22
0
	def validate(self):
		from erpnext.controllers.status_updater import validate_status
		from erpnext.accounts.utils import validate_fiscal_year
		# validate_status(self.status, ["Present", "Absent", "Half Day"])
		validate_fiscal_year(self.att_date, self.fiscal_year, _("Attendance Date"), self)
		self.validate_att_date()
		self.validate_duplicate_record()
		self.check_leave_record()
		self.validate_inout()
		self.calculate_ot()
		self.get_employee_holidays()
		self.min_working_hours()
Beispiel #23
0
 def validate(self):
     from erpnext.controllers.status_updater import validate_status
     from erpnext.accounts.utils import validate_fiscal_year
     # validate_status(self.status, ["Present", "Absent", "Half Day"])
     validate_fiscal_year(self.att_date, self.fiscal_year,
                          _("Attendance Date"), self)
     self.validate_att_date()
     self.validate_duplicate_record()
     self.check_leave_record()
     self.validate_inout()
     self.calculate_ot()
     self.get_employee_holidays()
     self.min_working_hours()
	def validate_posting_date(self):
		from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year

		validate_fiscal_year(self.posting_date, self.fiscal_year, self.company, label=_("Posting Date"), doc=self)

		self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year, company=self.company)[1]

		pce = frappe.db.sql("""select name from `tabPeriod Closing Voucher`
			where posting_date > %s and fiscal_year = %s and docstatus = 1""",
			(self.posting_date, self.fiscal_year))
		if pce and pce[0][0]:
			frappe.throw(_("Another Period Closing Entry {0} has been made after {1}")
				.format(pce[0][0], self.posting_date))
	def validate_posting_date(self):
		from erpnext.accounts.utils import get_fiscal_year, validate_fiscal_year

		validate_fiscal_year(self.posting_date, self.fiscal_year, self.company, label=_("Posting Date"), doc=self)

		self.year_start_date = get_fiscal_year(self.posting_date, self.fiscal_year, company=self.company)[1]

		pce = frappe.db.sql("""select name from `tabPeriod Closing Voucher`
			where posting_date > %s and fiscal_year = %s and docstatus = 1""",
			(self.posting_date, self.fiscal_year))
		if pce and pce[0][0]:
			frappe.throw(_("Another Period Closing Entry {0} has been made after {1}")
				.format(pce[0][0], self.posting_date))
Beispiel #26
0
    def validate(self):
        from erpnext.controllers.status_updater import validate_status
        from erpnext.accounts.utils import validate_fiscal_year
        validate_status(self.status, ["Present", "Absent", "Half Day"])
        validate_fiscal_year(self.att_date, self.fiscal_year,
                             _("Attendance Date"), self)
        self.validate_att_date()
        self.validate_duplicate_record()
        self.check_leave_record()
        self.validate_task_details()

        self.working_hours = self.calculate_total_work_hours()
        self.break_time = self.calculate_total_break_hours()
Beispiel #27
0
	def validate(self):
		self._prev = frappe._dict({
			"contact_date": frappe.db.get_value("Opportunity", self.name, "contact_date") if \
				(not cint(self.get("__islocal"))) else None,
			"contact_by": frappe.db.get_value("Opportunity", self.name, "contact_by") if \
				(not cint(self.get("__islocal"))) else None,
		})

		self.set_status()
		self.validate_item_details()
		self.validate_uom_is_integer("uom", "qty")
		self.validate_lead_cust()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.transaction_date, self.fiscal_year, "Opportunity Date")
Beispiel #28
0
	def validate(self):
		self._prev = frappe._dict({
			"contact_date": frappe.db.get_value("Opportunity", self.name, "contact_date") if \
				(not cint(self.get("__islocal"))) else None,
			"contact_by": frappe.db.get_value("Opportunity", self.name, "contact_by") if \
				(not cint(self.get("__islocal"))) else None,
		})

		self.set_status()
		self.validate_item_details()
		self.validate_uom_is_integer("uom", "qty")
		self.validate_lead_cust()

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.transaction_date, self.fiscal_year, "Opportunity Date")
Beispiel #29
0
    def validate(self):
        self.pro_doc = None
        if self.production_order:
            self.pro_doc = frappe.get_doc("Production Order", self.production_order)

        self.validate_posting_time()
        self.validate_purpose()
        validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
        self.validate_item()
        self.set_transfer_qty()
        self.validate_uom_is_integer("uom", "qty")
        self.validate_uom_is_integer("stock_uom", "transfer_qty")
        self.validate_warehouse()
        self.validate_production_order()
        self.validate_bom()
        self.validate_finished_goods()
        self.validate_with_material_request()
        self.validate_batch()

        self.set_actual_qty()
        self.calculate_rate_and_amount()
Beispiel #30
0
	def validate(self):
		self.pro_doc = None
		if self.production_order:
			self.pro_doc = frappe.get_doc('Production Order', self.production_order)

		self.validate_posting_time()
		self.validate_purpose()
		validate_fiscal_year(self.posting_date, self.fiscal_year, self.meta.get_label("posting_date"), self)
		self.validate_item()
		self.set_transfer_qty()
		self.validate_uom_is_integer("uom", "qty")
		self.validate_uom_is_integer("stock_uom", "transfer_qty")
		self.validate_warehouse()
		self.validate_production_order()
		self.get_stock_and_rate()
		self.validate_bom()
		self.validate_finished_goods()
		self.validate_return_reference_doc()
		self.validate_with_material_request()
		self.validate_valuation_rate()
		self.set_total_incoming_outgoing_value()
		self.set_total_amount()
Beispiel #31
0
	def validate(self):
		self._prev = frappe._dict({
			"contact_date": frappe.db.get_value("Opportunity", self.name, "contact_date") if \
				(not cint(self.get("__islocal"))) else None,
			"contact_by": frappe.db.get_value("Opportunity", self.name, "contact_by") if \
				(not cint(self.get("__islocal"))) else None,
		})

		self.make_new_lead_if_required()

		if not self.enquiry_from:
			frappe.throw(_("Opportunity From field is mandatory"))

		self.set_status()
		self.validate_item_details()
		self.validate_uom_is_integer("uom", "qty")
		self.validate_lead_cust()
		self.validate_cust_name()

		if not self.title:
			self.title = self.customer_name

		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.transaction_date, self.fiscal_year, _("Opportunity Date"), self)
	def validate_fiscal_year(self):
		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year, "Posting Date")
Beispiel #33
0
 def validate_fiscal_year(self):
     from erpnext.accounts.utils import validate_fiscal_year
     validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year,
                          "Posting Date")
Beispiel #34
0
	def validate_fiscal_year(self):
		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.posting_date, self.fiscal_year,
			self.meta.get_label("posting_date"))
 def validate_fiscal_year(self):
     from erpnext.accounts.utils import validate_fiscal_year
     validate_fiscal_year(self.inst_date, self.fiscal_year,
                          "Installation Date")
	def validate_fiscal_year(self):
		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.inst_date, self.fiscal_year, "Installation Date")
Beispiel #37
0
 def validate_fiscal_year(self):
     from erpnext.accounts.utils import validate_fiscal_year
     validate_fiscal_year(self.posting_date, self.fiscal_year,
                          self.meta.get_label("posting_date"))
	def validate(self):
		validate_fiscal_year(self.posting_date, self.fiscal_year, _("Posting Date"), self)
		self.validate_exp_details()
		self.validate_expense_approver()
		set_employee_name(self)
Beispiel #39
0
 def validate_fiscal_year(self):
     from erpnext.accounts.utils import validate_fiscal_year
     validate_fiscal_year(self.att_date, self.fiscal_year)
	def validate_fiscal_year(self):
		from erpnext.accounts.utils import validate_fiscal_year
		validate_fiscal_year(self.att_date, self.fiscal_year)