Merge branch 'hotfix' into validate_iban

This commit is contained in:
Nabin Hait
2019-04-23 18:41:46 +05:30
committed by GitHub
4 changed files with 20 additions and 15 deletions

View File

@@ -45,6 +45,7 @@ def create_bank_entries(columns, data, bank_account):
fields.update({key: d[int(value)-1]}) fields.update({key: d[int(value)-1]})
try:
bank_transaction = frappe.get_doc({ bank_transaction = frappe.get_doc({
"doctype": "Bank Transaction" "doctype": "Bank Transaction"
}) })
@@ -54,6 +55,9 @@ def create_bank_entries(columns, data, bank_account):
bank_transaction.insert() bank_transaction.insert()
bank_transaction.submit() bank_transaction.submit()
count = count + 1 count = count + 1
except Exception as e:
frappe.throw(e)
frappe.log_error(frappe.get_traceback())
return count return count

View File

@@ -33,10 +33,12 @@ def reconcile(bank_transaction, payment_doctype, payment_name):
return 'reconciled' return 'reconciled'
def add_payment_to_transaction(transaction, payment_entry, gl_entry): def add_payment_to_transaction(transaction, payment_entry, gl_entry):
gl_amount, transaction_amount = (gl_entry.credit, transaction.debit) if gl_entry.credit > 0 else (gl_entry.debit, transaction.credit)
allocated_amount = gl_amount if gl_amount <= transaction_amount else transaction_amount
transaction.append("payment_entries", { transaction.append("payment_entries", {
"payment_document": payment_entry.doctype, "payment_document": payment_entry.doctype,
"payment_entry": payment_entry.name, "payment_entry": payment_entry.name,
"allocated_amount": gl_entry.credit if gl_entry.credit > 0 else gl_entry.debit "allocated_amount": allocated_amount
}) })
transaction.save() transaction.save()
@@ -274,7 +276,7 @@ def check_amount_vs_description(amount_matching, description_matching):
result.append(am_match) result.append(am_match)
continue continue
if hasattr(am_match, "reference_no") and hasattr(des_match, "reference_no"): if "reference_no" in am_match and "reference_no" in des_match:
if difflib.SequenceMatcher(lambda x: x == " ", am_match["reference_no"], des_match["reference_no"]).ratio() > 70: if difflib.SequenceMatcher(lambda x: x == " ", am_match["reference_no"], des_match["reference_no"]).ratio() > 70:
if am_match not in result: if am_match not in result:
result.append(am_match) result.append(am_match)

View File

@@ -407,7 +407,6 @@ def get_returned_qty_map(delivery_note):
@frappe.whitelist() @frappe.whitelist()
def make_sales_invoice(source_name, target_doc=None): def make_sales_invoice(source_name, target_doc=None):
doc = frappe.get_doc('Delivery Note', source_name) doc = frappe.get_doc('Delivery Note', source_name)
sales_orders = [d.against_sales_order for d in doc.items]
returned_qty_map = get_returned_qty_map(source_name) returned_qty_map = get_returned_qty_map(source_name)
invoiced_qty_map = get_invoiced_qty_map(source_name) invoiced_qty_map = get_invoiced_qty_map(source_name)
@@ -465,7 +464,7 @@ def make_sales_invoice(source_name, target_doc=None):
"cost_center": "cost_center" "cost_center": "cost_center"
}, },
"postprocess": update_item, "postprocess": update_item,
"filter": lambda d: get_pending_qty(d)[0]<=0 "filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0
}, },
"Sales Taxes and Charges": { "Sales Taxes and Charges": {
"doctype": "Sales Taxes and Charges", "doctype": "Sales Taxes and Charges",

View File

@@ -458,7 +458,7 @@ def make_purchase_invoice(source_name, target_doc=None):
"asset": "asset", "asset": "asset",
}, },
"postprocess": update_item, "postprocess": update_item,
"filter": lambda d: get_pending_qty(d)[0]<=0 "filter": lambda d: get_pending_qty(d)[0] <= 0 if not doc.get("is_return") else get_pending_qty(d)[0] > 0
}, },
"Purchase Taxes and Charges": { "Purchase Taxes and Charges": {
"doctype": "Purchase Taxes and Charges", "doctype": "Purchase Taxes and Charges",