mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 11:49:10 +00:00
Merge branch 'edge' of github.com:webnotes/erpnext into webshop
Conflicts: patches/april_2013/p05_update_file_data.py
This commit is contained in:
26
patches/may_2013/p01_conversion_factor_and_aii.py
Normal file
26
patches/may_2013/p01_conversion_factor_and_aii.py
Normal file
@@ -0,0 +1,26 @@
|
||||
import webnotes
|
||||
from webnotes.utils import cint
|
||||
from accounts.utils import create_stock_in_hand_jv
|
||||
|
||||
def execute():
|
||||
webnotes.conn.auto_commit_on_many_writes = True
|
||||
|
||||
aii_enabled = cint(webnotes.conn.get_value("Global Defaults", None,
|
||||
"auto_inventory_accounting"))
|
||||
|
||||
if aii_enabled:
|
||||
create_stock_in_hand_jv(reverse = True)
|
||||
|
||||
webnotes.conn.sql("""update `tabPurchase Invoice Item` pi_item
|
||||
set conversion_factor = (select ifnull(if(conversion_factor=0, 1, conversion_factor), 1)
|
||||
from `tabUOM Conversion Detail`
|
||||
where parent = pi_item.item_code and uom = pi_item.uom
|
||||
)
|
||||
where ifnull(conversion_factor, 0)=0""")
|
||||
|
||||
if aii_enabled:
|
||||
create_stock_in_hand_jv()
|
||||
|
||||
webnotes.conn.auto_commit_on_many_writes = False
|
||||
|
||||
|
||||
@@ -29,6 +29,6 @@ def execute():
|
||||
except:
|
||||
pass
|
||||
i += 1
|
||||
if i%100 == 0:
|
||||
if i%50 == 0:
|
||||
webnotes.conn.sql("commit")
|
||||
webnotes.conn.sql("start transaction")
|
||||
Reference in New Issue
Block a user