From c1c54c94001ce35f5913c242c715f223ce8f36b3 Mon Sep 17 00:00:00 2001 From: Ravi Dey Date: Thu, 30 Jun 2011 18:10:20 +0530 Subject: [PATCH] invoice account head fix --- accounts/doctype/payable_voucher/payable_voucher.py | 2 +- accounts/doctype/receivable_voucher/receivable_voucher.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/accounts/doctype/payable_voucher/payable_voucher.py b/accounts/doctype/payable_voucher/payable_voucher.py index 4559de28441..7e90d71d0c0 100644 --- a/accounts/doctype/payable_voucher/payable_voucher.py +++ b/accounts/doctype/payable_voucher/payable_voucher.py @@ -35,7 +35,7 @@ class DocType(TransactionBase): # Credit To # ---------- def get_credit_to(self): - acc_head = sql("select name, credit_days from `tabAccount` where name = %s", (cstr(self.doc.supplier) + " - " + self.get_company_abbr())) + acc_head = sql("select name, credit_days from `tabAccount` where (name = %s or (master_name = %s and master_type = 'supplier')) and docstatus != 2", (cstr(self.doc.supplier) + " - " + self.get_company_abbr(),self.doc.supplier)) #supp_detail = sql("select supplier_name,address from `tabSupplier` where name = %s", self.doc.supplier, as_dict =1) #ret = { # 'supplier_name' : supp_detail and supp_detail[0]['supplier_name'] or '', diff --git a/accounts/doctype/receivable_voucher/receivable_voucher.py b/accounts/doctype/receivable_voucher/receivable_voucher.py index 6fac40d277c..cb62a65fdb5 100644 --- a/accounts/doctype/receivable_voucher/receivable_voucher.py +++ b/accounts/doctype/receivable_voucher/receivable_voucher.py @@ -81,7 +81,7 @@ class DocType(TransactionBase): # Get Account Head to which amount needs to be Debited based on Customer # ---------------------------------------------------------------------- def get_customer_account(self): - acc_head = sql("select name from `tabAccount` where name = %s and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr())) + acc_head = sql("select name from `tabAccount` where (name = %s or (master_name = %s and master_type = 'customer')) and docstatus != 2", (cstr(self.doc.customer) + " - " + self.get_company_abbr(),self.doc.customer)) if acc_head and acc_head[0][0]: return acc_head[0][0] else: