Merge remote-tracking branch 'webnotes/4.0.0-wip' into permissions

Conflicts:
	erpnext/accounts/page/accounts_browser/accounts_browser.css
	erpnext/controllers/buying_controller.py
	erpnext/manufacturing/doctype/production_order/production_order.py
	erpnext/patches/patch_list.py
	erpnext/selling/doctype/customer/customer.txt
	erpnext/selling/doctype/sales_order/sales_order.py
	erpnext/selling/doctype/sales_order/test_sales_order.py
	erpnext/setup/doctype/features_setup/features_setup.txt
	erpnext/stock/doctype/stock_entry/test_stock_entry.py
	erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
	startup/query_handlers.py
This commit is contained in:
Anand Doshi
2013-12-26 18:30:39 +05:30
1813 changed files with 12064 additions and 18858 deletions

View File

@@ -1,24 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "material_request")
webnotes.reload_doc("buying", "doctype", "purchase_order")
webnotes.reload_doc("selling", "doctype", "lead")
from core.doctype.custom_field.custom_field import create_custom_field_if_values_exist
create_custom_field_if_values_exist("Material Request",
{"fieldtype":"Text", "fieldname":"remark", "label":"Remarks","insert_after":"Fiscal Year"})
create_custom_field_if_values_exist("Purchase Order",
{"fieldtype":"Text", "fieldname":"instructions", "label":"Instructions","insert_after":"% Billed"})
create_custom_field_if_values_exist("Purchase Order",
{"fieldtype":"Text", "fieldname":"remarks", "label":"Remarks","insert_after":"% Billed"})
create_custom_field_if_values_exist("Purchase Order",
{"fieldtype":"Text", "fieldname":"payment_terms", "label":"Payment Terms","insert_after":"Print Heading"})
create_custom_field_if_values_exist("Lead",
{"fieldtype":"Text", "fieldname":"remark", "label":"Remark","insert_after":"Territory"})

View File

