mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-19 13:09:17 +00:00
refactor: remove repeated validation for voucher
(cherry picked from commit a856091ff4)
# Conflicts:
# erpnext/accounts/doctype/sales_invoice/sales_invoice.py
This commit is contained in:
committed by
ruthra kumar
parent
677525b2cf
commit
c9bcf79e83
@@ -538,23 +538,10 @@ class PurchaseInvoice(BuyingController):
|
|||||||
]
|
]
|
||||||
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
|
child_tables = {"items": ("expense_account",), "taxes": ("account_head",)}
|
||||||
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
|
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
|
||||||
self.validate_deferred_accounting_before_repost()
|
|
||||||
self.validate_write_off_account()
|
self.validate_write_off_account()
|
||||||
self.validate_expense_account()
|
self.validate_expense_account()
|
||||||
self.db_set("repost_required", self.needs_repost)
|
self.db_set("repost_required", self.needs_repost)
|
||||||
|
|
||||||
def validate_deferred_accounting_before_repost(self):
|
|
||||||
# validate if deferred expense is enabled for any item
|
|
||||||
# Don't allow to update the invoice if deferred expense is enabled
|
|
||||||
if self.needs_repost:
|
|
||||||
for item in self.get("items"):
|
|
||||||
if item.enable_deferred_expense:
|
|
||||||
frappe.throw(
|
|
||||||
_(
|
|
||||||
"Deferred Expense is enabled for item {0}. You cannot update the invoice after submission."
|
|
||||||
).format(item.item_code)
|
|
||||||
)
|
|
||||||
|
|
||||||
def make_gl_entries(self, gl_entries=None, from_repost=False):
|
def make_gl_entries(self, gl_entries=None, from_repost=False):
|
||||||
if not gl_entries:
|
if not gl_entries:
|
||||||
gl_entries = self.get_gl_entries()
|
gl_entries = self.get_gl_entries()
|
||||||
|
|||||||
@@ -539,10 +539,10 @@ class SalesInvoice(SellingController):
|
|||||||
"taxes": ("account_head",),
|
"taxes": ("account_head",),
|
||||||
}
|
}
|
||||||
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
|
self.needs_repost = self.check_if_fields_updated(fields_to_check, child_tables)
|
||||||
self.validate_deferred_accounting_before_repost()
|
|
||||||
self.validate_accounts()
|
self.validate_accounts()
|
||||||
self.db_set("repost_required", self.needs_repost)
|
self.db_set("repost_required", self.needs_repost)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
# validate if deferred revenue is enabled for any item
|
# validate if deferred revenue is enabled for any item
|
||||||
# Don't allow to update the invoice if deferred revenue is enabled
|
# Don't allow to update the invoice if deferred revenue is enabled
|
||||||
@@ -580,6 +580,8 @@ class SalesInvoice(SellingController):
|
|||||||
=======
|
=======
|
||||||
>>>>>>> 68effd93bd (refactor: move reposting logic to common controller)
|
>>>>>>> 68effd93bd (refactor: move reposting logic to common controller)
|
||||||
|
|
||||||
|
=======
|
||||||
|
>>>>>>> a856091ff4 (refactor: remove repeated validation for voucher)
|
||||||
def set_paid_amount(self):
|
def set_paid_amount(self):
|
||||||
paid_amount = 0.0
|
paid_amount = 0.0
|
||||||
base_paid_amount = 0.0
|
base_paid_amount = 0.0
|
||||||
|
|||||||
Reference in New Issue
Block a user