Fixes in fetching party details

This commit is contained in:
Nabin Hait 2014-01-29 19:51:36 +05:30
parent 24da761a17
commit b87e9f2651
4 changed files with 31 additions and 24 deletions

View File

@ -756,16 +756,18 @@ class TestSalesInvoice(unittest.TestCase):
def _test_recurring_invoice(self, base_si, first_and_last_day):
from webnotes.utils import add_months, get_last_day
from erpnext.accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices
from erpnext.accounts.doctype.sales_invoice.sales_invoice \
import manage_recurring_invoices, get_next_date
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
def _test(i):
self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
where recurring_id=%s and docstatus=1""", base_si.doc.recurring_id)[0][0])
next_date = add_months(base_si.doc.posting_date, no_of_months)
next_date = get_next_date(base_si.doc.posting_date, no_of_months,
base_si.doc.repeat_on_day_of_month)
manage_recurring_invoices(next_date=next_date, commit=False)
recurred_invoices = webnotes.conn.sql("""select name from `tabSales Invoice`

View File

@ -48,24 +48,29 @@ erpnext.utils.get_address_display = function(frm, address_field) {
address_field = "supplier_address";
}
}
wn.call({
method: "erpnext.utilities.doctype.address.address.get_address_display",
args: {address: frm.doc[address_field] },
callback: function(r) {
if(r.message)
frm.set_value("address_display", r.message)
}
})
if(frm.doc[address_field]) {
wn.call({
method: "erpnext.utilities.doctype.address.address.get_address_display",
args: {address: frm.doc[address_field] },
callback: function(r) {
if(r.message)
frm.set_value("address_display", r.message)
}
})
}
}
erpnext.utils.get_contact_details = function(frm) {
if(frm.updating_party_details) return;
wn.call({
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
args: {address: frm.doc.contact_person },
callback: function(r) {
if(r.message)
frm.set_value(r.message);
}
})
if(frm.doc[address_field]) {
wn.call({
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
args: {contact: frm.doc.contact_person },
callback: function(r) {
if(r.message)
frm.set_value(r.message);
}
})
}
}

View File

@ -196,13 +196,14 @@ def get_customer_details(customer, price_list=None, currency=None):
out[f] = customer.get("default_" + f)
# price list
out.selling_price_list = webnotes.conn.get_defaults("selling_price_list", webnotes.session.user)
from webnotes.defaults import get_defaults_for
out.selling_price_list = get_defaults_for(webnotes.session.user).get(price_list)
if isinstance(out.selling_price_list, list):
out.selling_price_list = None
out.selling_price_list = out.selling_price_list or customer.price_list \
or webnotes.conn.get_value("Customer Group", customer.customer_group, "default_price_list")
or price_list
or webnotes.conn.get_value("Customer Group",
customer.customer_group, "default_price_list") or price_list
if out.selling_price_list:
out.price_list_currency = webnotes.conn.get_value("Price List", out.selling_price_list, "currency")

View File

@ -64,5 +64,4 @@ def get_contact_details(contact):
"contact_department": contact.get("department")
}
return out
return out