@@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
si_no_gle = webnotes.conn.sql("""select si.name from `tabSales Invoice` si
where docstatus=1 and not exists(select name from `tabGL Entry`
where voucher_type='Sales Invoice' and voucher_no=si.name)
and modified >= '2013-08-01'""")
for si in si_no_gle:
webnotes.get_obj("Sales Invoice", si[0]).make_gl_entries()

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
if not webnotes.conn.sql("""show index from `tabSingles`
where Key_name="singles_doctype_field_index" """):
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tabSingles`
add index singles_doctype_field_index(`doctype`, `field`)""")

View File

@@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
import webnotes
# report_name
webnotes.conn.sql("""update `tabReport` set report_name=name where ifnull(report_name, '')=''""")
# report_type
webnotes.conn.sql("""update `tabReport` set report_type='Report Builder'
where ifnull(report_type, '')='' and ifnull(json, '')!=''""")
# is_standard
webnotes.conn.sql("""update `tabReport` set is_standard='No' where ifnull(is_standard, '')=''""")

View File

@@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.auto_commit_on_many_writes = True
for name in webnotes.conn.sql_list("""select name from tabComment"""):
webnotes.get_obj("Comment", name).update_comment_in_doc()
webnotes.conn.auto_commit_on_many_writes = False

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("accounts", "doctype", "fiscal_year")
webnotes.conn.sql("""update `tabFiscal Year` set year_end_date =
subdate(adddate(year_start_date, interval 1 year), interval 1 day)""")

View File

@@ -1,16 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
bean = webnotes.bean("Website Settings")
for company in webnotes.conn.sql_list("select name from `tabCompany`"):
if bean.doc.banner_html == ("""<h3 style='margin-bottom: 20px;'>""" + company + "</h3>"):
bean.doc.banner_html = None
if not bean.doc.brand_html:
bean.doc.brand_html = company
bean.save()
break

View File

@@ -1,34 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
import json
def execute():
doctypes_child_tables_map = {}
# Get all saved report columns
columns = webnotes.conn.sql("""select defvalue, defkey from `tabDefaultValue` where
defkey like '_list_settings:%'""")
# Make map of doctype and child tables
for value, key in columns:
doctype = key.split(':')[-1]
child_tables = webnotes.conn.sql_list("""select options from `tabDocField`
where parent=%s and fieldtype='Table'""", doctype)
doctypes_child_tables_map.setdefault(doctype, child_tables + [doctype])
# If defvalue contains child doctypes then only append the column
for value, key in columns:
new_columns = []
column_doctype = key.split(':')[-1]
for field, field_doctype in json.loads(value):
if field_doctype in doctypes_child_tables_map.get(column_doctype):
new_columns.append([field, field_doctype])
if new_columns:
webnotes.conn.sql("""update `tabDefaultValue` set defvalue=%s
where defkey=%s""" % ('%s', '%s'), (json.dumps(new_columns), key))
else:
webnotes.conn.sql("""delete from `tabDefaultValue` where defkey=%s""", key)

View File

@@ -1,32 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("setup", "doctype", "email_digest")
from webnotes.profile import get_system_managers
system_managers = get_system_managers(only_name=True)
if not system_managers:
return
# no default company
company = webnotes.conn.sql_list("select name from `tabCompany`")
if company:
company = company[0]
if not company:
return
# scheduler errors digest
edigest = webnotes.new_bean("Email Digest")
edigest.doc.fields.update({
"name": "Scheduler Errors",
"company": company,
"frequency": "Daily",
"enabled": 1,
"recipient_list": "\n".join(system_managers),
"scheduler_errors": 1
})
edigest.insert()

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
from webnotes.utils import extract_email_id
for name, recipients in webnotes.conn.sql("""select name, recipient_list from `tabEmail Digest`"""):
recipients = "\n".join([extract_email_id(r) for r in recipients.split("\n")])
webnotes.conn.set_value("Email Digest", name, "recipient_list", recipients)

View File

@@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes, os, shutil
from webnotes.utils import get_base_path
webnotes.delete_doc('Page', 'stock-ledger')
webnotes.delete_doc('Page', 'stock-ageing')
webnotes.delete_doc('Page', 'stock-level')
webnotes.delete_doc('Page', 'general-ledger')
for d in [["stock", "stock_ledger"], ["stock", "stock_ageing"],
["stock", "stock_level"], ["accounts", "general_ledger"]]:
path = os.path.join(get_base_path(), "app", d[0], "page", d[1])
if os.path.exists(path):
shutil.rmtree(path)

View File

@@ -70,7 +70,7 @@ def update_user_match():
webnotes.defaults.add_default(doctype, name, profile, "Restriction")
def add_employee_restrictions_to_leave_approver():
from core.page.user_properties import user_properties
from webnotes.core.page.user_properties import user_properties
# add restrict rights to HR User and HR Manager
webnotes.conn.sql("""update `tabDocPerm` set `restrict`=1 where parent in ('Employee', 'Leave Application')

View File

@@ -5,7 +5,7 @@ from __future__ import unicode_literals
import webnotes
def execute():
from core.page.user_properties import user_properties
from webnotes.core.page.user_properties import user_properties
for warehouse, profile in webnotes.conn.sql("""select parent, user from `tabWarehouse User`"""):
user_properties.add(profile, "Warehouse", warehouse)

View File

@@ -6,7 +6,7 @@ import webnotes
def execute():
# reset Page perms
from core.page.permission_manager.permission_manager import reset
from webnotes.core.page.permission_manager.permission_manager import reset
reset("Page")
reset("Report")

View File

@@ -1 +0,0 @@
from __future__ import unicode_literals

View File

@@ -1,38 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
from webnotes.utils import cstr
from stock.stock_ledger import update_entries_after
def execute():
webnotes.conn.auto_commit_on_many_writes = 1
pr_items = webnotes.conn.sql("""select item_code, warehouse, serial_no, valuation_rate, name
from `tabPurchase Receipt Item` where ifnull(serial_no, '') != '' and docstatus = 1""",
as_dict=True)
item_warehouse = []
for item in pr_items:
serial_nos = cstr(item.serial_no).strip().split("\n")
serial_nos = map(lambda x: x.strip(), serial_nos)
if cstr(item.serial_no) != "\n".join(serial_nos):
webnotes.conn.sql("""update `tabPurchase Receipt Item` set serial_no = %s
where name = %s""", ("\n".join(serial_nos), item.name))
if [item.item_code, item.warehouse] not in item_warehouse:
item_warehouse.append([item.item_code, item.warehouse])
webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s
where name in (%s)""" % ('%s', ', '.join(['%s']*len(serial_nos))),
tuple([item.valuation_rate] + serial_nos))
for d in item_warehouse:
try:
update_entries_after({"item_code": d[0], "warehouse": d[1] })
except:
continue
webnotes.conn.auto_commit_on_many_writes = 0

View File

@@ -1,23 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
if not webnotes.conn.exists("Country", "Aruba"):
webnotes.bean({
"doctype": "Country",
"country_name": "Aruba",
"time_zones": "America/Aruba",
"date_format": "mm-dd-yyyy"
}).insert()
if not webnotes.conn.exists("Currency", "AWG"):
webnotes.bean({
"doctype": "Currency",
"currency_name": "AWG",
"fraction": "Cent",
"fraction_units": 100,
"symbol": "Afl",
"number_format": "#,###.##"
}).insert()

View File

@@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.sql("""update `tabQuotation` set customer_name = organization
where quotation_to = 'Lead' and ifnull(lead, '') != ''
and ifnull(organization, '') != ''""")
webnotes.conn.sql("""update `tabQuotation` set customer_name = lead_name
where quotation_to = 'Lead' and ifnull(lead, '') != ''
and ifnull(organization, '') = '' and ifnull(lead_name, '') != ''""")
webnotes.conn.sql("""update `tabQuotation` set contact_display = lead_name
where quotation_to = 'Lead' and ifnull(lead, '') != '' and ifnull(lead_name, '') != ''""")
webnotes.conn.sql("""update `tabOpportunity` set contact_display = lead_name
where enquiry_from = 'Lead' and ifnull(lead, '') != '' and ifnull(lead_name, '') != ''""")
webnotes.conn.sql("""update `tabOpportunity` opp, `tabLead` lead
set opp.customer_name = lead.company_name where opp.lead = lead.name""")

View File

@@ -1,15 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, json
import webnotes.utils
def execute():
modules = webnotes.get_config().modules
ml = json.loads(webnotes.conn.get_global("modules_list") or "[]")
if ml:
webnotes.conn.set_global("hidden_modules",
json.dumps(list(set(modules.keys()).difference(set(ml)))))

View File

@@ -1,15 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
import webnotes.model
def execute():
for p in ["activity", "todo", "questions", "question-view"]:
pbean = webnotes.bean("Page", p)
if len(pbean.doclist) == 1:
pbean.doclist.append({
"doctype": "Page Role",
"role": "All",
"parentfield": "roles"
})
pbean.save()

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, json
import webnotes.utils
def execute():
modules = webnotes.get_config().modules
ml = json.loads(webnotes.conn.get_global("hidden_modules") or "[]")
if len(ml) == len(modules.keys()):
webnotes.conn.set_global("hidden_modules", json.dumps([]))

View File

@@ -1,76 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, webnotes.utils, os
def execute():
webnotes.reload_doc("core", "doctype", "file_data")
webnotes.reset_perms("File Data")
singles = get_single_doctypes()
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
fieldname='file_list'"""):
# the other scenario is handled in p07_update_file_data_2
if doctype in singles:
update_file_list(doctype, singles)
# export_to_files([["DocType", doctype]])
def get_single_doctypes():
return webnotes.conn.sql_list("""select name from tabDocType
where ifnull(issingle,0)=1""")
def update_file_list(doctype, singles):
if doctype in singles:
doc = webnotes.doc(doctype, doctype)
if doc.file_list:
update_for_doc(doctype, doc)
webnotes.conn.set_value(doctype, None, "file_list", None)
else:
try:
for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where
ifnull(file_list, '')!=''""" % doctype, as_dict=True):
update_for_doc(doctype, doc)
webnotes.conn.commit()
webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype)
except Exception, e:
print webnotes.getTraceback()
if (e.args and e.args[0]!=1054) or not e.args:
raise
def update_for_doc(doctype, doc):
for filedata in doc.file_list.split("\n"):
if not filedata:
continue
filedata = filedata.split(",")
if len(filedata)==2:
filename, fileid = filedata[0], filedata[1]
else:
continue
exists = True
if not (filename.startswith("http://") or filename.startswith("https://")):
if not os.path.exists(webnotes.utils.get_site_path(webnotes.conf.files_path, filename)):
exists = False
if exists:
if webnotes.conn.exists("File Data", fileid):
try:
fd = webnotes.bean("File Data", fileid)
if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name):
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name
fd.save()
else:
fd = webnotes.bean("File Data", copy=fd.doclist)
fd.doc.attached_to_doctype = doctype
fd.doc.attached_to_name = doc.name
fd.doc.name = None
fd.insert()
except webnotes.DuplicateEntryError:
pass
else:
webnotes.conn.sql("""delete from `tabFile Data` where name=%s""",
fileid)

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("Stock", "DocType", "Delivery Note Item")
for dt in ("Journal Voucher Detail", "Sales Taxes and Charges",
"Purchase Taxes and Charges", "Delivery Note Item",
"Purchase Invoice Item", "Sales Invoice Item"):
webnotes.conn.sql_ddl("""alter table `tab%s` alter `cost_center` drop default""" \
% (dt,))
webnotes.reload_doc(webnotes.conn.get_value("DocType", dt, "module"), "DocType", dt)

View File

@@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, os, webnotes.utils
def execute():
files_path = webnotes.utils.get_site_path(webnotes.conf.files_path)
webnotes.conn.auto_commit_on_many_writes = 1
for f in webnotes.conn.sql("""select name, file_name from
`tabFile Data`""", as_dict=True):
if f.file_name:
filepath = os.path.join(files_path, f.file_name)
if os.path.exists(filepath):
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
webnotes.conn.auto_commit_on_many_writes = 0

View File

@@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("Accounts", "DocType", "Sales Taxes and Charges")
webnotes.conn.sql("""update `tabSales Taxes and Charges`
set cost_center = cost_center_other_charges""")
webnotes.conn.sql_ddl("""alter table `tabSales Taxes and Charges`
drop column cost_center_other_charges""")

View File

@@ -1,22 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes
webnotes.conn.auto_commit_on_many_writes = 1
singles = get_single_doctypes()
for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns`
where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name):
doctype = doctype[3:]
if not webnotes.conn.exists("DocType", doctype): continue
update_file_list(doctype, singles)
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
and parent=%s""", doctype)
webnotes.conn.auto_commit_on_many_writes = 0

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
from patches.january_2013 import rebuild_tree
rebuild_tree.execute()

View File

@@ -1,49 +0,0 @@
import webnotes
def execute():
create_fiscal_years()
doctypes = webnotes.conn.sql_list("""select parent from tabDocField
where (fieldtype="Link" and options='Fiscal Year')
or (fieldtype="Select" and options='link:Fiscal Year')""")
for dt in doctypes:
date_fields = webnotes.conn.sql_list("""select fieldname from tabDocField
where parent=%s and fieldtype='Date'""", dt)
date_field = get_date_field(date_fields, dt)
if not date_field:
print dt, date_field
else:
webnotes.conn.sql("""update `tab%s` set fiscal_year =
if(%s<='2013-06-30', '2012-2013', '2013-2014')""" % (dt, date_field))
def create_fiscal_years():
fiscal_years = {
"2012-2013": ["2012-07-01", "2013-06-30"],
"2013-2014": ["2013-07-01", "2014-06-30"]
}
for d in fiscal_years:
webnotes.bean({
"doctype": "Fiscal Year",
"year": d,
"year_start_date": fiscal_years[d][0],
"is_fiscal_year_closed": "No"
}).insert()
def get_date_field(date_fields, dt):
date_field = None
if date_fields:
if "posting_date" in date_fields:
date_field = "posting_date"
elif "transaction_date" in date_fields:
date_field = 'transaction_date'
else:
date_field = date_fields[0]
# print dt, date_fields
return date_field

View File

@@ -1,6 +0,0 @@
import webnotes
from webnotes.utils import cint
def execute():
import patches.march_2013.p08_create_aii_accounts
patches.march_2013.p08_create_aii_accounts.execute()

View File

@@ -1,20 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("hr", "doctype", "hr_settings")
webnotes.reload_doc("setup", "doctype", "global_defaults")
hr = webnotes.bean("HR Settings", "HR Settings")
hr.doc.emp_created_by = webnotes.conn.get_value("Global Defaults", "Global Defaults", "emp_created_by")
if webnotes.conn.sql("""select name from `tabSalary Slip` where docstatus=1 limit 1"""):
hr.doc.include_holidays_in_total_working_days = 1
hr.save()
webnotes.conn.sql("""delete from `tabSingles` where doctype = 'Global Defaults'
and field = 'emp_created_by'""")

View File

@@ -1,41 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list")
webnotes.reload_doc("stock", "doctype", "item_price")
for t in [
("Supplier Quotation", "price_list_name", "buying_price_list"),
("Purchase Order", "price_list_name", "buying_price_list"),
("Purchase Invoice", "price_list_name", "buying_price_list"),
("Purchase Receipt", "price_list_name", "buying_price_list"),
("Quotation", "price_list_name", "selling_price_list"),
("Sales Order", "price_list_name", "selling_price_list"),
("Delivery Note", "price_list_name", "selling_price_list"),
("Sales Invoice", "price_list_name", "selling_price_list"),
("POS Setting", "price_list_name", "selling_price_list"),
("Shopping Cart Price List", "price_list", "selling_price_list"),
("Item Price", "price_list_name", "price_list"),
("BOM", "price_list", "buying_price_list"),
]:
table_columns = webnotes.conn.get_table_columns(t[0])
if t[2] in table_columns and t[1] in table_columns:
# already reloaded, so copy into new column and drop old column
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" % (t[0], t[2], t[1]))
webnotes.conn.sql_ddl("""alter table `tab%s` drop column `%s`""" % (t[0], t[1]))
elif t[1] in table_columns:
webnotes.conn.sql_ddl("alter table `tab%s` change `%s` `%s` varchar(180)" % t)
webnotes.reload_doc(webnotes.conn.get_value("DocType", t[0], "module"), "DocType", t[0])
webnotes.conn.sql("""update tabSingles set field='selling_price_list'
where field='price_list_name' and doctype='Selling Settings'""")
webnotes.reload_doc("Selling", "DocType", "Selling Settings")
webnotes.bean("Selling Settings").save()

View File

@@ -1,24 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("accounts", "doctype", "pos_setting")
if "customer_account" in webnotes.conn.get_table_columns("POS Setting"):
customer_account = webnotes.conn.sql("""select customer_account, name from `tabPOS Setting`
where ifnull(customer_account, '')!=''""")
for cust_acc, pos_name in customer_account:
customer = webnotes.conn.sql("""select master_name, account_name from `tabAccount`
where name=%s""", (cust_acc), as_dict=1)
if not customer[0].master_name:
customer_name = webnotes.conn.get_value('Customer', customer[0].account_name, 'name')
else:
customer_name = customer[0].master_name
webnotes.conn.set_value('POS Setting', pos_name, 'customer', customer_name)
webnotes.conn.sql_ddl("""alter table `tabPOS Setting` drop column `customer_account`""")

View File

@@ -1,14 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "event")
webnotes.conn.sql("""delete from `tabEvent` where repeat_on='Every Year' and ref_type='Employee'""")
for employee in webnotes.conn.sql_list("""select name from `tabEmployee` where status='Active' and
ifnull(date_of_birth, '')!=''"""):
obj = webnotes.get_obj("Employee", employee)
obj.update_dob_event()

View File

@@ -1,5 +0,0 @@
import webnotes
def execute():
webnotes.conn.sql("""update `tabSerial No` set status = 'Not Available' where status='Not In Store'""")
webnotes.conn.sql("""update `tabSerial No` set status = 'Available' where status='In Store'""")

View File

@@ -1,11 +0,0 @@
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
webnotes.reload_doc("stock", "doctype", "serial_no")
webnotes.reload_doc("stock", "report", "stock_ledger")
webnotes.conn.sql("""delete from `tabStock Ledger Entry`
where ifnull(is_cancelled, 'No') = 'Yes'""")
webnotes.reload_doc("accounts", "doctype", "gl_entry")
webnotes.conn.sql("""delete from `tabGL Entry` where ifnull(is_cancelled, 'No') = 'Yes'""")

View File

@@ -1,113 +0,0 @@
import webnotes
def execute():
cancelled = []
uncancelled = []
stock_entries = webnotes.conn.sql("""select * from `tabStock Entry`
where docstatus >= 1 and date(modified) >= "2013-08-16"
and ifnull(production_order, '') != '' and ifnull(bom_no, '') != ''
order by modified desc, name desc""", as_dict=True)
for entry in stock_entries:
if not webnotes.conn.sql("""select name from `tabStock Entry Detail`
where parent=%s""", entry.name):
res = webnotes.conn.sql("""select * from `tabStock Ledger Entry`
where voucher_type='Stock Entry' and voucher_no=%s
and is_cancelled='No'""", entry.name, as_dict=True)
if res:
make_stock_entry_detail(entry, res, cancelled, uncancelled)
if cancelled or uncancelled:
send_email(cancelled, uncancelled)
def make_stock_entry_detail(entry, res, cancelled, uncancelled):
fg_item = webnotes.conn.get_value("Production Order", entry.production_order,
"production_item")
voucher_detail_entries_map = {}
for sle in res:
voucher_detail_entries_map.setdefault(sle.voucher_detail_no, []).append(sle)
for i, voucher_detail_no in enumerate(sorted(voucher_detail_entries_map.keys())):
sl_entries = voucher_detail_entries_map[voucher_detail_no]
# create stock entry details back from stock ledger entries
stock_entry_detail = webnotes.doc({
"doctype": "Stock Entry Detail",
"parentfield": "mtn_details",
"parenttype": "Stock Entry",
"parent": entry.name,
"__islocal": 1,
"idx": i+1,
"docstatus": 1,
"owner": entry.owner,
"name": voucher_detail_no,
"transfer_qty": abs(sl_entries[0].actual_qty),
"qty": abs(sl_entries[0].actual_qty),
"stock_uom": sl_entries[0].stock_uom,
"uom": sl_entries[0].stock_uom,
"conversion_factor": 1,
"item_code": sl_entries[0].item_code,
"description": webnotes.conn.get_value("Item", sl_entries[0].item_code,
"description"),
"incoming_rate": sl_entries[0].incoming_rate,
"batch_no": sl_entries[0].batch_no,
"serial_no": sl_entries[0].serial_no
})
if sl_entries[0].item_code == fg_item:
stock_entry_detail.bom_no = entry.bom_no
for sle in sl_entries:
if sle.actual_qty < 0:
stock_entry_detail.s_warehouse = sle.warehouse
else:
stock_entry_detail.t_warehouse = sle.warehouse
stock_entry_detail.save()
if entry.docstatus == 2:
webnotes.conn.set_value("Stock Entry", entry.name, "docstatus", 1)
# call for cancelled ones
se = webnotes.bean("Stock Entry", entry.name)
controller = se.make_controller()
controller.update_production_order(1)
res = webnotes.conn.sql("""select name from `tabStock Entry`
where amended_from=%s""", entry.name)
if res:
cancelled.append(res[0][0])
if res[0][0] in uncancelled:
uncancelled.remove(res[0][0])
webnotes.bean("Stock Entry", res[0][0]).cancel()
uncancelled.append(se.doc.name)
def send_email(cancelled, uncancelled):
from webnotes.utils.email_lib import sendmail_to_system_managers
uncancelled = "we have undone the cancellation of the following Stock Entries through a patch:\n" + \
"\n".join(uncancelled) if uncancelled else ""
cancelled = "and cancelled the following Stock Entries:\n" + "\n".join(cancelled) \
if cancelled else ""
subject = "[ERPNext] [Important] Cancellation undone for some Stock Entries"
content = """Dear System Manager,
An error got introduced into the code that cleared the item table in a Stock Entry associated to a Production Order.
To undo its effect,
%s
%s
You will have to edit them again.
Sorry for the inconvenience this has caused.
Regards,
Team ERPNext.""" % (uncancelled, cancelled)
# print subject, content
sendmail_to_system_managers(subject, content)

View File

@@ -1,15 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("utilities", "doctype", "address")
webnotes.conn.sql("""update tabAddress set address_title = customer_name where ifnull(customer_name,'')!=''""")
webnotes.conn.sql("""update tabAddress set address_title = supplier_name where ifnull(supplier_name,'')!=''""")
webnotes.conn.sql("""update tabAddress set address_title = sales_partner where ifnull(sales_partner,'')!=''""")
# move code to new doctype
webnotes.conn.set_value("Website Script", None, "javascript",
webnotes.conn.get_value("Website Settings", None, "startup_code"))

View File

@@ -1,6 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.delete_doc("Print Format", "Form 16A Print Format")

View File

@@ -1,15 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
"""finds references of deleted addresses and contacts and deletes these references"""
import webnotes.model
for dt in ["Address", "Contact"]:
link_fields = webnotes.model.get_link_fields(dt)
for parent, lf in link_fields:
webnotes.conn.sql("""update `tab%s` ref set `%s`=null
where ifnull(`%s`, '')!='' and not exists (
select * from `tab%s` where name=ref.`%s`)""" % \
(parent, lf, lf, dt, lf))

View File

@@ -1,42 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
from webnotes.model.code import get_obj
from webnotes.model.doc import addchild
# delete doctypes and tables
for dt in ["TDS Payment", "TDS Return Acknowledgement", "Form 16A",
"TDS Rate Chart", "TDS Category", "TDS Control", "TDS Detail",
"TDS Payment Detail", "TDS Rate Detail", "TDS Category Account",
"Form 16A Ack Detail", "Form 16A Tax Detail"]:
webnotes.delete_doc("DocType", dt)
webnotes.conn.commit()
webnotes.conn.sql("drop table if exists `tab%s`" % dt)
webnotes.conn.begin()
# Add tds entry in tax table for purchase invoice
pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice`
where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
for pi in pi_list:
piobj = get_obj("Purchase Invoice", pi[0], with_children=1)
ch = addchild(piobj.doc, 'taxes_and_charges', 'Purchase Taxes and Charges')
ch.charge_type = "Actual"
ch.account_head = piobj.doc.tax_code
ch.description = piobj.doc.tax_code
ch.rate = -1*piobj.doc.ded_amount
ch.tax_amount = -1*piobj.doc.ded_amount
ch.category = "Total"
ch.save(1)
# Add tds entry in entries table for journal voucher
jv_list = webnotes.conn.sql("""select name from `tabJournal Voucher`
where ifnull(tax_code, '')!='' and ifnull(ded_amount, 0)!=0""")
for jv in jv_list:
jvobj = get_obj("Journal Voucher", jv[0], with_children=1)
ch = addchild(jvobj.doc, 'entries', 'Journal Voucher Detail')
ch.account = jvobj.doc.tax_code
ch.credit = jvobj.doc.ded_amount
ch.save(1)

View File

@@ -1,29 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
# new roles
roles = [r[0] for r in webnotes.conn.sql("""select name from tabRole""")]
if not "Leave Approver" in roles:
webnotes.bean([{"doctype":"Role", "role_name":"Leave Approver",
"__islocal":1, "module":"HR"}]).save()
if not "Expense Approver" in roles:
webnotes.bean([{"doctype":"Role", "role_name":"Expense Approver",
"__islocal":1, "module":"HR"}]).save()
# reload
webnotes.clear_perms("Leave Application")
webnotes.reload_doc("hr", "doctype", "leave_application")
webnotes.clear_perms("Expense Claim")
webnotes.reload_doc("hr", "doctype", "expense_claim")
# remove extra space in Approved Expense Vouchers
webnotes.conn.sql("""update `tabExpense Claim` set approval_status='Approved'
where approval_status='Approved '""")
webnotes.conn.commit()
for t in ['__CacheItem', '__SessionCache', 'tabSupport Ticket Response']:
webnotes.conn.sql("drop table if exists `%s`" % t)

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
for dt in webnotes.conn.sql("""select distinct parent from tabDocField
where fieldname='file_list'"""):
try:
webnotes.conn.sql("""update `tab%s` set file_list =
replace(file_list, "-", "")""" % dt[0])
except Exception, e:
if e.args[0]!=1146: raise

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.sql("""update `tabDocType` set default_print_format=null
where default_print_format='Standard'""")

View File

@@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes, json
def execute():
for p in webnotes.conn.sql("""select name, recent_documents from
tabProfile where ifnull(recent_documents,'')!=''"""):
if not '~~~' in p[1] and p[1][0]=='[':
webnotes.cache().set_value("recent:" + p[0], json.loads(p[1]))

View File

@@ -1,53 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
delete_doctypes()
rename_module()
cleanup_bom()
rebuild_exploded_bom()
def delete_doctypes():
webnotes.delete_doc("DocType", "Production Control")
webnotes.delete_doc("DocType", "BOM Control")
def rename_module():
webnotes.reload_doc("core", "doctype", "role")
webnotes.reload_doc("core", "doctype", "page")
webnotes.reload_doc("core", "doctype", "module_def")
if webnotes.conn.exists("Role", "Production User"):
webnotes.rename_doc("Role", "Production User", "Manufacturing User")
if webnotes.conn.exists("Role", "Production Manager"):
webnotes.rename_doc("Role", "Production Manager", "Manufacturing Manager")
if webnotes.conn.exists("Page", "manufacturing-home"):
webnotes.delete_doc("Page", "production-home")
else:
webnotes.rename_doc("Page", "production-home", "manufacturing-home")
if webnotes.conn.exists("Module Def", "Production"):
webnotes.rename_doc("Module Def", "Production", "Manufacturing")
modules_list = webnotes.conn.get_global('modules_list')
if modules_list:
webnotes.conn.set_global("modules_list", modules_list.replace("Production",
"Manufacturing"))
# set end of life to null if "0000-00-00"
webnotes.conn.sql("""update `tabItem` set end_of_life=null where end_of_life='0000-00-00'""")
def rebuild_exploded_bom():
from webnotes.model.code import get_obj
for bom in webnotes.conn.sql("""select name from `tabBOM` where docstatus < 2"""):
get_obj("BOM", bom[0], with_children=1).on_update()
def cleanup_bom():
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 1 where ifnull(is_active, 'No') = 'Yes'""")
webnotes.conn.sql("""UPDATE `tabBOM` SET is_active = 0 where ifnull(is_active, 'No') = 'No'""")
webnotes.reload_doc("manufacturing", "doctype", "bom")
webnotes.conn.sql("""update `tabBOM` set with_operations = 1""")

