mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-25 16:04:46 +00:00
fixed conflict and aii check in global defaults
This commit is contained in:
18
patches/march_2013/p10_set_fiscal_year_for_stock.py
Normal file
18
patches/march_2013/p10_set_fiscal_year_for_stock.py
Normal 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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user