moved directory structure

This commit is contained in:
Rushabh Mehta
2012-09-24 19:13:42 +05:30
parent e47a6779e9
commit 2fa2f7178d
1637 changed files with 47 additions and 11450 deletions

View File

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

View File

@@ -0,0 +1,19 @@
// 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/>.
cur_frm.cscript.refresh = function(doc) {
cur_frm.toggle_display('warehouse_name', doc.__islocal);
}

View File

@@ -0,0 +1,123 @@
# 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/>.
# Please edit this list and import only required elements
from __future__ import unicode_literals
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 get_bin(self, item_code):
bin = sql("select name from tabBin where item_code = %s and \
warehouse = %s", (item_code, self.doc.name))
bin = bin and bin[0][0] or ''
if not bin:
if not self.doc.warehouse_type :
msgprint("[Warehouse Type is Mandatory] Please Enter warehouse type in Warehouse " + self.doc.name)
raise Exception
bin = Document('Bin')
bin.item_code = item_code
bin.stock_uom = get_value('Item', item_code, 'stock_uom')
bin.warehouse = self.doc.name
bin.warehouse_type = self.doc.warehouse_type
bin_obj = get_obj(doc=bin)
bin_obj.validate()
bin.save(1)
bin = bin.name
else:
bin_obj = get_obj('Bin',bin)
return bin_obj
def validate_asset(self, item_code):
if sql("select is_asset_item from tabItem where name=%s", item_code)[0][0] == 'Yes' and self.doc.warehouse_type != 'Fixed Asset':
msgprint("Fixed Asset Item %s can only be transacted in a Fixed Asset type Warehouse" % item_code)
raise Exception
# update bin
# ----------
def update_bin(self, actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, item_code, dt, sle_id = '',posting_time = '', serial_no = '', is_cancelled = 'No',doc_type='',doc_name='',is_amended='No'):
self.validate_asset(item_code)
it_det = get_value('Item', item_code, 'is_stock_item')
if it_det and it_det == 'Yes':
bin = self.get_bin(item_code)
bin.update_stock(actual_qty, reserved_qty, ordered_qty, indented_qty, planned_qty, dt, sle_id, posting_time, serial_no, is_cancelled,doc_type,doc_name,is_amended)
return bin
else:
msgprint("[Stock Update] Ignored %s since it is not a stock item" % item_code)
# repost stock
# ------------
def repost_stock(self):
bl = sql("select name from tabBin where warehouse=%s", self.doc.name)
for b in bl:
bobj = get_obj('Bin',b[0])
bobj.update_entries_after(posting_date = '0000-00-00', posting_time = '00:00')
sql("COMMIT")
sql("START TRANSACTION")
def check_state(self):
return "\n" + "\n".join([i[0] for i in sql("select state_name from `tabState` where `tabState`.country='%s' " % self.doc.country)])
def validate(self):
if self.doc.email_id:
if not validate_email_add(self.doc.email_id):
msgprint("Please enter valid Email Id.")
raise Exception
if not self.doc.warehouse_type:
msgprint("[Warehouse Type is Mandatory] Please Enter Please Entry warehouse type in Warehouse " + self.doc.name)
raise Exception
wt = sql("select warehouse_type from `tabWarehouse` where name ='%s'" % self.doc.name)
if cstr(self.doc.warehouse_type) != cstr(wt and wt[0][0] or ''):
sql("update `tabStock Ledger Entry` set warehouse_type = '%s' where warehouse = '%s'" % (self.doc.warehouse_type, self.doc.name))
msgprint("All Stock Ledger Entries Updated.")
def on_trash(self):
# delete bin
bins = sql("select * from `tabBin` where warehouse = %s", self.doc.name, as_dict=1)
for d in bins:
if d['actual_qty'] or d['reserved_qty'] or d['ordered_qty'] or d['indented_qty'] or d['projected_qty'] or d['planned_qty']:
msgprint("Warehouse: %s can not be deleted as qty exists for item: %s" % (self.doc.name, d['item_code']), raise_exception=1)
else:
sql("delete from `tabBin` where name = %s", d['name'])
# delete cancelled sle
if sql("select name from `tabStock Ledger Entry` where warehouse = %s and ifnull('is_cancelled', '') = 'No'", self.doc.name):
mdgprint("Warehosue can not be deleted as stock ledger entry exists for this warehosue.", raise_exception=1)
else:
sql("delete from `tabStock Ledger Entry` where warehouse = %s", self.doc.name)

View File