View File

@@ -1,18 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
from webnotes.utils import cstr
from webnotes.model.code import get_obj
fy_list = webnotes.conn.sql("""select name from `tabFiscal Year`
where docstatus < 2 order by year_start_date desc""")
series_list = []
for fy in fy_list:
series_list.append("PRO/" + cstr(fy[0][2:5]) + cstr(fy[0][7:9]) + "/")
naming_series_obj = get_obj("Naming Series")
naming_series_obj.doc.user_must_always_select = 1
naming_series_obj.set_series_for("Production Order", series_list)

View File

@@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree("Item Group", "parent_item_group")

View File

@@ -1,19 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
from webnotes.widgets.form.assign_to import add
for t in webnotes.conn.sql("""select * from tabQuotation
where ifnull(contact_by, '')!=''""", as_dict=1):
add({
'doctype': "Quotation",
'name': t['name'],
'assign_to': t['contact_by'],
'assigned_by': t['owner'],
'description': "Contact regarding quotation.",
'date': t['creation'],
"no_notification": True
})

View File

@@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""update `tabCustom Script`
set script = replace(script, 'createLocal', 'wn.model.make_new_doc_and_get_name')
where script_type='Client'""")

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
from utilities.repost_stock import get_ordered_qty, update_bin
for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
update_bin(d[0], d[1], {
"ordered_qty": get_ordered_qty(d[0], d[1])
})

View File

@@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""update `tabBin`
set projected_qty = ifnull(actual_qty, 0) + ifnull(indented_qty, 0) +
ifnull(ordered_qty, 0) + ifnull(planned_qty, 0) - ifnull(reserved_qty, 0)""")

