fix: set default posting_date value to None

using mutable python defaults, and especially function calls, inside
function definitions causes bugs that can be really hard to debug
sometimes. please refrain from using such defaults.

instead, using None is almost always a sane default. the values can
then be manipulated inside the function instead.

Signed-off-by: Chinmay D. Pai <chinmaydpai@gmail.com>
This commit is contained in:
Chinmay D. Pai 2020-05-24 00:54:04 +05:30
parent 0b5e990751
commit 0d147b011e
No known key found for this signature in database
GPG Key ID: 75507BE256F40CED

View File

@ -199,10 +199,13 @@ def book_deferred_income_or_expense(doc, deferred_process, posting_date=None):
if item.get(enable_check):
_book_deferred_revenue_or_expense(item)
def process_deferred_accounting(posting_date=today()):
def process_deferred_accounting(posting_date=None):
''' Converts deferred income/expense into income/expense
Executed via background jobs on every month end '''
if not posting_date:
posting_date = today()
if not cint(frappe.db.get_singles_value('Accounts Settings', 'automatically_process_deferred_accounting_entry')):
return