Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-11-16 08:09:24 +01:00
commit fde69be5bf
8 changed files with 248 additions and 141 deletions

View File

@ -0,0 +1,22 @@
# ERPNext - web based ERP (http://erpnext.com)
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
import webnotes
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl

View File

@ -0,0 +1,76 @@
# DocType, Activity Type
[
# These values are common in all dictionaries
{
u'creation': '2012-07-03 13:30:51',
u'docstatus': 0,
u'modified': '2012-11-16 12:14:21',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
{
'autoname': u'field:activity_type',
'colour': u'White:FFF',
u'doctype': u'DocType',
'document_type': u'Master',
'in_dialog': 1,
'module': u'Projects',
u'name': u'__common__',
'section_style': u'Simple',
'server_code_error': u' ',
'version': 1
},
# These values are common for all DocField
{
u'doctype': u'DocField',
'fieldname': u'activity_type',
'fieldtype': u'Data',
'label': u'Activity Type',
u'name': u'__common__',
'parent': u'Activity Type',
'parentfield': u'fields',
'parenttype': u'DocType',
'permlevel': 0,
'reqd': 1
},
# These values are common for all DocPerm
{
'create': 1,
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Activity Type',
'parentfield': u'permissions',
'parenttype': u'DocType',
'permlevel': 0,
'read': 1,
'write': 1
},
# DocType, Activity Type
{
u'doctype': u'DocType',
u'name': u'Activity Type'
},
# DocField
{
u'doctype': u'DocField'
},
# DocPerm
{
u'doctype': u'DocPerm',
'role': u'System Manager'
},
# DocPerm
{
u'doctype': u'DocPerm',
'role': u'Projects User'
}
]

View File

@ -5,7 +5,7 @@
{
u'creation': '2012-08-08 10:41:31',
u'docstatus': 0,
u'modified': '2012-11-15 12:36:41',
u'modified': '2012-11-16 12:26:14',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
@ -321,7 +321,7 @@
# DocField
{
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
'description': u'<a href="#Sales Browser/Territory">To manage Territory, click here</a>',
u'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',

View File

@ -3,11 +3,11 @@
# These values are common in all dictionaries
{
'creation': '2012-05-15 12:14:52',
'docstatus': 0,
'modified': '2012-05-31 12:42:38',
'modified_by': u'Administrator',
'owner': u'Administrator'
u'creation': '2012-07-03 13:30:38',
u'docstatus': 0,
u'modified': '2012-11-16 12:27:49',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
# These values are common for all DocType
@ -15,11 +15,11 @@
'_last_update': u'1324284087',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
u'doctype': u'DocType',
'document_type': u'Transaction',
'is_submittable': 1,
'module': u'Selling',
'name': '__common__',
u'name': u'__common__',
'search_fields': u'status,transaction_date,customer,lead,enquiry_type,territory,company',
'section_style': u'Tabbed',
'server_code_error': u' ',
@ -30,8 +30,8 @@
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
u'doctype': u'DocField',
u'name': u'__common__',
'parent': u'Opportunity',
'parentfield': u'fields',
'parenttype': u'DocType'
@ -39,8 +39,8 @@
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
u'doctype': u'DocPerm',
u'name': u'__common__',
'parent': u'Opportunity',
'parentfield': u'permissions',
'parenttype': u'DocType',
@ -49,82 +49,15 @@
# DocType, Opportunity
{
'doctype': 'DocType',
'name': u'Opportunity'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'submit': 1,
'write': 1
u'doctype': u'DocType',
u'name': u'Opportunity'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Enter customer enquiry for which you might raise a quotation in future',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'basic_info',
'fieldtype': u'Section Break',
'label': u'Basic Info',
@ -136,7 +69,7 @@
{
'colour': u'White:FFF',
'description': u'To manage multiple series please go to Setup > Manage Series',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'naming_series',
'fieldtype': u'Select',
'label': u'Naming Series',
@ -151,7 +84,7 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'enquiry_from',
'fieldtype': u'Select',
'label': u'Opportunity From',
@ -168,7 +101,7 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'customer',
'fieldtype': u'Link',
'hidden': 0,
@ -186,7 +119,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'lead',
'fieldtype': u'Link',
'hidden': 0,
@ -202,7 +135,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
@ -214,7 +147,7 @@
{
'colour': u'White:FFF',
'default': u'Draft',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'status',
'fieldtype': u'Select',
'label': u'Status',
@ -229,7 +162,7 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'enquiry_type',
'fieldtype': u'Select',
'label': u'Opportunity Type',
@ -243,7 +176,7 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'items',
'fieldtype': u'Section Break',
'label': u'Items',
@ -255,7 +188,7 @@
{
'colour': u'White:FFF',
'description': u"Items which do not exist in Item master can also be entered on customer's request",
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'enquiry_details',
'fieldtype': u'Table',
'label': u'Opportunity Items',
@ -269,7 +202,7 @@
{
'colour': u'White:FFF',
'description': u'Keep a track of communication related to this enquiry which will help for future reference.',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'communication_history',
'fieldtype': u'Section Break',
'label': u'Communication History',
@ -281,7 +214,7 @@
{
'allow_on_submit': 1,
'colour': u'White:FFF',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'communication_html',
'fieldtype': u'HTML',
'label': u'Communication HTML',
@ -292,7 +225,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_info',
'fieldtype': u'Section Break',
'label': u'Contact Info',
@ -301,7 +234,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_person',
'fieldtype': u'Link',
'in_filter': 1,
@ -314,7 +247,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'customer_address',
'fieldtype': u'Link',
'in_filter': 1,
@ -327,7 +260,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Data',
'label': u'Customer Name',
@ -337,7 +270,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'address_display',
'fieldtype': u'Small Text',
'hidden': 0,
@ -349,7 +282,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'column_break3',
'fieldtype': u'Column Break',
'permlevel': 0
@ -357,7 +290,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_display',
'fieldtype': u'Small Text',
'label': u'Contact',
@ -366,7 +299,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_email',
'fieldtype': u'Text',
'label': u'Contact Email',
@ -375,7 +308,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_mobile',
'fieldtype': u'Text',
'label': u'Contact Mobile No',
@ -384,7 +317,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'lead_name',
'fieldtype': u'Data',
'hidden': 0,
@ -398,8 +331,8 @@
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.enquiry_from=="Customer"',
'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To Manage Customer Groups, click here</a>',
'doctype': u'DocField',
'description': u'<a href="#Sales Browser/Customer Group">To manage Territory, click here</a>',
u'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'hidden': 0,
@ -418,8 +351,8 @@
# DocField
{
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To Manage Territory, click here</a>',
'doctype': u'DocField',
'description': u'<a href="#Sales Browser/Territory">To manage Territory, click here</a>',
u'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'in_filter': 1,
@ -436,7 +369,7 @@
{
'colour': u'White:FFF',
'description': u'Filing in Additional Information about the Opportunity will help you analyze your data better.',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'more_info',
'fieldtype': u'Section Break',
'label': u'More Info',
@ -446,7 +379,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'column_break1',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
@ -458,7 +391,7 @@
{
'default': u'Today',
'description': u'The date at which current entry is made in system.',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'transaction_date',
'fieldtype': u'Date',
'label': u'Opportunity Date',
@ -471,7 +404,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'fiscal_year',
'fieldtype': u'Select',
'in_filter': 1,
@ -487,7 +420,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'source',
'fieldtype': u'Select',
'label': u'Source',
@ -501,7 +434,7 @@
{
'colour': u'White:FFF',
'description': u'Enter name of campaign if source of enquiry is campaign',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'campaign',
'fieldtype': u'Link',
'label': u'Campaign',
@ -515,7 +448,7 @@
{
'colour': u'White:FFF',
'depends_on': u'eval:!doc.__islocal',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'order_lost_reason',
'fieldtype': u'Small Text',
'label': u'Quotation Lost Reason',
@ -528,7 +461,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
'in_filter': 1,
@ -544,7 +477,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'column_break2',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
@ -556,7 +489,7 @@
{
'colour': u'White:FFF',
'description': u'Your sales person who will contact the customer in future',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_by',
'fieldtype': u'Link',
'in_filter': 1,
@ -572,7 +505,7 @@
{
'colour': u'White:FFF',
'description': u'Your sales person will get a reminder on this date to contact the customer',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'contact_date',
'fieldtype': u'Date',
'label': u'Next Contact Date',
@ -587,7 +520,7 @@
'colour': u'White:FFF',
'depends_on': u'eval:!doc.__islocal',
'description': u'Date on which the lead was last contacted',
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'last_contact_date',
'fieldtype': u'Date',
'label': u'Last Contact Date',
@ -600,7 +533,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'to_discuss',
'fieldtype': u'Small Text',
'label': u'To Discuss',
@ -612,7 +545,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'amended_from',
'fieldtype': u'Data',
'label': u'Amended From',
@ -626,7 +559,7 @@
# DocField
{
'doctype': u'DocField',
u'doctype': u'DocField',
'fieldname': u'amendment_date',
'fieldtype': u'Date',
'label': u'Amendment Date',
@ -636,5 +569,72 @@
'permlevel': 1,
'print_hide': 1,
'width': u'150px'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'submit': 1,
'write': 1
},
# DocPerm
{
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'System Manager'
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales User',
'submit': 1,
'write': 1
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
u'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Sales User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 1,
'cancel': 1,
'create': 1,
u'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Sales Manager',
'submit': 1,
'write': 1
}
]

View File

@ -31,6 +31,11 @@ cur_frm.cscript.refresh = function(doc) {
cur_frm.cscript.hide_website_fields(doc);
}
cur_frm.cscript.item_code = function(doc) {
if(!doc.item_name) cur_frm.set_value("item_name", doc.item_code);
if(!doc.description) cur_frm.set_value("description", doc.item_code);
}
cur_frm.cscript.hide_website_fields = function(doc) {
var website_fields_list = ['page_name', 'website_image', 'web_short_description',
'web_long_description'];

View File

@ -85,7 +85,9 @@ class DocType:
# On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
def on_trash(self):
sql("delete from tabBin where item_code='%s'"%(self.doc.item_code))
sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
sql("""delete from `tabStock Ledger Entry`
where item_code=%s and is_cancelled='Yes' """, self.doc.item_code)
self.delete_web_cache(self.doc.page_name)
@ -164,7 +166,7 @@ class DocType:
msgprint("As Production Order can be made for this Item, then Is Stock Item Should be 'Yes' as we maintain it's stock. Refer Manufacturing and Inventory section.", raise_exception=1)
if self.doc.is_stock_item == "Yes" and not self.doc.default_warehouse:
msgprint("As we maintain stock of this item, its better to maintain default warehouse. To add default warehouse please go to 'Inventory' section. It will be fetched automatically while making Sales Order, Delivery Note, etc.. ", 1)
msgprint("Please set Default Warehouse for Stock Item", raise_exception=1)
if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1)

View File

@ -5,7 +5,7 @@
{
u'creation': '2012-10-26 16:49:39',
u'docstatus': 0,
u'modified': '2012-11-12 18:15:45',
u'modified': '2012-11-16 12:35:02',
u'modified_by': u'Administrator',
u'owner': u'Administrator'
},
@ -202,21 +202,6 @@
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Enter unit of measurement in which stock of this item is maintained in your warehouse.',
u'doctype': u'DocField',
'fieldname': u'stock_uom',
'fieldtype': u'Link',
'label': u'Default UoM',
'oldfieldname': u'stock_uom',
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
@ -235,6 +220,8 @@
# DocField
{
'colour': u'White:FFF',
'description': u'Mandatory if Stock Item is "Yes"',
u'doctype': u'DocField',
'fieldname': u'default_warehouse',
'fieldtype': u'Link',
@ -245,6 +232,21 @@
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'Enter unit of measurement in which stock of this item is maintained in your warehouse.',
u'doctype': u'DocField',
'fieldname': u'stock_uom',
'fieldtype': u'Link',
'label': u'Default UoM',
'oldfieldname': u'stock_uom',
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',