set fiscal year in stock entry and stock reconciliation

This commit is contained in:
Anand Doshi 2013-03-27 17:35:23 +05:30
parent 80fee65ed2
commit e35073157c
2 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,18 @@
import webnotes
from accounts.utils import get_fiscal_year, FiscalYearError
def execute():
webnotes.reload_doc("stock", "doctype", "stock_entry")
webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
for doctype in ["Stock Entry", "Stock Reconciliation"]:
for name, posting_date in webnotes.conn.sql("""select name, posting_date from `tab%s`
where ifnull(fiscal_year,'')='' and docstatus=1""" % doctype):
try:
fiscal_year = get_fiscal_year(posting_date, 0)[0]
webnotes.conn.sql("""update `tab%s` set fiscal_year=%s where name=%s""" % \
(doctype, "%s", "%s"), (fiscal_year, name))
except FiscalYearError:
pass

View File

@ -216,7 +216,12 @@ patch_list = [
"patches.march_2013.p06_remove_sales_purchase_return_tool",
"execute:webnotes.bean('Global Defaults').save()",
"patches.march_2013.p07_update_project_in_stock_ledger",
"execute:webnotes.reload_doc('stock', 'doctype', 'item') #2013-03-25",
"execute:webnotes.reload_doc('setup', 'doctype', 'item_group') #2013-03-25",
"execute:webnotes.reload_doc('website', 'doctype', 'blog_post') #2013-03-25",
"execute:webnotes.reload_doc('website', 'doctype', 'web_page') #2013-03-25",
"execute:webnotes.bean('Style Settings').save() #2013-03-25",
"execute:webnotes.conn.set_value('Email Settings', None, 'send_print_in_body_and_attachment', 1)",
"patches.march_2013.p09_unset_user_type_partner",
"patches.march_2013.p10_set_fiscal_year_for_stock",
]