fixed conflict
This commit is contained in:
commit
0c9a262de4
@ -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',
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
}
|
||||
]
|
||||
]
|
@ -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
|
||||
|
@ -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) {
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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()
|
||||
|
@ -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
|
||||
}
|
||||
]
|
||||
]
|
@ -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'""")
|
8
erpnext/patches/july_2012/update_purchase_tax.py
Normal file
8
erpnext/patches/july_2012/update_purchase_tax.py
Normal file
@ -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'""")
|
@ -488,7 +488,11 @@ patch_list = [
|
||||
'description': "set default freeze_account as 'No' where NULL"
|
||||
},
|
||||
{
|
||||
'patch_module': 'patches.june_2012',
|
||||
'patch_module': 'patches.july_2012',
|
||||
'patch_file': 'update_purchase_tax',
|
||||
'description': "rename options in purchase taxes and charges"
|
||||
},
|
||||
{ 'patch_module': 'patches.june_2012',
|
||||
'patch_file': 'cms2',
|
||||
'description': 'cms2 release patches'
|
||||
},
|
||||
|
@ -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',
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -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'<div class="help_box">Set your outgoing mail settings here. All system generated notifications, emails will go from this mail server</div>'
|
||||
},
|
||||
|
||||
# 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'<div class="help_box">To automatically create Support Tickets from your incoming mail, set your pop3 settings here.</div>'
|
||||
},
|
||||
|
||||
# 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'
|
||||
},
|
||||
|
||||
|
@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
// 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');
|
||||
})
|
||||
}
|
||||
|
@ -14,7 +14,6 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# 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")
|
||||
|
@ -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'<div style="padding: 8px; background-color: #FFD; margin: 8px 0px;">\nWrite the list of series options in the list below. Each on a new line<br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>'
|
||||
'options': u'<div class="help-box">\nEdit list of Series in the box below. Each Series Prefix on a new line.<br><br>\nAllowed special characters are "/" and "-"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>'
|
||||
},
|
||||
|
||||
# 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'
|
||||
}
|
||||
]
|
@ -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',
|
||||
|
@ -14,14 +14,6 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
|
||||
// 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.")
|
||||
}
|
@ -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',
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
'creation': '2012-07-03 13:30:46',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-07-11 09:57:40',
|
||||
'modified': '2012-07-11 09:57:42',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
@ -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';
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
@ -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:
|
||||
|
@ -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,
|
||||
|
@ -57,7 +57,7 @@
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "Readings of incoming quality inspections"
|
||||
href="#!List/Quality Inspection">Incoming Inspection</a>
|
||||
href="#!List/Quality Inspection">Quality Inspection</a>
|
||||
</div>
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
|
@ -49,7 +49,7 @@
|
||||
padding-right: 15px;
|
||||
}
|
||||
|
||||
.layout-main {
|
||||
.todo-layout {
|
||||
background-color: #FFFDC9;
|
||||
min-height: 300px;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="appframe-area"></div>
|
||||
<div class="layout-main">
|
||||
<div class="layout-main todo-layout">
|
||||
<div>
|
||||
<div id="todo-list">
|
||||
<h4>My List</h4><br>
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -607,7 +607,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=$('<div class="msgprint">').appendTo(msg_dialog.body);}
|
||||
if(msg.search(/<br>|<p>/)==-1)
|
||||
if(msg.search(/<br>|<p>|<li>/)==-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){$('<div id="dialog-container">').appendTo('body');}
|
||||
@ -1375,7 +1375,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;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
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;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].fieldtype=='Table'){var no_value=true;$.each(locals[fl[i].options],function(k,d){if(d.parent==doc.name&&d.parenttype==doc.doctype&&d.parentfield==fl[i].fieldname){no_value=false;}});}else{var no_value=is_null(v);}
|
||||
if(fl[i].reqd&&no_value&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
if(all_clear)all_clear=false;}}
|
||||
if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
(doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
|
||||
@ -1700,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('<span class="label %(lab_class)s">\
|
||||
%(lab_status)s</span>',{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</span>',{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');}
|
||||
@ -1748,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=$('<div class="help-box form-intro-area">').insertBefore(this.page_layout.body.firstChild);}
|
||||
if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';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=$('<div class="help-box form-intro-area">').insertAfter(this.page_layout.body.lastChild);}
|
||||
if(txt){if(txt.search(/<p>/)==-1)txt='<p>'+txt+'</p>';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;i<fl.length;i++){var f=fl[i];if(f.fieldtype=='Section Break'&&fl[i+1]&&fl[i+1].fieldtype=='Section Break')
|
||||
continue;var fn=f.fieldname?f.fieldname:f.label;var fld=make_field(f,this.doctype,this.layout.cur_cell,this);this.fields[this.fields.length]=fld;this.fields_dict[fn]=fld;if(sec&&['Section Break','Column Break'].indexOf(f.fieldtype)==-1){fld.parent_section=sec;sec.fields.push(fld);}
|
||||
@ -1809,10 +1813,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='<div style="padding: 150px 16px; text-align: center; font-size: 14px;">'
|
||||
+(cur_frm.message_after_save?cur_frm.message_after_save:'Your information has been sent. Thank you!')
|
||||
+'</div>';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);}}
|
||||
@ -1858,6 +1859,7 @@ _f.Frm.prototype.toggle_fields=function(fields,show){if(show){unhide_field(field
|
||||
else{hide_field(fields)}}
|
||||
_f.Frm.prototype.enable_fields=function(fields,enable){if(typeof fields=='string')fields=[fields];$.each(fields,function(i,f){var field=cur_frm.fields_dict[f];if(field){field.disabled=enable?false:true;field.refresh&&field.refresh();};})}
|
||||
_f.Frm.prototype.call_server=function(method,args,callback){$c_obj(cur_frm.get_doclist(),method,args,callback);}
|
||||
_f.Frm.prototype.set_value=function(field,value){cur_frm.get_doc()[field]=value;cur_frm.fields_dict[field].refresh();}
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/form_fields.js
|
||||
*/
|
||||
@ -2177,7 +2179,7 @@ CommentItem.prototype.cmt_delete=function(cell,ri,ci,d){var me=this;if(d[ri][2]=
|
||||
/*
|
||||
* lib/js/legacy/wn/widgets/form/sidebar.js
|
||||
*/
|
||||
wn.widgets.form.sidebar={Sidebar:function(form){var me=this;this.form=form;this.opts={sections:[{title:'Actions',items:[{type:'link',label:'New',icon:'icon-plus',display:function(){return in_list(profile.can_create,form.doctype)},onclick:function(){new_doc(me.form.doctype)}},{type:'link',label:'List',icon:'icon-list',display:function(){return!me.form.meta.issingle&&!me.form.meta.read_only;},onclick:function(){window.location.href="#!List/"+me.form.doctype}},{type:'link',label:'Refresh',icon:'icon-refresh',onclick:function(){me.form.reload_doc()}},{type:'link',label:'Print',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_print);},icon:'icon-print',onclick:function(){me.form.print_doc()}},{type:'link',label:'Email',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_email);},icon:'icon-envelope',onclick:function(){me.form.email_doc()}},{type:'link',label:'Copy',display:function(){return in_list(profile.can_create,me.form.doctype)&&!me.form.meta.allow_copy},icon:'icon-file',onclick:function(){me.form.copy_doc()}},{type:'link',label:'Delete',display:function(){return(cint(me.form.doc.docstatus)!=1)&&!me.form.doc.__islocal&&wn.model.can_delete(me.form.doctype);},icon:'icon-remove-sign',onclick:function(){me.form.savetrash()}}]},{title:'Assign To',render:function(wrapper){me.form.assign_to=new wn.widgets.form.sidebar.AssignTo(wrapper,me,me.form.doctype,me.form.docname);},display:function(){if(me.form.doc.__local)return false;else return true;}},{title:'Attachments',render:function(wrapper){me.form.attachments=new wn.widgets.form.sidebar.Attachments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return me.form.meta.allow_attach}},{title:'Comments',render:function(wrapper){new wn.widgets.form.sidebar.Comments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return!me.form.doc.__islocal}},{title:'Tags',render:function(wrapper){me.form.taglist=new TagList(wrapper,me.form.doc._user_tags?me.form.doc._user_tags.split(','):[],me.form.doctype,me.form.docname,0,function(){});},display:function(){return!me.form.doc.__islocal}},{title:'Users',render:function(wrapper){var doc=cur_frm.doc;var scrub_date=function(d){if(d)t=d.split(' ');else return'';return dateutil.str_to_user(t[0])+' '+t[1];}
|
||||
wn.widgets.form.sidebar={Sidebar:function(form){var me=this;this.form=form;this.opts={sections:[{title:'Actions',items:[{type:'link',label:'New',icon:'icon-plus',display:function(){return in_list(profile.can_create,form.doctype)},onclick:function(){new_doc(me.form.doctype)}},{type:'link',label:'List',icon:'icon-list',display:function(){return!me.form.meta.issingle&&!me.form.meta.read_only;},onclick:function(){window.location.href="#!List/"+me.form.doctype}},{type:'link',label:'Refresh',icon:'icon-refresh',onclick:function(){me.form.reload_doc()}},{type:'link',label:'Print',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_print);},icon:'icon-print',onclick:function(){me.form.print_doc()}},{type:'link',label:'Email',display:function(){return!(me.form.doc.__islocal||me.form.meta.allow_email);},icon:'icon-envelope',onclick:function(){me.form.email_doc()}},{type:'link',label:'Copy',display:function(){return in_list(profile.can_create,me.form.doctype)&&!me.form.meta.allow_copy},icon:'icon-file',onclick:function(){me.form.copy_doc()}},{type:'link',label:'Delete',display:function(){return(cint(me.form.doc.docstatus)!=1)&&!me.form.doc.__islocal&&wn.model.can_delete(me.form.doctype);},icon:'icon-remove-sign',onclick:function(){me.form.savetrash()}}],display:function(){return me.form.meta.hide_toolbar?false:true;}},{title:'Assign To',render:function(wrapper){me.form.assign_to=new wn.widgets.form.sidebar.AssignTo(wrapper,me,me.form.doctype,me.form.docname);},display:function(){if(me.form.doc.__local)return false;else return true;}},{title:'Attachments',render:function(wrapper){me.form.attachments=new wn.widgets.form.sidebar.Attachments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return me.form.meta.allow_attach}},{title:'Comments',render:function(wrapper){new wn.widgets.form.sidebar.Comments(wrapper,me,me.form.doctype,me.form.docname);},display:function(){return!me.form.doc.__islocal}},{title:'Tags',render:function(wrapper){me.form.taglist=new TagList(wrapper,me.form.doc._user_tags?me.form.doc._user_tags.split(','):[],me.form.doctype,me.form.docname,0,function(){});},display:function(){return!me.form.doc.__islocal}},{title:'Users',render:function(wrapper){var doc=cur_frm.doc;var scrub_date=function(d){if(d)t=d.split(' ');else return'';return dateutil.str_to_user(t[0])+' '+t[1];}
|
||||
$(wrapper).html(repl('<p>Created:<br> <span class="avatar-small">\
|
||||
<img title="%(created_by)s" src="%(avatar_created)s" /></span> \
|
||||
<span class="help small">%(creation)s</span></p>\
|
||||
|
@ -494,7 +494,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=$('<div class="msgprint">').appendTo(msg_dialog.body);}
|
||||
if(msg.search(/<br>|<p>/)==-1)
|
||||
if(msg.search(/<br>|<p>|<li>/)==-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){$('<div id="dialog-container">').appendTo('body');}
|
||||
@ -686,7 +686,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;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].reqd&&is_null(v)&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
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;i<fl.length;i++){var key=fl[i].fieldname;var v=doc[key];if(fl[i].fieldtype=='Table'){var no_value=true;$.each(locals[fl[i].options],function(k,d){if(d.parent==doc.name&&d.parenttype==doc.doctype&&d.parentfield==fl[i].fieldname){no_value=false;}});}else{var no_value=is_null(v);}
|
||||
if(fl[i].reqd&&no_value&&fl[i].fieldname){errfld[errfld.length]=fl[i].label;if(cur_frm){var f=cur_frm.fields_dict[fl[i].fieldname];if(f){if(f.set_as_error)f.set_as_error(1);if(!cur_frm.error_in_section&&f.parent_section){cur_frm.error_in_section=1;}}}
|
||||
if(all_clear)all_clear=false;}}
|
||||
if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
(doc.parenttype?(wn.meta.docfield_map[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
|
||||
|
Loading…
x
Reference in New Issue
Block a user