Пример #1
0
	def update_against_document_in_jv(self):
		"""
			Links invoice and advance voucher:
				1. cancel advance voucher
				2. split into multiple rows if partially adjusted, assign against voucher
				3. submit advance voucher
		"""
		
		lst = []
		for d in getlist(self.doclist, 'advance_adjustment_details'):
			if flt(d.allocated_amount) > 0:
				args = {
					'voucher_no' : d.journal_voucher, 
					'voucher_detail_no' : d.jv_detail_no, 
					'against_voucher_type' : 'Sales Invoice', 
					'against_voucher'  : self.doc.name,
					'account' : self.doc.debit_to, 
					'is_advance' : 'Yes', 
					'dr_or_cr' : 'credit', 
					'unadjusted_amt' : flt(d.advance_amount),
					'allocated_amt' : flt(d.allocated_amount)
				}
				lst.append(args)
		
		if lst:
			from accounts.utils import reconcile_against_document
			reconcile_against_document(lst)
Пример #2
0
    def update_against_document_in_jv(self):
        """
			Links invoice and advance voucher:
				1. cancel advance voucher
				2. split into multiple rows if partially adjusted, assign against voucher
				3. submit advance voucher
		"""

        lst = []
        for d in getlist(self.doclist, "advance_adjustment_details"):
            if flt(d.allocated_amount) > 0:
                args = {
                    "voucher_no": d.journal_voucher,
                    "voucher_detail_no": d.jv_detail_no,
                    "against_voucher_type": "Sales Invoice",
                    "against_voucher": self.doc.name,
                    "account": self.doc.debit_to,
                    "is_advance": "Yes",
                    "dr_or_cr": "credit",
                    "unadjusted_amt": flt(d.advance_amount),
                    "allocated_amt": flt(d.allocated_amount),
                }
                lst.append(args)

        if lst:
            from accounts.utils import reconcile_against_document

            reconcile_against_document(lst)
	def reconcile(self):
		"""
			Links booking and payment voucher
			1. cancel payment voucher
			2. split into multiple rows if partially adjusted, assign against voucher
			3. submit payment voucher
		"""
		if not self.doc.voucher_no or not webnotes.conn.sql("""select name from `tab%s` 
				where name = %s""" % (self.doc.voucher_type, '%s'), self.doc.voucher_no):
			msgprint("Please select valid Voucher No to proceed", raise_exception=1)
		
		lst = []
		for d in getlist(self.doclist, 'ir_payment_details'):
			if flt(d.amt_to_be_reconciled) > 0:
				args = {
					'voucher_no' : d.voucher_no,
					'voucher_detail_no' : d.voucher_detail_no, 
					'against_voucher_type' : self.doc.voucher_type, 
					'against_voucher'  : self.doc.voucher_no,
					'account' : self.doc.account, 
					'is_advance' : 'No', 
					'dr_or_cr' :  self.doc.account_type=='debit' and 'credit' or 'debit', 
					'unadjusted_amt' : flt(d.amt_due),
					'allocated_amt' : flt(d.amt_to_be_reconciled)
				}
			
				lst.append(args)
		
		if lst:
			from accounts.utils import reconcile_against_document
			reconcile_against_document(lst)
			msgprint("Successfully allocated.")
		else:
			msgprint("No amount allocated.", raise_exception=1)
Пример #4
0
    def update_against_document_in_jv(self):
        """
			Links invoice and advance voucher:
				1. cancel advance voucher
				2. split into multiple rows if partially adjusted, assign against voucher
				3. submit advance voucher
		"""

        lst = []
        for d in getlist(self.doclist, 'advance_adjustment_details'):
            if flt(d.allocated_amount) > 0:
                args = {
                    'voucher_no': d.journal_voucher,
                    'voucher_detail_no': d.jv_detail_no,
                    'against_voucher_type': 'Sales Invoice',
                    'against_voucher': self.doc.name,
                    'account': self.doc.debit_to,
                    'is_advance': 'Yes',
                    'dr_or_cr': 'credit',
                    'unadjusted_amt': flt(d.advance_amount),
                    'allocated_amt': flt(d.allocated_amount)
                }
                lst.append(args)

        if lst:
            from accounts.utils import reconcile_against_document
            reconcile_against_document(lst)
    def reconcile(self):
        """
			Links booking and payment voucher
			1. cancel payment voucher
			2. split into multiple rows if partially adjusted, assign against voucher
			3. submit payment voucher
		"""
        if not self.doc.voucher_no or not webnotes.conn.sql(
            """select name from `tab%s` 
				where name = %s"""
            % (self.doc.voucher_type, "%s"),
            self.doc.voucher_no,
        ):
            msgprint("Please select valid Voucher No to proceed", raise_exception=1)

        lst = []
        for d in getlist(self.doclist, "ir_payment_details"):
            if flt(d.amt_to_be_reconciled) > 0:
                args = {
                    "voucher_no": d.voucher_no,
                    "voucher_detail_no": d.voucher_detail_no,
                    "against_voucher_type": self.doc.voucher_type,
                    "against_voucher": self.doc.voucher_no,
                    "account": self.doc.account,
                    "is_advance": "No",
                    "dr_or_cr": self.doc.account_type == "debit" and "credit" or "debit",
                    "unadjusted_amt": flt(d.amt_due),
                    "allocated_amt": flt(d.amt_to_be_reconciled),
                }

                lst.append(args)

        if lst:
            from accounts.utils import reconcile_against_document

            reconcile_against_document(lst)
            msgprint("Successfully allocated.")
        else:
            msgprint("No amount allocated.", raise_exception=1)