View File

@@ -1,78 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
# removed following fields
webnotes.reload_doc("stock", "doctype", "stock_entry")
custom_fields()
deprecate_process()
webnotes.delete_doc("doctype", "sandbox")
def custom_fields():
fields = [
{
"label": "Is Excisable Goods",
"fieldname": "is_excisable_goods",
"fieldtype": "Select",
"options": "\nYes\nNo",
"insert_after": "Company"
},
{
"label": "Excisable Goods",
"fieldname": "excisable_goods",
"fieldtype": "Select",
"options": "\nReturnable\nNon-Returnable)",
"insert_after": "Amended From"
},
{
"label": "Under Rule",
"fieldname": "under_rule",
"fieldtype": "Select",
"options": "\nOrdinary\n57 AC (5) a\n57 F (2) Non-Exc.",
"insert_after": "Remarks"
},
{
"label": "Transporter",
"fieldname": "transporter",
"fieldtype": "Data",
"options": "",
"insert_after": "Project Name"
},
{
"label": "Transfer Date",
"fieldname": "transfer_date",
"fieldtype": "Date",
"options": "",
"insert_after": "Select Print Heading"
},
]
for fld in fields:
if webnotes.conn.sql("""select name from `tabStock Entry`
where ifnull(%s, '') != '' and docstatus<2""", (fld['fieldname'])):
create_custom_field(fld)
def create_custom_field(fld):
fld.update({
"doctype": "Custom Field",
"dt": "Stock Entry",
"print_hide": 1,
"permlevel": 0
})
from webnotes.model.doclist import DocList
webnotes.insert(DocList([fld]))
def deprecate_process():
webnotes.conn.sql("""update `tabStock Entry`
set `purpose`="Material Transfer"
where process="Material Transfer" and purpose="Production Order" """)
webnotes.conn.sql("""update `tabStock Entry`
set `purpose`="Manufacture/Repack"
where (process="Backflush" and purpose="Production Order") or purpose="Other" """)
webnotes.conn.sql("""update `tabStock Entry`
set `purpose`="Subcontract"
where process="Subcontracting" """)

