Fixes in fetching party details
This commit is contained in:
parent
24da761a17
commit
b87e9f2651
@ -756,7 +756,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
|
|
||||||
def _test_recurring_invoice(self, base_si, first_and_last_day):
|
def _test_recurring_invoice(self, base_si, first_and_last_day):
|
||||||
from webnotes.utils import add_months, get_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]
|
no_of_months = ({"Monthly": 1, "Quarterly": 3, "Yearly": 12})[base_si.doc.recurring_type]
|
||||||
|
|
||||||
@ -764,7 +765,8 @@ class TestSalesInvoice(unittest.TestCase):
|
|||||||
self.assertEquals(i+1, webnotes.conn.sql("""select count(*) from `tabSales Invoice`
|
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])
|
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)
|
manage_recurring_invoices(next_date=next_date, commit=False)
|
||||||
|
|
||||||
|
@ -48,6 +48,7 @@ erpnext.utils.get_address_display = function(frm, address_field) {
|
|||||||
address_field = "supplier_address";
|
address_field = "supplier_address";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(frm.doc[address_field]) {
|
||||||
wn.call({
|
wn.call({
|
||||||
method: "erpnext.utilities.doctype.address.address.get_address_display",
|
method: "erpnext.utilities.doctype.address.address.get_address_display",
|
||||||
args: {address: frm.doc[address_field] },
|
args: {address: frm.doc[address_field] },
|
||||||
@ -57,15 +58,19 @@ erpnext.utils.get_address_display = function(frm, address_field) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
erpnext.utils.get_contact_details = function(frm) {
|
erpnext.utils.get_contact_details = function(frm) {
|
||||||
if(frm.updating_party_details) return;
|
if(frm.updating_party_details) return;
|
||||||
|
|
||||||
|
if(frm.doc[address_field]) {
|
||||||
wn.call({
|
wn.call({
|
||||||
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
|
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
|
||||||
args: {address: frm.doc.contact_person },
|
args: {contact: frm.doc.contact_person },
|
||||||
callback: function(r) {
|
callback: function(r) {
|
||||||
if(r.message)
|
if(r.message)
|
||||||
frm.set_value(r.message);
|
frm.set_value(r.message);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
@ -196,13 +196,14 @@ def get_customer_details(customer, price_list=None, currency=None):
|
|||||||
out[f] = customer.get("default_" + f)
|
out[f] = customer.get("default_" + f)
|
||||||
|
|
||||||
# price list
|
# 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):
|
if isinstance(out.selling_price_list, list):
|
||||||
out.selling_price_list = None
|
out.selling_price_list = None
|
||||||
|
|
||||||
out.selling_price_list = out.selling_price_list or customer.price_list \
|
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 webnotes.conn.get_value("Customer Group",
|
||||||
or price_list
|
customer.customer_group, "default_price_list") or price_list
|
||||||
|
|
||||||
if out.selling_price_list:
|
if out.selling_price_list:
|
||||||
out.price_list_currency = webnotes.conn.get_value("Price List", out.selling_price_list, "currency")
|
out.price_list_currency = webnotes.conn.get_value("Price List", out.selling_price_list, "currency")
|
||||||
|
@ -65,4 +65,3 @@ def get_contact_details(contact):
|
|||||||
}
|
}
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
Loading…
Reference in New Issue
Block a user