Fixes in fetching party details
This commit is contained in:
parent
24da761a17
commit
b87e9f2651
@ -756,16 +756,18 @@ 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]
|
||||||
|
|
||||||
def _test(i):
|
def _test(i):
|
||||||
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)
|
||||||
|
|
||||||
recurred_invoices = webnotes.conn.sql("""select name from `tabSales Invoice`
|
recurred_invoices = webnotes.conn.sql("""select name from `tabSales Invoice`
|
||||||
|
@ -48,24 +48,29 @@ erpnext.utils.get_address_display = function(frm, address_field) {
|
|||||||
address_field = "supplier_address";
|
address_field = "supplier_address";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wn.call({
|
if(frm.doc[address_field]) {
|
||||||
method: "erpnext.utilities.doctype.address.address.get_address_display",
|
wn.call({
|
||||||
args: {address: frm.doc[address_field] },
|
method: "erpnext.utilities.doctype.address.address.get_address_display",
|
||||||
callback: function(r) {
|
args: {address: frm.doc[address_field] },
|
||||||
if(r.message)
|
callback: function(r) {
|
||||||
frm.set_value("address_display", r.message)
|
if(r.message)
|
||||||
}
|
frm.set_value("address_display", r.message)
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
wn.call({
|
|
||||||
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
|
if(frm.doc[address_field]) {
|
||||||
args: {address: frm.doc.contact_person },
|
wn.call({
|
||||||
callback: function(r) {
|
method: "erpnext.utilities.doctype.contact.contact.get_contact_details",
|
||||||
if(r.message)
|
args: {contact: frm.doc.contact_person },
|
||||||
frm.set_value(r.message);
|
callback: function(r) {
|
||||||
}
|
if(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")
|
||||||
|
@ -64,5 +64,4 @@ def get_contact_details(contact):
|
|||||||
"contact_department": contact.get("department")
|
"contact_department": contact.get("department")
|
||||||
}
|
}
|
||||||
|
|
||||||
return out
|
return out
|
||||||
|
|
Loading…
Reference in New Issue
Block a user