mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-26 00:14:50 +00:00
Merge branch 'hotfix' into validate_iban
This commit is contained in:
@@ -45,15 +45,19 @@ def create_bank_entries(columns, data, bank_account):
|
|||||||
fields.update({key: d[int(value)-1]})
|
fields.update({key: d[int(value)-1]})
|
||||||
|
|
||||||
|
|
||||||
bank_transaction = frappe.get_doc({
|
try:
|
||||||
"doctype": "Bank Transaction"
|
bank_transaction = frappe.get_doc({
|
||||||
})
|
"doctype": "Bank Transaction"
|
||||||
bank_transaction.update(fields)
|
})
|
||||||
bank_transaction.date = getdate(parse_date(bank_transaction.date))
|
bank_transaction.update(fields)
|
||||||
bank_transaction.bank_account = bank_account
|
bank_transaction.date = getdate(parse_date(bank_transaction.date))
|
||||||
bank_transaction.insert()
|
bank_transaction.bank_account = bank_account
|
||||||
bank_transaction.submit()
|
bank_transaction.insert()
|
||||||
count = count + 1
|
bank_transaction.submit()
|
||||||
|
count = count + 1
|
||||||
|
except Exception as e:
|
||||||
|
frappe.throw(e)
|
||||||
|
frappe.log_error(frappe.get_traceback())
|
||||||
|
|
||||||
return count
|
return count
|
||||||
|
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
@@ -447,7 +446,7 @@ def make_sales_invoice(source_name, target_doc=None):
|
|||||||
returned_qty = 0
|
returned_qty = 0
|
||||||
return pending_qty, returned_qty
|
return pending_qty, returned_qty
|
||||||
|
|
||||||
doc = get_mapped_doc("Delivery Note", source_name, {
|
doc = get_mapped_doc("Delivery Note", source_name, {
|
||||||
"Delivery Note": {
|
"Delivery Note": {
|
||||||
"doctype": "Sales Invoice",
|
"doctype": "Sales Invoice",
|
||||||
"validation": {
|
"validation": {
|
||||||
@@ -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",
|
||||||
|
|||||||
@@ -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",
|
||||||
|
|||||||
Reference in New Issue
Block a user