Merge pull request #17198 from rohitwaghchaure/fix_auto_assign_payment_entry_to_invoice

fix: don't assign the advance payment entries if Allocate Advances Automatically is disabled
This commit is contained in:
rohitwaghchaure
2019-04-11 09:57:45 +05:30
committed by GitHub
6 changed files with 334 additions and 12 deletions

View File

@@ -344,6 +344,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = frappe.copy_doc(test_records[0]) pi = frappe.copy_doc(test_records[0])
pi.disable_rounded_total = 1 pi.disable_rounded_total = 1
pi.allocate_advances_automatically = 0
pi.append("advances", { pi.append("advances", {
"reference_type": "Journal Entry", "reference_type": "Journal Entry",
"reference_name": jv.name, "reference_name": jv.name,
@@ -383,6 +384,7 @@ class TestPurchaseInvoice(unittest.TestCase):
pi = frappe.copy_doc(test_records[0]) pi = frappe.copy_doc(test_records[0])
pi.disable_rounded_total = 1 pi.disable_rounded_total = 1
pi.allocate_advances_automatically = 0
pi.append("advances", { pi.append("advances", {
"reference_type": "Journal Entry", "reference_type": "Journal Entry",
"reference_name": jv.name, "reference_name": jv.name,

File diff suppressed because it is too large Load Diff

View File

@@ -855,6 +855,7 @@ class TestSalesInvoice(unittest.TestCase):
jv.submit() jv.submit()
si = frappe.copy_doc(test_records[0]) si = frappe.copy_doc(test_records[0])
si.allocate_advances_automatically = 0
si.append("advances", { si.append("advances", {
"doctype": "Sales Invoice Advance", "doctype": "Sales Invoice Advance",
"reference_type": "Journal Entry", "reference_type": "Journal Entry",

View File

@@ -379,6 +379,8 @@ def make_purchase_invoice(source_name, target_doc=None):
def postprocess(source, target): def postprocess(source, target):
set_missing_values(source, target) set_missing_values(source, target)
#Get the advance paid Journal Entries in Purchase Invoice Advance #Get the advance paid Journal Entries in Purchase Invoice Advance
if target.get("allocate_advances_automatically"):
target.set_advances() target.set_advances()
def update_item(obj, target, source_parent): def update_item(obj, target, source_parent):

View File

@@ -612,6 +612,7 @@ def make_sales_invoice(source_name, target_doc=None, ignore_permissions=False):
def postprocess(source, target): def postprocess(source, target):
set_missing_values(source, target) set_missing_values(source, target)
#Get the advance paid Journal Entries in Sales Invoice Advance #Get the advance paid Journal Entries in Sales Invoice Advance
if target.get("allocate_advances_automatically"):
target.set_advances() target.set_advances()
def set_missing_values(source, target): def set_missing_values(source, target):