View File

@@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "docfield")
webnotes.conn.sql("""update tabDocField set print_width = width""")

View File

@@ -1,27 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
# set page published = 1
webnotes.reload_doc("website", "doctype", "web_page")
webnotes.conn.sql("""update `tabWeb Page` set published=1;""")
# convert all page & blog markdowns to html
from markdown2 import markdown
for page in webnotes.conn.sql("""select name, main_section from `tabWeb Page`"""):
m = markdown(page[1] or "").encode("utf8")
webnotes.conn.set_value("Web Page", page[0], "main_section", m)
for page in webnotes.conn.sql("""select name, content from `tabBlog`"""):
m = markdown(page[1] or "").encode("utf8")
webnotes.conn.set_value("Blog", page[0], "content", m)
# delete website cache
webnotes.delete_doc("DocType", "Web Cache")
webnotes.conn.commit()
webnotes.conn.sql("""drop table if exists `tabWeb Cache`""")

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.reload_doc("accounts", "doctype", "account")
webnotes.conn.sql("update `tabAccount` set allow_negative_balance = 1")

View File

@@ -1,23 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
from webnotes.utils import flt
records = webnotes.conn.sql("""
select against_voucher_type, against_voucher,
sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) as outstanding from `tabGL Entry`
where ifnull(is_cancelled, 'No') = 'No'
and against_voucher_type in ("Sales Invoice", "Purchase Invoice")
and ifnull(against_voucher, '') != ''
group by against_voucher_type, against_voucher""", as_dict=1)
for r in records:
outstanding = webnotes.conn.sql("""select name, outstanding_amount from `tab%s`
where name = %s and docstatus = 1""" %
(r["against_voucher_type"], '%s'), (r["against_voucher"]))
if outstanding and abs(flt(r["outstanding"])) != flt(outstanding[0][1]):
if ((r["against_voucher_type"]=='Sales Invoice' and flt(r["outstanding"]) >= 0) \
or (r["against_voucher_type"]=="Purchase Invoice" and flt(["outstanding"]) <= 0)):
webnotes.conn.set_value(r["against_voucher_type"], r["against_voucher"],
"outstanding_amount", abs(flt(r["outstanding"])))

