From 4feae61b62fdaeaf3cb79173c6615fe618c08e03 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 12 Jul 2012 16:01:20 +0530 Subject: [PATCH 1/2] fixes to taxes and charges master and naming_series --- .../purchase_taxes_and_charges.txt | 147 +++++++++--------- .../purchase_taxes_and_charges_master.js | 8 +- .../purchase_taxes_and_charges_master.txt | 31 ++-- .../sales_taxes_and_charges.txt | 8 +- .../sales_taxes_and_charges_master.js | 6 +- .../sales_taxes_and_charges_master.py | 42 ++--- .../sales_taxes_and_charges_master.txt | 135 +++++++--------- .../july_2012/default_freeze_account.py | 6 + .../patches/july_2012/update_purchase_tax.py | 8 + erpnext/patches/patch_list.py | 5 + erpnext/selling/doctype/campaign/campaign.txt | 107 ++++++------- .../doctype/naming_series/naming_series.js | 48 ++++-- .../doctype/naming_series/naming_series.py | 58 ++++--- .../doctype/naming_series/naming_series.txt | 30 ++-- .../doctype/supplier_type/supplier_type.js | 12 +- .../terms_and_conditions.txt | 79 +++++----- erpnext/stock/page/stock_home/stock_home.html | 2 +- erpnext/utilities/page/todo/todo.css | 2 +- erpnext/utilities/page/todo/todo.html | 2 +- public/css/all-app.css | 5 +- public/css/all-web.css | 5 +- public/js/all-app.js | 10 +- public/js/all-web.js | 2 +- 23 files changed, 387 insertions(+), 371 deletions(-) create mode 100644 erpnext/patches/july_2012/update_purchase_tax.py diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt index 74fd69740c..096050d252 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:46', + 'creation': '2012-07-03 13:30:49', 'docstatus': 0, - 'modified': '2012-03-27 14:35:46', + 'modified': '2012-07-12 14:08:27', 'modified_by': u'Administrator', 'owner': u'wasim@webnotestech.com' }, @@ -24,7 +24,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 13 + 'version': 1 }, # These values are common for all DocField @@ -42,34 +42,6 @@ 'name': u'Purchase Taxes and Charges' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'category', - 'fieldtype': u'Select', - 'label': u'Category', - 'oldfieldname': u'category', - 'oldfieldtype': u'Select', - 'options': u'\nFor Total\nFor Valuation\nFor Both', - 'permlevel': 0, - 'reqd': 1 - }, - - # DocField - { - 'default': u'Add', - 'doctype': u'DocField', - 'fieldname': u'add_deduct_tax', - 'fieldtype': u'Select', - 'label': u'Add or Deduct', - 'oldfieldname': u'add_deduct_tax', - 'oldfieldtype': u'Select', - 'options': u'\nAdd\nDeduct', - 'permlevel': 0, - 'reqd': 1, - 'trigger': u'Client' - }, - # DocField { 'doctype': u'DocField', @@ -84,46 +56,6 @@ 'trigger': u'Client' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'row_id', - 'fieldtype': u'Data', - 'hidden': 0, - 'label': u'Enter Row', - 'oldfieldname': u'row_id', - 'oldfieldtype': u'Data', - 'permlevel': 0, - 'trigger': u'Client' - }, - - # DocField - { - 'colour': u'White:FFF', - 'doctype': u'DocField', - 'fieldname': u'item_wise_tax_detail', - 'fieldtype': u'Small Text', - 'hidden': 1, - 'label': u'Item Wise Tax Detail ', - 'oldfieldname': u'item_wise_tax_detail', - 'oldfieldtype': u'Small Text', - 'permlevel': 1, - 'print_hide': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'description', - 'fieldtype': u'Small Text', - 'label': u'Description', - 'oldfieldname': u'description', - 'oldfieldtype': u'Small Text', - 'permlevel': 0, - 'reqd': 1, - 'width': u'300px' - }, - # DocField { 'doctype': u'DocField', @@ -151,6 +83,19 @@ 'trigger': u'Client' }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'description', + 'fieldtype': u'Small Text', + 'label': u'Description', + 'oldfieldname': u'description', + 'oldfieldtype': u'Small Text', + 'permlevel': 0, + 'reqd': 1, + 'width': u'300px' + }, + # DocField { 'doctype': u'DocField', @@ -182,12 +127,70 @@ 'doctype': u'DocField', 'fieldname': u'total', 'fieldtype': u'Currency', - 'label': u'Aggregate Total', + 'label': u'Total', 'oldfieldname': u'total', 'oldfieldtype': u'Currency', 'permlevel': 1 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'row_id', + 'fieldtype': u'Data', + 'hidden': 0, + 'label': u'Enter Row', + 'oldfieldname': u'row_id', + 'oldfieldtype': u'Data', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'For Both', + 'doctype': u'DocField', + 'fieldname': u'category', + 'fieldtype': u'Select', + 'label': u'Consider Tax or Charge for', + 'oldfieldname': u'category', + 'oldfieldtype': u'Select', + 'options': u'Valuation and Total\nValuation\nTotal', + 'permlevel': 0, + 'reqd': 1 + }, + + # DocField + { + 'colour': u'White:FFF', + 'default': u'Add', + 'doctype': u'DocField', + 'fieldname': u'add_deduct_tax', + 'fieldtype': u'Select', + 'label': u'Add or Deduct', + 'oldfieldname': u'add_deduct_tax', + 'oldfieldtype': u'Select', + 'options': u'Add\nDeduct', + 'permlevel': 0, + 'reqd': 1, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', + 'doctype': u'DocField', + 'fieldname': u'item_wise_tax_detail', + 'fieldtype': u'Small Text', + 'hidden': 1, + 'label': u'Item Wise Tax Detail ', + 'oldfieldname': u'item_wise_tax_detail', + 'oldfieldtype': u'Small Text', + 'permlevel': 1, + 'print_hide': 1 + }, + # DocField { 'doctype': u'DocField', diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js index d3a32e92c0..fa2c836530 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js @@ -22,7 +22,7 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { } cur_frm.cscript.refresh = function(doc, cdt, cdn) { - + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); } cur_frm.pformat.purchase_tax_details= function(doc){ @@ -74,7 +74,7 @@ cur_frm.cscript.add_deduct_tax = function(doc, cdt, cdn) { alert("Please select Category first"); d.add_deduct_tax = ''; } - else if(d.category != 'For Total' && d.add_deduct_tax == 'Deduct'){ + else if(d.category != 'Total' && d.add_deduct_tax == 'Deduct'){ alert("You cannot Deduct when category is for valuation or for both(i.e total and valuation)"); d.add_deduct_tax = ''; } @@ -91,8 +91,8 @@ cur_frm.cscript.charge_type = function(doc, cdt, cdn) { alert("You cannot select Charge Type as 'On Previous Row Amount' or 'On Previous Row Total' for first row"); d.charge_type = ''; } - else if((d.category == 'For Valuation' || d.category == 'For Both') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ - alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'For Total' option for previous row amount or previous row total") + else if((d.category == 'Valuation' || d.category == 'Valuation and Total') && (d.charge_type == 'On Previous Row Amount' || d.charge_type == 'On Previous Row Total')){ + alert("You cannot select charge type as 'On Previous Row Amount' or 'On Previous Row Total' for valuation. You can select only 'Total' option for previous row amount or previous row total") d.charge_type = ''; } validated = false; diff --git a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt index 1ecac405f3..8add7afa67 100644 --- a/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:35:51', + 'creation': '2012-07-03 13:30:50', 'docstatus': 0, - 'modified': '2012-03-27 14:35:51', + 'modified': '2012-07-12 14:10:35', 'modified_by': u'Administrator', 'owner': u'wasim@webnotestech.com' }, @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard tax template that can be applied to all Purchase Transactions. This template can contain list of tax heads and also other expense heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Consider Tax or Charge for: In this section you can specify if the tax / charge is only for valuation (not a part of total) or only for total (does not add value to the item) or for both.\n10. Add or Deduct: Whether you want to add or deduct the tax.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Accounts', @@ -24,7 +25,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 18 + 'version': 1 }, # These values are common for all DocField @@ -106,17 +107,6 @@ 'search_index': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'company', - 'fieldtype': u'Link', - 'in_filter': 1, - 'label': u'Company', - 'options': u'Company', - 'reqd': 1 - }, - # DocField { 'doctype': u'DocField', @@ -126,5 +116,16 @@ 'oldfieldname': u'purchase_tax_details', 'oldfieldtype': u'Table', 'options': u'Purchase Taxes and Charges' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'company', + 'fieldtype': u'Link', + 'in_filter': 1, + 'label': u'Company', + 'options': u'Company', + 'reqd': 1 } -] +] \ No newline at end of file diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt index 2a25a6a61e..66d7aae835 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges/sales_taxes_and_charges.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:14:34', + 'creation': '2012-07-04 16:40:13', 'docstatus': 0, - 'modified': '2012-07-04 13:27:05', + 'modified': '2012-07-12 13:50:43', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -113,7 +113,7 @@ 'doctype': u'DocField', 'fieldname': u'tax_amount', 'fieldtype': u'Currency', - 'label': u'Amount*', + 'label': u'Amount', 'oldfieldname': u'tax_amount', 'oldfieldtype': u'Currency', 'permlevel': 0, @@ -126,7 +126,7 @@ 'doctype': u'DocField', 'fieldname': u'total', 'fieldtype': u'Currency', - 'label': u'Total*', + 'label': u'Total', 'oldfieldname': u'total', 'oldfieldtype': u'Currency', 'permlevel': 1 diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js index bae6b74d27..16bf1bb6d9 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js @@ -19,9 +19,9 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) { // } -/*cur_frm.cscript.refresh = function(doc, cdt, cdn) { - -}*/ +cur_frm.cscript.refresh = function(doc, cdt, cdn) { + cur_frm.set_footnote(wn.markdown(cur_frm.meta.description)); +} // For customizing print cur_frm.pformat.net_total = function(doc) { diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py index f5342edf5f..1750e51282 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.py @@ -8,43 +8,25 @@ # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . -# Please edit this list and import only required elements import webnotes -from webnotes.utils import add_days, add_months, add_years, cint, cstr, date_diff, default_fields, flt, fmt_money, formatdate, generate_hash, getTraceback, get_defaults, get_first_day, get_last_day, getdate, has_common, month_name, now, nowdate, replace_newlines, sendmail, set_default, str_esc_quote, user_format, validate_email_add -from webnotes.model import db_exists -from webnotes.model.doc import Document, addchild, getchildren, make_autoname -from webnotes.model.doclist import getlist, copy_doclist -from webnotes.model.code import get_obj, get_server_obj, run_server_obj, updatedb, check_syntax -from webnotes import session, form, is_testing, msgprint, errprint - -set = webnotes.conn.set -sql = webnotes.conn.sql -get_value = webnotes.conn.get_value -in_transaction = webnotes.conn.in_transaction -convert_to_lists = webnotes.conn.convert_to_lists - -# ----------------------------------------------------------------------------------------- - - class DocType: - def __init__(self, doc, doclist=[]): - self.doc = doc - self.doclist = doclist + def __init__(self, doc, doclist=[]): + self.doc = doc + self.doclist = doclist - # Get Tax Rate if account type is Tax - # =================================================================== - def get_rate(self, arg): - get_obj('Sales Common').get_rate(arg, self) + def get_rate(self, arg): + from webnotes.model.code import get_obj + return get_obj('Sales Common').get_rate(arg, self) - def update_other_default_charges(self): - sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company)) + def update_other_default_charges(self): + webnotes.conn.sql("update `tabSales Taxes and Charges Master` set is_default = 0 where ifnull(is_default,0) = 1 and name != '%s' and company = '%s'" % (self.doc.name, self.doc.company)) - def on_update(self): - self.update_other_default_charges() + def on_update(self): + self.update_other_default_charges() diff --git a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt index 655269c26e..1707bf4cfb 100644 --- a/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt +++ b/erpnext/accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:22', + 'creation': '2012-07-03 13:30:46', 'docstatus': 0, - 'modified': '2012-03-27 14:36:22', + 'modified': '2012-07-12 13:43:32', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard tax template that can be applied to all Sales Transactions. This template can contain list of tax heads and also other expense / income heads like "Shipping", "Insurance", "Handling" etc.\n\n#### Note\n\nThe tax rate you define here will be the standard tax rate for all **Items**. If there are **Items** that have different rates, they must be added in the **Item Tax** table in the **Item** master.\n\n#### Description of Columns\n\n1. Calculation Type: \n - This can be on **Net Total** (that is the sum of basic amount).\n - **On Previous Row Total / Amount** (for cumulative taxes or charges). If you select this option, the tax will be applied as a percentage of the previous row (in the tax table) amount or total.\n - **Actual** (as mentioned).\n2. Account Head: The Account ledger under which this tax will be booked\n3. Cost Center: If the tax / charge is an income (like shipping) or expense it needs to be booked against a Cost Center.\n4. Description: Description of the tax (that will be printed in invoices / quotes).\n5. Rate: Tax rate.\n6. Amount: Tax amount.\n7. Total: Cumulative total to this point.\n8. Enter Row: If based on "Previous Row Total" you can select the row number which will be taken as a base for this calculation (default is the previous row).\n9. Is this Tax included in Basic Rate?: If you check this, it means that this tax will not be shown below the item table, but will be included in the Basic Rate in your main item table. This is useful where you want give a flat price (inclusive of all taxes) price to customers.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Accounts', @@ -24,7 +25,7 @@ 'section_style': u'Tabbed', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 57 + 'version': 1 }, # These values are common for all DocField @@ -33,7 +34,8 @@ 'name': '__common__', 'parent': u'Sales Taxes and Charges Master', 'parentfield': u'fields', - 'parenttype': u'DocType' + 'parenttype': u'DocType', + 'permlevel': 0 }, # These values are common for all DocPerm @@ -52,6 +54,42 @@ 'name': u'Sales Taxes and Charges Master' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'amend': 0, @@ -86,63 +124,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'trash_reason', - 'fieldtype': u'Small Text', - 'label': u'Trash Reason', - 'oldfieldname': u'trash_reason', - 'oldfieldtype': u'Small Text', - 'permlevel': 1 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'other_charges_details', - 'fieldtype': u'Section Break', - 'label': u'Other Charges Details', - 'oldfieldtype': u'Section Break', - 'permlevel': 0 - }, - # DocField { 'doctype': u'DocField', @@ -152,7 +133,6 @@ 'label': u'Title', 'oldfieldname': u'title', 'oldfieldtype': u'Data', - 'permlevel': 0, 'reqd': 1, 'search_index': 0 }, @@ -162,8 +142,20 @@ 'doctype': u'DocField', 'fieldname': u'is_default', 'fieldtype': u'Check', - 'label': u'Default', - 'permlevel': 0 + 'label': u'Default' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'* Will be calculated in the transaction.', + 'doctype': u'DocField', + 'fieldname': u'other_charges', + 'fieldtype': u'Table', + 'label': u'Sales Taxes and Charges Master', + 'oldfieldname': u'other_charges', + 'oldfieldtype': u'Table', + 'options': u'Sales Taxes and Charges' }, # DocField @@ -176,20 +168,7 @@ 'oldfieldname': u'company', 'oldfieldtype': u'Link', 'options': u'Company', - 'permlevel': 0, 'reqd': 1, 'search_index': 0 - }, - - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'other_charges', - 'fieldtype': u'Table', - 'label': u'Sales Taxes and Charges Master', - 'oldfieldname': u'other_charges', - 'oldfieldtype': u'Table', - 'options': u'Sales Taxes and Charges', - 'permlevel': 0 } -] +] \ No newline at end of file diff --git a/erpnext/patches/july_2012/default_freeze_account.py b/erpnext/patches/july_2012/default_freeze_account.py index f5b3cc6e8a..c8cbd1aedc 100644 --- a/erpnext/patches/july_2012/default_freeze_account.py +++ b/erpnext/patches/july_2012/default_freeze_account.py @@ -1,3 +1,9 @@ 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/erpnext/patches/july_2012/update_purchase_tax.py b/erpnext/patches/july_2012/update_purchase_tax.py new file mode 100644 index 0000000000..7982a0c2f1 --- /dev/null +++ b/erpnext/patches/july_2012/update_purchase_tax.py @@ -0,0 +1,8 @@ +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/erpnext/patches/patch_list.py b/erpnext/patches/patch_list.py index 6cd73cd71e..45a40b002d 100644 --- a/erpnext/patches/patch_list.py +++ b/erpnext/patches/patch_list.py @@ -492,4 +492,9 @@ patch_list = [ 'patch_file': 'default_freeze_account', 'description': "set default freeze_account as 'No' where NULL" }, + { + 'patch_module': 'patches.july_2012', + 'patch_file': 'update_purchase_tax', + 'description': "rename options in purchase taxes and charges" + }, ] \ No newline at end of file diff --git a/erpnext/selling/doctype/campaign/campaign.txt b/erpnext/selling/doctype/campaign/campaign.txt index 0912fe7085..41c0e77709 100644 --- a/erpnext/selling/doctype/campaign/campaign.txt +++ b/erpnext/selling/doctype/campaign/campaign.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:07', + 'creation': '2012-07-03 13:30:38', 'docstatus': 0, - 'modified': '2012-03-27 14:36:07', + 'modified': '2012-07-12 13:21:52', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:campaign_name', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Keep Track of Sales Campaigns. Keep track of Leads, Quotations, Sales Order etc from Campaigns to gauge Return on Investment. ', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Selling', @@ -24,7 +25,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 7 + 'version': 1 }, # These values are common for all DocField @@ -54,6 +55,56 @@ 'name': u'Campaign' }, + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'write': 0 + }, + + # DocPerm + { + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales User', + 'write': 0 + }, + # DocPerm { 'cancel': 1, @@ -64,56 +115,6 @@ 'write': 1 }, - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'write': 0 - }, - - # DocPerm - { - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales User', - 'write': 0 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/setup/doctype/naming_series/naming_series.js b/erpnext/setup/doctype/naming_series/naming_series.js index 7e702c45f4..3057e62642 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.js +++ b/erpnext/setup/doctype/naming_series/naming_series.js @@ -8,33 +8,47 @@ // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License -// along with this program. If not, see . +// along with this program. If not, see . // Settings cur_frm.cscript.onload = function(doc, cdt, cdn){ - var callback = function(r, rt){ - set_field_options('select_doc_for_series', r.message); - } - $c_obj(make_doclist(doc.doctype, doc.name),'get_transactions','',callback); - cur_frm.cscript.refresh(); - // add page head - //var ph = new PageHeader(cur_frm.fields_dict['head_html'].wrapper, 'Setup Series', 'Set prefix for numbering series on your transactions'); + cur_frm.call_server('get_transactions', '', cur_frm.cscript.update_selects); + + cur_frm.cscript.select_doc_for_series(doc); } -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - // hide buttons - $('.appframe-toolbar').toggle(false); +cur_frm.cscript.update_selects = function(r) { + set_field_options('select_doc_for_series', r.message.transactions); + set_field_options('prefix', r.message.prefixes); } + cur_frm.cscript.select_doc_for_series = function(doc, cdt, cdn) { - var callback = function(r, rt){ - locals[cdt][cdn].set_options = r.message; - refresh_field('set_options'); - } + cur_frm.toggle_fields(['help_html','set_options', 'user_must_always_select', 'update'], + doc.select_doc_for_series) - $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback) + var callback = function(r, rt){ + locals[cdt][cdn].set_options = r.message; + refresh_field('set_options'); + if(r.message && r.message.split('\n')[0]=='') { + cur_frm.set_value('user_must_always_select', 1) + } + } + + if(doc.select_doc_for_series) + $c_obj(make_doclist(doc.doctype, doc.name),'get_options','',callback) +} + +cur_frm.cscript.update = function() { + cur_frm.call_server('update_series', '', cur_frm.cscript.update_selects) +} + +cur_frm.cscript.prefix = function(doc) { + cur_frm.call_server('get_current', '', function(r) { + refresh_field('current_value'); + }) } diff --git a/erpnext/setup/doctype/naming_series/naming_series.py b/erpnext/setup/doctype/naming_series/naming_series.py index 5a9a26579a..6473459f8a 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.py +++ b/erpnext/setup/doctype/naming_series/naming_series.py @@ -14,7 +14,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Please edit this list and import only required elements import webnotes from webnotes.utils import cint, cstr @@ -22,23 +21,37 @@ from webnotes import msgprint, errprint import webnotes.model.doctype sql = webnotes.conn.sql - -# ----------------------------------------------------------------------------------------- - class DocType: def __init__(self, d, dl): self.doc, self.doclist = d, dl - #----------------------------------------------------------------------------------------------------------------------------------- - def get_transactions(self): - return "\n".join([''] + [i[0] for i in sql("SELECT `tabDocField`.`parent` FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent")]) + def get_transactions(self, arg=None): + return { + "transactions": "\n".join([''] + [i[0] for i in sql("""select `tabDocField`.`parent` + FROM `tabDocField`, `tabDocType` WHERE `tabDocField`.`fieldname` = 'naming_series' + and `tabDocType`.name=`tabDocField`.parent order by `tabDocField`.parent""")]), + "prefixes": "\n".join([''] + [i[0] for i in sql("""select name from tabSeries""")])} def scrub_options_list(self, ol): options = filter(lambda x: x, [cstr(n.upper()).strip() for n in ol]) return options + + def update_series(self, arg=None): + """update series list""" + self.check_duplicate() + series_list = self.doc.set_options.split("\n") + + # set in doctype + self.set_series_for(self.doc.select_doc_for_series, series_list) + + # create series + map(self.insert_series, series_list) + + msgprint('Series Updated') + + return self.get_transactions() - #----------------------------------------------------------------------------------------------------------------------------------- def set_series_for(self, doctype, ol): options = self.scrub_options_list(ol) @@ -78,14 +91,7 @@ class DocType: from webnotes.utils.cache import CacheItem CacheItem(doctype).clear() - - #----------------------------------------------------------------------------------------------------------------------------------- - def update_series(self): - self.check_duplicate() - self.set_series_for(self.doc.select_doc_for_series, self.doc.set_options.split("\n")) - msgprint('Series Updated') - #----------------------------------------------------------------------------------------------------------------------------------- def check_duplicate(self): from core.doctype.doctype.doctype import DocType dt = DocType() @@ -100,27 +106,31 @@ class DocType: if series in i[0].split("\n"): msgprint("Oops! Series name %s is already in use in %s. Please select a new one" % (series, i[1]), raise_exception=1) - #----------------------------------------------------------------------------------------------------------------------------------- def validate_series_name(self, n): import re if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n): msgprint('Special Characters except "-" and "/" not allowed in naming series') raise Exception - #----------------------------------------------------------------------------------------------------------------------------------- def get_options(self, arg=''): - sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, 'options', 'naming_series') + sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series, + 'options', 'naming_series') return sr + def get_current(self, arg=None): + """get series current""" + self.doc.current_value = webnotes.conn.sql("""select current from tabSeries where name=%s""", + self.doc.prefix)[0][0] + + def insert_series(self, series): + """insert series if missing""" + if not webnotes.conn.exists('Series', series): + sql("insert into tabSeries (name, current) values (%s,0)", (series)) - #----------------------------------------------------------------------------------------------------------------------------------- def update_series_start(self): if self.doc.prefix: - ser_det = sql("select name from `tabSeries` where name = %s", self.doc.prefix) - if ser_det: - sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.starts_from-1,self.doc.prefix)) - else: - sql("insert into tabSeries (name, current) values (%s,%s)",(cstr(self.doc.prefix),cint(self.doc.starts_from)-1)) + self.insert_series(self.doc.prefix) + sql("update `tabSeries` set current = '%s' where name = '%s'" % (self.doc.current_value,self.doc.prefix)) msgprint("Series Updated Successfully") else: msgprint("Please select prefix first") diff --git a/erpnext/setup/doctype/naming_series/naming_series.txt b/erpnext/setup/doctype/naming_series/naming_series.txt index 6cb1dab6b4..ff83af82d5 100644 --- a/erpnext/setup/doctype/naming_series/naming_series.txt +++ b/erpnext/setup/doctype/naming_series/naming_series.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-04-10 13:01:16', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-04-10 18:45:34', + 'modified': '2012-07-12 15:59:52', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -16,7 +16,7 @@ 'description': u'Set prefix for numbering series on your transactions', 'doctype': 'DocType', 'hide_heading': 0, - 'hide_toolbar': 0, + 'hide_toolbar': 1, 'issingle': 1, 'module': u'Setup', 'name': '__common__', @@ -24,7 +24,7 @@ 'section_style': u'Tray', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 66 + 'version': 1 }, # These values are common for all DocField @@ -123,7 +123,7 @@ 'fieldname': u'help_html', 'fieldtype': u'HTML', 'label': u'Help HTML', - 'options': u'
\nWrite the list of series options in the list below. Each on a new line
\nAllowed special characters are "/" and "-"
\nExamples:
\nINV-
\nINV-10-
\nINVK-
\n
' + 'options': u'
\nEdit list of Series in the box below. Each Series Prefix on a new line.