@@ -0,0 +1,363 @@
# DocType, Warehouse
[
# These values are common in all dictionaries
{
'creation': '2012-07-03 13:30:45',
'docstatus': 0,
'modified': '2012-07-11 10:18:07',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1319016431',
'allow_trash': 1,
'autoname': u'field:warehouse_name',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'description': u'A logical Warehouse against which stock entries are made.\n\nThere are two main Warehouse Types that are significant in ERPNext.\n\n1. **Stores:** These are where your incoming **Items** are kept before they are consumed or sold. You can have as many \u201cStores\u201d type **Warehouses** as you wish. Stores type warehouses are significant because if you set an Item for automatic re-order, ERPNext will check its quantities in all \u201cStores\u201d type **Warehouses** when deciding whether to re-order or not.\n\n2. **Asset**: **Items** marked as type \u201cFixed Asset\u201d are maintained in Asset Type **Warehouses**. This helps you separate them for the **Items** that are consumed as a part of your regular operations or \u201cCost of Goods Sold\u201d.\n',
'doctype': 'DocType',
'document_type': u'Master',
'module': u'Stock',
'name': '__common__',
'search_fields': u'warehouse_type',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 1
},
# These values are common for all DocField
{
'doctype': u'DocField',
'name': '__common__',
'parent': u'Warehouse',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'doctype': u'DocPerm',
'name': '__common__',
'parent': u'Warehouse',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1
},
# DocType, Warehouse
{
'doctype': 'DocType',
'name': u'Warehouse'
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material User',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'amend': 0,
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Manager',
'submit': 0,
'write': 0
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'All'
},
# DocPerm
{
'amend': 0,
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Material Master Manager',
'submit': 0,
'write': 1
},
# DocPerm
{
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Material Master Manager'
},
# DocPerm
{
'cancel': 1,
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'System Manager',
'write': 1
},
# DocPerm
{
'create': 0,
'doctype': u'DocPerm',
'permlevel': 2,
'role': u'System Manager',
'write': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'warehouse_detail',
'fieldtype': u'Section Break',
'label': u'Warehouse Detail',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'warehouse_name',
'fieldtype': u'Data',
'label': u'Warehouse Name',
'oldfieldname': u'warehouse_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'warehouse_type',
'fieldtype': u'Link',
'label': u'Warehouse Type',
'oldfieldname': u'warehouse_type',
'oldfieldtype': u'Link',
'options': u'Warehouse Type',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Company',
'oldfieldname': u'company',
'oldfieldtype': u'Link',
'options': u'Company',
'permlevel': 0,
'search_index': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'For Reference Only.',
'doctype': u'DocField',
'fieldname': u'warehouse_contact_info',
'fieldtype': u'Section Break',
'label': u'Warehouse Contact Info',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'email_id',
'fieldtype': u'Data',
'hidden': 1,
'label': u'Email Id',
'oldfieldname': u'email_id',
'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'phone_no',
'fieldtype': u'Data',
'label': u'Phone No',
'oldfieldname': u'phone_no',
'oldfieldtype': u'Int',
'options': u'Phone',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'mobile_no',
'fieldtype': u'Data',
'label': u'Mobile No',
'oldfieldname': u'mobile_no',
'oldfieldtype': u'Int',
'options': u'Phone',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'column_break0',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'address_line_1',
'fieldtype': u'Data',
'label': u'Address Line 1',
'oldfieldname': u'address_line_1',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'address_line_2',
'fieldtype': u'Data',
'label': u'Address Line 2',
'oldfieldname': u'address_line_2',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'city',
'fieldtype': u'Data',
'label': u'City',
'oldfieldname': u'city',
'oldfieldtype': u'Data',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'state',
'fieldtype': u'Data',
'label': u'State',
'oldfieldname': u'state',
'oldfieldtype': u'Select',
'options': u'Suggest',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'pin',
'fieldtype': u'Int',
'label': u'PIN',
'oldfieldname': u'pin',
'oldfieldtype': u'Int',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'description': u'For Admin use only. Please report errors to support@erpnext.com',
'doctype': u'DocField',
'fieldname': u'repost_stock',
'fieldtype': u'Section Break',
'label': u'Repost Stock',
'oldfieldtype': u'Section Break',
'permlevel': 2
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'repost_stock_ledger',
'fieldtype': u'Button',
'hidden': 0,
'label': u'Repost Stock Ledger',
'oldfieldtype': u'Button',
'options': u'repost_stock',
'permlevel': 2
}
]

View File

@@ -0,0 +1,35 @@
// render
wn.doclistviews['Warehouse'] = wn.views.ListView.extend({
init: function(d) {
this._super(d)
this.fields = this.fields.concat([
"`tabWarehouse`.warehouse_type",
"`tabWarehouse`.address_line_1",
"`tabWarehouse`.address_line_2",
"`tabWarehouse`.city",
"`tabWarehouse`.state",
"`tabWarehouse`.pin",
]);
this.stats = this.stats.concat(['company']);
},
prepare_data: function(data) {
this._super(data);
var concat_list = [];
data.address_line_1 && concat_list.push(data.address_line_1);
data.address_line_2 && concat_list.push(data.address_line_2);
data.city && concat_list.push(data.city);
data.state && concat_list.push(data.state);
data.pin && concat_list.push(data.pin);
data.address = concat_list.join(", ");
},
columns: [
{width: '3%', content:'check'},
{width: '5%', content:'avatar'},
{width: '20%', content:'name'},
{width: '15%', content:'warehouse_type'},
{width: '45%', content:'address+tags'},
{width: '12%', content:'modified', css: {'text-align': 'right', 'color':'#777'}}
]
});