View File

@@ -1,25 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
from webnotes.utils import flt
records = webnotes.conn.sql("""select name, grand_total, debit_to from `tabSales Invoice`
where docstatus = 1""", as_dict=1)
for r in records:
gle = webnotes.conn.sql("""select name, debit from `tabGL Entry`
where account = %s and voucher_type = 'Sales Invoice' and voucher_no = %s
and ifnull(is_cancelled, 'No') = 'No' limit 1""", (r.debit_to, r.name), as_dict=1)
if gle:
diff = flt((flt(r.grand_total) - flt(gle[0]['debit'])), 2)
if abs(diff) == 0.01:
# print r.name, r.grand_total, gle[0]['debit'], diff
webnotes.conn.sql("""update `tabGL Entry` set debit = debit + %s
where name = %s""", (diff, gle[0]['name']))
webnotes.conn.sql("""update `tabGL Entry` set credit = credit - %s
where voucher_type = 'Sales Invoice' and voucher_no = %s
and credit > 0 limit 1""", (diff, r.name))

View File

@@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "event")
webnotes.conn.sql("""update tabEvent set subject=description""")
webnotes.conn.sql("""update tabEvent set description = concat(description, "\n", notes)
where ifnull(notes,"") != "" """)
webnotes.conn.sql("""update tabEvent set starts_on = timestamp(event_date, event_hour)""")
webnotes.conn.sql("""update tabEvent set ends_on = timestampadd(hour, 1, starts_on)""")

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("setup", "doctype", "email_digest")
webnotes.conn.sql('update `tabEmail Digest` set calendar_events=1, todo_list=1 where enabled=1')

View File

@@ -1,30 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, os, sys
def execute():
webnotes.reload_doc("core", "doctype", "doctype")
tables = webnotes.conn.sql_list("show tables")
if not "tabMaterial Request Item" in tables:
webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
if not "tabMaterial Request" in tables:
webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
webnotes.reload_doc("stock", "doctype", "material_request")
webnotes.reload_doc("stock", "doctype", "material_request_item")
webnotes.conn.sql("""update `tabMaterial Request` set material_request_type='Purchase'""")
os.system("rm -rf app/buying/doctype/purchase_request")
os.system("rm -rf app/buying/doctype/purchase_request_item")
os.system("rm -rf app/hr/doctype/holiday_block_list")
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)

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes, os
def execute():
webnotes.delete_doc("DocType", "Product")
webnotes.delete_doc("DocType", "Test")
webnotes.delete_doc("Module Def", "Test")
os.system("rm -rf app/test")
os.system("rm -rf app/website/doctype/product")

View File

@@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("hr", "doctype", "leave_application")
if not webnotes.get_doctype("Leave Application").get({"doctype": "DocField",
"parent": "Leave Application", "permlevel": 2}):
webnotes.conn.sql("""update `tabDocPerm` set permlevel=1
where parent="Leave Application" and permlevel=2""")

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.clear_perms("Report")
webnotes.clear_perms("ToDo")
webnotes.reload_doc("core", "doctype", "report")
webnotes.reload_doc("core", "doctype", "todo")
webnotes.reload_doc("core", "report", "todo")

View File

@@ -1,12 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
for w in webnotes.conn.sql("""select name from `tabWarehouse` where docstatus=2"""):
try:
webnotes.delete_doc("Warehouse", w[0])
except webnotes.ValidationError:
pass

View File

@@ -1,58 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
# convert timesheet details to time logs
webnotes.reload_doc("projects", "doctype", "time_log")
# copy custom fields
custom_map = {"Timesheet":[], "Timesheet Detail":[]}
for custom_field in webnotes.conn.sql("""select * from `tabCustom Field` where
dt in ('Timesheet', 'Timesheet Detail')""", as_dict=True):
custom_map[custom_field.dt].append(custom_field.fieldname)
custom_field.doctype = "Custom Field"
custom_field.dt = "Time Log"
custom_field.insert_after = None
try:
cf = webnotes.bean(custom_field).insert()
except Exception, e:
# duplicate custom field
pass
for name in webnotes.conn.sql_list("""select name from tabTimesheet"""):
ts = webnotes.bean("Timesheet", name)
for tsd in ts.doclist.get({"doctype":"Timesheet Detail"}):
if not webnotes.conn.exists("Project", tsd.project_name):
tsd.project_name = None
if not webnotes.conn.exists("Task", tsd.task_id):
tsd.task_id = None
tl = webnotes.bean({
"doctype": "Time Log",
"status": "Draft",
"from_time": ts.doc.timesheet_date + " " + tsd.act_start_time,
"to_time": ts.doc.timesheet_date + " " + tsd.act_end_time,
"activity_type": tsd.activity_type,
"task": tsd.task_id,
"project": tsd.project_name,
"note": ts.doc.notes,
"file_list": ts.doc.file_list,
"_user_tags": ts.doc._user_tags,
"owner": ts.doc.owner,
"creation": ts.doc.creation,
"modified_by": ts.doc.modified_by
})
for key in custom_map["Timesheet"]:
tl.doc.fields[key] = ts.doc.fields.get(key)
for key in custom_map["Timesheet Detail"]:
tl.doc.fields[key] = tsd.fields.get(key)
tl.make_controller()
tl.controller.set_status()
tl.controller.calculate_total_hours()
tl.doc.insert()

View File

@@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""update `tabSingles` set value = ''
where doctype = 'Payment to Invoice Matching Tool'
and field in ('account', 'voucher_no', 'total_amount', 'pending_amt_to_reconcile',
'from_date', 'to_date', 'amt_greater_than', 'amt_less_than')""")

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'BOM Replace Tool'""")
webnotes.reload_doc("manufacturing", "doctype", "bom_replace_tool")

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
from webnotes.utils import get_base_path
import shutil
import os
utils_path = os.path.join(get_base_path(), "app", "accounts", "utils")
if os.path.exists(utils_path):
shutil.rmtree(utils_path)

View File

@@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
try:
for mapper in webnotes.conn.sql("""select name from `tabGL Mapper`"""):
webnotes.delete_doc("GL Mapper", mapper[0])
except Exception, e:
pass

View File