\nAllowed special characters are "/" and "-"
\nExamples:
\nINV-
\nINV-10-
\nINVK-
\n
' }, # DocField @@ -131,7 +131,7 @@ 'doctype': u'DocField', 'fieldname': u'set_options', 'fieldtype': u'Text', - 'label': u'Set Series' + 'label': u'Series List for this Transaction' }, # DocField @@ -146,16 +146,17 @@ # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'update', 'fieldtype': u'Button', - 'label': u'Update', - 'options': u'update_series' + 'label': u'Update' }, # DocField { - 'description': u'Set starting number for series of your transactions', + 'colour': u'White:FFF', + 'description': u'Change the starting / current sequence number of an existing series.', 'doctype': u'DocField', 'fieldname': u'update_series', 'fieldtype': u'Section Break', @@ -166,24 +167,27 @@ { 'doctype': u'DocField', 'fieldname': u'prefix', - 'fieldtype': u'Data', + 'fieldtype': u'Select', 'label': u'Prefix' }, # DocField { + 'colour': u'White:FFF', + 'description': u'This is the number of the last created transaction with this prefix', 'doctype': u'DocField', - 'fieldname': u'starts_from', + 'fieldname': u'current_value', 'fieldtype': u'Int', - 'label': u'Starts From' + 'label': u'Current Value' }, # DocField { + 'colour': u'White:FFF', 'doctype': u'DocField', 'fieldname': u'update_series_start', 'fieldtype': u'Button', - 'label': u'Update Series Start', + 'label': u'Update Series Number', 'options': u'update_series_start' } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/supplier_type/supplier_type.js b/erpnext/setup/doctype/supplier_type/supplier_type.js index 306ead0928..945dec0823 100644 --- a/erpnext/setup/doctype/supplier_type/supplier_type.js +++ b/erpnext/setup/doctype/supplier_type/supplier_type.js @@ -14,14 +14,6 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . - - -// ONLOAD -// =================================================================================== -cur_frm.cscript.onload = function(doc, cdt, cdn) { - -} - -cur_frm.cscript.refresh = function(doc, cdt, cdn) { - +cur_frm.cscript.refresh = function(doc) { + cur_frm.set_intro(doc.__islocal ? "" : "There is nothing to edit.") } \ No newline at end of file diff --git a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt index 09d71f4ad9..c120b2c4ff 100644 --- a/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt +++ b/erpnext/setup/doctype/terms_and_conditions/terms_and_conditions.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:25', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-03-27 14:36:25', + 'modified': '2012-07-12 11:37:56', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -17,6 +17,7 @@ 'autoname': u'field:title', 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Standard Terms and Conditions that can be added to Sales and Purchases.\n\nExamples:\n\n1. Validity of the offer.\n1. Payment Terms (In Advance, On Credit, part advance etc).\n1. What is extra (or payable by the Customer).\n1. Safety / usage warning.\n1. Warranty if any.\n1. Returns Policy.\n1. Terms of shipping, if applicable.\n1. Ways of addressing disputes, indemnity, liability, etc.\n1. Address and Contact of your Company.', 'doctype': 'DocType', 'document_type': u'Master', 'module': u'Setup', @@ -24,7 +25,7 @@ 'section_style': u'Simple', 'server_code_error': u' ', 'show_in_menu': 0, - 'version': 11 + 'version': 1 }, # These values are common for all DocField @@ -52,6 +53,42 @@ 'name': u'Terms and Conditions' }, + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 0 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 1, + 'create': 1, + 'doctype': u'DocPerm', + 'permlevel': 0, + 'role': u'Sales Master Manager', + 'submit': 0, + 'write': 1 + }, + + # DocPerm + { + 'amend': 0, + 'cancel': 0, + 'create': 0, + 'doctype': u'DocPerm', + 'permlevel': 1, + 'role': u'Sales User', + 'submit': 0, + 'write': 0 + }, + # DocPerm { 'amend': 0, @@ -91,42 +128,6 @@ 'write': 1 }, - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 0 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 1, - 'create': 1, - 'doctype': u'DocPerm', - 'permlevel': 0, - 'role': u'Sales Master Manager', - 'submit': 0, - 'write': 1 - }, - - # DocPerm - { - 'amend': 0, - 'cancel': 0, - 'create': 0, - 'doctype': u'DocPerm', - 'permlevel': 1, - 'role': u'Sales User', - 'submit': 0, - 'write': 0 - }, - # DocField { 'doctype': u'DocField', diff --git a/erpnext/stock/page/stock_home/stock_home.html b/erpnext/stock/page/stock_home/stock_home.html index 449a603424..0939a77681 100644 --- a/erpnext/stock/page/stock_home/stock_home.html +++ b/erpnext/stock/page/stock_home/stock_home.html @@ -57,7 +57,7 @@
Incoming Inspection + href="#!List/Quality Inspection">Quality Inspection
-
+

