From 23a64d7f9dba71ad1df17705b1387c860ad37dd6 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Jul 2013 16:19:54 +0530 Subject: [PATCH 1/4] [minor] removed customer validation between quotation and SO --- selling/doctype/sales_order/sales_order.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py index 210e56f04d5..fb04714a078 100644 --- a/selling/doctype/sales_order/sales_order.py +++ b/selling/doctype/sales_order/sales_order.py @@ -166,7 +166,7 @@ class DocType(SellingController): super(DocType, self).validate_with_previous_doc(self.tname, { "Quotation": { "ref_dn_field": "prevdoc_docname", - "compare_fields": [["customer", "="], ["company", "="], ["currency", "="]] + "compare_fields": [["company", "="], ["currency", "="]] } }) From 02a3d7ac129b2af5c932e948651fe19de7bb9d33 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Jul 2013 16:33:30 +0530 Subject: [PATCH 2/4] [minor] [fix] fetching contact details --- utilities/transaction_base.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 8894cb4b22a..2900bf6ec3b 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -396,20 +396,22 @@ def map_party_contact_details(contact_name=None, party_field=None, party_name=No if not contact_name and party_field: contact_name = get_default_contact(party_field, party_name) - contact = webnotes.conn.sql("""select * from `tabContact` where name=%s""", contact_name, as_dict=True) + if contact_name: + contact = webnotes.conn.sql("""select * from `tabContact` where name=%s""", + contact_name, as_dict=True) - if contact: - contact = contact[0] - out.update({ - "contact_person": contact.get("name"), - "contact_display": " ".join(filter(None, - [contact.get("first_name"), contact.get("last_name")])), - "contact_email": contact.get("email_id"), - "contact_mobile": contact.get("mobile_no"), - "contact_phone": contact.get("phone"), - "contact_designation": contact.get("designation"), - "contact_department": contact.get("department") - }) + if contact: + contact = contact[0] + out.update({ + "contact_person": contact.get("name"), + "contact_display": " ".join(filter(None, + [contact.get("first_name"), contact.get("last_name")])), + "contact_email": contact.get("email_id"), + "contact_mobile": contact.get("mobile_no"), + "contact_phone": contact.get("phone"), + "contact_designation": contact.get("designation"), + "contact_department": contact.get("department") + }) return out From 6c7f3db7551da62e4d49def52672a1aa582246a3 Mon Sep 17 00:00:00 2001 From: Anand Doshi Date: Wed, 24 Jul 2013 16:49:11 +0530 Subject: [PATCH 3/4] [report] [issue] #641 - added customer name and supplier name in accounts receivable and accounts payable reports respectively --- accounts/report/accounts_payable/accounts_payable.py | 9 ++++++--- .../report/accounts_receivable/accounts_receivable.py | 8 ++++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py index 6bc98f6471f..f884773cd90 100644 --- a/accounts/report/accounts_payable/accounts_payable.py +++ b/accounts/report/accounts_payable/accounts_payable.py @@ -7,8 +7,10 @@ from accounts.report.accounts_receivable.accounts_receivable import get_ageing_d def execute(filters=None): if not filters: filters = {} columns = get_columns() - entries = get_gl_entries(filters) + account_supplier = dict(webnotes.conn.sql("""select account.name, supplier.supplier_name + from `tabAccount` account, `tabSupplier` supplier + where account.master_type="Supplier" and supplier.name=account.master_name""")) entries_after_report_date = [[gle.voucher_type, gle.voucher_no] for gle in get_gl_entries(filters, before_report_date=False)] @@ -38,7 +40,8 @@ def execute(filters=None): if abs(flt(outstanding_amount)) > 0.01: paid_amount = invoiced_amount - outstanding_amount - row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, + row = [gle.posting_date, gle.account, account_supplier.get(gle.account, ""), + gle.voucher_type, gle.voucher_no, gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no, bill_date, invoiced_amount, paid_amount, outstanding_amount] @@ -55,7 +58,7 @@ def execute(filters=None): def get_columns(): return [ - "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", + "Posting Date:Date:80", "Account:Link/Account:150", "Supplier::150", "Voucher Type::110", "Voucher No::120", "Remarks::150", "Supplier Type:Link/Supplier Type:120", "Due Date:Date:80", "Bill No::80", "Bill Date:Date:80", "Invoiced Amount:Currency:100", "Paid Amount:Currency:100", diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py index 2bd3be878e6..4ae3c86f72f 100644 --- a/accounts/report/accounts_receivable/accounts_receivable.py +++ b/accounts/report/accounts_receivable/accounts_receivable.py @@ -7,6 +7,9 @@ def execute(filters=None): if not filters: filters = {} columns = get_columns() entries = get_gl_entries(filters) + account_customer = dict(webnotes.conn.sql("""select account.name, customer.customer_name + from `tabAccount` account, `tabCustomer` customer + where account.master_type="Customer" and customer.name=account.master_name""")) entries_after_report_date = [[gle.voucher_type, gle.voucher_no] for gle in get_gl_entries(filters, upto_report_date=False)] @@ -32,7 +35,8 @@ def execute(filters=None): if abs(flt(outstanding_amount)) > 0.01: payment_amount = invoiced_amount - outstanding_amount - row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no, + row = [gle.posting_date, gle.account, account_customer.get(gle.account, ""), + gle.voucher_type, gle.voucher_no, gle.remarks, due_date, account_territory_map.get(gle.account), invoiced_amount, payment_amount, outstanding_amount] # Ageing @@ -48,7 +52,7 @@ def execute(filters=None): def get_columns(): return [ - "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110", + "Posting Date:Date:80", "Account:Link/Account:150", "Customer::150", "Voucher Type::110", "Voucher No::120", "Remarks::150", "Due Date:Date:80", "Territory:Link/Territory:80", "Invoiced Amount:Currency:100", "Payment Received:Currency:100", "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100", From 8c0485d085a8d4bc916a16141141114dc2511a26 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Wed, 24 Jul 2013 16:56:03 +0530 Subject: [PATCH 4/4] [fix] [minor] fix in sending sms from transactions --- utilities/doctype/sms_control/sms_control.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities/doctype/sms_control/sms_control.js b/utilities/doctype/sms_control/sms_control.js index f470f960ff8..e56315c5618 100644 --- a/utilities/doctype/sms_control/sms_control.js +++ b/utilities/doctype/sms_control/sms_control.js @@ -62,9 +62,9 @@ function SMSManager() { var btn = d.fields_dict.send.input; var v = me.dialog.get_values(); if(v) { - btn.set_working(); + $(this).set_working(); $c_obj('SMS Control', 'send_form_sms', v, function(r,rt) { - btn.done_working(); + $(this).done_working(); if(r.exc) {msgprint(r.exc); return; } msgprint('Message Sent'); me.dialog.hide();