Merge branch 'staging' into develop

This commit is contained in:
Frappe Bot
2019-01-23 08:19:00 +00:00
35 changed files with 570 additions and 117 deletions

View File

@@ -249,7 +249,6 @@ class AccountsController(TransactionBase):
if self.get("is_subcontracted"):
args["is_subcontracted"] = self.is_subcontracted
ret = get_item_details(args)
for fieldname, value in ret.items():
if item.meta.get_field(fieldname) and value is not None:
if (item.get(fieldname) is None or fieldname in force_item_fields):
@@ -268,9 +267,10 @@ class AccountsController(TransactionBase):
if ret.get("pricing_rule"):
# if user changed the discount percentage then set user's discount percentage ?
item.set("pricing_rule", ret.get("pricing_rule"))
item.set("discount_percentage", ret.get("discount_percentage"))
if ret.get("pricing_rule_for") == "Price":
item.set("pricing_list_rate", ret.get("pricing_list_rate"))
if ret.get("pricing_rule_for") == "Rate":
item.set("price_list_rate", ret.get("price_list_rate"))
if item.price_list_rate:
item.rate = flt(item.price_list_rate *
@@ -954,11 +954,12 @@ def get_advance_journal_entries(party_type, party, party_account, amount_field,
return list(journal_entries)
def get_advance_payment_entries(party_type, party, party_account,
order_doctype, order_list=None, include_unallocated=True, against_all_orders=False):
def get_advance_payment_entries(party_type, party, party_account, order_doctype,
order_list=None, include_unallocated=True, against_all_orders=False, limit=1000):
party_account_field = "paid_from" if party_type == "Customer" else "paid_to"
payment_type = "Receive" if party_type == "Customer" else "Pay"
payment_entries_against_order, unallocated_payment_entries = [], []
limit_cond = "limit %s" % (limit or 1000)
if order_list or against_all_orders:
if order_list:
@@ -978,8 +979,8 @@ def get_advance_payment_entries(party_type, party, party_account,
t1.name = t2.parent and t1.{0} = %s and t1.payment_type = %s
and t1.party_type = %s and t1.party = %s and t1.docstatus = 1
and t2.reference_doctype = %s {1}
order by t1.posting_date
""".format(party_account_field, reference_condition),
order by t1.posting_date {2}
""".format(party_account_field, reference_condition, limit_cond),
[party_account, payment_type, party_type, party,
order_doctype] + order_list, as_dict=1)
@@ -991,8 +992,8 @@ def get_advance_payment_entries(party_type, party, party_account,
where
{0} = %s and party_type = %s and party = %s and payment_type = %s
and docstatus = 1 and unallocated_amount > 0
order by posting_date
""".format(party_account_field), (party_account, party_type, party, payment_type), as_dict=1)
order by posting_date {1}
""".format(party_account_field, limit_cond), (party_account, party_type, party, payment_type), as_dict=1)
return list(payment_entries_against_order) + list(unallocated_payment_entries)