addchild will never save added doc

This commit is contained in:
Anand Doshi
2012-12-24 17:02:38 +05:30
parent acc36be87f
commit f5d90abe92
27 changed files with 386 additions and 376 deletions

View File

@@ -42,7 +42,7 @@ class DocType:
self.doc.total_amount = 0.0
for d in dl:
nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', 1, self.doclist)
nl = addchild(self.doc, 'entries', 'Bank Reconciliation Detail', self.doclist)
nl.posting_date = cstr(d[5])
nl.voucher_id = cstr(d[0])
nl.cheque_number = cstr(d[1])

View File

@@ -31,7 +31,8 @@ class DocType:
'October','November','December']
idx =1
for m in month_list:
mnth = addchild(self.doc,'budget_distribution_details','Budget Distribution Detail',1,self.doclist)
mnth = addchild(self.doc, 'budget_distribution_details',
'Budget Distribution Detail', self.doclist)
mnth.month = m or ''
mnth.idx = idx
idx += 1

View File

@@ -223,7 +223,7 @@ class DocType:
obj.doclist = obj.doc.clear_table(obj.doclist,table_field_name)
# Create advance table
for d in jv_detail:
add = addchild(obj.doc, table_field_name, table_name, 1, obj.doclist)
add = addchild(obj.doc, table_field_name, table_name, obj.doclist)
add.journal_voucher = d[0]
add.jv_detail_no = d[3]
add.remarks = d[1]
@@ -286,7 +286,7 @@ class DocType:
webnotes.conn.sql("update `tabJournal Voucher Detail` set %s = '%s', %s = '%s' where name = '%s'" % (dr_or_cr, flt(allocate), doctype == "Purchase Invoice" and 'against_voucher' or 'against_invoice',cstr(against_document_no), jv_detail_no))
# new entry with balance amount
add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1, jv_obj.doclist)
add = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', jv_obj.doclist)
add.account = account_head
add.cost_center = cstr(jvd[0][1])
add.balance = cstr(jvd[0][2])
@@ -353,7 +353,7 @@ class DocType:
if d['allocated_amt'] < d['unadjusted_amt']:
jvd = webnotes.conn.sql("select cost_center, balance, against_account, is_advance from `tabJournal Voucher Detail` where name = '%s'" % d['voucher_detail_no'])
# new entry with balance amount
ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail', 1)
ch = addchild(jv_obj.doc, 'entries', 'Journal Voucher Detail')
ch.account = d['account']
ch.cost_center = cstr(jvd[0][0])
ch.balance = cstr(jvd[0][1])

View File

@@ -174,7 +174,7 @@ class DocType:
# Set the diff in a new row
if flag == 0 and (flt(diff) != 0):
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
if diff>0:
jd.credit = flt(diff)
elif diff<0:
@@ -256,7 +256,7 @@ class DocType:
total = 0
for d in self.get_values():
total += flt(d[2])
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
jd.account = cstr(d[1])
if self.doc.write_off_based_on == 'Accounts Receivable':
jd.credit = flt(d[2])
@@ -265,7 +265,7 @@ class DocType:
jd.debit = flt(d[2])
jd.against_voucher = cstr(d[0])
jd.save(1)
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', 1, self.doclist)
jd = addchild(self.doc, 'entries', 'Journal Voucher Detail', self.doclist)
if self.doc.write_off_based_on == 'Accounts Receivable':
jd.debit = total
elif self.doc.write_off_based_on == 'Accounts Payable':

View File

@@ -100,7 +100,7 @@ class DocType:
#--------------------------------------------------
def create_payment_table(self, gle):
for d in gle:
ch = addchild(self.doc, 'ir_payment_details', 'Payment to Invoice Matching Tool Detail', 1, self.doclist)
ch = addchild(self.doc, 'ir_payment_details', 'Payment to Invoice Matching Tool Detail', self.doclist)
ch.voucher_no = d.get('voucher_no')
ch.posting_date = d.get('posting_date')
ch.amt_due = self.acc_type == 'debit' and flt(d.get('amt_due')) or -1*flt(d.get('amt_due'))