Merge branch 'edge' of github.com:webnotes/erpnext into webshop
Conflicts:
patches/april_2013/p05_update_file_data.py
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index 38c0026..910c1b1 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,4 +1,6 @@
erpnext.updates = [
+ ["17th May", ["Patch: Set Conversion Factor for purchase invoice item in all old records. And repost JV to book Stock Received But Not Billed account, if Auto Inventory Integration enabed."
+ ]],
["2nd May", ["Buying: Warehouse must belong to same company as transaction",
"Price List: Added Currency Field. One price list can have only one currency",
"Item: Naming can now be by series or item code",
diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py
index fc1b614..0168de6 100644
--- a/patches/april_2013/p05_update_file_data.py
+++ b/patches/april_2013/p05_update_file_data.py
@@ -8,10 +8,10 @@
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
fieldname='file_list'"""):
- update_file_list(doctype, singles)
+ # the other scenario is handled in p07_update_file_data_2
+ if doctype in singles:
+ update_file_list(doctype, singles)
- webnotes.conn.sql("""delete from tabDocField where fieldname='file_list'
- and parent=%s""", doctype)
# export_to_files([["DocType", doctype]])
def get_single_doctypes():
diff --git a/patches/april_2013/p07_update_file_data_2.py b/patches/april_2013/p07_update_file_data_2.py
index 2405e80..0cb44d0 100644
--- a/patches/april_2013/p07_update_file_data_2.py
+++ b/patches/april_2013/p07_update_file_data_2.py
@@ -13,6 +13,4 @@
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
and parent=%s""", doctype)
- webnotes.conn.sql("""delete from `tabDocField` where fieldname='file_list'
- and parent=%s""", doctype)
\ No newline at end of file
diff --git a/patches/august_2012/change_profile_permission.py b/patches/august_2012/change_profile_permission.py
index 27169d8..7e945d5 100644
--- a/patches/august_2012/change_profile_permission.py
+++ b/patches/august_2012/change_profile_permission.py
@@ -31,5 +31,4 @@
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'profile')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'profile')
\ No newline at end of file
diff --git a/patches/august_2012/changed_blog_date_format.py b/patches/august_2012/changed_blog_date_format.py
deleted file mode 100644
index df51977..0000000
--- a/patches/august_2012/changed_blog_date_format.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- from webnotes.model.bean import Bean
- Bean("Website Settings", "Website Settings").save()
\ No newline at end of file
diff --git a/patches/august_2012/report_supplier_quotations.py b/patches/august_2012/report_supplier_quotations.py
deleted file mode 100644
index 8eaf707..0000000
--- a/patches/august_2012/report_supplier_quotations.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- from webnotes.modules import reload_doc
- reload_doc("buying", "report", "supplier_quotations")
diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py
index 66b2bf6..f0373bd 100644
--- a/patches/february_2013/p03_material_request.py
+++ b/patches/february_2013/p03_material_request.py
@@ -23,3 +23,7 @@
os.system("rm -rf app/hr/doctype/holiday_block_list_allow")
os.system("rm -rf app/hr/doctype/holiday_block_list_date")
+ for dt in ("Purchase Request", "Purchase Request Item"):
+ if webnotes.conn.exists("DocType", dt):
+ webnotes.delete_doc("DocType", dt)
+
\ No newline at end of file
diff --git a/patches/july_2012/address_contact_perms.py b/patches/july_2012/address_contact_perms.py
index 5b79f22..882cf72 100644
--- a/patches/july_2012/address_contact_perms.py
+++ b/patches/july_2012/address_contact_perms.py
@@ -6,7 +6,6 @@
where parent in ('Address', 'Contact')""")
webnotes.conn.commit()
- import webnotes.model.sync
- webnotes.model.sync.sync('utilities', 'address')
- webnotes.model.sync.sync('utilities', 'contact')
+ webnotes.reload_doc('utilities', 'doctype', 'address')
+ webnotes.reload_doc('utilities', 'doctype', 'contact')
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/july_2012/blog_guest_permission.py b/patches/july_2012/blog_guest_permission.py
deleted file mode 100644
index bc42a9d..0000000
--- a/patches/july_2012/blog_guest_permission.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- """allocate read write permission to guest for doctype 'Blog'"""
- import webnotes
- webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'Blog'""")
-
- webnotes.conn.commit()
-
- import webnotes.model.sync
- webnotes.model.sync.sync('website', 'blog', 1)
-
- webnotes.conn.begin()
diff --git a/patches/july_2012/project_patch_repeat.py b/patches/july_2012/project_patch_repeat.py
index bd52522..b138661 100644
--- a/patches/july_2012/project_patch_repeat.py
+++ b/patches/july_2012/project_patch_repeat.py
@@ -12,8 +12,6 @@
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.commit()
- from webnotes.model.sync import sync
- sync("buying", "purchase_order")
- sync("buying", "purchase_request")
- sync("accounts", "purchase_invoice")
+ webnotes.reload_doc("buying", "doctype", "purchase_order")
+ webnotes.reload_doc("accounts", "doctype", "purchase_invoice")
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/july_2012/supplier_quotation.py b/patches/july_2012/supplier_quotation.py
index 49fa14d..0a1ab35 100644
--- a/patches/july_2012/supplier_quotation.py
+++ b/patches/july_2012/supplier_quotation.py
@@ -1,13 +1,12 @@
from __future__ import unicode_literals
+import webnotes
+
def execute():
"""sync supplier quotatoin and create supplier quotation mappers"""
- from webnotes.model.sync import sync
- sync('buying', 'supplier_quotation')
- sync('buying', 'supplier_quotation_item')
- sync('buying', 'purchase_request')
- sync('buying', 'purchase_request_item')
- sync('buying', 'purchase_order')
- sync('buying', 'purchase_order_item')
+ webnotes.reload_doc('buying', 'doctype', 'supplier_quotation')
+ webnotes.reload_doc('buying', 'doctype', 'supplier_quotation_item')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
from webnotes.modules import reload_doc
reload_doc('buying', 'DocType Mapper', 'Material Request-Supplier Quotation')
diff --git a/patches/june_2012/cms2.py b/patches/june_2012/cms2.py
index 414af73..17b7d23 100644
--- a/patches/june_2012/cms2.py
+++ b/patches/june_2012/cms2.py
@@ -1,14 +1,11 @@
from __future__ import unicode_literals
def execute():
import webnotes
- import webnotes.model.sync
# sync doctypes required for the patch
- webnotes.model.sync.sync('website', 'web_cache')
- webnotes.model.sync.sync('website', 'web_page')
- webnotes.model.sync.sync('website', 'blog')
- webnotes.model.sync.sync('website', 'website_settings')
- webnotes.model.sync.sync('stock', 'item')
+ webnotes.reload_doc('website', 'doctype', 'web_page')
+ webnotes.reload_doc('website', 'doctype', 'website_settings')
+ webnotes.reload_doc('stock', 'doctype', 'item')
cleanup()
diff --git a/patches/june_2012/copy_uom_for_pur_inv_item.py b/patches/june_2012/copy_uom_for_pur_inv_item.py
index b374249..a22146c 100644
--- a/patches/june_2012/copy_uom_for_pur_inv_item.py
+++ b/patches/june_2012/copy_uom_for_pur_inv_item.py
@@ -2,11 +2,9 @@
def execute():
import webnotes
- # perform sync
- import webnotes.model.sync
- webnotes.model.sync.sync('buying', 'purchase_order_item')
- webnotes.model.sync.sync('accounts', 'purchase_invoice_item')
- webnotes.model.sync.sync('stock', 'purchase_receipt_item')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
+ webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice_item')
+ webnotes.reload_doc('stock', 'doctype', 'purchase_receipt_item')
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Order Item` t2 set t1.uom = t2.uom where ifnull(t1.po_detail, '') != '' and t1.po_detail = t2.name")
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Receipt Item` t2 set t1.uom = t2.uom where ifnull(t1.pr_detail, '') != '' and t1.pr_detail = t2.name")
\ No newline at end of file
diff --git a/patches/june_2012/reports_list_permission.py b/patches/june_2012/reports_list_permission.py
index a02f4fa..e34eb5a 100644
--- a/patches/june_2012/reports_list_permission.py
+++ b/patches/june_2012/reports_list_permission.py
@@ -8,8 +8,7 @@
webnotes.conn.commit()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'search_criteria')
- webnotes.model.sync.sync('core', 'report')
+ webnotes.reload_doc('core', 'doctype', 'search_criteria')
+ webnotes.reload_doc('core', 'doctype', 'report')
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/june_2012/set_recurring_type.py b/patches/june_2012/set_recurring_type.py
index 79dd286..7fb416e 100644
--- a/patches/june_2012/set_recurring_type.py
+++ b/patches/june_2012/set_recurring_type.py
@@ -1,7 +1,6 @@
from __future__ import unicode_literals
def execute():
import webnotes
- from webnotes.model.sync import sync
- sync('accounts', 'sales_invoice')
+ webnotes.reload_doc('accounts', 'doctype', 'sales_invoice')
webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1")
\ No newline at end of file
diff --git a/patches/june_2012/support_ticket_autoreply.py b/patches/june_2012/support_ticket_autoreply.py
index 9fb0534..32e0956 100644
--- a/patches/june_2012/support_ticket_autoreply.py
+++ b/patches/june_2012/support_ticket_autoreply.py
@@ -4,9 +4,8 @@
import webnotes
import webnotes.utils
- import webnotes.model.sync
webnotes.conn.commit()
- webnotes.model.sync.sync('setup', 'email_settings')
+ webnotes.reload_doc('setup', 'doctype', 'email_settings')
webnotes.conn.begin()
sync_support_mails = webnotes.utils.cint(webnotes.conn.get_value('Email Settings',
diff --git a/patches/mar_2012/clean_property_setter.py b/patches/mar_2012/clean_property_setter.py
index 08a0a94..a9c7b81 100644
--- a/patches/mar_2012/clean_property_setter.py
+++ b/patches/mar_2012/clean_property_setter.py
@@ -12,8 +12,7 @@
clean_docfield_properties()
def change_property_setter_fieldnames():
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'property_setter')
+ webnotes.reload_doc('core', 'doctype', 'property_setter')
docfield_list = webnotes.conn.sql("""\
SELECT name, fieldname FROM `tabDocField`""", as_list=1)
custom_field_list = webnotes.conn.sql("""\
diff --git a/patches/mar_2012/create_custom_fields.py b/patches/mar_2012/create_custom_fields.py
index d4c1a13..a91c765 100644
--- a/patches/mar_2012/create_custom_fields.py
+++ b/patches/mar_2012/create_custom_fields.py
@@ -94,8 +94,7 @@
from webnotes.model.doc import Document
def execute():
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'custom_field')
+ webnotes.reload_doc('core', 'doctype', 'custom_field')
for f in field_list:
res = webnotes.conn.sql("""SELECT name FROM `tabCustom Field`
WHERE dt=%s AND fieldname=%s""", (f[0], f[1]))
diff --git a/patches/may_2012/cleanup_notification_control.py b/patches/may_2012/cleanup_notification_control.py
index 25a704e..1a7730b 100644
--- a/patches/may_2012/cleanup_notification_control.py
+++ b/patches/may_2012/cleanup_notification_control.py
@@ -25,5 +25,4 @@
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('setup', 'notification_control')
\ No newline at end of file
+ webnotes.reload_doc('setup', 'doctype', 'notification_control')
\ No newline at end of file
diff --git a/patches/may_2012/cs_server_readonly.py b/patches/may_2012/cs_server_readonly.py
index b680606..51a9b76 100644
--- a/patches/may_2012/cs_server_readonly.py
+++ b/patches/may_2012/cs_server_readonly.py
@@ -27,5 +27,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'custom_script')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'custom_script')
\ No newline at end of file
diff --git a/patches/may_2012/profile_perm_patch.py b/patches/may_2012/profile_perm_patch.py
index 4423fdb..29fa9c0 100644
--- a/patches/may_2012/profile_perm_patch.py
+++ b/patches/may_2012/profile_perm_patch.py
@@ -19,5 +19,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'profile')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'profile')
\ No newline at end of file
diff --git a/patches/may_2012/remove_communication_log.py b/patches/may_2012/remove_communication_log.py
index e44e673..b6e7e7d 100644
--- a/patches/may_2012/remove_communication_log.py
+++ b/patches/may_2012/remove_communication_log.py
@@ -1,8 +1,7 @@
from __future__ import unicode_literals
def execute():
import webnotes
- import webnotes.model.sync
- webnotes.model.sync.sync('support', 'communication')
+ webnotes.reload_doc('support', 'doctype', 'communication')
webnotes.conn.commit()
webnotes.conn.begin()
diff --git a/patches/may_2012/std_pf_readonly.py b/patches/may_2012/std_pf_readonly.py
index 83b5813..9fbbfe9 100644
--- a/patches/may_2012/std_pf_readonly.py
+++ b/patches/may_2012/std_pf_readonly.py
@@ -27,5 +27,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'print_format')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'print_format')
\ No newline at end of file
diff --git a/patches/may_2013/p01_conversion_factor_and_aii.py b/patches/may_2013/p01_conversion_factor_and_aii.py
new file mode 100644
index 0000000..89d82e0
--- /dev/null
+++ b/patches/may_2013/p01_conversion_factor_and_aii.py
@@ -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
+
+
\ No newline at end of file
diff --git a/patches/may_2013/repost_stock_for_no_posting_time.py b/patches/may_2013/repost_stock_for_no_posting_time.py
index 04ceae5..b4d52ec 100644
--- a/patches/may_2013/repost_stock_for_no_posting_time.py
+++ b/patches/may_2013/repost_stock_for_no_posting_time.py
@@ -29,6 +29,6 @@
except:
pass
i += 1
- if i%100 == 0:
+ if i%50 == 0:
webnotes.conn.sql("commit")
webnotes.conn.sql("start transaction")
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index f9d4d29..5ceb232 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -74,15 +74,12 @@
"patches.july_2012.auth_table",
"patches.july_2012.remove_event_role_owner_match",
"patches.july_2012.deprecate_bulk_rename",
- "patches.july_2012.blog_guest_permission",
"patches.july_2012.bin_permission",
"patches.july_2012.project_patch_repeat",
"patches.july_2012.repost_stock_due_to_wrong_packing_list",
"patches.july_2012.supplier_quotation",
- "patches.august_2012.report_supplier_quotations",
"patches.august_2012.task_allocated_to_assigned",
"patches.august_2012.change_profile_permission",
- "patches.august_2012.changed_blog_date_format",
"patches.august_2012.repost_billed_amt",
"patches.august_2012.remove_cash_flow_statement",
"patches.september_2012.stock_report_permissions_for_accounts",
@@ -93,7 +90,6 @@
"patches.september_2012.plot_patch",
"patches.september_2012.event_permission",
"patches.september_2012.repost_stock",
- "patches.september_2012.reload_gross_profit",
"patches.september_2012.rebuild_trees",
"patches.september_2012.deprecate_account_balance",
"patches.september_2012.profile_delete_permission",
@@ -252,4 +248,5 @@
"patches.april_2013.p08_price_list_country",
"patches.may_2013.p01_selling_net_total_export",
"patches.may_2013.repost_stock_for_no_posting_time",
+ "patches.may_2013.p01_conversion_factor_and_aii",
]
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/september_2012/reload_gross_profit.py
deleted file mode 100644
index 0a3f9ef..0000000
--- a/patches/september_2012/reload_gross_profit.py
+++ /dev/null
@@ -1,21 +0,0 @@
-# ERPNext - web based ERP (http://erpnext.com)
-# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py
index 501b535..09181db 100644
--- a/stock/doctype/serial_no/serial_no.py
+++ b/stock/doctype/serial_no/serial_no.py
@@ -142,7 +142,8 @@
gl_entries = self.get_gl_entries_for_stock(against_stock_account, self.doc.purchase_rate)
for entry in gl_entries:
- entry["posting_date"] = self.doc.purchase_date
+ entry["posting_date"] = self.doc.purchase_date or (self.doc.creation and
+ self.doc.creation.split(' ')[0]) or nowdate()
if gl_entries:
make_gl_entries(gl_entries, cancel)
\ No newline at end of file