My List


diff --git a/public/css/all-app.css b/public/css/all-app.css index 4fa90aa1e4..9c5ae1cd24 100644 --- a/public/css/all-app.css +++ b/public/css/all-app.css @@ -2309,12 +2309,15 @@ div.notice { .help_box, .help-box { background-color: #ffe; - color: #874; padding: 9px 9px 9px 9px; border: 1px dashed #fc7; margin: 11px 0px; } +.help-box, .help-box p, .help-box h1, .help-box h2, .help-box h3, .help-box h4 { + color: #643; +} + /* * lib/css/legacy/forms.css diff --git a/public/css/all-web.css b/public/css/all-web.css index f825619d7d..322cb257a3 100644 --- a/public/css/all-web.css +++ b/public/css/all-web.css @@ -2170,12 +2170,15 @@ div.notice { .help_box, .help-box { background-color: #ffe; - color: #874; padding: 9px 9px 9px 9px; border: 1px dashed #fc7; margin: 11px 0px; } +.help-box, .help-box p, .help-box h1, .help-box h2, .help-box h3, .help-box h4 { + color: #643; +} + /* * lib/css/legacy/dialog.css diff --git a/public/js/all-app.js b/public/js/all-app.js index 7ee5607800..fe42bd1e37 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -608,7 +608,7 @@ document.body.appendChild(temp);temp.submit();return temp;} var msg_dialog;function msgprint(msg,title){if(!msg)return;if(typeof(msg)!='string') msg=JSON.stringify(msg);if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;} if(!msg_dialog){msg_dialog=new wn.ui.Dialog({title:"Message",onhide:function(){msg_dialog.msg_area.empty();}});msg_dialog.msg_area=$('
').appendTo(msg_dialog.body);} -if(msg.search(/
|

/)==-1) +if(msg.search(/
|

|

  • /)==-1) msg=replace_newlines(msg);msg_dialog.set_title(title||'Message') msg_dialog.msg_area.append(msg);msg_dialog.show();} var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('
    ').appendTo('body');} @@ -1701,7 +1701,8 @@ this.$w=this.appframe.$w;},refresh:function(){if(cur_frm.cscript.set_breadcrumbs this.refresh_labels();this.refresh_toolbar();},refresh_labels:function(){var labinfo={0:['Saved','label-success'],1:['Submitted','label-info'],2:['Cancelled','label-important']}[cint(cur_frm.doc.docstatus)];if(labinfo[0]=='Saved'&&cur_frm.meta.is_submittable){labinfo[0]='Saved, to Submit';} if(cur_frm.doc.__unsaved||cur_frm.doc.__islocal){labinfo[0]='Not Saved';labinfo[1]='label-warning'} this.set_label(labinfo);if(cur_frm.doc.__unsaved&&cint(cur_frm.doc.docstatus)==1&&this.appframe.buttons['Update']){this.appframe.buttons['Update'].toggle(true);}},set_label:function(labinfo){this.$w.find('.label').remove();$(repl('\ - %(lab_status)s',{lab_status:labinfo[0],lab_class:labinfo[1]})).insertBefore(this.$w.find('.breadcrumb-area'))},refresh_toolbar:function(){this.appframe.clear_buttons();var p=cur_frm.get_doc_perms();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable) + %(lab_status)s',{lab_status:labinfo[0],lab_class:labinfo[1]})).insertBefore(this.$w.find('.breadcrumb-area'))},refresh_toolbar:function(){if(cur_frm.meta.hide_toolbar){$('.appframe-toolbar').toggle(false);return;} +this.appframe.clear_buttons();var p=cur_frm.get_doc_perms();if(cur_frm.meta.read_only_onload&&!cur_frm.doc.__islocal){if(!cur_frm.editable) this.appframe.add_button('Edit',function(){cur_frm.edit_doc();},'icon-pencil');else this.appframe.add_button('Print View',function(){cur_frm.is_editable[cur_frm.docname]=0;cur_frm.refresh();},'icon-print');} var docstatus=cint(cur_frm.doc.docstatus);if(docstatus==0&&p[WRITE]){this.appframe.add_button('Save',function(){cur_frm.save('Save');},'');this.appframe.buttons['Save'].addClass('btn-info');} @@ -1749,6 +1750,8 @@ _f.Frm.prototype.setup_footer=function(){var me=this;var f=this.page_layout.foot f.hide_save=function(){$dh(me.page_layout.footer.save_area);}} _f.Frm.prototype.set_intro=function(txt){if(!this.intro_area){this.intro_area=$('
    ').insertBefore(this.page_layout.body.firstChild);} if(txt){if(txt.search(/

    /)==-1)txt='

    '+txt+'

    ';this.intro_area.html(txt);}else{this.intro_area.remove();this.intro_area=null;}} +_f.Frm.prototype.set_footnote=function(txt){if(!this.footnote_area){this.footnote_area=$('
    ').insertAfter(this.page_layout.body.lastChild);} +if(txt){if(txt.search(/

    /)==-1)txt='

    '+txt+'

    ';this.footnote_area.html(txt);}else{this.footnote_area.remove();this.footnote_area=null;}} _f.Frm.prototype.setup_fields_std=function(){var fl=wn.meta.docfield_list[this.doctype];fl.sort(function(a,b){return a.idx-b.idx});if(fl[0]&&fl[0].fieldtype!="Section Break"||get_url_arg('embed')){this.layout.addrow();if(fl[0].fieldtype!="Column Break"){var c=this.layout.addcell();$y(c.wrapper,{padding:'8px'});}} var sec;for(var i=0;iCreated:
    \ \ %(creation)s

    \ diff --git a/public/js/all-web.js b/public/js/all-web.js index de31023a5f..128a831b76 100644 --- a/public/js/all-web.js +++ b/public/js/all-web.js @@ -495,7 +495,7 @@ document.body.appendChild(temp);temp.submit();return temp;} var msg_dialog;function msgprint(msg,title){if(!msg)return;if(typeof(msg)!='string') msg=JSON.stringify(msg);if(msg.substr(0,8)=='__small:'){show_alert(msg.substr(8));return;} if(!msg_dialog){msg_dialog=new wn.ui.Dialog({title:"Message",onhide:function(){msg_dialog.msg_area.empty();}});msg_dialog.msg_area=$('
    ').appendTo(msg_dialog.body);} -if(msg.search(/
    |

    /)==-1) +if(msg.search(/
    |

    |

  • /)==-1) msg=replace_newlines(msg);msg_dialog.set_title(title||'Message') msg_dialog.msg_area.append(msg);msg_dialog.show();} var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('
    ').appendTo('body');} From 357fb2640b3416cfb631c689d4c9fa1f3ace5567 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Thu, 12 Jul 2012 18:00:21 +0530 Subject: [PATCH 2/2] sales bom fixes and mandatory in table fields --- .../doctype/email_digest/email_digest.js | 2 +- .../doctype/email_digest/email_digest.txt | 69 +++++++------------ .../doctype/email_settings/email_settings.txt | 62 +++++++++-------- .../notification_control.txt | 11 ++- erpnext/stock/doctype/sales_bom/sales_bom.js | 8 ++- erpnext/stock/doctype/sales_bom/sales_bom.py | 15 +++- erpnext/stock/doctype/sales_bom/sales_bom.txt | 4 +- public/js/all-app.js | 8 +-- public/js/all-web.js | 3 +- 9 files changed, 93 insertions(+), 89 deletions(-) diff --git a/erpnext/setup/doctype/email_digest/email_digest.js b/erpnext/setup/doctype/email_digest/email_digest.js index 1380e779ab..9d8d5b5db7 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.js +++ b/erpnext/setup/doctype/email_digest/email_digest.js @@ -116,7 +116,7 @@ cur_frm.cscript.add_to_rec_list = function(doc, tab, length) { } } doc.recipient_list = rec_list.join('\n'); - //console.log(doc.recipient_list); cur_frm.rec_dialog.hide(); + cur_frm.save(); cur_frm.refresh_fields(); } diff --git a/erpnext/setup/doctype/email_digest/email_digest.txt b/erpnext/setup/doctype/email_digest/email_digest.txt index 0a29a8caf3..7aa39ca4e9 100644 --- a/erpnext/setup/doctype/email_digest/email_digest.txt +++ b/erpnext/setup/doctype/email_digest/email_digest.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-03-27 14:36:20', + 'creation': '2012-07-03 13:30:54', 'docstatus': 0, - 'modified': '2012-03-27 14:36:20', + 'modified': '2012-07-12 16:29:08', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,13 +15,14 @@ '_last_update': u'1324556758', 'autoname': u'Prompt', 'colour': u'White:FFF', + 'description': u'Send regular summary reports via Email.', 'doctype': 'DocType', 'document_type': u'System', 'module': u'Setup', 'name': '__common__', 'section_style': u'Simple', 'show_in_menu': 0, - 'version': 81 + 'version': 1 }, # These values are common for all DocField @@ -70,7 +71,7 @@ 'doctype': u'DocField', 'fieldname': u'settings', 'fieldtype': u'Section Break', - 'label': u'Settings', + 'label': u'Email Digest Settings', 'permlevel': 0 }, @@ -144,16 +145,6 @@ 'permlevel': 0 }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'addremove_recipients', - 'fieldtype': u'Button', - 'label': u'Add/Remove Recipients', - 'permlevel': 0, - 'trigger': u'Client' - }, - # DocField { 'description': u'Note: Email will not be sent to disabled users', @@ -167,7 +158,19 @@ # DocField { + 'doctype': u'DocField', + 'fieldname': u'addremove_recipients', + 'fieldtype': u'Button', + 'label': u'Add/Remove Recipients', + 'permlevel': 0, + 'trigger': u'Client' + }, + + # DocField + { + 'colour': u'White:FFF', 'depends_on': u'eval:doc.use_standard', + 'description': u'Check all the items below that you want to send in this digest.', 'doctype': u'DocField', 'fieldname': u'select_digest_content', 'fieldtype': u'Section Break', @@ -245,6 +248,14 @@ 'permlevel': 0 }, + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb1', + 'fieldtype': u'Column Break', + 'permlevel': 0 + }, + # DocField { 'depends_on': u'eval:doc.use_standard', @@ -323,35 +334,5 @@ 'hidden': 1, 'label': u'Stock Items below re-order level', 'permlevel': 0 - }, - - # DocField - { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'enter_custom_code', - 'fieldtype': u'Section Break', - 'label': u'Enter Custom Code', - 'permlevel': 0 - }, - - # DocField - { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'custom_code', - 'fieldtype': u'Code', - 'label': u'Custom Python Code', - 'permlevel': 0 - }, - - # DocField - { - 'depends_on': u'eval:!doc.use_standard', - 'doctype': u'DocField', - 'fieldname': u'email_template', - 'fieldtype': u'Code', - 'label': u'Email Template', - 'permlevel': 0 } ] \ No newline at end of file diff --git a/erpnext/setup/doctype/email_settings/email_settings.txt b/erpnext/setup/doctype/email_settings/email_settings.txt index 2772367263..cf9d443198 100644 --- a/erpnext/setup/doctype/email_settings/email_settings.txt +++ b/erpnext/setup/doctype/email_settings/email_settings.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-15 12:15:01', + 'creation': '2012-07-03 13:30:55', 'docstatus': 0, - 'modified': '2012-06-14 14:47:49', + 'modified': '2012-07-12 16:16:27', 'modified_by': u'Administrator', 'owner': u'harshada@webnotestech.com' }, @@ -18,6 +18,7 @@ 'allow_print': 1, 'colour': u'White:FFF', 'default_print_format': u'Standard', + 'description': u'Email Settings for Outgoing and Incoming Emails.', 'doctype': 'DocType', 'in_create': 1, 'issingle': 1, @@ -70,6 +71,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Set your outgoing mail SMTP settings here. All system generated notifications, emails will go from this mail server. If you are not sure, leave this blank to use ERPNext servers (emails will still be sent from your email id) or contact your email provider.', 'doctype': u'DocField', 'fieldname': u'outgoing_mails', 'fieldtype': u'Section Break', @@ -78,29 +81,14 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'html1', - 'fieldtype': u'HTML', - 'label': u'1', - 'options': u'
    Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server
    ' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'SMTP Server (e.g. smtp.gmail.com)', 'doctype': u'DocField', 'fieldname': u'outgoing_mail_server', 'fieldtype': u'Data', 'label': u'Outgoing Mail Server' }, - # DocField - { - 'doctype': u'DocField', - 'fieldname': u'mail_port', - 'fieldtype': u'Int', - 'label': u'Mail Port' - }, - # DocField { 'doctype': u'DocField', @@ -111,6 +99,25 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'If non standard port (e.g. 587)', + 'doctype': u'DocField', + 'fieldname': u'mail_port', + 'fieldtype': u'Int', + 'label': u'Mail Port' + }, + + # DocField + { + 'doctype': u'DocField', + 'fieldname': u'cb0', + 'fieldtype': u'Column Break' + }, + + # DocField + { + 'colour': u'White:FFF', + 'description': u'Set Login and Password if authentication is required.', 'doctype': u'DocField', 'fieldname': u'mail_login', 'fieldtype': u'Data', @@ -127,6 +134,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'System generated mails will be sent from this email id.', 'doctype': u'DocField', 'fieldname': u'auto_email_id', 'fieldtype': u'Data', @@ -144,19 +153,12 @@ # DocField { - 'doctype': u'DocField', - 'fieldname': u'html2', - 'fieldtype': u'HTML', - 'label': u'2', - 'options': u'
    To automatically create Support Tickets from your incoming mail, set your pop3 settings here.
    ' - }, - - # DocField - { + 'colour': u'White:FFF', + 'description': u'To automatically create Support Tickets from your incoming mail, set your POP3 settings here. You must ideally create a separate email id for the erp system so that all emails will be synced into the system from that mail id. If you are not sure, please contact your EMail Provider.', 'doctype': u'DocField', 'fieldname': u'section_break0', 'fieldtype': u'Section Break', - 'options': u'Simple' + 'label': u'Incoming Mail Setting' }, # DocField @@ -216,7 +218,7 @@ # DocField { 'doctype': u'DocField', - 'fieldname': u'column_break0', + 'fieldname': u'cb1', 'fieldtype': u'Column Break' }, diff --git a/erpnext/setup/doctype/notification_control/notification_control.txt b/erpnext/setup/doctype/notification_control/notification_control.txt index 000902e54b..15c8eb2769 100644 --- a/erpnext/setup/doctype/notification_control/notification_control.txt +++ b/erpnext/setup/doctype/notification_control/notification_control.txt @@ -3,9 +3,9 @@ # These values are common in all dictionaries { - 'creation': '2012-05-03 16:16:21', + 'creation': '2012-07-03 13:30:56', 'docstatus': 0, - 'modified': '2012-05-03 16:23:29', + 'modified': '2012-07-12 16:20:36', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -16,6 +16,7 @@ 'allow_email': 1, 'allow_print': 1, 'colour': u'White:FFF', + 'description': u'Send automatic emails to Contacts on Submitting transactions.', 'doctype': 'DocType', 'issingle': 1, 'module': u'Setup', @@ -70,10 +71,12 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'When any of the checked transactions are "Submitted", an email is automatically sent to the associated "Contact" in that transaction, with the transaction as an attachment.', 'doctype': u'DocField', 'fieldname': u'send_autonotification_for', 'fieldtype': u'Section Break', - 'label': u'Send Auto-notification for' + 'label': u'Send Email Automatically on Submission of' }, # DocField @@ -152,6 +155,8 @@ # DocField { + 'colour': u'White:FFF', + 'description': u'Customize the introductory text that goes as a part of that email. Each transaction has a separate introductory text.', 'doctype': u'DocField', 'fieldname': u'customize_the_notification', 'fieldtype': u'Section Break', diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.js b/erpnext/stock/doctype/sales_bom/sales_bom.js index fe84272b45..68b9013521 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.js +++ b/erpnext/stock/doctype/sales_bom/sales_bom.js @@ -30,4 +30,10 @@ cur_frm.fields_dict.new_item_code.get_query = function() { } cur_frm.fields_dict.new_item_code.query_description = 'Select Item where "Is Stock Item" is "No" \ and "Is Sales Item" is "Yes" and there is no other Sales BOM'; - \ No newline at end of file + +cur_frm.cscript.item_code = function(doc, dt, dn) { + var d = locals[dt][dn]; + if (d.item_code){ + get_server_fields('get_item_details', d.item_code, 'sales_bom_items', doc ,dt, dn, 1); + } +} \ No newline at end of file diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.py b/erpnext/stock/doctype/sales_bom/sales_bom.py index 4a9ba2d3f1..1cf919894c 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.py +++ b/erpnext/stock/doctype/sales_bom/sales_bom.py @@ -33,10 +33,22 @@ class DocType: def validate_main_item(self): """main item must have Is Stock Item as No and Is Sales Item as Yes""" if not webnotes.conn.sql("""select name from tabItem where name=%s and - ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'"""): + ifnull(is_stock_item,'')='No' and ifnull(is_sales_item,'')='Yes'""", self.doc.new_item_code): webnotes.msgprint("""Parent Item %s is either a Stock Item or a not a Sales Item""", raise_exception=1) + def get_item_details(self, name): + det = webnotes.conn.sql("""select description, stock_uom from `tabItem` + where name = %s""", name) + rate = webnotes.conn.sql("""select ref_rate from `tabItem Price` + where price_list_name = %s and parent = %s + and ref_currency = %s""", (self.doc.price_list, name, self.doc.currency)) + return { + 'description' : det and det[0][0] or '', + 'uom': det and det[0][1] or '', + 'rate': rate and flt(rate[0][0]) or 0.00 + } + def check_duplicate(self, finder=0): il = getlist(self.doclist, "sales_bom_items") if not il: @@ -61,7 +73,6 @@ class DocType: if finder: webnotes.msgprint("There is no Sales BOM present with the following Combination.") - def has_same_items(self, l1, l2): if len(l1)!=len(l2): return 0 for l in l2: diff --git a/erpnext/stock/doctype/sales_bom/sales_bom.txt b/erpnext/stock/doctype/sales_bom/sales_bom.txt index c131d1cc8b..74268215dd 100644 --- a/erpnext/stock/doctype/sales_bom/sales_bom.txt +++ b/erpnext/stock/doctype/sales_bom/sales_bom.txt @@ -5,7 +5,7 @@ { 'creation': '2012-07-03 13:30:44', 'docstatus': 0, - 'modified': '2012-07-11 19:17:51', + 'modified': '2012-07-12 18:00:16', 'modified_by': u'Administrator', 'owner': u'Administrator' }, @@ -15,7 +15,7 @@ '_last_update': u'1322549701', 'allow_trash': 1, 'colour': u'White:FFF', - 'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the packed **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials', + 'description': u'Aggregate group of **Items** into another **Item**. This is useful if you are bundling a certain **Items** into a package and you maintain stock of the packed **Items** and not the aggregate **Item**. \n\nThe package **Item** will have "Is Stock Item" as "No" and "Is Sales Item" as "Yes".\n\nFor Example: If you are selling Laptops and Backpacks separately and have a special price if the customer buys both, then the Laptop + Backpack will be a new Sales BOM Item.\n\nNote: BOM = Bill of Materials', 'doctype': 'DocType', 'document_type': u'Master', 'is_submittable': 0, diff --git a/public/js/all-app.js b/public/js/all-app.js index fe42bd1e37..fbd3f8966d 100644 --- a/public/js/all-app.js +++ b/public/js/all-app.js @@ -1376,7 +1376,8 @@ return;} var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;} if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));} if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}} -function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;iMandatory fields required in '+ (doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':\n'+errfld.join('\n'));return all_clear;} @@ -1813,10 +1814,7 @@ locals[this.doctype][this.docname].trash_reason=reason;} if(save_action=='Cancel'){var reason=prompt('Reason for cancellation (mandatory)','');if(!strip(reason)){msgprint('Reason is mandatory, not cancelled');return;} locals[this.doctype][this.docname].cancel_reason=reason;locals[this.doctype][this.docname].cancelled_on=dateutil.full_str();locals[this.doctype][this.docname].cancelled_by=user;}else if(save_action=='Update'){}else{validated=true;if(this.cscript.validate) this.runclientscript('validate',this.doctype,this.docname);if(!validated){this.savingflag=false;return'Error';}} -var ret_fn=function(r){me.savingflag=false;if(user=='Guest'&&!r.exc){$dh(me.page_layout.wrapper);$ds(me.saved_wrapper);me.saved_wrapper.innerHTML='
    ' -+(cur_frm.message_after_save?cur_frm.message_after_save:'Your information has been sent. Thank you!') -+'
    ';return;} -if(!me.meta.istable){me.refresh(r.docname);} +var ret_fn=function(r){me.savingflag=false;if(!me.meta.istable&&r){me.refresh(r.docname);} if(call_back){call_back(r);}} var me=this;var ret_fn_err=function(r){var doc=locals[me.doctype][me.docname];me.savingflag=false;ret_fn(r);} this.savingflag=true;if(this.docname&&validated){scroll(0,0);return this.savedoc(save_action,ret_fn,ret_fn_err);}} diff --git a/public/js/all-web.js b/public/js/all-web.js index 128a831b76..b2cae26a3b 100644 --- a/public/js/all-web.js +++ b/public/js/all-web.js @@ -687,7 +687,8 @@ return;} var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;} if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));} if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}} -function check_required(dt,dn,parent_dt){var doc=locals[dt][dn];if(doc.docstatus>1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;i1)return true;var fl=wn.meta.docfield_list[dt];if(!fl)return true;var all_clear=true;var errfld=[];for(var i=0;iMandatory fields required in '+ (doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':\n'+errfld.join('\n'));return all_clear;}