@@ -1,13 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.auto_commit_on_many_writes = 1
from utilities.repost_stock import get_reserved_qty, update_bin
for d in webnotes.conn.sql("select item_code, warehouse from tabBin"):
update_bin(d[0], d[1], {
"reserved_qty": get_reserved_qty(d[0], d[1])
})
webnotes.conn.auto_commit_on_many_writes = 0

View File

@@ -1,15 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.reload_doc("hr", "doctype", "leave_application")
webnotes.conn.sql("""update `tabLeave Application`, `tabEmployee` set
`tabLeave Application`.company = `tabEmployee`.company where
`tabLeave Application`.employee = `tabEmployee`.name""")
company = webnotes.conn.get_default("company")
if company:
webnotes.conn.sql("""update `tabLeave Application`
set company = %s where ifnull(company,'')=''""", company)

View File

@@ -1,16 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "patch_log")
if webnotes.conn.table_exists("__PatchLog"):
for d in webnotes.conn.sql("""select patch from __PatchLog"""):
webnotes.doc({
"doctype": "Patch Log",
"patch": d[0]
}).insert()
webnotes.conn.commit()
webnotes.conn.sql("drop table __PatchLog")

View File

@@ -1,19 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
# get all currencies
webnotes.reload_doc("setup", "doctype", "currency")
clist = [webnotes.conn.get_default("currency")]
for f in webnotes.conn.sql("""select parent, fieldname from tabDocField
where options in ('Currency', 'link:Currency')""", as_dict=1):
if not webnotes.conn.get_value("DocType", f.parent, "issingle"):
clist += [c[0] for c in webnotes.conn.sql("""select distinct `%s`
from `tab%s`""" % (f.fieldname, f.parent))]
clist = list(set(clist))
for c in clist:
if c:
webnotes.conn.sql("""update tabCurrency set `enabled`=1 where name=%s""", c)

View File

@@ -1,66 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
from webnotes.utils import get_base_path
import os
def execute():
# find out when was the file list patch run
res = webnotes.conn.sql("""select applied_on from `__PatchLog`
where patch='patches.december_2012.file_list_rename' order by applied_on desc limit 1""")
if res:
patch_date = res[0][0].date()
files_path = os.path.join(get_base_path(), "public", "files")
change_map = {}
file_data_list = webnotes.conn.sql("""select name, file_name from `tabFile Data`
where date(modified) <= %s and ifnull(file_url, '')='' and name like "%%-%%" """,
patch_date)
# print patch_date
# print file_data_list
# print files_path
for fid, file_name in file_data_list:
if os.path.exists(os.path.join(files_path, fid)):
new_fid, new_file_name = fid.replace("-", ""), file_name.replace("-", "")
try:
webnotes.conn.sql("""update `tabFile Data`
set name=%s, file_name=%s where name=%s""", (new_fid, new_file_name, fid))
os.rename(os.path.join(files_path, fid), os.path.join(files_path, new_fid))
change_map[",".join((file_name, fid))] = ",".join((new_file_name, new_fid))
except Exception, e:
# if duplicate entry, then dont update
if e[0]!=1062:
raise
changed_keys = change_map.keys()
for dt in webnotes.conn.sql("""select distinct parent from tabDocField
where fieldname='file_list'"""):
try:
data = webnotes.conn.sql("""select name, file_list from `tab%s`
where ifnull(file_list, '')!=''""" % dt[0])
for name, file_list in data:
new_file_list = []
file_list = file_list.split("\n")
for f in file_list:
if f in changed_keys:
new_file_list.append(change_map[f])
else:
new_file_list.append(f)
if new_file_list != file_list:
webnotes.conn.sql("""update `tab%s` set file_list=%s
where name=%s""" % (dt[0], "%s", "%s"),
("\n".join(new_file_list), name))
except Exception, e:
if e[0]!=1146:
raise

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.sql("""update tabDocPerm set `report`=`read`
where ifnull(permlevel,0)=0""")

View File

@@ -1,44 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
for name in webnotes.conn.sql("""select name from `tabHoliday List`"""):
holiday_list_wrapper = webnotes.bean("Holiday List", name[0])
desc_count = _count([d.description for d in
holiday_list_wrapper.doclist.get({"doctype": "Holiday"})])
holiday_list_obj = webnotes.get_obj(doc=holiday_list_wrapper.doc,
doclist=holiday_list_wrapper.doclist)
save = False
for desc in desc_count.keys():
if desc in ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday",
"Friday", "Saturday"] and desc_count[desc] > 50:
holiday_list_obj.doclist = holiday_list_obj.doclist.get(
{"description": ["!=", desc]})
webnotes.conn.sql("""delete from `tabHoliday`
where parent=%s and parenttype='Holiday List'
and `description`=%s""", (holiday_list_obj.doc.name, desc))
holiday_list_obj.doc.weekly_off = desc
holiday_list_obj.get_weekly_off_dates()
save = True
if save:
holiday_list_wrapper.set_doclist(holiday_list_obj.doclist)
holiday_list_wrapper.save()
def _count(lst):
out = {}
for l in lst:
out[l] = out.setdefault(l, 0) + 1
return out

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
def execute():
from webnotes.utils.nestedset import rebuild_tree
rebuild_tree("Item Group", "parent_item_group")
rebuild_tree("Customer Group", "parent_customer_group")
rebuild_tree("Territory", "parent_territory")
rebuild_tree("Sales Person", "parent_sales_person")

View File

@@ -1,19 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
from webnotes.modules.import_file import import_files
import_files([["selling", "Print Format", "Quotation Classic"],
["selling", "Print Format", "Quotation Modern"],
["selling", "Print Format", "Quotation Spartan"],
["selling", "Print Format", "Sales Order Classic"],
["selling", "Print Format", "Sales Order Modern"],
["selling", "Print Format", "Sales Order Spartan"]])
import_files([["stock", "Print Format", "Delivery Note Classic"],
["stock", "Print Format", "Delivery Note Modern"],
["stock", "Print Format", "Delivery Note Spartan"]])
import_files([["accounts", "Print Format", "Sales Invoice Classic"],
["accounts", "Print Format", "Sales Invoice Modern"],
["accounts", "Print Format", "Sales Invoice Spartan"]])

View File

@@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.sql("""update tabDocPerm set permlevel=0 where permlevel is null""")
webnotes.conn.sql("""update tabDocPerm set `create`=0, `submit`=0, `cancel`=0,
`amend`=0, `match`='' where permlevel>0""")
webnotes.delete_doc("Permission Control")

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.delete_doc("DocType", "Landed Cost Master")
webnotes.delete_doc("DocType", "Landed Cost Master Detail")

View File

@@ -1,9 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
return
from webnotes.modules.import_file import import_file
import_file("accounts", "GL Mapper", "Journal Voucher")
import_file("accounts", "GL Mapper", "Purchase Invoice")
import_file("accounts", "GL Mapper", "Purchase Invoice with write off")

View File

@@ -1,16 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
for dt in webnotes.conn.sql("""select name, issingle from tabDocType"""):
if dt[1]:
webnotes.conn.sql("""update tabDocPerm set report = 0 where parent = %s""", dt[0])
doctype = webnotes.bean("DocType", dt[0])
for pl in [1, 2, 3]:
if not doctype.doclist.get({"doctype": "DocField", "permlevel": pl}):
if doctype.doclist.get({"doctype":"DocPerm", "permlevel":pl}):
webnotes.conn.sql("""delete from `tabDocPerm`
where parent = %s and permlevel = %s""", (dt[0], pl))

