def validate(self):
		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)
		self.validate_date_with_fiscal_year()

		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()

			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)

			validate_return(self)
			self.set_total_in_words()

		if self.doctype in ("Sales Invoice", "Purchase Invoice") and not self.is_return:
			self.validate_due_date()
			self.validate_advance_entries()

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()

		self.validate_party()
		self.validate_currency()

		if self.meta.get_field("is_recurring"):
			if self.amended_from and self.recurring_id:
				self.recurring_id = None
			if not self.get("__islocal"):
				validate_recurring_document(self)
				convert_to_recurring(self, self.get("posting_date") or self.get("transaction_date"))

		if self.doctype == 'Purchase Invoice':
			self.validate_paid_amount()
	def validate(self):
		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)

		self.validate_date_with_fiscal_year()

		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()

			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)

			validate_return(self)
			self.set_total_in_words()

		self.validate_all_documents_schedule()

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()
			self.validate_tax_account_company()

		self.validate_party()
		self.validate_currency()

		if self.doctype == 'Purchase Invoice':
			self.validate_paid_amount()
Exemple #3
0
    def validate(self):
        if self.get("_action") and self._action != "update_after_submit":
            self.set_missing_values(for_validate=True)

        self.validate_date_with_fiscal_year()

        if self.meta.get_field("currency"):
            self.calculate_taxes_and_totals()

            if not self.meta.get_field("is_return") or not self.is_return:
                self.validate_value("base_grand_total", ">=", 0)

            validate_return(self)
            self.set_total_in_words()

        self.validate_all_documents_schedule()

        if self.meta.get_field("taxes_and_charges"):
            self.validate_enabled_taxes_and_charges()
            self.validate_tax_account_company()

        self.validate_party()
        self.validate_currency()

        if self.doctype == 'Purchase Invoice':
            self.validate_paid_amount()
Exemple #4
0
    def validate(self):
        if self.get("_action") and self._action != "update_after_submit":
            self.set_missing_values(for_validate=True)
        self.validate_date_with_fiscal_year()

        if self.meta.get_field("currency"):
            self.calculate_taxes_and_totals()
            if not self.meta.get_field("is_return") or not self.is_return:
                self.validate_value("base_grand_total", ">=", 0)

            validate_return(self)
            self.set_total_in_words()

        if self.doctype in ("Sales Invoice",
                            "Purchase Invoice") and not self.is_return:
            self.validate_due_date()

        if self.meta.get_field("taxes_and_charges"):
            self.validate_enabled_taxes_and_charges()

        self.validate_party()
        self.validate_currency()

        if self.meta.get_field("is_recurring") and not self.get("__islocal"):
            validate_recurring_document(self)
            convert_to_recurring(
                self,
                self.get("posting_date") or self.get("transaction_date"))
Exemple #5
0
	def validate(self):
		if not self.get('is_return'):
			self.validate_qty_is_not_zero()

		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)

		self.ensure_supplier_is_not_blocked()

		self.validate_date_with_fiscal_year()

		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()

			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)

			validate_return(self)
			self.set_total_in_words()

		self.validate_all_documents_schedule()

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()
			self.validate_tax_account_company()

		self.validate_party()
		self.validate_currency()

		if self.doctype == 'Purchase Invoice':
			self.calculate_paid_amount()

		if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
			pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
			if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
				self.set_advances()

			if self.is_return:
				self.validate_qty()
			else:
				self.validate_deferred_start_and_end_date()

		validate_regional(self)
		if self.doctype != 'Material Request':
			apply_pricing_rule_on_transaction(self)
	def validate(self):
		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)
		self.validate_date_with_fiscal_year()
		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()
			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)
			
			validate_return(self)
			self.set_total_in_words()

		if self.doctype in ("Sales Invoice", "Purchase Invoice") and not self.is_return:
			self.validate_due_date()

		if self.meta.get_field("is_recurring"):
			validate_recurring_document(self)

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()
Exemple #7
0
	def validate(self):

		#self.validate_qty_is_not_zero()
		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)

		self.ensure_supplier_is_not_blocked()

		self.validate_date_with_fiscal_year()

		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()

			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)

			validate_return(self)

			if self.meta.get_field("in_words") or self.meta.get_field("base_in_words"):
				self.set_total_in_words()

		self.validate_all_documents_schedule()

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()
			self.validate_tax_account_company()

		self.validate_party()
		self.validate_currency()

		if self.doctype == 'Purchase Invoice':
			self.validate_paid_amount()

		if self.doctype in ['Purchase Invoice', 'Sales Invoice', 'Landed Cost Voucher'] and cint(self.allocate_advances_automatically):
			self.set_advances()

		if self.doctype in ['Purchase Invoice', 'Sales Invoice'] and self.is_return:
				self.validate_qty()

		validate_regional(self)
	def validate(self):

		self.validate_qty_is_not_zero()
		if self.get("_action") and self._action != "update_after_submit":
			self.set_missing_values(for_validate=True)

		self.ensure_supplier_is_not_blocked()

		self.validate_date_with_fiscal_year()

		if self.meta.get_field("currency"):
			self.calculate_taxes_and_totals()

			if not self.meta.get_field("is_return") or not self.is_return:
				self.validate_value("base_grand_total", ">=", 0)

			validate_return(self)
			self.set_total_in_words()

		self.validate_all_documents_schedule()

		if self.meta.get_field("taxes_and_charges"):
			self.validate_enabled_taxes_and_charges()
			self.validate_tax_account_company()

		self.validate_party()
		self.validate_currency()

		if self.doctype == 'Purchase Invoice':
			self.validate_paid_amount()

		if self.doctype in ['Purchase Invoice', 'Sales Invoice']:
			pos_check_field = "is_pos" if self.doctype=="Sales Invoice" else "is_paid"
			if cint(self.allocate_advances_automatically) and not cint(self.get(pos_check_field)):
				self.set_advances()

			if self.is_return:
				self.validate_qty()

		validate_regional(self)