예제 #1
0
    def validate(self):
        if not self.is_opening:
            self.is_opening = 'No'

        self.validate_posting_time()

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

        super(PurchaseInvoice, self).validate()

        if not self.is_return:
            self.po_required()
            self.pr_required()
            self.validate_supplier_invoice()

        # validate cash purchase
        if (self.is_paid == 1):
            self.validate_cash()

        # validate service stop date to lie in between start and end date
        validate_service_stop_date(self)

        if self._action == "submit" and self.update_stock:
            self.make_batches('warehouse')

        self.validate_release_date()
        self.check_conversion_rate()
        self.validate_credit_to_acc()
        self.clear_unallocated_advances("Purchase Invoice Advance", "advances")
        self.check_for_closed_status()
        self.validate_with_previous_doc()
        self.validate_uom_is_integer("uom", "qty")
        self.validate_uom_is_integer("stock_uom", "stock_qty")
        self.set_expense_account(for_validate=True)
        self.set_against_expense_account()
        self.validate_write_off_account()
        self.validate_multiple_billing("Purchase Receipt", "pr_detail",
                                       "amount", "items")
        self.validate_fixed_asset()
        self.create_remarks()
        self.set_status()
        validate_inter_company_party(self.doctype, self.supplier, self.company,
                                     self.inter_company_invoice_reference)
예제 #2
0
	def validate(self):
		if not self.is_opening:
			self.is_opening = 'No'

		self.validate_posting_time()

		super(PurchaseInvoice, self).validate()

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

		if not self.is_return:
			self.po_required()
			self.pr_required()
			self.validate_supplier_invoice()

		# validate cash purchase
		if (self.is_paid == 1):
			self.validate_cash()

		# validate service stop date to lie in between start and end date
		validate_service_stop_date(self)

		if self._action=="submit" and self.update_stock:
			self.make_batches('warehouse')

		self.validate_release_date()
		self.check_conversion_rate()
		self.validate_credit_to_acc()
		self.clear_unallocated_advances("Purchase Invoice Advance", "advances")
		self.check_for_closed_status()
		self.validate_with_previous_doc()
		self.validate_uom_is_integer("uom", "qty")
		self.validate_uom_is_integer("stock_uom", "stock_qty")
		self.set_expense_account(for_validate=True)
		self.set_against_expense_account()
		self.validate_write_off_account()
		self.validate_multiple_billing("Purchase Receipt", "pr_detail", "amount", "items")
		self.validate_fixed_asset()
		self.create_remarks()
		self.set_status()
		validate_inter_company_party(self.doctype, self.supplier, self.company, self.inter_company_invoice_reference)