View File

@@ -1,17 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "docperm")
webnotes.conn.sql("""update tabDocPerm set `report`=`read`""")
# no report for singles
webnotes.conn.sql("""update tabDocPerm, tabDocType set tabDocPerm.`report`=0
where tabDocPerm.`parent` = tabDocType.name
and ifnull(tabDocType.issingle,0) = 1""")
# no submit for not submittables
webnotes.conn.sql("""update tabDocPerm, tabDocType set tabDocPerm.`submit`=0
where tabDocPerm.`parent` = tabDocType.name
and ifnull(tabDocType.is_submittable,0) = 0""")

View File

@@ -1,73 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("stock", "doctype", "stock_ledger_entry")
webnotes.reload_doc("stock", "doctype", "stock_reconciliation")
rename_fields()
move_remarks_to_comments()
store_stock_reco_json()
def rename_fields():
args = [["Stock Ledger Entry", "bin_aqat", "qty_after_transaction"],
["Stock Ledger Entry", "fcfs_stack", "stock_queue"],
["Stock Reconciliation", "reconciliation_date", "posting_date"],
["Stock Reconciliation", "reconciliation_time", "posting_time"]]
for doctype, old_fieldname, new_fieldname in args:
webnotes.conn.sql("""update `tab%s` set `%s`=`%s`""" %
(doctype, new_fieldname, old_fieldname))
def move_remarks_to_comments():
from webnotes.utils import get_fullname
result = webnotes.conn.sql("""select name, remark, modified_by from `tabStock Reconciliation`
where ifnull(remark, '')!=''""")
fullname_map = {}
for reco, remark, modified_by in result:
webnotes.bean([{
"doctype": "Comment",
"comment": remark,
"comment_by": modified_by,
"comment_by_fullname": fullname_map.setdefault(modified_by, get_fullname(modified_by)),
"comment_doctype": "Stock Reconciliation",
"comment_docname": reco
}]).insert()
def store_stock_reco_json():
import os
import json
from webnotes.utils.datautils import read_csv_content
from webnotes.utils import get_base_path
files_path = os.path.join(get_base_path(), "public", "files")
list_of_files = os.listdir(files_path)
replaced_list_of_files = [f.replace("-", "") for f in list_of_files]
for reco, file_list in webnotes.conn.sql("""select name, file_list
from `tabStock Reconciliation`"""):
if file_list:
file_list = file_list.split("\n")
stock_reco_file = file_list[0].split(",")[1]
stock_reco_file_path = os.path.join(files_path, stock_reco_file)
if not os.path.exists(stock_reco_file_path):
if stock_reco_file in replaced_list_of_files:
stock_reco_file_path = os.path.join(files_path,
list_of_files[replaced_list_of_files.index(stock_reco_file)])
else:
stock_reco_file_path = ""
if stock_reco_file_path:
with open(stock_reco_file_path, "r") as open_reco_file:
content = open_reco_file.read()
try:
content = read_csv_content(content)
reconciliation_json = json.dumps(content, separators=(',', ': '))
webnotes.conn.sql("""update `tabStock Reconciliation`
set reconciliation_json=%s where name=%s""",
(reconciliation_json, reco))
except Exception:
# if not a valid CSV file, do nothing
pass

View File

@@ -1,7 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.commit()
webnotes.conn.sql("""alter table tabSessions engine=MyISAM""")

View File

@@ -1,35 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.reload_doc("core", "doctype", "docfield")
webnotes.reload_doc("support", "doctype", "support_ticket")
# customer issue resolved_by should be Profile
if webnotes.conn.sql("""select count(*) from `tabCustomer Issue`
where ifnull(resolved_by,"")!="" """)[0][0]:
webnotes.make_property_setter({
"doctype":"Customer Issue",
"fieldname": "resolved_by",
"property": "options",
"value": "Sales Person"
})
def get_communication_time(support_ticket, sort_order = 'asc'):
tmp = webnotes.conn.sql("""select creation from tabCommunication where
support_ticket=%s order by creation %s limit 1""" % ("%s", sort_order),
support_ticket)
return tmp and tmp[0][0] or None
# update in support ticket
webnotes.conn.auto_commit_on_many_writes = True
for st in webnotes.conn.sql("""select name, modified, status from
`tabSupport Ticket`""", as_dict=1):
webnotes.conn.sql("""update `tabSupport Ticket` set first_responded_on=%s where
name=%s""", (get_communication_time(st.name) or st.modified, st.name))
if st.status=="Closed":
webnotes.conn.sql("""update `tabSupport Ticket` set resolution_date=%s where
name=%s""", (get_communication_time(st.name, 'desc') or st.modified, st.name))

View File

@@ -1,30 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
from webnotes.country_info import get_all
data = get_all()
webnotes.reload_doc("setup", "doctype", "country")
webnotes.reload_doc("setup", "doctype", "currency")
for c in webnotes.conn.sql("""select name from tabCountry"""):
if c[0] in data:
info = webnotes._dict(data[c[0]])
doc = webnotes.doc("Country", c[0])
doc.date_format = info.date_format or "dd-mm-yyyy"
doc.time_zones = "\n".join(info.timezones or [])
doc.save()
if webnotes.conn.exists("Currency", info.currency):
doc = webnotes.doc("Currency", info.currency)
doc.fields.update({
"fraction": info.currency_fraction,
"symbol": info.currency_symbol,
"fraction_units": info.currency_fraction_units
})
doc.save()

View File

@@ -1,6 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.conn.sql("""update `tabCurrency` set fraction = 'Cent' where fraction = 'Cent[D]'""")

View File

@@ -1,21 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
def execute():
from webnotes.country_info import get_all
data = get_all()
webnotes.reload_doc("setup", "doctype", "currency")
for c in data:
info = webnotes._dict(data[c])
if webnotes.conn.exists("Currency", info.currency):
doc = webnotes.doc("Currency", info.currency)
doc.fields.update({
"number_format": info.number_format,
})
doc.save()

View File

@@ -1,11 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
import webnotes
def execute():
webnotes.conn.sql("""drop table if exists `tabDocType Mapper`""")
webnotes.conn.sql("""drop table if exists `tabTable Mapper Detail`""")
webnotes.conn.sql("""drop table if exists `tabField Mapper Detail`""")
webnotes.delete_doc("DocType", "DocType Mapper")
webnotes.delete_doc("DocType", "Table Mapper Detail")
webnotes.delete_doc("DocType", "Field Mapper Detail")

View File

@@ -1,10 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.reload_doc("setup", "doctype", "global_defaults")
gd = webnotes.bean('Global Defaults')
gd.doc.maintain_same_sales_rate = 1
gd.save()

View File

@@ -1,8 +0,0 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
def execute():
import webnotes
webnotes.reload_doc("stock", "doctype", "delivery_note")
webnotes.conn.sql("""update `tabDelivery Note` set shipping_address_name = customer_address,
shipping_address = address_display""")

Some files were not shown because too many files have changed in this diff Show More