brotherton-erpnext/patches/may_2013/p05_update_cancelled_gl_entries.py
2013-08-06 16:19:18 +05:30

15 lines
538 B
Python

# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint
def execute():
aii_enabled = cint(webnotes.defaults.get_global_default("perpetual_accounting"))
if aii_enabled:
webnotes.conn.sql("""update `tabGL Entry` gle set is_cancelled = 'Yes'
where voucher_type = 'Delivery Note'
and exists(select name from `tabDelivery Note`
where name = gle.voucher_no and docstatus = 2)""")