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>
(cherry picked from commit 0d147b011e5a9685de81564170f0668070d75af4)
This commit is contained in:
Chinmay D. Pai 2020-05-24 00:54:04 +05:30 committed by mergify-bot
parent 804c8709e3
commit a7f39a9879

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