Merge branch 'master' of github.com:webnotes/erpnext into edge

This commit is contained in:
Rushabh Mehta 2013-02-05 11:31:56 +05:30
commit e9c334a778
3 changed files with 45 additions and 39 deletions

View File

@ -248,22 +248,23 @@ class DocType(AccountsController):
from accounts.general_ledger import make_gl_entries from accounts.general_ledger import make_gl_entries
gl_map = [] gl_map = []
for d in self.doclist.get({"parentfield": "entries"}): for d in self.doclist.get({"parentfield": "entries"}):
gl_map.append( if d.debit or d.credit:
self.get_gl_dict({ gl_map.append(
"account": d.account, self.get_gl_dict({
"against": d.against_account, "account": d.account,
"debit": d.debit, "against": d.against_account,
"credit": d.credit, "debit": d.debit,
"against_voucher_type": ((d.against_voucher and "Purchase Invoice") "credit": d.credit,
or (d.against_invoice and "Sales Invoice") "against_voucher_type": ((d.against_voucher and "Purchase Invoice")
or (d.against_jv and "Journal Voucher")), or (d.against_invoice and "Sales Invoice")
"against_voucher": d.against_voucher or d.against_invoice or d.against_jv, or (d.against_jv and "Journal Voucher")),
"remarks": self.doc.remark, "against_voucher": d.against_voucher or d.against_invoice or d.against_jv,
"cost_center": d.cost_center "remarks": self.doc.remark,
}, cancel) "cost_center": d.cost_center
) }, cancel)
)
make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj) if gl_map:
make_gl_entries(gl_map, cancel=cancel, adv_adj=adv_adj)
def get_outstanding(self, args): def get_outstanding(self, args):
args = eval(args) args = eval(args)

View File

@ -422,16 +422,17 @@ class DocType(BuyingController):
abbr = self.get_company_abbr() abbr = self.get_company_abbr()
# parent's gl entry # parent's gl entry
gl_entries.append( if self.doc.grand_total:
self.get_gl_dict({ gl_entries.append(
"account": self.doc.credit_to, self.get_gl_dict({
"against": self.doc.against_expense_account, "account": self.doc.credit_to,
"credit": self.doc.grand_total, "against": self.doc.against_expense_account,
"remarks": self.doc.remarks, "credit": self.doc.grand_total,
"against_voucher": self.doc.name, "remarks": self.doc.remarks,
"against_voucher_type": self.doc.doctype, "against_voucher": self.doc.name,
}, is_cancel) "against_voucher_type": self.doc.doctype,
) }, is_cancel)
)
# tax table gl entries # tax table gl entries
for tax in getlist(self.doclist, "purchase_tax_details"): for tax in getlist(self.doclist, "purchase_tax_details"):
@ -506,7 +507,9 @@ class DocType(BuyingController):
"cost_center": self.doc.write_off_cost_center "cost_center": self.doc.write_off_cost_center
}, is_cancel) }, is_cancel)
) )
make_gl_entries(gl_entries, cancel=is_cancel)
if gl_entries:
make_gl_entries(gl_entries, cancel=is_cancel)
def check_next_docstatus(self): def check_next_docstatus(self):

View File

@ -637,16 +637,17 @@ class DocType(SellingController):
abbr = self.get_company_abbr() abbr = self.get_company_abbr()
# parent's gl entry # parent's gl entry
gl_entries.append( if self.doc.grand_total:
self.get_gl_dict({ gl_entries.append(
"account": self.doc.debit_to, self.get_gl_dict({
"against": self.doc.against_income_account, "account": self.doc.debit_to,
"debit": self.doc.grand_total, "against": self.doc.against_income_account,
"remarks": self.doc.remarks, "debit": self.doc.grand_total,
"against_voucher": self.doc.name, "remarks": self.doc.remarks,
"against_voucher_type": self.doc.doctype, "against_voucher": self.doc.name,
}, is_cancel) "against_voucher_type": self.doc.doctype,
) }, is_cancel)
)
# tax table gl entries # tax table gl entries
for tax in self.doclist.get({"parentfield": "other_charges"}): for tax in self.doclist.get({"parentfield": "other_charges"}):
@ -745,8 +746,9 @@ class DocType(SellingController):
update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes' update_outstanding = self.doc.is_pos and self.doc.write_off_account and 'No' or 'Yes'
merge_entries=cint(self.doc.is_pos)!=1 and 1 or 0 merge_entries=cint(self.doc.is_pos)!=1 and 1 or 0
make_gl_entries(gl_entries, cancel=is_cancel, if gl_entries:
update_outstanding=update_outstanding, merge_entries=merge_entries) make_gl_entries(gl_entries, cancel=is_cancel,
update_outstanding=update_outstanding, merge_entries=merge_entries)
def update_c_form(self): def update_c_form(self):
"""Update amended id in C-form""" """Update amended id in C-form"""