Hi,
I have a doctype A it has child table CA which is read only i want to add data to child table CA when ever A is submitted
what i tried is
def before_submit(self):
self.add_to_payment_history(self.name,self.amount_paid,self.due_amount,ge.name)
def add_to_payment_history(self,hotel_booking,amount_paid,due_amount,payment_no):
oph = frappe.new_doc("CA")
oph.payment_no = payment_no
oph.parent = hotel_booking
oph.parentfield = "c_a"
oph.parenttype = "A"
oph.paid_amount = amount_paid
oph.out_standing_amount = due_amount
oph.date_of_payment = today()
oph.save()
where ge.name is
ge.posting_date = today()
ge.account = account
ge.account_currency = self.company_currency
ge.against = account
ge.against_voucher_type = self.doctype
ge.against_voucher = self.name
ge.voucher_type = self.doctype
ge.voucher_no = self.name
ge.is_opening = 'No'
ge.is_advance = 'No'
ge.cost_center = self.cost_center
if account_type == "expense":
ge.debit = self.total_amount
ge.debit_in_account_currency = self.total_amount
if account_type == "liablity":
if self.amount_paid:
amount = self.total_amount - self.amount_paid
else:
amount = self.total_amount
ge.credit = amount
ge.credit_in_account_currency = amount
ge.party_type = "Supplier"
ge.party = self.hotel
if account_type == "cash":
ge.credit = self.amount_paid
ge.credit_in_account_currency = self.amount_paid
ge.flags.ignore_permissions = True
ge.submit()
ge.name
but when i try to submit form submited but this data is not added to child table CA
please help me to find what is the issue