diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py index a43f8ca7a5..b445f81cb1 100644 --- a/accounts/doctype/journal_voucher/journal_voucher.py +++ b/accounts/doctype/journal_voucher/journal_voucher.py @@ -7,7 +7,7 @@ import webnotes from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate from webnotes.model.doc import addchild from webnotes.model.bean import getlist -from webnotes import msgprint +from webnotes import msgprint, _ from setup.utils import get_company_currency from controllers.accounts_controller import AccountsController diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py index 17ae216e02..c7dba9c95b 100644 --- a/accounts/doctype/sales_invoice/sales_invoice.py +++ b/accounts/doctype/sales_invoice/sales_invoice.py @@ -9,7 +9,7 @@ from webnotes.utils import add_days, cint, cstr, date_diff, flt, getdate, nowdat get_first_day, get_last_day from webnotes.utils.email_lib import sendmail -from webnotes.utils import comma_and +from webnotes.utils import comma_and, get_url from webnotes.model.doc import make_autoname from webnotes.model.bean import getlist from webnotes.model.code import get_obj @@ -148,6 +148,9 @@ class DocType(SellingController): self.validate_recurring_invoice() self.convert_to_recurring() + def get_portal_page(self): + return "invoice" if self.doc.docstatus==1 else None + def set_missing_values(self, for_validate=False): self.set_pos_fields(for_validate) @@ -916,7 +919,7 @@ def notify_errors(inv, owner): Regards, Administrator - """ % (inv, website.get_site_address(), inv) + """ % (inv, get_url(), inv) subj = "[Urgent] Error while creating recurring invoice from %s" % inv from webnotes.profile import get_system_managers diff --git a/website/doctype/about_us_settings/__init__.py b/accounts/doctype/sales_invoice/templates/__init__.py similarity index 100% rename from website/doctype/about_us_settings/__init__.py rename to accounts/doctype/sales_invoice/templates/__init__.py diff --git a/website/doctype/about_us_team_member/__init__.py b/accounts/doctype/sales_invoice/templates/pages/__init__.py similarity index 100% rename from website/doctype/about_us_team_member/__init__.py rename to accounts/doctype/sales_invoice/templates/pages/__init__.py diff --git a/accounts/doctype/sales_invoice/templates/pages/invoice.html b/accounts/doctype/sales_invoice/templates/pages/invoice.html new file mode 100644 index 0000000000..db6e009f89 --- /dev/null +++ b/accounts/doctype/sales_invoice/templates/pages/invoice.html @@ -0,0 +1,5 @@ +{% extends "app/portal/templates/sale.html" %} + +{% block status -%} + {% if doc.status %}{{ doc.status }}{% endif %} +{%- endblock %} \ No newline at end of file diff --git a/accounts/doctype/sales_invoice/templates/pages/invoice.py b/accounts/doctype/sales_invoice/templates/pages/invoice.py new file mode 100644 index 0000000000..8fc89135c9 --- /dev/null +++ b/accounts/doctype/sales_invoice/templates/pages/invoice.py @@ -0,0 +1,30 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes +from webnotes import _ +from webnotes.utils import flt, fmt_money + +no_cache = True + +def get_context(): + from portal.utils import get_transaction_context + context = get_transaction_context("Sales Invoice", webnotes.form_dict.name) + modify_status(context.get("doc")) + context.update({ + "parent_link": "invoices", + "parent_title": "Invoices" + }) + return context + +def modify_status(doc): + doc.status = "" + if flt(doc.outstanding_amount): + doc.status = ' %s' % \ + ("label-warning", "icon-exclamation-sign", + _("To Pay") + " = " + fmt_money(doc.outstanding_amount, currency=doc.currency)) + else: + doc.status = ' %s' % \ + ("label-success", "icon-ok", _("Paid")) + \ No newline at end of file diff --git a/accounts/doctype/sales_invoice/templates/pages/invoices.html b/accounts/doctype/sales_invoice/templates/pages/invoices.html new file mode 100644 index 0000000000..f108683cb9 --- /dev/null +++ b/accounts/doctype/sales_invoice/templates/pages/invoices.html @@ -0,0 +1 @@ +{% extends "app/portal/templates/sales_transactions.html" %} \ No newline at end of file diff --git a/accounts/doctype/sales_invoice/templates/pages/invoices.py b/accounts/doctype/sales_invoice/templates/pages/invoices.py new file mode 100644 index 0000000000..59e53a05c0 --- /dev/null +++ b/accounts/doctype/sales_invoice/templates/pages/invoices.py @@ -0,0 +1,28 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes + +no_cache = True + +def get_context(): + from portal.utils import get_currency_context + context = get_currency_context() + context.update({ + "title": "Invoices", + "method": "accounts.doctype.sales_invoice.templates.pages.invoices.get_invoices", + "icon": "icon-file-text", + "empty_list_message": "No Invoices Found", + "page": "invoice" + }) + return context + +@webnotes.whitelist() +def get_invoices(start=0): + from portal.utils import get_transaction_list + from accounts.doctype.sales_invoice.templates.pages.invoice import modify_status + invoices = get_transaction_list("Sales Invoice", start, ["outstanding_amount"]) + for d in invoices: + modify_status(d) + return invoices \ No newline at end of file diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py index 416cf0e023..9425afc7d0 100644 --- a/accounts/page/voucher_import_tool/voucher_import_tool.py +++ b/accounts/page/voucher_import_tool/voucher_import_tool.py @@ -104,7 +104,7 @@ def import_vouchers(common_values, data, start_idx, import_type): if account.master_name: map_fields(["against_sales_invoice:against_invoice", - "against_purhase_invoice:against_voucher", + "against_purchase_invoice:against_voucher", "against_journal_voucher:against_jv"], d, detail.fields) webnotes.conn.commit() diff --git a/config.json b/config.json index e0f98d8daa..17b01edb25 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "app_name": "ERPNext", + "base_template": "app/portal/templates/base.html", "modules": { "Selling": { "link": "selling-home", @@ -43,12 +44,6 @@ "color": "#7f8c8d", "icon": "icon-cogs" }, - "Website": { - "type": "module", - "link": "website-home", - "color": "#16a085", - "icon": "icon-globe" - }, "HR": { "type": "module", "link": "hr-home", @@ -77,138 +72,5 @@ "label": "Notes", "icon": "icon-file-alt" } - }, - "web": { - "pages": { - "about": { - "template": "app/website/templates/pages/about", - "args_method": "website.doctype.about_us_settings.about_us_settings.get_args" - }, - "account": { - "no_cache": true, - "template": "app/website/templates/pages/account" - }, - "blog": { - "template": "app/website/templates/pages/blog", - "args_method": "website.helpers.blog.get_blog_template_args" - }, - "contact": { - "template": "app/website/templates/pages/contact", - "args_doctype": "Contact Us Settings" - }, - "index": { - "template": "app/website/templates/pages/index" - }, - "order": { - "no_cache": true, - "template": "app/website/templates/pages/sale", - "args_method": "website.helpers.transaction.get_order_args", - "portal": { - "doctype": "Sales Order", - "conditions": { - "docstatus": 1 - } - } - }, - "orders": { - "no_cache": true, - "template": "app/website/templates/pages/sales_transactions", - "args_method": "website.helpers.transaction.order_list_args" - }, - "invoice": { - "no_cache": true, - "template": "app/website/templates/pages/sale", - "args_method": "website.helpers.transaction.get_invoice_args", - "portal": { - "doctype": "Sales Invoice", - "conditions": { - "docstatus": 1 - } - } - }, - "invoices": { - "no_cache": true, - "template": "app/website/templates/pages/sales_transactions", - "args_method": "website.helpers.transaction.invoice_list_args" - }, - "shipment": { - "no_cache": true, - "template": "app/website/templates/pages/sale", - "args_method": "website.helpers.transaction.get_shipment_args", - "portal": { - "doctype": "Delivery Note", - "conditions": { - "docstatus": 1 - } - } - }, - "shipments": { - "no_cache": true, - "template": "app/website/templates/pages/sales_transactions", - "args_method": "website.helpers.transaction.shipment_list_args" - }, - "product_search": { - "template": "app/website/templates/pages/product_search" - }, - "ticket": { - "no_cache": true, - "template": "app/website/templates/pages/ticket", - "args_method": "support.doctype.support_ticket.support_ticket.get_website_args", - "portal": { - "doctype": "Support Ticket" - } - }, - "tickets": { - "template": "app/website/templates/pages/tickets", - "args_method": "website.helpers.transaction.ticket_list_args" - }, - "address": { - "no_cache": true, - "template": "app/website/templates/pages/address", - "args_method": "utilities.doctype.address.address.get_website_args" - }, - "addresses": { - "template": "app/website/templates/pages/addresses" - }, - "writers": { - "template": "app/website/templates/pages/writers", - "args_method": "website.doctype.blogger.blogger.get_writers_args" - }, - "profile": { - "no_cache": true, - "template": "app/website/templates/pages/profile", - "args_method": "startup.webutils.get_profile_args" - }, - "cart": { - "no_cache": true, - "template": "app/website/templates/pages/cart.html" - }, - "partners": { - "template": "app/website/templates/pages/partners", - "args_method": "website.helpers.partner.get_partner_args" - } - }, - "generators": { - "Web Page": { - "template": "app/website/templates/html/web_page.html", - "condition_field": "published" - }, - "Blog Post": { - "template": "app/website/templates/html/blog_page.html", - "condition_field": "published" - }, - "Item": { - "template": "app/website/templates/html/product_page.html", - "condition_field": "show_in_website" - }, - "Item Group":{ - "template": "app/website/templates/html/product_group.html", - "condition_field": "show_in_website" - }, - "Sales Partner": { - "template": "app/website/templates/html/partner_page.html", - "condition_field": "show_in_website" - } - } } } \ No newline at end of file diff --git a/hr/doctype/leave_application/test_leave_application.py b/hr/doctype/leave_application/test_leave_application.py index 5888eaee3c..c89f7c4537 100644 --- a/hr/doctype/leave_application/test_leave_application.py +++ b/hr/doctype/leave_application/test_leave_application.py @@ -106,13 +106,12 @@ class TestLeaveApplication(unittest.TestCase): add_role("test1@example.com", "Leave Approver") add_role("test2@example.com", "Leave Approver") - self._test_leave_approval_basic_case_1() - self._test_leave_approval_basic_case_2() + self._test_leave_approval_basic_case() self._test_leave_approval_invalid_leave_approver_insert() self._test_leave_approval_invalid_leave_approver_submit() self._test_leave_approval_valid_leave_approver_insert() - def _test_leave_approval_basic_case_1(self): + def _test_leave_approval_basic_case(self): self._clear_applications() # create leave application as Employee @@ -128,19 +127,6 @@ class TestLeaveApplication(unittest.TestCase): self.assertEqual(webnotes.conn.get_value("Leave Application", application.doc.name, "docstatus"), 1) - def _test_leave_approval_basic_case_2(self): - self._clear_applications() - - # create leave application by any leave approver, - # when no leave approver specified in employee's leave approvers list - application = self.get_application(test_records[1]) - application.doc.leave_approver = "test1@example.com" - application.insert() - application.doc.status = "Approved" - application.submit() - self.assertEqual(webnotes.conn.get_value("Leave Application", application.doc.name, - "docstatus"), 1) - def _test_leave_approval_invalid_leave_approver_insert(self): from hr.doctype.leave_application.leave_application import InvalidLeaveApproverError @@ -186,11 +172,13 @@ class TestLeaveApplication(unittest.TestCase): original_department = webnotes.conn.get_value("Employee", "_T-Employee-0001", "department") webnotes.conn.set_value("Employee", "_T-Employee-0001", "department", None) - # change to valid leave approver and try to create and submit leave application - webnotes.session.user = "test2@example.com" + webnotes.session.user = "test@example.com" application = self.get_application(test_records[1]) application.doc.leave_approver = "test2@example.com" application.insert() + + # change to valid leave approver and try to submit leave application + webnotes.session.user = "test2@example.com" application.doc.status = "Approved" application.submit() self.assertEqual(webnotes.conn.get_value("Leave Application", application.doc.name, diff --git a/install_erpnext.py b/install_erpnext.py index 70cc2aaa91..79f79d7cc0 100644 --- a/install_erpnext.py +++ b/install_erpnext.py @@ -289,7 +289,7 @@ NameVirtualHost *:8080 RewriteCond %%{REQUEST_FILENAME} !-f RewriteCond %%{REQUEST_FILENAME} !-d RewriteCond %%{REQUEST_FILENAME} !-l - RewriteRule ^([^/]+)$ /web.py?page=$1 [QSA,L] + RewriteRule ^([^/]+)$ /web.py?page=$1 [QSA,L] """ % (install_path, install_path) diff --git a/patches/april_2012/__init__.py b/patches/april_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/april_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/april_2012/after_sync_cleanup.py b/patches/april_2012/after_sync_cleanup.py deleted file mode 100644 index 5e93ce1ea4..0000000000 --- a/patches/april_2012/after_sync_cleanup.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model import delete_doc - webnotes.conn.sql("update `tabDocType` set module = 'Utilities' where name in ('Question', 'Answer')") - delete_doc('Module Def', 'Knowledge Base') diff --git a/patches/april_2012/delete_about_contact.py b/patches/april_2012/delete_about_contact.py deleted file mode 100644 index 2655e3c06e..0000000000 --- a/patches/april_2012/delete_about_contact.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model import delete_doc - delete_doc('DocType', 'About Us Team') - delete_doc('DocType', 'About Us Settings') - delete_doc('DocType', 'Contact Us Settings') \ No newline at end of file diff --git a/patches/april_2012/naming_series_patch.py b/patches/april_2012/naming_series_patch.py deleted file mode 100644 index 8b086f7b2a..0000000000 --- a/patches/april_2012/naming_series_patch.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.code import get_obj - ns_list = webnotes.conn.sql("""\ - SELECT `tabDocField`.`parent`, `tabDocField`.`options` - FROM `tabDocField`, `tabDocType` - WHERE `tabDocField`.`fieldname` = 'naming_series' - AND `tabDocType`.name=`tabDocField`.parent""") - ns_obj = get_obj('Naming Series') - for ns in ns_list: - if ns[0] and isinstance(ns[1], basestring): - ns_obj.set_series_for(ns[0], ns[1].split("\n")) diff --git a/patches/april_2012/reload_c_form.py b/patches/april_2012/reload_c_form.py deleted file mode 100644 index afb8b6acfd..0000000000 --- a/patches/april_2012/reload_c_form.py +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.modules import reload_doc - reload_doc('accounts', 'doctype', 'c_form') diff --git a/patches/april_2012/remove_default_from_rv_detail.py b/patches/april_2012/remove_default_from_rv_detail.py deleted file mode 100644 index 7716e6ce3e..0000000000 --- a/patches/april_2012/remove_default_from_rv_detail.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("update `tabDocField` set `default` = '' where fieldname = 'cost_center' and parent = 'RV Detail' and `default` = 'Purchase - TC'") diff --git a/patches/april_2012/repost_stock_for_posting_time.py b/patches/april_2012/repost_stock_for_posting_time.py deleted file mode 100644 index 0626205f0c..0000000000 --- a/patches/april_2012/repost_stock_for_posting_time.py +++ /dev/null @@ -1,16 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry` - where posting_time > '00:00:00' and posting_time < '00:01:00'""", as_dict=1) - webnotes.conn.sql("update `tabStock Ledger Entry` set posting_time = '00:00:00' where posting_time > '00:00:00' and posting_time < '00:01:00'") - - from stock.stock_ledger import update_entries_after - for d in res: - update_entries_after({ - "item_code": d.item_code, - "warehouse": d.warehouse, - }) diff --git a/patches/april_2012/update_appraisal_permission.py b/patches/april_2012/update_appraisal_permission.py deleted file mode 100644 index 1c07822bd2..0000000000 --- a/patches/april_2012/update_appraisal_permission.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.doc import addchild - from webnotes.model.code import get_obj - - webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and permlevel = 0 and parent in ('Appraisal', 'Ticket', 'Project')") - - appr = get_obj('DocType', 'Appraisal', with_children=1) - ch = addchild(appr.doc, 'permissions', 'DocPerm') - ch.permlevel = 0 - ch.role = 'Employee' - ch.read = 1 - ch.write = 1 - ch.save() diff --git a/patches/april_2012/update_permlevel_in_address.py b/patches/april_2012/update_permlevel_in_address.py deleted file mode 100644 index a4b84de8fe..0000000000 --- a/patches/april_2012/update_permlevel_in_address.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Address'") diff --git a/patches/april_2012/update_role_in_address.py b/patches/april_2012/update_role_in_address.py deleted file mode 100644 index 33fecbea3c..0000000000 --- a/patches/april_2012/update_role_in_address.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.doc import addchild - from webnotes.model.code import get_obj - - webnotes.conn.sql("delete from `tabDocPerm` where role = 'All' and parent = 'Address'") - - role1 = ['Sales User', 'Purchase User', 'Accounts User', 'Maintenance User'] - role2 = ['Sales Manager', 'Sales Master Manager', 'Purchase Manager', 'Purchase Master Manager', 'Accounts Manager', 'Maintenance Manager'] - - addr = get_obj('DocType', 'Address', with_children=1) - for d in role1+role2: - ch = addchild(addr.doc, 'permissions', 'DocPerm') - ch.role = d - ch.read = 1 - ch.write = 1 - ch.create = 1 - if d in role2: - ch.cancel = 1 - - ch.save() diff --git a/patches/august_2012/__init__.py b/patches/august_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/august_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/august_2012/change_profile_permission.py b/patches/august_2012/change_profile_permission.py deleted file mode 100644 index 5944c03148..0000000000 --- a/patches/august_2012/change_profile_permission.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - import webnotes.model.doc - webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and permlevel=1") - new_perms = [ - { - 'parent': 'Profile', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'Administrator', - 'permlevel': 1, - 'read': 1, - 'write': 1 - }, - { - 'parent': 'Profile', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'System Manager', - 'permlevel': 1, - 'read': 1, - 'write': 1 - }, - - ] - for perms in new_perms: - doc = webnotes.model.doc.Document('DocPerm') - doc.fields.update(perms) - doc.save() - webnotes.conn.commit() - webnotes.conn.begin() - - webnotes.reload_doc('core', 'doctype', 'profile') \ No newline at end of file diff --git a/patches/august_2012/repost_billed_amt.py b/patches/august_2012/repost_billed_amt.py deleted file mode 100644 index b545c2e621..0000000000 --- a/patches/august_2012/repost_billed_amt.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.code import get_obj - from selling.doctype.sales_common.sales_common import StatusUpdater - - invoices = webnotes.conn.sql("select name from `tabSales Invoice` where docstatus = 1") - for inv in invoices: - inv_obj = get_obj('Sales Invoice', inv[0], with_children=1) - StatusUpdater(inv_obj, 1).update_all_qty() \ No newline at end of file diff --git a/patches/august_2012/task_allocated_to_assigned.py b/patches/august_2012/task_allocated_to_assigned.py deleted file mode 100644 index 5d736bf872..0000000000 --- a/patches/august_2012/task_allocated_to_assigned.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# 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 tabTask - where ifnull(allocated_to, '')!=''""", as_dict=1): - add({ - 'doctype': "Task", - 'name': t['name'], - 'assign_to': t['allocated_to'], - 'assigned_by': t['owner'], - 'description': t['subject'], - 'date': t['creation'], - "no_notification": True - }) \ No newline at end of file diff --git a/patches/august_2013/p02_rename_price_list.py b/patches/august_2013/p02_rename_price_list.py index 0b1c4d0047..41efb27306 100644 --- a/patches/august_2013/p02_rename_price_list.py +++ b/patches/august_2013/p02_rename_price_list.py @@ -5,7 +5,7 @@ from __future__ import unicode_literals import webnotes def execute(): - webnotes.reload_doc("website", "doctype", "shopping_cart_price_list") + webnotes.reload_doc("selling", "doctype", "shopping_cart_price_list") for t in [ ("Supplier Quotation", "price_list_name", "buying_price_list"), diff --git a/patches/july_2012/__init__.py b/patches/july_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/july_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/july_2012/address_contact_perms.py b/patches/july_2012/address_contact_perms.py deleted file mode 100644 index 8c41dbc8e8..0000000000 --- a/patches/july_2012/address_contact_perms.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("""\ - delete from `tabDocPerm` - where parent in ('Address', 'Contact')""") - webnotes.conn.commit() - - 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/auth_table.py b/patches/july_2012/auth_table.py deleted file mode 100644 index 718243d6de..0000000000 --- a/patches/july_2012/auth_table.py +++ /dev/null @@ -1,17 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes -def execute(): - webnotes.conn.commit() - - from webnotes.install_lib.install import Installer - Installer(None, None).create_auth_table() - - webnotes.conn.begin() - - for user, password in webnotes.conn.sql("""select name, password from tabProfile"""): - if password: - webnotes.conn.sql("""insert into __Auth (user, `password`) values (%s, %s)""", - (user, password)) diff --git a/patches/july_2012/bin_permission.py b/patches/july_2012/bin_permission.py deleted file mode 100644 index 3f9b65cd93..0000000000 --- a/patches/july_2012/bin_permission.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("update `tabDocPerm` set permlevel = 0 where parent = 'Bin'") \ No newline at end of file diff --git a/patches/july_2012/default_freeze_account.py b/patches/july_2012/default_freeze_account.py deleted file mode 100644 index 5255aa0df8..0000000000 --- a/patches/july_2012/default_freeze_account.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("""update tabAccount set freeze_account='No' where freeze_account is null""") - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Valuation and Total' where category='For Both'""") - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Valuation' where category='For Valuation'""") - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Total' where category='For Total'""") \ No newline at end of file diff --git a/patches/july_2012/deprecate_bulk_rename.py b/patches/july_2012/deprecate_bulk_rename.py deleted file mode 100644 index 5cb25a75e0..0000000000 --- a/patches/july_2012/deprecate_bulk_rename.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model import delete_doc - delete_doc('DocType', 'Bulk Rename Tool') - webnotes.conn.commit() - webnotes.conn.sql("drop table `tabBulk Rename Tool`") - webnotes.conn.begin() \ No newline at end of file diff --git a/patches/july_2012/deprecate_import_data_control.py b/patches/july_2012/deprecate_import_data_control.py deleted file mode 100644 index f060587ccc..0000000000 --- a/patches/july_2012/deprecate_import_data_control.py +++ /dev/null @@ -1,14 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """ - deprecate: - * doctype - import data control - * page - import data (old) - """ - import webnotes - from webnotes.model import delete_doc - delete_doc('DocType', 'Import Data Control') - delete_doc('Page', 'Import Data') \ No newline at end of file diff --git a/patches/july_2012/packing_list_cleanup_and_serial_no.py b/patches/july_2012/packing_list_cleanup_and_serial_no.py deleted file mode 100644 index b91ef810f1..0000000000 --- a/patches/july_2012/packing_list_cleanup_and_serial_no.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.utils import flt - wrong_plist = webnotes.conn.sql(""" - select dnpi.name, dnpi.parent, dnpi.docstatus, dnpi.serial_no - from `tabDelivery Note Packing Item` dnpi - where ifnull(dnpi.parent, '') != '' - and ifnull(dnpi.parent, '') not like 'old_par%' - and dnpi.parenttype = 'Delivery Note' - and not exists ( - select * from `tabDelivery Note Item` dni - where dni.item_code = dnpi.parent_item and - dni.name = dnpi.parent_detail_docname and - dni.parent = dnpi.parent - ) - """, as_dict=1) - - for d in wrong_plist: - if d['docstatus'] == 2 and d['serial_no']: - for s in d['serial_no'].splitlines(): - sle = webnotes.conn.sql(""" - select actual_qty, warehouse, voucher_no - from `tabStock Ledger Entry` - where ( - serial_no like '%s\n%%' - or serial_no like '%%\n%s' - or serial_no like '%%\n%s\n%%' - or serial_no = '%s' - ) - and voucher_no != '%s' - and ifnull(is_cancelled, 'No') = 'No' - order by name desc - limit 1 - """% (s, s, s, s, d['parent']), as_dict=1) - - status = 'Not in Use' - if sle and flt(sle[0]['actual_qty']) > 0: - status = 'Available' - elif sle and flt(sle[0]['actual_qty']) < 0: - status = 'Delivered' - - webnotes.conn.sql("update `tabSerial No` set status = %s, warehouse = %s where name = %s", (status, sle[0]['warehouse'], s)) - - webnotes.conn.sql("delete from `tabDelivery Note Packing Item` where name = %s", d['name']) \ No newline at end of file diff --git a/patches/july_2012/project_patch_repeat.py b/patches/july_2012/project_patch_repeat.py deleted file mode 100644 index c17e9c448b..0000000000 --- a/patches/july_2012/project_patch_repeat.py +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("""update `tabPurchase Order Item` t1, `tabPurchase Order` t2 - set t1.project_name = t2.project_name where t1.parent = t2.name - and ifnull(t1.project_name, '') = ''""") - webnotes.conn.sql("""update `tabPurchase Invoice Item` t1, `tabPurchase Invoice` t2 - set t1.project_name = t2.project_name where t1.parent = t2.name - and ifnull(t1.project_name, '') = ''""") - webnotes.conn.sql("""update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 - set t1.project_name = t2.project_name where t1.parent = t2.name - and ifnull(t1.project_name, '') = ''""") - - webnotes.conn.commit() - 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/remove_event_role_owner_match.py b/patches/july_2012/remove_event_role_owner_match.py deleted file mode 100644 index cd5f489036..0000000000 --- a/patches/july_2012/remove_event_role_owner_match.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("""\ - update `tabDocPerm` set `match`=NULL - where parent='Event' and role='All' and permlevel=0""") \ No newline at end of file diff --git a/patches/july_2012/repost_stock_due_to_wrong_packing_list.py b/patches/july_2012/repost_stock_due_to_wrong_packing_list.py deleted file mode 100644 index 315b4edd20..0000000000 --- a/patches/july_2012/repost_stock_due_to_wrong_packing_list.py +++ /dev/null @@ -1,100 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes -from stock.stock_ledger import update_entries_after - -def execute(): - # add index - webnotes.conn.commit() - try: - webnotes.conn.sql("""alter table `tabDelivery Note Packing Item` - add index item_code_warehouse (item_code, warehouse)""") - except: - pass - webnotes.conn.begin() - - webnotes.conn.auto_commit_on_many_writes = 1 - repost_reserved_qty() - cleanup_wrong_sle() - webnotes.conn.auto_commit_on_many_writes = 0 - -def repost_reserved_qty(): - from webnotes.utils import flt - bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`") - i = 0 - for d in bins: - i += 1 - reserved_qty = webnotes.conn.sql(""" - select - sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty)) - from - ( - select - qty as dnpi_qty, - ( - select qty from `tabSales Order Item` - where name = dnpi.parent_detail_docname - ) as so_item_qty, - ( - select ifnull(delivered_qty, 0) from `tabSales Order Item` - where name = dnpi.parent_detail_docname - ) as so_item_delivered_qty - from - ( - select qty, parent_detail_docname - from `tabDelivery Note Packing Item` dnpi_in - where item_code = %s and warehouse = %s - and parenttype="Sales Order" - and exists (select * from `tabSales Order` so - where name = dnpi_in.parent and docstatus = 1 and status != 'Stopped') - ) dnpi - ) tab - where - so_item_qty >= so_item_delivered_qty - """, (d[0], d[1])) - - if flt(d[3]) != flt(reserved_qty[0][0]): - webnotes.conn.sql(""" - update `tabBin` set reserved_qty = %s where name = %s - """, (reserved_qty and reserved_qty[0][0] or 0, d[2])) - -def cleanup_wrong_sle(): - sle = webnotes.conn.sql(""" - select item_code, warehouse, voucher_no, name - from `tabStock Ledger Entry` sle - where voucher_type = 'Delivery Note' - and not exists( - select name from `tabDelivery Note Packing Item` - where item_code = sle.item_code - and qty = abs(sle.actual_qty) - and parent = sle.voucher_no - ) and not exists ( - select name from `tabDelivery Note Item` - where item_code = sle.item_code - and qty = abs(sle.actual_qty) - and parent = sle.voucher_no - ) - """) - if sle: - for d in sle: - webnotes.conn.sql("update `tabStock Ledger Entry` set is_cancelled = 'Yes' where name = %s", d[3]) - create_comment(d[3]) - update_entries_after({ - "item_code": d[0], - "warehouse": d[1], - "posting_date": "2012-07-01", - "posting_time": "12:05" - }) - -def create_comment(dn): - from webnotes.model.doc import Document - cmt = Document('Comment') - cmt.comment = 'Cancelled by administrator due to wrong entry in packing list' - cmt.comment_by = 'Administrator' - cmt.comment_by_fullname = 'Administrator' - cmt.comment_doctype = 'Stock Ledger Entry' - cmt.comment_docname = dn - cmt.save(1) - \ No newline at end of file diff --git a/patches/july_2012/unicode_conf.py b/patches/july_2012/unicode_conf.py deleted file mode 100644 index cbbe5daeb1..0000000000 --- a/patches/july_2012/unicode_conf.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals - -def execute(): - """appends from __future__ import unicode_literals to py files if necessary""" - import wnf - wnf.append_future_import() \ No newline at end of file diff --git a/patches/july_2012/update_purchase_tax.py b/patches/july_2012/update_purchase_tax.py deleted file mode 100644 index 28f2ca7d8c..0000000000 --- a/patches/july_2012/update_purchase_tax.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Valuation and Total' where category='For Both'""") - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Valuation' where category='For Valuation'""") - webnotes.conn.sql("""update `tabPurchase Taxes and Charges` - set category='Total' where category='For Total'""") \ No newline at end of file diff --git a/patches/june_2012/__init__.py b/patches/june_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/june_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/june_2012/alter_tabsessions.py b/patches/june_2012/alter_tabsessions.py deleted file mode 100644 index 29ae17796f..0000000000 --- a/patches/june_2012/alter_tabsessions.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.commit() - webnotes.conn.sql("alter table `tabSessions` modify user varchar(180)") - webnotes.conn.begin() \ No newline at end of file diff --git a/patches/june_2012/barcode_in_feature_setup.py b/patches/june_2012/barcode_in_feature_setup.py deleted file mode 100644 index 630f50f789..0000000000 --- a/patches/june_2012/barcode_in_feature_setup.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.code import get_obj - fs = get_obj('Features Setup') - fs.doc.fs_item_barcode = 0 - fs.doc.save() - fs.validate() \ No newline at end of file diff --git a/patches/june_2012/cms2.py b/patches/june_2012/cms2.py deleted file mode 100644 index a9171d754e..0000000000 --- a/patches/june_2012/cms2.py +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - - # sync doctypes required for the patch - webnotes.reload_doc('website', 'doctype', 'web_page') - webnotes.reload_doc('website', 'doctype', 'website_settings') - webnotes.reload_doc('stock', 'doctype', 'item') - - cleanup() - - save_pages() - - save_website_settings() - -def cleanup(): - import webnotes - - # delete pages from `tabPage` of module Website or of type Webpage - webnotes.conn.sql("""\ - delete from `tabPage` - where module='Website' and ifnull(web_page, 'No') = 'Yes'""") - - # change show_in_website value in item table to 0 or 1 - webnotes.conn.sql("""\ - update `tabItem` - set show_in_website = if(show_in_website = 'Yes', 1, 0) - where show_in_website is not null""") - - # move comments from comment_doctype Page to Blog - webnotes.conn.sql("""\ - update `tabComment` comm, `tabBlog` blog - set comm.comment_doctype = 'Blog', comm.comment_docname = blog.name - where comm.comment_docname = blog.page_name""") - - # delete deprecated pages - import webnotes.model - for page in ['products', 'contact', 'blog', 'about']: - try: - webnotes.model.delete_doc('Page', page) - except Exception, e: - webnotes.modules.patch_handler.log(unicode(e)) - - import os - import conf - # delete other html files - exception_list = ['app.html', 'unsupported.html', 'blank.html'] - conf_dir = os.path.dirname(os.path.abspath(conf.__file__)) - public_path = os.path.join(conf_dir, 'public') - for f in os.listdir(public_path): - if f.endswith('.html') and f not in exception_list: - os.remove(os.path.join(public_path, f)) - -def save_pages(): - """save all web pages, blogs to create content""" - query_map = { - 'Web Page': """select name from `tabWeb Page` where docstatus=0""", - 'Blog': """\ - select name from `tabBlog` - where docstatus = 0 and ifnull(published, 0) = 1""", - 'Item': """\ - select name from `tabItem` - where docstatus = 0 and ifnull(show_in_website, 0) = 1""", - } - - import webnotes - from webnotes.model.bean import Bean - import webnotes.modules.patch_handler - - for dt in query_map: - for result in webnotes.conn.sql(query_map[dt], as_dict=1): - try: - Bean(dt, result['name'].encode('utf-8')).save() - except Exception, e: - webnotes.modules.patch_handler.log(unicode(e)) - -def save_website_settings(): - from webnotes.model.code import get_obj - - # rewrite pages - get_obj('Website Settings').on_update() - - ss = get_obj('Style Settings') - ss.validate() - ss.doc.save() - ss.on_update() \ No newline at end of file diff --git a/patches/june_2012/copy_uom_for_pur_inv_item.py b/patches/june_2012/copy_uom_for_pur_inv_item.py deleted file mode 100644 index 947d11014d..0000000000 --- a/patches/june_2012/copy_uom_for_pur_inv_item.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - - 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/delete_old_parent_entries.py b/patches/june_2012/delete_old_parent_entries.py deleted file mode 100644 index 384df775a5..0000000000 --- a/patches/june_2012/delete_old_parent_entries.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """delete entries of child table having parent like old_par%% or ''""" - import webnotes - res = webnotes.conn.sql("""\ - select dt.name from `tabDocType` dt - where ifnull(dt.istable, 0)=1 and - exists ( - select * from `tabDocField` df - where df.fieldtype='Table' and - df.options=dt.name - )""") - for r in res: - if r[0]: - webnotes.conn.sql("""\ - delete from `tab%s` - where (ifnull(parent, '')='' or parent like "old_par%%") and - ifnull(parenttype, '')!=''""" % r[0]) \ No newline at end of file diff --git a/patches/june_2012/fetch_organization_from_lead.py b/patches/june_2012/fetch_organization_from_lead.py deleted file mode 100644 index 85b14364a9..0000000000 --- a/patches/june_2012/fetch_organization_from_lead.py +++ /dev/null @@ -1,7 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("update `tabQuotation` t1, `tabLead` t2 set t1.organization = t2.company_name where ifnull(t1.lead, '') != '' and t1.quotation_to = 'Lead' and ifnull(t1.organization, '') = '' and t1.lead = 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 deleted file mode 100644 index c70b659656..0000000000 --- a/patches/june_2012/reports_list_permission.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """allow read permission to all for report list""" - import webnotes - webnotes.conn.sql("""\ - delete from `tabDocPerm` - where parent in ('Report', 'Search Criteria')""") - - webnotes.reload_doc('core', 'doctype', 'report') diff --git a/patches/june_2012/series_unique_patch.py b/patches/june_2012/series_unique_patch.py deleted file mode 100644 index 4bea9f0f60..0000000000 --- a/patches/june_2012/series_unique_patch.py +++ /dev/null @@ -1,10 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """add unique constraint to series table's name column""" - import webnotes - webnotes.conn.commit() - webnotes.conn.sql("alter table `tabSeries` add unique (name)") - 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 deleted file mode 100644 index c7d4d63fcb..0000000000 --- a/patches/june_2012/set_recurring_type.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - 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 deleted file mode 100644 index a9c8d82d6f..0000000000 --- a/patches/june_2012/support_ticket_autoreply.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """New Send Autoreply checkbox in Email Settings""" - import webnotes - import webnotes.utils - - webnotes.conn.commit() - webnotes.reload_doc('setup', 'doctype', 'email_settings') - webnotes.conn.begin() - - sync_support_mails = webnotes.utils.cint(webnotes.conn.get_value('Email Settings', - None, 'sync_support_mails')) - - if sync_support_mails: - webnotes.conn.set_value('Email Settings', None, 'send_autoreply', 1) \ No newline at end of file diff --git a/patches/june_2013/p08_shopping_cart_settings.py b/patches/june_2013/p08_shopping_cart_settings.py index 9378c389bd..479a6961e2 100644 --- a/patches/june_2013/p08_shopping_cart_settings.py +++ b/patches/june_2013/p08_shopping_cart_settings.py @@ -4,7 +4,7 @@ import webnotes def execute(): - webnotes.reload_doc("website", "doctype", "shopping_cart_settings") + webnotes.reload_doc("selling", "doctype", "shopping_cart_settings") # create two default territories, one for home country and one named Rest of the World from setup.doctype.setup_control.setup_control import create_territories diff --git a/patches/mar_2012/__init__.py b/patches/mar_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/mar_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/mar_2012/add_fieldnames.py b/patches/mar_2012/add_fieldnames.py deleted file mode 100644 index 52cf6b7f82..0000000000 --- a/patches/mar_2012/add_fieldnames.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -# do not run this patch -from __future__ import unicode_literals -def execute(): - import webnotes - import webnotes.modules - forbidden = ['%', "'", '"', '#', '*', '?', '`', '(', ')', '<', '>', '-', - '\\', '/', '.', '&', '!', '@', '$', '^', '+'] - doctype_list = webnotes.conn.sql("SELECT name, module FROM `tabDocType`") - for doctype, module in doctype_list: - docfield_list = webnotes.conn.sql("""\ - SELECT name, label, fieldtype FROM `tabDocField` - WHERE parent = %s AND IFNULL(fieldname, '') = ''""", doctype) - field_type_count = {} - count = 0 - for name, label, fieldtype in docfield_list: - fieldname = None - if label: - temp_label = label - if len(temp_label)==1: - temp_label = fieldtype + temp_label - - fieldname = temp_label.lower().replace(' ', '_') - if "<" in fieldname: - count = field_type_count.setdefault(fieldtype, 0) - fieldname = fieldtype.lower().replace(' ', '_') + str(count) - field_type_count[fieldtype] = count + 1 - elif fieldtype: - count = field_type_count.setdefault(fieldtype, 0) - fieldname = fieldtype.lower().replace(' ', '_') + str(count) - field_type_count[fieldtype] = count + 1 - - if fieldname: - for f in forbidden: fieldname = fieldname.replace(f, '') - fieldname = fieldname.replace('__', '_') - if fieldname.endswith('_'): - fieldname = fieldname[:-1] - if fieldname.startswith('_'): - fieldname = fieldname[1:] - #print fieldname - webnotes.conn.sql("""\ - UPDATE `tabDocField` SET fieldname = %s - WHERE name = %s""", (fieldname, name)) - webnotes.modules.export_doc('DocType', doctype) diff --git a/patches/mar_2012/clean_property_setter.py b/patches/mar_2012/clean_property_setter.py deleted file mode 100644 index b4ad909615..0000000000 --- a/patches/mar_2012/clean_property_setter.py +++ /dev/null @@ -1,81 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes - -def execute(): - """ - * Remove unnecessary doctype properties - * Remove docfield property setters if fieldname doesn't exist - * Remove prev_field properties if value fieldname doesn't exist - """ - change_property_setter_fieldnames() - clean_doctype_properties() - clean_docfield_properties() - -def change_property_setter_fieldnames(): - 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("""\ - SELECT name, fieldname FROM `tabCustom Field`""", as_list=1) - field_list = docfield_list + custom_field_list - property_setter_list = webnotes.conn.sql("""\ - SELECT name, doc_name, value, property - FROM `tabProperty Setter` - WHERE doctype_or_field='DocField'""") - field_dict = dict(field_list) - for name, doc_name, value, prop in property_setter_list: - if doc_name in field_dict: - webnotes.conn.sql("""\ - UPDATE `tabProperty Setter` - SET field_name = %s - WHERE name = %s""", (field_dict.get(doc_name), name)) - if value in field_dict and prop=='previous_field': - webnotes.conn.sql("""\ - UPDATE `tabProperty Setter` - SET value = %s - WHERE name = %s""", (field_dict.get(value), name)) - -def clean_doctype_properties(): - desc = webnotes.conn.sql("DESC `tabDocType`", as_dict=1) - property_list = '", "'.join([d.get('Field') for d in desc]) - webnotes.conn.sql("""\ - DELETE FROM `tabProperty Setter` - WHERE doctype_or_field = 'DocType' - AND property NOT IN ("%s")""" % property_list) - -def clean_docfield_properties(): - delete_list_1 = webnotes.conn.sql("""\ - SELECT name FROM `tabProperty Setter` ps - WHERE doctype_or_field = 'DocField' - AND NOT EXISTS ( - SELECT fieldname FROM `tabDocField` df - WHERE df.parent = ps.doc_type - AND df.fieldname = ps.field_name - ) AND NOT EXISTS ( - SELECT fieldname FROM `tabCustom Field` cf - WHERE cf.dt = ps.doc_type - AND cf.fieldname = ps.field_name - )""") - - delete_list_2 = webnotes.conn.sql("""\ - SELECT name FROM `tabProperty Setter` ps - WHERE doctype_or_field = 'DocField' - AND property = 'previous_field' - AND NOT EXISTS ( - SELECT fieldname FROM `tabDocField` df - WHERE df.parent = ps.doc_type - AND df.fieldname = ps.value - ) AND NOT EXISTS ( - SELECT fieldname FROM `tabCustom Field` cf - WHERE cf.dt = ps.doc_type - AND cf.fieldname = ps.value - )""") - - delete_list = [d[0] for d in delete_list_1] + [d[0] for d in delete_list_2] - - webnotes.conn.sql("""\ - DELETE FROM `tabProperty Setter` - WHERE NAME IN ("%s")""" % '", "'.join(delete_list)) diff --git a/patches/mar_2012/cleanup_control_panel.py b/patches/mar_2012/cleanup_control_panel.py deleted file mode 100644 index 6692bc441e..0000000000 --- a/patches/mar_2012/cleanup_control_panel.py +++ /dev/null @@ -1,11 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes -def execute(): - webnotes.conn.sql("""\ - DELETE FROM `tabSingles` - WHERE doctype = 'Control Panel' - AND field IN ("sync_with_gateway", "mail_password", "auto_email_id", - "mail_port", "outgoing_mail_server", "mail_login", "use_ssl")""") diff --git a/patches/mar_2012/create_custom_fields.py b/patches/mar_2012/create_custom_fields.py deleted file mode 100644 index b9fe2f0437..0000000000 --- a/patches/mar_2012/create_custom_fields.py +++ /dev/null @@ -1,118 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -# do not run this patch -from __future__ import unicode_literals -field_list = [ -['Contact', 'notes'], -['Contact', 'birthday'], -['Contact', 'anniversary'], -['Customer', 'state_tax_type'], -['Customer', 'tin_no'], -['Customer', 'excise_registration_number'], -['Customer', 'customer_discount_details'], -['Customer', 'notes'], -['Customer', 'follow_up_section'], -['Customer', 'follow_up'], -['Delivery Note', 'shipping_contact_no'], -['Delivery Note', 'shipping_tin_no'], -['Delivery Note', 'shipping_excise_no'], -['Delivery Note', 'tin_no'], -['Delivery Note', 'excise_no'], -['Delivery Note Detail', 'cetsh_number'], -['Item', 'base_material'], -['Item', 'tool_type'], -['Item', 'no_of_flutes'], -['Item', 'special_treatment'], -['Item', 'length'], -['Item', 'width'], -['Item', 'height_dia'], -['Item', 'pl_item'], -['Item', 'cetsh_number'], -['Item', 'stock_maintained'], -['Item', 'is_rm'], -['Journal Voucher Detail', 'line_remarks'], -['Lead', 'designation'], -['Purchase Order', 'challan_number'], -['Quotation', 'cust_enq_no'], -['Quotation', 'enq_date'], -['Quotation', 'quote_valid'], -['Quotation', 'due_date'], -['Receivable Voucher', 'voucher_time'], -['Receivable Voucher', 'removal_time'], -['Receivable Voucher', 'removal_date'], -['Receivable Voucher', 'shipping_address'], -['Receivable Voucher', 'shipping_location'], -['Receivable Voucher', 'ship_to'], -['Receivable Voucher', 'shipping_contact_no'], -['Receivable Voucher', 'shipping_excise_no'], -['Receivable Voucher', 'shipping_tin_no'], -['Receivable Voucher', 'po_no'], -['Receivable Voucher', 'po_date'], -['Receivable Voucher', 'lr_no'], -['Receivable Voucher', 'transporters'], -['Receivable Voucher', 'ship_terms'], -['Receivable Voucher', 'tin_no'], -['Receivable Voucher', 'excise_no'], -['RV Detail', 'cetsh_number'], -['Sales Order', 'shipping_contact_no'], -['Sales Order', 'shipping_tin_no'], -['Sales Order', 'shipping_excise_no'], -['Sales Order', 'tin_no'], -['Sales Order', 'excise_number'], -['Sales Order Detail', 'cetsh_number'], -['Sales Order Detail', 'prd_notes'], -['Shipping Address', 'phone_no'], -['Shipping Address', 'tin_no'], -['Shipping Address', 'excise_no'], -['Stock Entry', 'process_custom'], -['Stock Entry', 'city'], -['Stock Entry', 'address_line_2'], -['Stock Entry', 'address_line_1'], -['Stock Entry', 'comp_other'], -['Stock Entry', 'mobile_no'], -['Stock Entry', 'phone_no'], -['Stock Entry', 'country'], -['Stock Entry', 'state'], -['Stock Entry', 'challan_number'], -['Stock Entry Detail', 'machine'], -['Stock Entry Detail', 'worker'], -['Supplier', 'notes'], -['Supplier', 'purchase_other_charges'], -['Supplier', 'tax_details'], -['Supplier', 'tin_number'], -['Supplier', 'excise_regd_number'], -['Supplier', 'service_tax_regd_number'], -['Warehouse', 'comp_other'], -['Warehouse', 'process'], -['Warehouse', 'country'], -['Warehouse', 'tax_registration_number'], -['Warehouse Type', 'process'], -['Workstation', 'maintenance_data'], -] - - -import webnotes -from webnotes.model.code import get_obj -from webnotes.model.doc import Document - -def execute(): - 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])) - if res: continue - docfield = webnotes.conn.sql("""SELECT * FROM `tabDocField` - WHERE parent=%s AND fieldname=%s""", (f[0], f[1]), as_dict=1) - if not docfield: continue - custom_field = docfield[0] - - # scrub custom field dict - custom_field['dt'] = custom_field['parent'] - del custom_field['parent'] - - d = Document('Custom Field', fielddata=custom_field) - d.name = custom_field['dt'] + '-' + custom_field['fieldname'] - d.save(1, ignore_fields=1) - #obj = get_obj(doc=d) - #obj.on_update() diff --git a/patches/mar_2012/delete_docformat.py b/patches/mar_2012/delete_docformat.py deleted file mode 100644 index b6ee2ebd81..0000000000 --- a/patches/mar_2012/delete_docformat.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("DELETE FROM `tabDocField` WHERE options='DocFormat'") - webnotes.conn.sql("DELETE FROM `tabDocField` WHERE parent='DocFormat'") - webnotes.conn.sql("DELETE FROM `tabDocType` WHERE name='DocFormat'") - webnotes.conn.commit() - webnotes.conn.sql("DROP TABLE `tabDocFormat`") - webnotes.conn.begin() diff --git a/patches/mar_2012/doctype_get_refactor.py b/patches/mar_2012/doctype_get_refactor.py deleted file mode 100644 index 0900b9b78e..0000000000 --- a/patches/mar_2012/doctype_get_refactor.py +++ /dev/null @@ -1,147 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -import webnotes -def execute(): - """ - * Custom Field changes - * Add file_list to required tables - * Change floats/currency to decimal(18, 6) - * Remove DocFormat from DocType's fields - * Remove 'no_column' from DocField - * Drop table DocFormat - """ - import webnotes.model.sync - webnotes.model.sync.sync_all(force=1) - - handle_custom_fields() - create_file_list() - - # do at last - needs commit due to DDL statements - change_to_decimal() - -def handle_custom_fields(): - """ - * Assign idx to custom fields - * Create property setter entry of previous field - * Remove custom fields from tabDocField - """ - cf = get_cf() - assign_idx(cf) - create_prev_field_prop_setter(cf) - remove_custom_from_docfield(cf) - -def get_cf(): - return webnotes.conn.sql("""\ - SELECT * FROM `tabCustom Field` - WHERE docstatus < 2""", as_dict=1) - -def assign_idx(cf): - from webnotes.model.doctype import get - from webnotes.utils import cint - #print len(cf) - for f in cf: - #print f.get('dt'), f.get('name') - if f.get('idx'): continue - temp_doclist = get(f.get('dt'), form=0) - #print len(temp_doclist) - max_idx = max(d.idx for d in temp_doclist if d.doctype=='DocField') - if not max_idx: continue - webnotes.conn.sql("""\ - UPDATE `tabCustom Field` SET idx=%s - WHERE name=%s""", (cint(max_idx)+1, f.get('name'))) - -def create_prev_field_prop_setter(cf): - from webnotes.model.doc import Document - from core.doctype.custom_field.custom_field import get_fields_label - for f in cf: - idx_label_list, field_list = get_fields_label(f.get('dt'), 0) - temp_insert_after = (f.get('insert_after') or '').split(" - ") - if len(temp_insert_after)<=1: continue - similar_idx_label = [il for il in idx_label_list \ - if temp_insert_after[0] in il] - if not similar_idx_label: continue - label_index = idx_label_list.index(similar_idx_label[0]) - if label_index==-1: return - - webnotes.conn.sql("""\ - UPDATE `tabCustom Field` - SET insert_after = %s - WHERE name = %s""", (similar_idx_label[0], f.get('name'))) - - prev_field = field_list[label_index] - res = webnotes.conn.sql("""\ - SELECT name FROM `tabProperty Setter` - WHERE doc_type = %s - AND field_name = %s - AND property = 'previous_field'""", (f.get('dt'), f.get('fieldname'))) - - if not res: - ps = Document('Property Setter', fielddata = { - 'doctype_or_field': 'DocField', - 'doc_type': f.get('dt'), - 'field_name': f.get('fieldname'), - 'property': 'previous_field', - 'value': prev_field, - 'property_type': 'Data', - 'select_doctype': f.get('dt') - }) - ps.save(1) - -def remove_custom_from_docfield(cf): - for f in cf: - webnotes.conn.sql("""\ - DELETE FROM `tabDocField` - WHERE parent=%s AND fieldname=%s""", (f.get('dt'), - f.get('fieldname'))) - -def create_file_list(): - should_exist = ['Website Settings', 'Web Page', 'Timesheet', 'Task', - 'Support Ticket', 'Supplier', 'Style Settings', 'Stock Reconciliation', - 'Stock Entry', 'Serial No', 'Sales Order', 'Sales Invoice', - 'Quotation', 'Question', 'Purchase Receipt', 'Purchase Order', - 'Project', 'Profile', 'Production Order', 'Product', 'Print Format', - 'Price List', 'Purchase Invoice', 'Page', - 'Maintenance Visit', 'Maintenance Schedule', 'Letter Head', - 'Leave Application', 'Lead', 'Journal Voucher', 'Item', 'Material Request', - 'Expense Claim', 'Opportunity', 'Employee', 'Delivery Note', - 'Customer Issue', 'Customer', 'Contact Us Settings', 'Company', - 'Bulk Rename Tool', 'Blog', 'BOM', 'About Us Settings'] - - from webnotes.model.code import get_obj - - for dt in should_exist: - obj = get_obj('DocType', dt, with_children=1) - obj.doc.allow_attach = 1 - obj.doc.save() - obj.make_file_list() - from webnotes.model.db_schema import updatedb - updatedb(obj.doc.name) - - webnotes.clear_cache(doctype=obj.doc.name) - -def change_to_decimal(): - webnotes.conn.commit() - tables = webnotes.conn.sql("SHOW TABLES") - alter_tables_list = [] - for tab in tables: - if not tab: continue - desc = webnotes.conn.sql("DESC `%s`" % tab[0], as_dict=1) - flist = [] - for d in desc: - if d.get('Type')=='decimal(14,2)': - flist.append(d.get('Field')) - if flist: - #print tab[0], flist - statements = ("MODIFY `%s` decimal(18,6)" % f for f in flist) - statements = ", \n".join(statements) - alter_tables_list.append("ALTER TABLE `%s` \n%s\n" % (tab[0], - statements)) - - #print "\n\n".join(alter_tables_list) - for at in alter_tables_list: - webnotes.conn.sql(at) - - webnotes.conn.begin() - diff --git a/patches/mar_2012/earning_deduction_type_patch.py b/patches/mar_2012/earning_deduction_type_patch.py deleted file mode 100644 index 43a14338b9..0000000000 --- a/patches/mar_2012/earning_deduction_type_patch.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql(""" - UPDATE `tabDocField` - SET fieldtype = 'Link', options = 'Deduction Type' - WHERE parent = 'Deduction Detail' - AND fieldname = 'd_type' - """) - webnotes.conn.sql(""" - UPDATE `tabDocField` - SET fieldtype = 'Link', options = 'Earning Type' - WHERE parent = 'Earning Detail' - AND fieldname = 'e_type' - """) diff --git a/patches/mar_2012/is_submittable_patch.py b/patches/mar_2012/is_submittable_patch.py deleted file mode 100644 index b2da16cb2a..0000000000 --- a/patches/mar_2012/is_submittable_patch.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -# dont run this patch -from __future__ import unicode_literals -def execute(): - import webnotes - import webnotes.model.doctype - from webnotes.utils import cint - from webnotes.model.doc import Document - from webnotes.model.code import get_obj - doctype_list = webnotes.conn.sql("SELECT name FROM `tabDocType`") - for dt in doctype_list: - doclist = webnotes.model.doctype.get(dt[0], form=0) - is_submittable = 0 - for d in doclist: - if d.doctype == 'DocPerm' and d.fields.get('permlevel') == 0 \ - and cint(d.fields.get('submit')) == 1: - is_submittable = 1 - break - if is_submittable: - dt_doc = Document('DocType', doclist[0].name) - dt_doc.is_submittable = 1 - dt_doc.save() - obj = get_obj(doc=dt_doc) - obj.make_amendable() - obj.on_update() diff --git a/patches/mar_2012/usertags.py b/patches/mar_2012/usertags.py deleted file mode 100644 index 4cb9b14cd7..0000000000 --- a/patches/mar_2012/usertags.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - doctype_list = webnotes.conn.sql("""SELECT name FROM `tabDocType` - WHERE docstatus<2 AND IFNULL(issingle, 0)=0 - AND IFNULL(istable, 0)=0""") - webnotes.conn.commit() - for d in doctype_list: - add_col = True - desc = webnotes.conn.sql("DESC `tab%s`" % d[0], as_dict=1) - for td in desc: - if td.get('Field')=='_user_tags': - add_col = False - - if add_col: - webnotes.conn.sql("alter table `tab%s` add column `_user_tags` varchar(180)" % d[0]) - webnotes.conn.begin() - diff --git a/patches/may_2012/__init__.py b/patches/may_2012/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/patches/may_2012/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/patches/may_2012/cleanup_notification_control.py b/patches/may_2012/cleanup_notification_control.py deleted file mode 100644 index 054f7ec907..0000000000 --- a/patches/may_2012/cleanup_notification_control.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql(""" - delete from `tabSingles` - where doctype='Notification Control' - and field in ( - 'payable_voucher', - 'payment_received_message', - 'payment_sent_message', - 'enquiry') - """) - ren_list = [ - ['expense_voucher', 'expense_claim'], - ['receivable_voucher', 'sales_invoice'], - ['enquiry', 'opportunity'], - ] - for r in ren_list: - webnotes.conn.sql(""" - update `tabSingles` - set field=%s - where field=%s - and doctype='Notification Control' - """, (r[1], r[0])) - - webnotes.conn.commit() - webnotes.conn.begin() - webnotes.reload_doc('setup', 'doctype', 'notification_control') \ No newline at end of file diff --git a/patches/may_2012/cleanup_property_setter.py b/patches/may_2012/cleanup_property_setter.py deleted file mode 100644 index b793e9d7bb..0000000000 --- a/patches/may_2012/cleanup_property_setter.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("delete from `tabProperty Setter` where property in ('width', 'previous_field')") - - webnotes.conn.sql("delete from `tabSingles` where field = 'footer_font_color' and doctype = 'Style Settings'") diff --git a/patches/may_2012/create_report_manager_role.py b/patches/may_2012/create_report_manager_role.py deleted file mode 100644 index 56f2aa9cd9..0000000000 --- a/patches/may_2012/create_report_manager_role.py +++ /dev/null @@ -1,13 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.doc import Document - - if not webnotes.conn.sql("select name from `tabRole` where name = 'Report Manager'"): - r = Document('Role') - r.role_name = 'Report Manager' - r.module = 'Core' - r.save() \ No newline at end of file diff --git a/patches/may_2012/cs_server_readonly.py b/patches/may_2012/cs_server_readonly.py deleted file mode 100644 index 378a73da11..0000000000 --- a/patches/may_2012/cs_server_readonly.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """Make server custom script readonly for system manager""" - import webnotes.model.doc - new_perms = [ - { - 'parent': 'Custom Script', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'System Manager', - 'permlevel': 1, - 'read': 1, - }, - { - 'parent': 'Custom Script', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'Administrator', - 'permlevel': 1, - 'read': 1, - 'write': 1 - }, - ] - for perms in new_perms: - doc = webnotes.model.doc.Document('DocPerm') - doc.fields.update(perms) - doc.save() - webnotes.conn.commit() - webnotes.conn.begin() - webnotes.reload_doc('core', 'doctype', 'custom_script') \ No newline at end of file diff --git a/patches/may_2012/customize_form_cleanup.py b/patches/may_2012/customize_form_cleanup.py deleted file mode 100644 index ab86f0583c..0000000000 --- a/patches/may_2012/customize_form_cleanup.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.conn.sql("delete from `tabCustomize Form Field`") - webnotes.conn.sql("""delete from `tabSingles` - where doctype='Customize Form'""") \ No newline at end of file diff --git a/patches/may_2012/page_role_series_fix.py b/patches/may_2012/page_role_series_fix.py deleted file mode 100644 index c2b18f4d7d..0000000000 --- a/patches/may_2012/page_role_series_fix.py +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - sr = webnotes.conn.sql("select max(name) from `tabPage Role`") - if sr and sr[0][0].startswith('PR'): - webnotes.conn.sql("update tabSeries set current = %s where name = 'PR'", int(sr[0][0][2:])) diff --git a/patches/may_2012/profile_perm_patch.py b/patches/may_2012/profile_perm_patch.py deleted file mode 100644 index 26fc1ab03c..0000000000 --- a/patches/may_2012/profile_perm_patch.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """Make profile readonly for role All""" - import webnotes.model.doc - webnotes.conn.sql("delete from `tabDocPerm` where parent='Profile' and role='All'") - new_perms = [ - { - 'parent': 'Profile', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'All', - 'permlevel': 0, - 'read': 1, - }, - ] - for perms in new_perms: - doc = webnotes.model.doc.Document('DocPerm') - doc.fields.update(perms) - doc.save() - webnotes.conn.commit() - webnotes.conn.begin() - webnotes.reload_doc('core', 'doctype', 'profile') \ No newline at end of file diff --git a/patches/may_2012/reload_sales_invoice_pf.py b/patches/may_2012/reload_sales_invoice_pf.py deleted file mode 100644 index 72a8e4100e..0000000000 --- a/patches/may_2012/reload_sales_invoice_pf.py +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - import webnotes.modules - res = webnotes.conn.sql("""\ - select module, name, standard from `tabPrint Format` - where name like 'Sales Invoice%'""", as_dict=1) - for r in res: - if r.get('standard')=='Yes' and \ - r.get('name') in [ - 'Sales Invoice Classic', - 'Sales Invoice Spartan', - 'Sales Invoice Modern' - ]: - webnotes.modules.reload_doc(r.get('module'), 'Print Format', r.get('name')) - \ No newline at end of file diff --git a/patches/may_2012/remove_communication_log.py b/patches/may_2012/remove_communication_log.py deleted file mode 100644 index 0c06f8d6bb..0000000000 --- a/patches/may_2012/remove_communication_log.py +++ /dev/null @@ -1,110 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - webnotes.reload_doc('support', 'doctype', 'communication') - webnotes.conn.commit() - webnotes.conn.begin() - - # change doctype property setter and custom fields, and save them - move_customizations() - - try: - remove_communication_log() - except Exception, e: - if e.args[0] != 1146: - raise e - -def move_customizations(): - import webnotes.model.doc - import webnotes.model.doctype - - res = webnotes.conn.sql("""\ - delete from `tabProperty Setter` - where property='previous_field' - and doc_type = 'Communication Log'""") - - res = webnotes.conn.sql("""\ - select name from `tabCustom Field` - where dt='Communication Log'""") - for r in res: - d = webnotes.model.doc.Document('Custom Field', r[0]) - d.dt = 'Communication' - d.save() - from webnotes.model.db_schema import updatedb - updatedb('Communication') - - res = webnotes.conn.sql("""\ - select field_name from `tabProperty Setter` - where doc_type='Communication Log' and field_name is not null""") - - doclist = webnotes.model.doctype.get('Communication', 0) - field_list = [d.fieldname for d in doclist if d.doctype=='DocField'] - for r in res: - if r[0] in field_list: - webnotes.conn.sql("""\ - update `tabProperty Setter` - set doc_type = 'Communication' - where field_name=%s and doc_type='Communication Log'""", r[0]) - - webnotes.conn.sql("""\ - delete from `tabProperty Setter` - where doc_type='Communication Log'""") - - webnotes.clear_cache(doctype="Communication") - -def remove_communication_log(): - import webnotes - import webnotes.model - import webnotes.model.doc - import webnotes.model.doctype - - webnotes.conn.auto_commit_on_many_writes = True - - # get all communication log records - comm_log_list = webnotes.conn.sql("select * from `tabCommunication Log`", - as_dict=1) - - field_list = [d.fieldname for d in \ - webnotes.model.doctype.get('Communication', 0) \ - if d.doctype=='DocField'] - - # copy it to communication - for comm_log in comm_log_list: - d = webnotes.model.doc.Document('Communication') - - for key in comm_log.keys(): - if key not in webnotes.model.default_fields: - d.fields[key] = comm_log[key] - - parenttype = (comm_log.get('parenttype') or '').lower() - if parenttype in field_list: - d.fields[parenttype] = comm_log.get('parent') - - d.naming_series = 'COMM-' - d.subject = 'Follow Up' - d.content = comm_log.get('notes') or '' - d.medium = comm_log.get('follow_up_type') or '' - d.sales_person = comm_log.get('follow_up_by') - d.communication_date = comm_log.get('date') - d.category = 'Miscellaneous' - d.action = 'No Action' - d.save(ignore_fields=1) - - # delete records with parent type "Customer", "Lead", "Supplier" - webnotes.conn.sql("""\ - delete from `tabCommunication Log` - where parenttype in ('Customer', 'Lead', 'Supplier', - 'Opportunity', 'Quotation')""") - - # if all records deleted, drop table communication log - # and delete doctype communication log - # if for some reason, records remain, dont drop table and dont delete doctype - count = webnotes.conn.sql("select count(*) from `tabCommunication Log`")[0][0] - if not count: - webnotes.model.delete_doc('DocType', 'Communication Log') - webnotes.conn.commit() - webnotes.conn.sql("drop table `tabCommunication Log`") - webnotes.conn.begin() \ No newline at end of file diff --git a/patches/may_2012/remove_euro_currency.py b/patches/may_2012/remove_euro_currency.py deleted file mode 100644 index 02e439b63a..0000000000 --- a/patches/may_2012/remove_euro_currency.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """ - * Replace EURO with EUR - * Delete EURO from tabCurrency - """ - import webnotes - tables = webnotes.conn.sql("show tables") - for (tab,) in tables: - desc = webnotes.conn.sql("desc `%s`" % tab, as_dict=1) - for d in desc: - if "currency" in d.get('Field'): - field = d.get('Field') - webnotes.conn.sql("""\ - update `%s` set `%s`='EUR' - where `%s`='EURO'""" % (tab, field, field)) - webnotes.conn.sql("update `tabSingles` set value='EUR' where value='EURO'") - webnotes.conn.sql("delete from `tabCurrency` where name='EURO'") \ No newline at end of file diff --git a/patches/may_2012/rename_prev_doctype.py b/patches/may_2012/rename_prev_doctype.py deleted file mode 100644 index 81a2578169..0000000000 --- a/patches/may_2012/rename_prev_doctype.py +++ /dev/null @@ -1,18 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - dt_list = webnotes.conn.sql("select parent, fieldname from `tabDocField` where fieldname in ('against_doctype', 'prevdoc_doctype')") - - ren_dt = { - 'Indent' : 'Material Request', - 'Enquiry' : 'Opportunity', - 'Receivable Voucher' : 'Sales Invoice', - 'Payable Voucher' : 'Purchase Invoice' - } - - for d in ren_dt: - for dt in dt_list: - webnotes.conn.sql("update `tab%s` set %s = '%s' where %s = '%s'" % (dt[0], dt[1], ren_dt[d], dt[1], d)) diff --git a/patches/may_2012/same_purchase_rate_patch.py b/patches/may_2012/same_purchase_rate_patch.py deleted file mode 100644 index edb135f8bd..0000000000 --- a/patches/may_2012/same_purchase_rate_patch.py +++ /dev/null @@ -1,12 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.model.code import get_obj - gd = get_obj('Global Defaults') - gd.doc.maintain_same_rate = 1 - gd.doc.save() - gd.on_update() - \ No newline at end of file diff --git a/patches/may_2012/std_pf_readonly.py b/patches/may_2012/std_pf_readonly.py deleted file mode 100644 index f2e7261f63..0000000000 --- a/patches/may_2012/std_pf_readonly.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - """Make standard print formats readonly for system manager""" - import webnotes.model.doc - new_perms = [ - { - 'parent': 'Print Format', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'System Manager', - 'permlevel': 1, - 'read': 1, - }, - { - 'parent': 'Print Format', - 'parentfield': 'permissions', - 'parenttype': 'DocType', - 'role': 'Administrator', - 'permlevel': 1, - 'read': 1, - 'write': 1 - }, - ] - for perms in new_perms: - doc = webnotes.model.doc.Document('DocPerm') - doc.fields.update(perms) - doc.save() - webnotes.conn.commit() - webnotes.conn.begin() - webnotes.reload_doc('core', 'doctype', 'print_format') \ No newline at end of file diff --git a/patches/may_2012/stock_reco_patch.py b/patches/may_2012/stock_reco_patch.py deleted file mode 100644 index a3c702f2f7..0000000000 --- a/patches/may_2012/stock_reco_patch.py +++ /dev/null @@ -1,21 +0,0 @@ -# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. -# License: GNU General Public License v3. See license.txt - -from __future__ import unicode_literals -def execute(): - import webnotes - from webnotes.modules import reload_doc - reload_doc('stock', 'doctype', 'stock_reconciliation') - - sr = webnotes.conn.sql("select name, file_list from `tabStock Reconciliation` where docstatus = 1") - for d in sr: - if d[1]: - filename = d[1].split(',')[1] - - from webnotes.utils import file_manager - fn, content = file_manager.get_file(filename) - - if not isinstance(content, basestring) and hasattr(content, 'tostring'): - content = content.tostring() - - webnotes.conn.sql("update `tabStock Reconciliation` set diff_info = %s where name = %s and ifnull(diff_info, '') = ''", (content, d[0])) diff --git a/patches/patch_list.py b/patches/patch_list.py index e747993d35..7f7c747fe2 100644 --- a/patches/patch_list.py +++ b/patches/patch_list.py @@ -10,60 +10,6 @@ patch_list = [ "execute:webnotes.reload_doc('core', 'doctype', 'docperm') #2013-07-16", "execute:webnotes.reload_doc('core', 'doctype', 'page') #2013-07-16", "execute:webnotes.reload_doc('core', 'doctype', 'report') #2013-07-16", - "patches.mar_2012.clean_property_setter", - "patches.april_2012.naming_series_patch", - "patches.mar_2012.cleanup_control_panel", - "patches.mar_2012.doctype_get_refactor", - "patches.mar_2012.delete_docformat", - "patches.mar_2012.usertags", - "patches.april_2012.reload_c_form", - "patches.april_2012.after_sync_cleanup", - "patches.april_2012.remove_default_from_rv_detail", - "patches.april_2012.update_role_in_address", - "patches.april_2012.update_permlevel_in_address", - "patches.april_2012.update_appraisal_permission", - "patches.april_2012.repost_stock_for_posting_time", - "patches.may_2012.cleanup_property_setter", - "patches.may_2012.rename_prev_doctype", - "patches.may_2012.cleanup_notification_control", - "patches.may_2012.stock_reco_patch", - "patches.may_2012.page_role_series_fix", - "patches.may_2012.reload_sales_invoice_pf", - "patches.may_2012.std_pf_readonly", - "patches.may_2012.customize_form_cleanup", - "patches.may_2012.cs_server_readonly", - "patches.may_2012.clear_session_cache", - "patches.may_2012.same_purchase_rate_patch", - "patches.may_2012.create_report_manager_role", - "patches.may_2012.profile_perm_patch", - "patches.may_2012.remove_euro_currency", - "patches.may_2012.remove_communication_log", - "patches.june_2012.barcode_in_feature_setup", - "patches.june_2012.copy_uom_for_pur_inv_item", - "patches.june_2012.fetch_organization_from_lead", - "patches.june_2012.reports_list_permission", - "patches.june_2012.support_ticket_autoreply", - "patches.june_2012.series_unique_patch", - "patches.june_2012.set_recurring_type", - "patches.june_2012.alter_tabsessions", - "patches.june_2012.delete_old_parent_entries", - "patches.april_2012.delete_about_contact", - "patches.july_2012.reload_pr_po_mapper", - "patches.july_2012.address_contact_perms", - "patches.july_2012.packing_list_cleanup_and_serial_no", - "patches.july_2012.deprecate_import_data_control", - "patches.july_2012.default_freeze_account", - "patches.july_2012.update_purchase_tax", - "patches.june_2012.cms2", - "patches.july_2012.auth_table", - "patches.july_2012.remove_event_role_owner_match", - "patches.july_2012.deprecate_bulk_rename", - "patches.july_2012.bin_permission", - "patches.july_2012.project_patch_repeat", - "patches.july_2012.repost_stock_due_to_wrong_packing_list", - "patches.august_2012.task_allocated_to_assigned", - "patches.august_2012.change_profile_permission", - "patches.august_2012.repost_billed_amt", "patches.september_2012.stock_report_permissions_for_accounts", "patches.september_2012.communication_delete_permission", "patches.september_2012.all_permissions_patch", @@ -255,7 +201,6 @@ patch_list = [ "patches.august_2013.p05_employee_birthdays", "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-08-16", "patches.august_2013.p06_fix_sle_against_stock_entry", - "execute:webnotes.bean('Style Settings').save() #2013-08-20", "patches.september_2013.p01_add_user_defaults_from_pos_setting", "execute:webnotes.reload_doc('accounts', 'Print Format', 'POS Invoice') # 2013-09-02", "patches.september_2013.p01_fix_buying_amount_gl_entries", @@ -264,4 +209,6 @@ patch_list = [ "patches.september_2013.p02_fix_serial_no_status", "patches.september_2013.p03_modify_item_price_include_in_price_list", "patches.september_2013.p03_update_stock_uom_in_sle", + "patches.september_2013.p03_move_website_to_framework", + "execute:webnotes.bean('Style Settings').save() #2013-09-19", ] \ No newline at end of file diff --git a/patches/september_2013/p02_fix_serial_no_status.py b/patches/september_2013/p02_fix_serial_no_status.py index 714cd7a377..58c2957815 100644 --- a/patches/september_2013/p02_fix_serial_no_status.py +++ b/patches/september_2013/p02_fix_serial_no_status.py @@ -17,7 +17,7 @@ def execute(): serial_nos = d.serial_no.split("\n") for sr in serial_nos: serial_no = sr.strip() - if serial_no: + if serial_no and webnotes.conn.exists("Serial No", serial_no): serial_bean = webnotes.bean("Serial No", serial_no) if serial_bean.doc.status == "Not Available": latest_sle = webnotes.conn.sql("""select voucher_no from `tabStock Ledger Entry` diff --git a/patches/september_2013/p03_modify_item_price_include_in_price_list.py b/patches/september_2013/p03_modify_item_price_include_in_price_list.py index f29f8f5bf0..8ca6d76f9c 100644 --- a/patches/september_2013/p03_modify_item_price_include_in_price_list.py +++ b/patches/september_2013/p03_modify_item_price_include_in_price_list.py @@ -7,11 +7,13 @@ import webnotes def execute(): webnotes.reload_doc("setup", "doctype", "price_list") webnotes.reload_doc("setup", "doctype", "item_price") + webnotes.reload_doc("stock", "doctype", "item") + webnotes.conn.sql("""update `tabItem Price` set parenttype='Price List', - parentfield='item_prices', item_code=parent""") - + parentfield='item_prices', `item_code`=`parent`""") + # re-arranging idx of items - webnotes.conn.sql("""update `tabItem Price` set parent=price_list, idx=0""") + webnotes.conn.sql("""update `tabItem Price` set `parent`=`price_list`, idx=0""") for pl in webnotes.conn.sql("""select name from `tabPrice List`"""): webnotes.conn.sql("""set @name=0""") webnotes.conn.sql("""update `tabItem Price` set idx = @name := IF(ISNULL( @name ), 0, @name + 1) diff --git a/patches/september_2013/p03_move_website_to_framework.py b/patches/september_2013/p03_move_website_to_framework.py new file mode 100644 index 0000000000..9c15bcc34c --- /dev/null +++ b/patches/september_2013/p03_move_website_to_framework.py @@ -0,0 +1,17 @@ +# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. +# License: GNU General Public License v3. See license.txt + +from __future__ import unicode_literals +import webnotes +from webnotes.utils import get_base_path +import os, shutil + +def execute(): + # remove pyc files + utils_pyc = os.path.join(get_base_path(), "app", "selling", "utils.pyc") + if os.path.exists(utils_pyc): + os.remove(utils_pyc) + + old_path = os.path.join(get_base_path(), "app", "website") + if os.path.exists(old_path): + shutil.rmtree(old_path) \ No newline at end of file diff --git a/website/doctype/blog_category/__init__.py b/portal/__init__.py similarity index 100% rename from website/doctype/blog_category/__init__.py rename to portal/__init__.py diff --git a/website/doctype/blog_post/__init__.py b/portal/templates/__init__.py similarity index 100% rename from website/doctype/blog_post/__init__.py rename to portal/templates/__init__.py diff --git a/portal/templates/base.html b/portal/templates/base.html new file mode 100644 index 0000000000..bc6fb9755c --- /dev/null +++ b/portal/templates/base.html @@ -0,0 +1,3 @@ +{% extends "lib/website/templates/base.html" %} + +{% block footer %}{% include "app/portal/templates/includes/footer.html" %}{% endblock %} \ No newline at end of file diff --git a/website/templates/js/cart.js b/portal/templates/includes/cart.js similarity index 83% rename from website/templates/js/cart.js rename to portal/templates/includes/cart.js index 20090caec6..5ff6e3fb72 100644 --- a/website/templates/js/cart.js +++ b/portal/templates/includes/cart.js @@ -4,33 +4,33 @@ // js inside blog page $(document).ready(function() { - wn.cart.bind_events(); + erpnext.cart.bind_events(); return wn.call({ type: "POST", - method: "website.helpers.cart.get_cart_quotation", + method: "selling.utils.cart.get_cart_quotation", callback: function(r) { console.log(r); $("#cart-container").removeClass("hide"); $(".progress").remove(); if(r.exc) { if(r.exc.indexOf("WebsitePriceListMissingError")!==-1) { - wn.cart.show_error("Oops!", "Price List not configured."); + erpnext.cart.show_error("Oops!", "Price List not configured."); } else if(r["403"]) { - wn.cart.show_error("Hey!", "You need to be logged in to view your cart."); + erpnext.cart.show_error("Hey!", "You need to be logged in to view your cart."); } else { - wn.cart.show_error("Oops!", "Something went wrong."); + erpnext.cart.show_error("Oops!", "Something went wrong."); } } else { - wn.cart.set_cart_count(); - wn.cart.render(r.message); + erpnext.cart.set_cart_count(); + erpnext.cart.render(r.message); } } }); }); // shopping cart -if(!wn.cart) wn.cart = {}; -$.extend(wn.cart, { +if(!erpnext.cart) erpnext.cart = {}; +$.extend(erpnext.cart, { show_error: function(title, text) { $("#cart-container").html('