Merge branch 'master' into sync

Conflicts:
	version.num
This commit is contained in:
Anand Doshi 2012-03-05 14:37:26 +05:30
commit cd447b2ae5
125 changed files with 3795 additions and 2152 deletions

View File

@ -9,6 +9,7 @@
"lib/js/wn/require.js",
"lib/js/wn/dom.js",
"lib/js/wn/page.js",
"lib/js/wn/misc/user.js",
"lib/js/lib/json2.js",
"lib/js/core.js"
]
@ -36,7 +37,6 @@
{
"css/all-web.css": [
"lib/css/legacy/body.css",
"lib/css/legacy/menus.css",
"lib/css/legacy/messages.css",
"lib/css/legacy/dialog.css",
"lib/css/bootstrap/headings.css",
@ -52,7 +52,6 @@
{
"css/all-app.css": [
"lib/css/legacy/body.css",
"lib/css/legacy/menus.css",
"lib/css/legacy/messages.css",
"lib/css/legacy/forms.css",
"lib/css/legacy/grid.css",
@ -75,13 +74,12 @@
{
"js/all-web.js": [
"lib/js/lib/jquery.min.js:concat",
"lib/js/lib/history/history.min.js:concat",
"lib/js/lib/bootstrap.min.js:concat",
"lib/js/lib/sprintf.js",
"lib/js/core.min.js:concat",
"lib/js/legacy/globals.js",
"lib/js/legacy/utils/datatype.js",
"lib/js/legacy/utils/browser_detect.js",
"lib/js/legacy/utils/datetime.js",
"lib/js/legacy/utils/dom.js",
"lib/js/legacy/utils/handler.js",
@ -116,15 +114,14 @@
{
"js/all-app.js": [
"lib/js/lib/jquery.min.js:concat",
"lib/js/lib/history/history.min.js:concat",
"lib/js/legacy/jquery/jquery-ui.min.js:concat",
"lib/js/legacy/tiny_mce_33/jquery.tinymce.js:concat",
"lib/js/lib/bootstrap.min.js:concat",
"lib/js/lib/sprintf.js",
"lib/js/core.min.js:concat",
"lib/js/legacy/globals.js",
"lib/js/legacy/utils/datatype.js",
"lib/js/legacy/utils/browser_detect.js",
"lib/js/legacy/utils/datetime.js",
"lib/js/legacy/utils/dom.js",
"lib/js/legacy/utils/handler.js",
@ -175,9 +172,9 @@
"lib/js/legacy/app.js",
"js/app.js",
"erpnext/startup/startup.js",
"erpnext/startup/modules.js",
"erpnext/startup/toolbar.js",
"erpnext/startup/feature_setup.js"
"erpnext/startup/js/modules.js",
"erpnext/startup/js/toolbar.js",
"erpnext/startup/js/feature_setup.js"
]
}

View File

@ -230,59 +230,16 @@ div.std-footer-item {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
/*
* lib/css/legacy/menus.css
*/
/******** Menus - menu.js ************/
ul.menu_toolbar {
z-index: 30;
padding: 0px;
margin: 0px;
margin-top: 1px;
.avatar-small {
display: inline-block;
min-width: 29px;
}
.avatar-small img {
height: 24px;
margin-bottom: -7px;
max-width: 24px;
}
ul.menu_toolbar li {
list-style: none;
margin: 0px;
float: left;
}
.top_menu {
margin: 0px;
padding: 4px;
cursor: pointer;
color: #FFF;
margin-right: 8px;
}
.top_menu_mo {
background-color: #000;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
div.menu_toolbar_dropdown {
position: absolute;
margin-top: 4px;
margin-left: 8px;
width: 140px;
background-color: #FFF;
color: #000;
display: none;
border: 2px solid #333;
z-index: 31;
overflow-y: auto;
overflow-x: hidden;
}
div.dd_item {
cursor: pointer;
padding: 4px;
background-color: #FFF;
}
div.dd_item_mo { background-color: #FE8; }
/*
* lib/css/legacy/messages.css
*/
@ -1043,7 +1000,7 @@ div.dialog_head {
}
div.dialog_body {
padding: 8px 4px 16px 4px;
padding: 8px 8px 16px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
@ -2809,10 +2766,11 @@ span, div, td, input, textarea, button, select {
}
body {
background: url(../images/stripedbg.png) repeat;
}
.erpnext-footer {
margin: 3px auto;
margin: 11px auto;
text-align: center;
}

View File

@ -230,59 +230,16 @@ div.std-footer-item {
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
}
/*
* lib/css/legacy/menus.css
*/
/******** Menus - menu.js ************/
ul.menu_toolbar {
z-index: 30;
padding: 0px;
margin: 0px;
margin-top: 1px;
.avatar-small {
display: inline-block;
min-width: 29px;
}
.avatar-small img {
height: 24px;
margin-bottom: -7px;
max-width: 24px;
}
ul.menu_toolbar li {
list-style: none;
margin: 0px;
float: left;
}
.top_menu {
margin: 0px;
padding: 4px;
cursor: pointer;
color: #FFF;
margin-right: 8px;
}
.top_menu_mo {
background-color: #000;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
}
div.menu_toolbar_dropdown {
position: absolute;
margin-top: 4px;
margin-left: 8px;
width: 140px;
background-color: #FFF;
color: #000;
display: none;
border: 2px solid #333;
z-index: 31;
overflow-y: auto;
overflow-x: hidden;
}
div.dd_item {
cursor: pointer;
padding: 4px;
background-color: #FFF;
}
div.dd_item_mo { background-color: #FE8; }
/*
* lib/css/legacy/messages.css
*/
@ -362,7 +319,7 @@ div.dialog_head {
}
div.dialog_body {
padding: 8px 4px 16px 4px;
padding: 8px 8px 16px;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
@ -1617,10 +1574,11 @@ span, div, td, input, textarea, button, select {
}
body {
background: url(../images/stripedbg.png) repeat;
}
.erpnext-footer {
margin: 3px auto;
margin: 11px auto;
text-align: center;
}

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -177,7 +177,7 @@ class DocType:
#----------------------------------------------------------------------------
def make_single_entry(self,parent,d,le_map,cancel, merge_entries):
if self.get_val(le_map['account'], d, parent) and (self.get_val(le_map['debit'], d, parent) or self.get_val(le_map['credit'], d, parent)):
flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','transaction_date','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
flist = ['account','cost_center','against','debit','credit','remarks','voucher_type','voucher_no','posting_date','fiscal_year','against_voucher','against_voucher_type','company','is_opening', 'aging_date']
# Check budget before gl entry
#check budget only if account is expense account
@ -536,7 +536,6 @@ def create_new_invoice(prev_rv):
# update new rv
new_rv.doc.voucher_date = new_rv.doc.next_date
new_rv.doc.posting_date = new_rv.doc.next_date
new_rv.doc.aging_date = new_rv.doc.next_date
new_rv.doc.due_date = add_days(new_rv.doc.next_date, cint(date_diff(prev_rv.doc.due_date, prev_rv.doc.posting_date)))

View File

@ -52,10 +52,12 @@ class DocType:
msgprint("GL Entry: Debit or Credit amount is mandatory for %s" % self.doc.account)
raise Exception
# COMMMENTED below to allow zero amount (+ and -) entry in tax table
# Debit and credit can not done at the same time
if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
msgprint("Sorry you cannot credit and debit under same account head.")
raise Exception, "Validation Error."
#if flt(self.doc.credit) != 0 and flt(self.doc.debit) != 0:
# msgprint("Sorry you cannot credit and debit under same account head.")
# raise Exception, "Validation Error."
# Cost center is required only if transaction made against pl account
#--------------------------------------------------------------------
@ -152,11 +154,15 @@ class DocType:
amt = flt(self.doc.debit) - flt(self.doc.credit)
if det[0][2] == 'Credit': amt = -amt
debit = cancel and -1 * flt(self.doc.credit) or flt(self.doc.debit)
credit = cancel and -1 * flt(self.doc.debit) or flt(self.doc.credit)
if cancel:
debit = -1 * flt(self.doc.credit)
credit = -1 * flt(self.doc.debit)
else:
debit = flt(self.doc.debit)
credit = flt(self.doc.credit)
self.create_new_balances(det)
# build dict
p = {
'debit': self.doc.is_opening=='No' and flt(debit) or 0
@ -197,7 +203,7 @@ class DocType:
and ifnull(a.is_pl_account, 'No') = 'No'
and ab.period = ab.fiscal_year
and fy.name = ab.fiscal_year
and fy.year_start_date > %(posting_date)s""" % p)
and fy.year_start_date > '%(posting_date)s'""" % p)
# Update balance for all period for future years
sql("""update `tabAccount Balance` ab, `tabAccount` a, `tabFiscal Year` fy
@ -209,7 +215,7 @@ class DocType:
and ab.account = a.name
and ifnull(a.is_pl_account, 'No') = 'No'
and fy.name = ab.fiscal_year
and fy.year_start_date > %(posting_date)s""" % p)
and fy.year_start_date > '%(posting_date)s'""" % p)

View File

@ -45,11 +45,14 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
//------------------------
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
var callback1 = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
}
// Refresh
@ -58,7 +61,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, dt, dn);
// Show / Hide button

View File

@ -168,9 +168,6 @@ class DocType(TransactionBase):
return ret
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# *************************** Server Utility Functions *****************************
# Get Company abbr

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:11',
'docstatus': 0,
'modified': '2012-02-27 18:25:38',
'modified': '2012-03-02 12:28:23',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -24,7 +24,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'From %(supplier_name)s worth %(grand_total)s due on %(due_date)s | %(outstanding_amount)s outstanding',
'version': 520
'version': 521
},
# These values are common for all DocField
@ -308,22 +308,6 @@
'search_index': 1
},
# DocField
{
'default': u'Today',
'doctype': u'DocField',
'fieldname': u'voucher_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Voucher Date',
'no_copy': 0,
'oldfieldname': u'voucher_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
@ -613,7 +597,7 @@
'label': u'More Info',
'oldfieldtype': u'Section Break',
'permlevel': 0,
'print_hide': 0
'print_hide': 1
},
# DocField
@ -622,7 +606,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 0,
'print_hide': 1,
'width': u'50%'
},
@ -681,6 +665,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -750,7 +735,7 @@
'label': u'Advances',
'oldfieldtype': u'Section Break',
'permlevel': 0,
'print_hide': 0
'print_hide': 1
},
# DocField
@ -785,7 +770,8 @@
'fieldtype': u'Section Break',
'label': u'TDS',
'oldfieldtype': u'Section Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -793,6 +779,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -839,6 +826,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -894,6 +882,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
'modified': '2012-02-27 18:42:06',
'modified': '2012-03-05 10:54:12',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 43
'version': 45
},
# These values are common for all DocField
@ -100,10 +100,11 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'label': u'Ref Rate *',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
@ -114,42 +115,7 @@
'fieldtype': u'Currency',
'label': u'Discount %',
'permlevel': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'label': u'Rate ',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate *',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
@ -180,6 +146,43 @@
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'label': u'Rate ',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',

View File

@ -42,27 +42,31 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback2 = null;
if(doc.customer && doc.__islocal) {
var callback = function(doc, dt, dn) {
// called from mapper, update the account names for items and customer
callback2 = function(doc, dt, dn) {
$c_obj(make_doclist(doc.doctype,doc.name),
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
);
var callback2 = function(doc, dt, dn) {
if(doc.customer && doc.__islocal) {
$c_obj(make_doclist(doc.doctype,doc.name),
'load_default_accounts','',
function(r,rt) {
refresh_field('entries');
cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
);
}
}
// defined in sales_common.js
var callback1 = function(doc, dt, dn) {
//for previously created sales invoice, set required field related to pos
cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
}
}
// defined in sales_common.js
var callback1 = function(doc, dt, dn) {
//for previously created sales invoice, set required field related to pos
cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
}
if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn,callback1);
else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
if(doc.is_pos ==1) cur_frm.cscript.is_pos(doc, dt, dn,callback1);
else cur_frm.cscript.update_item_details(doc, dt, dn, callback2);
}
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
@ -97,16 +101,11 @@ cur_frm.cscript.hide_fields = function(doc, cdt, cdn) {
cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.cscript.is_opening(doc, dt, dn);
cur_frm.cscript.hide_fields(doc, dt, dn);
var callback = function() {
cur_frm.cscript.dynamic_label(doc, dt, dn);
}
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
// Show / Hide button
cur_frm.clear_custom_buttons();
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, dt, dn);
if(doc.docstatus==1) {
cur_frm.add_custom_button('View Ledger', cur_frm.cscript['View Ledger Entry']);
cur_frm.add_custom_button('Send SMS', cur_frm.cscript['Send SMS']);

View File

@ -66,11 +66,11 @@ class DocType(TransactionBase):
for i in lst:
val = pos and pos[0][i] or ''
webnotes.conn.set(self.doc,i,val)
self.doc.fields[i] = val
self.set_pos_item_values()
val = pos and flt(pos[0]['conversion_rate']) or 0
webnotes.conn.set(self.doc,'conversion_rate',val)
self.doc.conversion_rate = val
#fetch terms
if self.doc.tc_name: self.get_tc_details()
@ -167,16 +167,19 @@ class DocType(TransactionBase):
# Item Details
# -------------
def get_item_details(self, args=None):
args = eval(args)
if args['item_code']:
args = args and eval(args) or {}
if args.get('item_code'):
ret = get_obj('Sales Common').get_item_details(args, self)
return self.get_pos_details(args, ret)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
ret = obj.get_item_details(doc.item_code, self)
ret = self.get_pos_details(doc.item_code, ret)
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
ret = self.get_pos_details(arg, ret)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@ -205,14 +208,6 @@ class DocType(TransactionBase):
get_obj('Sales Common').get_adj_percent(self)
def get_comp_base_currency(self):
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
def get_price_list_currency(self):
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
# Get tax rate if account type is tax
# ------------------------------------
def get_rate(self,arg):
@ -538,7 +533,7 @@ class DocType(TransactionBase):
self.values.append({
'item_code' : d.item_code,
'warehouse' : wh,
'transaction_date' : self.doc.voucher_date,
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Receivable Voucher',

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:18',
'docstatus': 0,
'modified': '2012-02-27 17:34:46',
'modified': '2012-03-02 12:22:21',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -21,7 +21,7 @@
# These values are common for all DocType
{
'_last_update': u'1330344021',
'_last_update': u'1330593645',
'change_log': u'1. Change in pull_details method dt.-26-06-2009',
'colour': u'White:FFF',
'default_print_format': u'Standard',
@ -34,7 +34,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'To %(customer_name)s worth %(currency)s %(grand_total_export)s due on %(due_date)s | %(outstanding_amount)s outstanding',
'version': 414
'version': 415
},
# These values are common for all DocFormat
@ -176,6 +176,7 @@
# DocField
{
'colour': u'White:FFF',
'default': u'INV',
'depends_on': u'eval:doc.retail_transaction!="Yes"',
'description': u'To manage multiple series please go to Setup > Manage Series',
'doctype': u'DocField',
@ -185,7 +186,7 @@
'no_copy': 1,
'oldfieldname': u'naming_series',
'oldfieldtype': u'Select',
'options': u'\nINV\nINV/10-11/',
'options': u'INV\nINV/10-11/',
'permlevel': 0,
'print_hide': 1,
'reqd': 1
@ -643,17 +644,6 @@
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Rates HTML',
'oldfieldtype': u'HTML',
'options': u'* Rates in standard currency',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
@ -1072,24 +1062,6 @@
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'default': u'Today',
'description': u"This is the date on which this voucher is made in the system. Today's date comes by default.",
'doctype': u'DocField',
'fieldname': u'voucher_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Voucher Date',
'no_copy': 1,
'oldfieldname': u'voucher_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 0
},
# DocField
{
'doctype': u'DocField',
@ -1180,7 +1152,8 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -1390,7 +1363,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -1412,7 +1386,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Recurring Invoice',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -1420,6 +1395,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1473,6 +1449,7 @@
'fieldtype': u'Column Break',
'no_copy': 0,
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:20',
'docstatus': 0,
'modified': '2012-02-24 16:14:38',
'modified': '2012-03-05 10:50:03',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 25
'version': 28
},
# These values are common for all DocField
@ -85,15 +85,6 @@
'width': u'200px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'stock_uom',
'fieldtype': u'Data',
'label': u'UOM',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
@ -109,17 +100,23 @@
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldname': u'stock_uom',
'fieldtype': u'Data',
'label': u'UOM',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client'
'permlevel': 1,
'print_hide': 1
},
# DocField
@ -136,43 +133,6 @@
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'export_rate',
'fieldtype': u'Currency',
'label': u'Basic Rate',
'oldfieldname': u'export_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'export_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'export_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
@ -203,6 +163,46 @@
'reqd': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'export_rate',
'fieldtype': u'Currency',
'label': u'Basic Rate',
'oldfieldname': u'export_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'export_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'export_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
@ -264,7 +264,7 @@
'oldfieldname': u'serial_no',
'oldfieldtype': u'Small Text',
'permlevel': 0,
'print_hide': 1
'print_hide': 0
},
# DocField

View File

@ -62,6 +62,11 @@
title = "Analyze Sales and Purchase trends and slice them based on item, customer, groups etc"
href="#!Report/Profile/Trend Analyzer">Trend Analyzer</a>
</div>
<div class="section-item">
<a class="section-link"
title = "Check your Balance Sheet and Profit & Loss Statement"
href="#!Financial Statements">Financial Statements</a>
</div>
</div>
@ -141,4 +146,4 @@
</div>
</div>
<div style="clear: both;"></div>
</div>
</div>

View File

@ -66,7 +66,7 @@ for r in row_list:
for r in res:
if r[col_idx['Against Receivable']]:
dt=sql("select voucher_date, Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
dt=sql("select date(modified), Aging_date from `tabReceivable Voucher` where name='%s'"%r[col_idx['Against Receivable']])
r.append('')
r.append(dt and cstr(dt[0][0]) or '')
r.append(dt and cstr(dt[0][1]) or '')
@ -103,4 +103,4 @@ for r in res:
r.append(val_l2)
r.append(val_l3)
r.append(val_l4)
r.append(val_l5_above)
r.append(val_l5_above)

View File

@ -66,7 +66,7 @@ for r in row_list:
for r in res:
if r[col_idx['Against Payable']]:
dt=sql("select voucher_date, aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
dt=sql("select date(modified), aging_date from `tabPayable Voucher` where name='%s'"%r[col_idx['Against Payable']])
r.append('')
r.append(dt and cstr(dt[0][0]) or '')
r.append(dt and cstr(dt[0][1]) or '')
@ -102,4 +102,4 @@ for r in res:
r.append(val_l2)
r.append(val_l3)
r.append(val_l4)
r.append(val_l5_above)
r.append(val_l5_above)

View File

@ -61,7 +61,6 @@ class DocType:
# ---- get companies ---------
res = sql("select name from `tabCompany`")
comp.append('All')
for r in res:
comp.append(r[0])
#comp.append(r[0] for r in res)

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:12',
'docstatus': 0,
'modified': '2012-02-27 14:47:48',
'modified': '2012-03-05 10:50:51',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 62
'version': 64
},
# These values are common for all DocField
@ -121,10 +121,11 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'permlevel': 0
'label': u'Ref Rate *',
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -134,43 +135,10 @@
'fieldtype': u'Currency',
'label': u'Discount %',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'hidden': 0,
'label': u'Rate ',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate *',
'permlevel': 0
},
# DocField
{
'default': u'0.00',
@ -201,6 +169,41 @@
'reqd': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'hidden': 0,
'label': u'Rate ',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',

View File

@ -92,39 +92,38 @@ var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
// item table flds
item_cols_base = {'purchase_ref_rate': 'Ref Rate', 'amount': 'Amount'};
item_cols_import = {'import_rate': 'Rate', 'import_ref_rate': 'Ref Rate', 'import_amount': 'Amount'};
// item table flds
item_cols_base = {'purchase_ref_rate': 'Ref Rate', 'amount': 'Amount'};
item_cols_import = {'import_rate': 'Rate', 'import_ref_rate': 'Ref Rate', 'import_amount': 'Amount'};
for (d in item_cols_base) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_base[d]+' ('+base_curr+')');
for (d in item_cols_import) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_import[d]+' ('+doc.currency+')');
for (d in item_cols_base) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_base[d]+' ('+base_curr+')');
for (d in item_cols_import) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_import[d]+' ('+doc.currency+')');
var hide = (doc.currency == sys_defaults['currency']) ? false : true;
for (f in item_cols_base) cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
if (doc.doctype == 'Payable Voucher') {
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
// advance table flds
adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
for (d in adv_cols) $('[data-grid-fieldname="Advance Allocation Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');
}
else {
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-purchase_rate"]').html('Rate ('+base_curr+')');
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('purchase_rate', hide);
}
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Aggregate Total'};
for (d in tax_cols) $('[data-grid-fieldname="Purchase Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
var hide = (doc.currency == sys_defaults['currency']) ? false : true;
for (f in item_cols_import) {
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
}
if (doc.doctype == 'Payable Voucher') {
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
//cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
// advance table flds
adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
for (d in adv_cols) $('[data-grid-fieldname="Advance Allocation Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');
}
else {
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-purchase_rate"]').html('Rate ('+base_curr+')');
//cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('purchase_rate', hide);
}
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Aggregate Total'};
for (d in tax_cols) $('[data-grid-fieldname="Purchase Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
}
// Change label dynamically based on currency
//------------------------------------------------------------------
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, callback1) {
var callback = function(r, rt) {
if (r.message) base_curr = r.message;
else base_curr = sys_defaults['currency'];
@ -136,10 +135,16 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
set_dynamic_label_par(doc, cdt, cdn, base_curr);
set_dynamic_label_child(doc, cdt, cdn, base_curr);
if(callback1) callback1(doc, cdt, cdn);
}
if (doc.company == sys_defaults['company']) callback('', '');
else $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
else wn.call({
method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
args: {company: doc.company},
callback: callback
});
}
cur_frm.cscript.currency = function(doc, cdt, cdn) {

View File

@ -197,11 +197,6 @@ class DocType(TransactionBase):
msgprint("%s has no Last Purchase Rate."% d.item_code)
def get_comp_base_currency(self, comp):
""" get default currency of company"""
return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", comp)[0][0]
# validation
# -------------------------------------------------------------------------------------------------------

View File

@ -41,9 +41,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
var callback = function(doc, cdt, cdn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
}
cur_frm.cscript.dynamic_label(doc, cdt, cdn, callback);
}
// ================================== Refresh ==========================================
@ -52,7 +55,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// ---------------------------------
cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if(doc.docstatus == 1 && doc.status != 'Stopped'){
var ch = getchildren('PO Detail',doc.name,'po_details');

View File

@ -100,10 +100,6 @@ class DocType(TransactionBase):
return get_obj('Purchase Common').get_tc_details(self)
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# validate if indent has been pulled twice
def validate_prev_docname(self):

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:15',
'docstatus': 0,
'modified': '2012-02-27 17:51:53',
'modified': '2012-03-02 12:23:50',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -35,7 +35,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'To %(supplier_name)s on %(transaction_date)s | %(per_received)s% delivered',
'version': 500
'version': 501
},
# These values are common for all DocFormat
@ -569,17 +569,6 @@
'trigger': u'Client'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Note HTML',
'options': u'<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
@ -665,17 +654,6 @@
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Note HTML',
'options': u'<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
'permlevel': 1,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
@ -1019,6 +997,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1073,7 +1052,8 @@
'fieldtype': u'Section Break',
'label': u'Raw Material Details',
'oldfieldtype': u'Section Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField

View File

View File

@ -0,0 +1,23 @@
#activity-list .label {
display: inline-block;
width: 100px;
margin-right: 7px;
}
#activity-list .label-info {
cursor: pointer;
}
#activity-list .user-info {
float: right;
color: #777;
font-size: 10px;
}
#activity-list .date-sep {
margin-bottom: 11px;
padding: 5px 0px;
border-bottom: 1px solid #aaa;
color: #555;
font-size: 10px;
}

View File

@ -0,0 +1,6 @@
<div class="layout-wrapper">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Activity</h1>
<div id="activity-list">
</div>
</div>

View File

@ -0,0 +1,64 @@
wn.pages['activity'].onload = function(wrapper) {
var list = new wn.widgets.Listing({
method: 'home.page.activity.activity.get_feed',
parent: $('#activity-list'),
render_row: function(row, data) {
new erpnext.ActivityFeed(row, data);
}
});
list.run();
}
erpnext.last_feed_date = false;
erpnext.ActivityFeed = Class.extend({
init: function(row, data) {
this.scrub_data(data);
this.add_date_separator(row, data);
$(row).append(sprintf('<div style="margin: 0px">\
<span class="avatar-small"><img src="%(imgsrc)s" /></span> \
<span %(onclick)s class="label %(add_class)s">%(feed_type)s</span>\
%(link)s %(subject)s <span class="user-info">%(by)s</span></div>', data));
},
scrub_data: function(data) {
data.by = wn.user_info(data.owner).fullname;
data.imgsrc = wn.user_info(data.owner).image;
// feedtype
if(!data.feed_type) {
data.feed_type = get_doctype_label(data.doc_type);
data.add_class = "label-info";
data.onclick = repl('onclick="window.location.href=\'#!List/%(feed_type)s\';"', data)
}
// color for comment
if(data.feed_type=='Comment') {
data.add_class = "label-important";
}
if(data.feed_type=='Assignment') {
data.add_class = "label-warning";
}
// link
if(data.doc_name && data.feed_type!='Login') {
data.link = repl('<a href="#!Form/%(doc_type)s/%(doc_name)s">%(doc_name)s</a>', data)
}
},
add_date_separator: function(row, data) {
var date = dateutil.str_to_obj(data.modified);
var last = erpnext.last_feed_date;
if((last && dateutil.obj_to_str(last) != dateutil.obj_to_str(date)) || (!last)) {
var diff = dateutil.get_day_diff(new Date(), date);
if(diff < 1) {
pdate = 'Today';
} else if(diff < 2) {
pdate = 'Yesterday';
} else {
pdate = dateutil.global_date_format(date);
}
$(row).html(repl('<div class="date-sep">%(date)s</div>', {date: pdate}));
}
erpnext.last_feed_date = date;
}
})

View File

@ -0,0 +1,16 @@
import webnotes
@webnotes.whitelist()
def get_feed(arg=None):
"""get feed"""
return webnotes.conn.sql("""select
distinct t1.name, t1.feed_type, t1.doc_type, t1.doc_name, t1.subject, t1.owner,
t1.modified
from tabFeed t1, tabDocPerm t2
where t1.doc_type = t2.parent
and t2.role in ('%s')
and ifnull(t2.`read`,0) = 1
order by t1.modified desc
limit %s, %s""" % ("','".join(webnotes.get_roles()),
webnotes.form_dict['limit_start'], webnotes.form_dict['limit_page_length']),
as_dict=1)

View File

@ -0,0 +1,28 @@
# Page, activity
[
# These values are common in all dictionaries
{
'creation': '2012-02-29 11:59:13',
'docstatus': 0,
'modified': '2012-02-29 12:11:46',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': u'Home',
'name': '__common__',
'page_name': u'activity',
'standard': u'Yes',
'title': u'Activity'
},
# Page, activity
{
'doctype': 'Page',
'name': u'activity'
}
]

View File

@ -0,0 +1,91 @@
<div class="layout-wrapper">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Attributions</h1>
<hr>
<p><b>Source Code:</b> <a href="https://github.com/webnotes/erpnext">
https://github.com/webnotes/erpnext</a></p>
<p><b>Website:</b> <a href="https://erpnext.com">
https://erpnext.com</a></p>
<hr>
<p class="help">ERPNext is an Open Source project and is possible because of the work of
thousands of software developers, companies and designers who have contributed their
work to the community. We have tried to list as many projects as possible that are
used by ERPNext, but this list may not be exhaustive.</p>
<h4>Server</h4>
<ul>
<li>Linux (GNU)</li>
<li>Apache HTTPD server (web server)</li>
<li>MySQL (database, Percona build)</li>
<li>Git (source code control via Github)</li>
</ul>
<h4>Programming Languages & Libraries</h4>
<ul>
<li><a href="http://python.org">Python</a></li>
<ul>
<li>Python-MySQL</li>
<li>pytz (timezones)</li>
<li>jinja2 (templating)</li>
<li>markdown2 (markdown parser)</li>
<li>jsmin (javascript minifier)</li>
</ul>
<li>Javascript</li>
<ul>
<li>JQuery</li>
<li>JQuery UI (datepicker, sortable)</li>
<li>TinyMCE - text editor</li>
<li>Twitter Bootstrap</li>
<li>jQPlot - graphs</li>
<li>JSON2 - JSON builder, parser</li>
<li>JSColor - color picker</li>
<li>sprintf - string formatting</li>
<li>historyjs - AJAX history</li>
</ul>
</ul>
<h4>CSS Frameworks</h4>
<ul>
<li>Twitter Bootstrap</li>
</ul>
<h4>Icons</h4>
<ul>
<li>The Noun Project</li>
<li>Glyphicons</li>
</ul>
<h4>Web Frameworks</h4>
<ul>
<li>wnframework</li>
</ul>
<h4>Web Browsers</h4>
<ul>
<li>Mozilla Firefox</li>
<ul>
<li>Firebug (debugger)</li>
</ul>
<li>Apple Safari</li>
<li>Google Chorme</li>
</ul>
<hr>
<h2>ERPNext License</h2>
<p><b>ERPNext - Open Source, web based ERP</b></p>
<p>Copyright &copy; 2008 onwards, Web Notes Technologies Pvt Ltd, India</p>
<p>This program is free software: you can redistribute it and/or modify
it under the terms of the <b>GNU General Public License</b> as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.</p>
<p>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.</p>
<p>For complete license see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a></p>
<hr>
<p>For more information please write to us at support@erpnext.com</p>
</div>

View File

@ -0,0 +1 @@
wn.pages['attributions'].onload = function(wrapper) { }

View File

@ -0,0 +1 @@
import webnotes

View File

@ -0,0 +1,28 @@
# Page, attributions
[
# These values are common in all dictionaries
{
'creation': '2012-03-01 12:30:42',
'docstatus': 0,
'modified': '2012-03-01 12:30:42',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': u'Home',
'name': '__common__',
'page_name': u'attributions',
'standard': u'Yes',
'title': u'Attributions'
},
# Page, attributions
{
'doctype': 'Page',
'name': u'attributions'
}
]

View File

@ -41,10 +41,15 @@
.case-border {
border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
width: 56px;
height: 56px;
border: 4px solid white;
box-shadow: 0 0 10px 1px black;
-moz-box-shadow: 0 0 10px 1px black;
-webkit-box-shadow: 0 0 10px 1px black;
-o-box-shadow: 0 0 10px 1px black;
margin: auto;
}
@ -66,6 +71,9 @@
/* Hover and click effects */
.case-border:hover, .circle:hover {
box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
}
.case-border:active, .case-border:focus, .circle:active, .circle:focus {
@ -77,8 +85,11 @@
}
.circle {
border-radius: 100%;
border-radius: 30px;
-moz-border-radius: 30px;
-webkit-border-radius: 30px;
height: 15px;
line-height: 12px;
min-width: 15px;
background: #B00D07;
padding: 3px;
@ -88,6 +99,9 @@
margin-right: 10px;
border: 2px solid white;
box-shadow: 0 0 10px 1px black;
-moz-box-shadow: 0 0 10px 1px black;
-webkit-box-shadow: 0 0 10px 1px black;
-o-box-shadow: 0 0 10px 1px black;
}
.circle-text {

View File

@ -43,36 +43,53 @@ erpnext.desktop.add_classes = function() {
}
erpnext.desktop.render = function() {
var icons = [
{ gradient: 'brown', sprite: 'feed', label: 'Activity', link: '#!Event Updates' },
{ gradient: 'blue', sprite: 'account', label: 'Accounts', link: '#!accounts-home' },
{ gradient: 'green', sprite: 'selling', label: 'Selling', link: '#!selling-home' },
{ gradient: 'yellow', sprite: 'stock', label: 'Stock', link: '#!stock-home' },
{ gradient: 'red', sprite: 'buying', label: 'Buying', link: '#!buying-home' },
{ gradient: 'purple', sprite: 'support', label: 'Support', link: '#!support-home' },
{ gradient: 'ocean', sprite: 'hr', label: 'Human<br />Resources', link: '#!hr-home' },
{ gradient: 'violet', sprite: 'project', label: 'Projects', link: '#!projects-home' },
{ gradient: 'dark-red', sprite: 'production', label: 'Production', link: '#!production-home' },
{ gradient: 'leaf-green', sprite: 'website', label: 'Website', link: '#!website-home' },
{ gradient: 'grey', sprite: 'setting', label: 'Settings', link: '#!Setup' },
{ gradient: 'bright-green', sprite: 'dashboard', label: 'Dashboard', link: '#!dashboard' },
//{ gradient: 'dark-blue', sprite: 'report', label: 'Report' },
{ gradient: 'pink', sprite: 'messages', label: 'Messages', link: '#!messages' },
{ gradient: 'bright-yellow', sprite: 'todo', label: 'To Do', link: '#!todo' },
{ gradient: 'peacock', sprite: 'calendar', label: 'Calendar', link: '#!calendar' },
{ gradient: 'ultra-dark-green', sprite: 'kb', label: 'Knowledge<br />Base', link: '#!questions' },
]
var icons = {
'Accounts': { gradient: 'blue', sprite: 'account', label: 'Accounts'},
'Selling': { gradient: 'green', sprite: 'selling', label: 'Selling'},
'Stock': { gradient: 'yellow', sprite: 'stock', label: 'Stock'},
'Buying': { gradient: 'red', sprite: 'buying', label: 'Buying'},
'Support': { gradient: 'purple', sprite: 'support', label: 'Support'},
'HR': { gradient: 'ocean', sprite: 'hr', label: 'Human<br />Resources'},
'Projects': { gradient: 'violet', sprite: 'project', label: 'Projects'},
'Production': { gradient: 'dark-red', sprite: 'production', label: 'Production'},
'Website': { gradient: 'leaf-green', sprite: 'website', label: 'Website'},
'Activity': { gradient: 'brown', sprite: 'feed', label: 'Activity'},
'Setup': { gradient: 'grey', sprite: 'setting', label: 'Setup'},
'Dashboard': { gradient: 'bright-green', sprite: 'dashboard', label: 'Dashboard'},
'To Do': { gradient: 'bright-yellow', sprite: 'todo', label: 'To Do'},
'Messages': { gradient: 'pink', sprite: 'messages', label: 'Messages'},
'Calendar': { gradient: 'peacock', sprite: 'calendar', label: 'Calendar'},
'Knowledge Base': { gradient: 'ultra-dark-green', sprite: 'kb', label: 'Knowledge<br />Base'}
}
$.each(icons, function(i, v) {
var icon_case = $('#icon-grid').append(repl('\
<div id="%(sprite)s" class="case-wrapper"><a href="%(link)s">\
var add_icon = function(m) {
var icon = icons[m];
icon.link = erpnext.modules[m];
$('#icon-grid').append(repl('\
<div id="%(sprite)s" class="case-wrapper"><a href="#!%(link)s">\
<div class="case-border case-%(gradient)s">\
<div class="sprite-image sprite-%(sprite)s"></div>\
</div></a>\
<div class="case-label">%(label)s</div>\
</div>', v));
});
</div>', icon));
}
// setup
for(var i in wn.boot.modules_list) {
var m = wn.boot.modules_list[i];
if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1)
add_icon(m);
}
if(user_roles.indexOf('Accounts Manager')!=-1)
add_icon('Dashboard')
if(user_roles.indexOf('System Manager')!=-1)
add_icon('Setup')
// apps
erpnext.desktop.show_pending_notifications();
}

View File

@ -1,124 +0,0 @@
// 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/>.
// complete my company registration
// --------------------------------
pscript.complete_registration = function(is_complete, profile) {
if(is_complete == 'No'){
var d = new Dialog(400, 200, "Setup your Account");
if(user != 'Administrator'){
d.no_cancel(); // Hide close image
$('header').toggle(false);
}
d.make_body([
['HTML', 'Your Profile Details', '<h4>Your Profile Details</h4>'],
['Data', 'First Name'],
['Data', 'Last Name'],
['HTML', 'Company Details', '<h4>Create your first company</h4>'],
['Data','Company Name','Example: Your Company LLC'],
['Data','Company Abbreviation', 'Example: YC (all your acconts will have this as a suffix)'],
['Select','Fiscal Year Start Date'],
['Select','Default Currency'],
['Button','Save'],
]);
// if company name is set, set the input value
// and disable it
if(wn.control_panel.company_name) {
d.widgets['Company Name'].value = wn.control_panel.company_name;
d.widgets['Company Name'].disabled = 1;
}
if(profile && profile.length>0) {
if(profile[0].first_name && profile[0].first_name!='None') {
d.widgets['First Name'].value = profile[0].first_name;
}
if(profile[0].last_name && profile[0].last_name!='None') {
d.widgets['Last Name'].value = profile[0].last_name;
}
}
//d.widgets['Save'].disabled = true; // disable Save button
pscript.make_dialog_field(d);
// submit details
d.widgets['Save'].onclick = function()
{
d.widgets['Save'].set_working();
flag = pscript.validate_fields(d);
if(flag)
{
var args = [
d.widgets['Company Name'].value,
d.widgets['Company Abbreviation'].value,
d.widgets['Fiscal Year Start Date'].value,
d.widgets['Default Currency'].value,
d.widgets['First Name'].value,
d.widgets['Last Name'].value
];
$c_obj('Setup Control','setup_account',JSON.stringify(args),function(r, rt){
sys_defaults = r.message;
user_fullname = r.message.user_fullname;
d.hide();
$('header').toggle(true);
page_body.wntoolbar.set_user_name();
});
} else {
d.widgets['Save'].done_working();
}
}
d.show();
}
}
// make dialog fields
// ------------------
pscript.make_dialog_field = function(d)
{
// fiscal year format
fisc_format = d.widgets['Fiscal Year Start Date'];
add_sel_options(fisc_format, ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct']);
// default currency
currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN', 'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR', 'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF', 'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP', 'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF', 'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF', 'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD', 'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR', 'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP', 'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR', 'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY', 'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV', 'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
currency = d.widgets['Default Currency'];
add_sel_options(currency, currency_list);
}
// validate fields
// ---------------
pscript.validate_fields = function(d)
{
var lst = ['First Name', 'Company Name', 'Company Abbreviation', 'Fiscal Year Start Date', 'Default Currency'];
var msg = 'Please enter the following fields';
var flag = 1;
for(var i=0; i<lst.length; i++)
{
if(!d.widgets[lst[i]].value || d.widgets[lst[i]].value=='None'){
flag = 0;
msg = msg + NEWLINE + lst[i];
}
}
if(!flag) alert(msg);
return flag;
}

View File

@ -758,253 +758,3 @@ MemberCoversationComment = function(cell, det, conv) {
// ========================== Role object =====================================
pscript.all_roles = null;
RoleObj = function(profile_id){
this.roles_dict = {};
this.profile_id = profile_id;
this.setup_done = 0;
var d = new Dialog(500,500,'Assign Roles');
d.make_body([
['HTML','roles']
]);
this.dialog = d;
this.make_role_body(profile_id);
this.make_help_body();
this.body.innerHTML = '<span style="color:#888">Loading...</span> <img src="lib/images/ui/button-load.gif">'
var me=this;
d.onshow = function() {
if(!me.setup_done)
me.get_all_roles(me.profile_id);
}
}
// make role body
RoleObj.prototype.make_role_body = function(id){
var me = this;
var d = this.dialog;
this.role_div = $a(d.widgets['roles'],'div');
this.head = $a(this.role_div,'div','',{marginLeft:'4px', marginBottom:'4px',fontWeight:'bold'});
this.body = $a(this.role_div,'div');
this.footer = $a(this.role_div,'div');
this.update_btn = $btn(this.footer,'Update',function() { me.update_roles(me.profile_id); },{marginRight:'4px'},'',1);
}
// make help body
RoleObj.prototype.make_help_body = function(){
var me = this;
var d = this.dialog;
this.help_div = $a(d.widgets['roles'],'div');
var head = $a(this.help_div,'div'); this.help_div.head = head;
var body = $a(this.help_div,'div'); this.help_div.body = body;
var tail = $a(this.help_div,'div'); this.help_div.tail = tail;
var back_btn = $btn(tail,'Back', function() {
// back to assign roles
$(me.role_div).slideToggle('medium');
$(me.help_div).slideToggle('medium');
});
this.help_div.back_btn = back_btn;
$dh(this.help_div);
}
// get all roles
RoleObj.prototype.get_all_roles = function(id){
if(pscript.all_roles) {
this.make_roles(id);
return;
}
var me = this;
var callback = function(r,rt){
pscript.all_roles = r.message;
me.make_roles(id);
}
$c_obj('Company Control','get_all_roles','',callback);
}
// make roles
RoleObj.prototype.make_roles = function(id){
var me = this;
var list = pscript.all_roles;
me.setup_done = 1;
me.body.innerHTML = '';
var tbl = make_table( me.body, cint(list.length / 2) + 1,4,'100%',['5%','45%','5%','45%'],{padding:'4px'});
var in_right = 0; var ridx = 0;
for(i=0;i<list.length;i++){
var cidx = in_right * 2;
me.make_checkbox(tbl, ridx, cidx, list[i]);
me.make_label(tbl, ridx, cidx + 1, list[i]);
// change column
if(in_right) {in_right = 0; ridx++ } else in_right = 1;
}
me.get_user_roles(id);
}
// make checkbox
RoleObj.prototype.make_checkbox = function(tbl,ridx,cidx, role){
var me = this;
var a = $a_input($a($td(tbl, ridx, cidx),'div'),'checkbox');
a.role = role;
me.roles_dict[role] = a;
$y(a,{width:'20px'});
$y($td(tbl, ridx, cidx),{textAlign:'right'});
}
// make label
RoleObj.prototype.make_label = function(tbl, ridx, cidx, role){
var me = this;
var t = make_table($td(tbl, ridx, cidx),1,2,null,['16px', null],{marginRight:'5px'});
var ic = $a($td(t,0,0), 'img','',{cursor:'pointer', marginRight:'5px'});
ic.src= 'lib/images/icons/help.png';
ic.role = role;
ic.onclick = function(){
me.get_permissions(this.role);
}
$td(t,0,1).innerHTML= role;
}
// get user roles
RoleObj.prototype.get_user_roles = function(id){
var me = this;
me.head.innerHTML = 'Roles for ' + id;
$ds(me.role_div);
$dh(me.help_div);
var callback = function(r,rt){
me.set_user_roles(r.message);
}
$c_obj('Company Control','get_user_roles', id,callback);
}
// set user roles
RoleObj.prototype.set_user_roles = function(list){
var me = this;
for(d in me.roles_dict){
me.roles_dict[d].checked = 0;
}
for(l=0; l<list.length; l++){
me.roles_dict[list[l]].checked = 1;
}
}
// update roles
RoleObj.prototype.update_roles = function(id){
var me = this;
if(id == user && has_common(['System Manager'], user_roles) && !me.roles_dict['System Manager'].checked){
var callback = function(r,rt){
if(r.message){
if(r.message > 1){
var c = confirm("You have unchecked the System Manager role.\nYou will lose administrative rights and will not be able to set roles.\n\nDo you want to continue anyway?");
if(!c) return;
}
else{
var c = "There should be atleast one user with System Manager role.";
me.roles_dict['System Manager'].checked = 1;
}
}
me.set_roles(id);
}
$c_obj('Company Control','get_sm_count','',callback);
}
else{
me.set_roles(id);
}
}
// set roles
RoleObj.prototype.set_roles = function(id){
var me = this;
var role_list = [];
for(d in me.roles_dict){
if(me.roles_dict[d].checked){
role_list.push(d);
}
}
var callback = function(r,rt){
me.update_btn.done_working();
me.dialog.hide();
}
var arg = {'usr':id, 'role_list':role_list};
me.update_btn.set_working();
$c_obj('Company Control','update_roles',docstring(arg), callback);
}
// get permission
RoleObj.prototype.get_permissions = function(role){
var me = this;
var callback = function(r,rt){
$(me.help_div).slideToggle('medium');
$(me.role_div).slideToggle('medium');
me.set_permissions(r.message, role);
}
$c_obj('Company Control','get_permission',role,callback);
}
// set permission
RoleObj.prototype.set_permissions = function(perm, role){
var me = this;
me.help_div.body.innerHTML ='';
if(perm){
me.help_div.head.innerHTML = 'Permissions for ' + role + ':<br><br>';
perm_tbl = make_table(me.help_div.body,cint(perm.length)+2,7,'100%',['30%','10%','10%','10%','10%','10%','10%'],{padding:'4px'});
var head_lst = ['Document','Read','Write','Create','Submit','Cancel','Amend'];
for(var i=0; i<(head_lst.length-1);i++){
$td(perm_tbl,0,i).innerHTML= "<b>"+head_lst[i]+"</b>";
}
var accept_img1 = 'lib/images/icons/accept.gif';
var cancel_img1 = 'lib/images/icons/cancel.gif';
for(i=1; i<perm.length+1; i++){
$td(perm_tbl,i,0).innerHTML= get_doctype_label(perm[i-1][0]);
for(var j=1;j<(head_lst.length-1);j++){
if(perm[i-1][j]){
var accept_img = $a($td(perm_tbl,i,j), 'img'); accept_img.src= accept_img1;
}
else {
var cancel_img = $a($td(perm_tbl,i,j), 'img'); cancel_img.src= cancel_img1;
}
$y($td(perm_tbl,i,j),{textAlign:'center'});
}
}
}
else
me.help_div.head.innerHTML = 'No Permission set for ' + role + '.<br><br>';
}

View File

@ -26,13 +26,15 @@ MyProfile = function(wrapper) {
this.make = function() {
this.head = new PageHeader(this.wrapper, 'My Profile Settings');
this.head.add_button('Change Password', this.change_password)
this.head.add_button('Change Password', this.change_password);
this.head.add_button('Change Background', this.change_background);
this.tab = make_table($a(this.wrapper, 'div', '', {marginTop:'19px'}),
1, 2, '90%', ['50%', '50%'], {padding:'11px'})
this.img = $a($td(this.tab, 0, 0), 'img');
set_user_img(this.img, user);
this.img = $a($td(this.tab, 0, 0), 'img', '', {width: '120px', maxHeight:'200px'});
this.img.src = wn.user_info(user).image;
$btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image)
$btn($a($td(this.tab, 0, 0), 'div', '', {marginTop:'11px'}), 'Change Image', this.change_image);
this.make_form();
this.load_details();
@ -105,32 +107,46 @@ MyProfile = function(wrapper) {
//
this.change_image = function() {
if(!me.change_dialog) {
var d = new Dialog(400,200,'Set Your Profile Image');
d.make_body([
['HTML','wrapper']
]);
var w = d.widgets['wrapper'];
me.uploader = new Uploader(w,
{
modulename:'home.page.profile_settings.profile_settings',
method: 'set_user_image'
},
pscript.user_image_upload, 1)
me.change_dialog = d;
}
me.change_dialog.show();
var d = new wn.widgets.Dialog({
title: 'Set your Profile'
})
me.uploader = new Uploader(d.body, {
modulename:'home.page.profile_settings.profile_settings',
method: 'set_user_image'
},
pscript.user_image_upload, 1)
d.show();
pscript.open_dialog = d;
}
this.change_background = function() {
var d = new wn.widgets.Dialog({
title: 'Set Background Image'
})
me.uploader = new Uploader(d.body, {
modulename:'home.page.profile_settings.profile_settings',
method: 'set_user_background'
},
pscript.background_change, 1)
d.show();
pscript.open_dialog = d;
}
this.make();
}
pscript.user_image_upload = function(fid) {
pscript.background_change = function(fid) {
msgprint('File Uploaded');
if(fid) {
pscript.myprofile.change_dialog.hide();
set_user_img(pscript.myprofile.img, user, null, fid);
erpnext.set_user_background(fid);
pscript.open_dialog.hide();
}
}
pscript.user_image_upload = function(fid) {
msgprint('File Uploaded');
if(fid) {
pscript.open_dialog.hide();
wn.boot.user_info[user].image = 'files/' + fid;
pscript.myprofile.img.src = 'files/' + fid;
}
}

View File

@ -63,6 +63,31 @@ def set_user_image(fid, fname):
"""
Set uploaded image as user image
"""
from webnotes.utils.file_manager import add_file_list, remove_all
remove_all('Profile', webnotes.session['user'])
add_file_list('Profile', webnotes.session['user'], fname, fid)
from webnotes.utils.file_manager import add_file_list, remove_file
user = webnotes.session['user']
# remove old file
old_image = webnotes.conn.get_value('Profile', user, 'user_image')
if old_image:
remove_file('Profile', user, old_image)
# add new file
add_file_list('Profile', user, fname, fid)
webnotes.conn.set_value('Profile', user, 'user_image', fid)
@webnotes.whitelist()
def set_user_background(fid, fname):
"""
Set uploaded image as user image
"""
from webnotes.utils.file_manager import add_file_list, remove_file
user = webnotes.session['user']
# remove old file
old_image = webnotes.conn.get_value('Profile', user, 'background_image')
if old_image:
remove_file('Profile', user, old_image)
# add new file
add_file_list('Profile', user, fname, fid)
webnotes.conn.set_value('Profile', user, 'background_image', fid)

View File

@ -0,0 +1,10 @@
def execute():
"""
Adds various roles to Administrator. This patch is for making master db
ready for on premise installation
"""
import webnotes
from webnotes.model.code import get_obj
from webnotes.model.doc import Document
sc = get_obj('Setup Control', 'Setup Control')
sc.add_roles(Document('Profile', 'Administrator'))

View File

@ -16,6 +16,4 @@
def execute():
import webnotes
webnotes.conn.sql("""
delete from __SessionCache
""")
webnotes.clear_cache()

View File

@ -0,0 +1,7 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
webnotes.conn.sql("delete from `tabField Mapper Detail` where from_field = 'transaction_date' and parent in ('Sales Order-Delivery Note', 'Purchase Order-Purchase Receipt')")
reload_doc('stock', 'DocType Mapper', 'Sales Order-Delivery Note')
reload_doc('stock', 'DocType Mapper', 'Purchase Order-Purchase Receipt')

View File

@ -3,14 +3,14 @@ def execute():
from webnotes.model import delete_doc
from webnotes.modules.module_manager import reload_doc
dt = [
dt = {
'selling': ['quotation', 'sales_order', 'quotation_detail', 'sales_order_detail'],
'stock': ['delivery_note', 'delivery_note_detail', 'purchase_receipt', 'purchase_receipt_detail'],
'accounts': ['receivable_voucher', 'payable_voucher', 'rv_detail', 'pv_detail', 'rv_tax_detail', 'purchase_tax_detail'],
'buying': ['purchase_order', 'po_detail']
]
}
for m in dt:
for d in m:
for d in dt[m]:
reload_doc(m, 'doctype', d)
@ -21,7 +21,7 @@ def execute():
del_flds = {
'Sales Order Detail': "'delivery_date', 'confirmation_date'",
'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'"
'Delivery Note': "'supplier', 'supplier_address', 'purchase_receipt_no', 'purchase_order_no', 'transaction_date'",
'Receivable Voucher': "'voucher_date'",
'Payable Voucher': "'voucher_date'",
'Purchase Receipt': "'transaction_date'"
@ -33,10 +33,15 @@ def execute():
}
for d in del_flds:
webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = %s", (del_flds[d], d))
webnotes.conn.sql("delete from `tabDocField` where fieldname in (%s) and parent = '%s'"% (del_flds[d], d))
for d in del_labels:
webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = %s", (del_labels[d], d))
webnotes.conn.sql("delete from `tabDocField` where label in (%s) and parent = '%s'"% (del_labels[d], d))
delete_doc('DocType', 'Update Delivery Date Detail')
delete_doc('DocType', 'Update Delivery Date'
# Reload print formats
reload_doc('accounts', 'Print Format', 'Sales Invoice Classic')
reload_doc('accounts', 'Print Format', 'Sales Invoice Modern')
reload_doc('accounts', 'Print Format', 'Sales Invoice Spartan')

View File

@ -32,6 +32,17 @@ def execute():
reload_doc('utilities', 'page', 'todo')
reload_doc('utilities', 'page', 'calendar')
reload_doc('utilities', 'page', 'messages')
reload_doc('setup', 'page', 'modules_setup')
reload_doc('utilities', 'page', 'users')
reload_doc('home', 'page', 'activity')
reload_doc('home', 'page', 'attributions')
reload_doc('core', 'doctype', 'profile')
# update user_image in profile
for p in webnotes.conn.sql("""select name, file_list from tabProfile
where ifnull(file_list,'')!=''"""):
fid = p[1].split('\n')[0].split(',')[1]
webnotes.conn.set_value('Profile', p[0], 'user_image', fid)
webnotes.conn.set_value('Control Panel', 'Control Panel', 'home_page',
'desktop')

View File

@ -0,0 +1,9 @@
def execute():
import webnotes
from webnotes.modules.module_manager import reload_doc
reload_doc('selling', 'doctype', 'quotation_detail')
reload_doc('stock', 'doctype', 'delivery_note_detail')
reload_doc('stock', 'doctype', 'purchase_receipt_detail')
reload_doc('buying', 'doctype', 'po_detail')
reload_doc('accounts', 'doctype', 'rv_detail')
reload_doc('accounts', 'doctype', 'pv_detail')

View File

@ -69,3 +69,12 @@ def replace_file_list_column_entries():
if file_list and "/" in file_list:
webnotes.conn.sql("UPDATE `%s` SET file_list='%s' WHERE name='%s'" \
% (tab, file_list.replace('/', '-'), name))
singles = webnotes.conn.sql("""SELECT doctype, value FROM `tabSingles`
WHERE field='file_list'""")
for doctype, file_list in singles:
if file_list and "/" in file_list:
webnotes.conn.sql("""UPDATE `tabSingles` SET value='%s'
WHERE doctype='%s' AND field='file_list'"""
% (file_list.replace('/', '-'), doctype))

View File

@ -121,4 +121,61 @@ patch_list = [
'patch_file': 'fix_packing_slip',
'description': 'Update Mapper Delivery Note-Packing Slip'
},
{
'patch_module': 'patches.jan_mar_2012.apps',
'patch_file': 'todo_item',
'description': 'Reloads todo item'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'convert_tables_to_utf8',
'description': 'Convert tables to UTF-8'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'pending_patches',
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'pos_setting_patch',
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'reload_doctype',
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'reload_po_pr_mapper',
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'delete_pur_of_service',
'description': 'Deletes purpose of service'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'navupdate',
'description': 'New Navigation Pages'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'label_cleanup',
'description': 'Remove extra fields and new dynamic labels'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'add_roles_to_admin',
'description': 'Add Roles to Administrator'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'dt_map_fix',
'description': 'removed transaction date from dt_mapper'
},
{
'patch_module': 'patches.jan_mar_2012',
'patch_file': 'reload_table',
'description': 'Relaod all item table: fld order changes'
},
]

View File

@ -200,7 +200,7 @@
<td><table width=100% cellspacing=0><tbody>
<tr>
<td width=40%><b>Invoice Date</b></td>
<td><script>date.str_to_user(doc.voucher_date)</script></td>
<td><script>date.str_to_user(doc.posting_date)</script></td>
<tr>
<tr>
<td><b>Due Date</b></td>

View File

@ -227,7 +227,7 @@
</tr>
<tr>
<td width=40%><b>Invoice Date</b></td>
<td><script>date.str_to_user(doc.voucher_date)</script></td>
<td><script>date.str_to_user(doc.posting_date)</script></td>
<tr>
<tr>
<td><b>Due Date</b></td>

View File

@ -222,7 +222,7 @@
<td><table width=100% cellspacing=0><tbody>
<tr>
<td width=40%><b>Invoice Date</b></td>
<td><script>date.str_to_user(doc.voucher_date)</script></td>
<td><script>date.str_to_user(doc.posting_date)</script></td>
<tr>
<tr>
<td><b>Due Date</b></td>

View File

@ -5,47 +5,48 @@
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
'modified': '2011-07-20 10:42:05',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-02-29 13:24:31',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': '1309508837',
'_last_update': u'1330501485',
'allow_print': 0,
'allow_trash': 1,
'colour': 'White:FFF',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
'document_type': 'Master',
'module': 'Selling',
'document_type': u'Master',
'module': u'Selling',
'name': '__common__',
'search_fields': 'customer_name,customer_group,country,territory',
'section_style': 'Tabbed',
'server_code_error': ' ',
'search_fields': u'customer_name,customer_group,country,territory',
'section_style': u'Tabbed',
'server_code_error': u' ',
'show_in_menu': 0,
'subject': "eval:'%(customer_name)s'=='%(name)s' ? ' ' : '%(customer_name)s'",
'tag_fields': 'customer_group,customer_type',
'version': 433
'subject': u'eval:"%(customer_name)s"=="%(name)s" ? "" : "%(customer_name)s"',
'tag_fields': u'customer_group,customer_type',
'version': 434
},
# These values are common for all DocField
{
'doctype': 'DocField',
'doctype': u'DocField',
'name': '__common__',
'parent': 'Customer',
'parentfield': 'fields',
'parenttype': 'DocType'
'parent': u'Customer',
'parentfield': u'fields',
'parenttype': u'DocType'
},
# These values are common for all DocPerm
{
'amend': 0,
'doctype': 'DocPerm',
'doctype': u'DocPerm',
'name': '__common__',
'parent': 'Customer',
'parentfield': 'permissions',
'parenttype': 'DocType',
'parent': u'Customer',
'parentfield': u'permissions',
'parenttype': u'DocType',
'read': 1,
'submit': 0
},
@ -53,17 +54,16 @@
# DocType, Customer
{
'doctype': 'DocType',
'name': 'Customer'
'name': u'Customer'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'doctype': u'DocPerm',
'permlevel': 1,
'role': 'Sales Manager',
'role': u'Sales Manager',
'write': 0
},
@ -71,10 +71,9 @@
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 2,
'doctype': u'DocPerm',
'permlevel': 0,
'role': 'Sales Manager',
'role': u'Sales Manager',
'write': 0
},
@ -82,10 +81,9 @@
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 3,
'doctype': u'DocPerm',
'permlevel': 1,
'role': 'Sales User',
'role': u'Sales User',
'write': 0
},
@ -93,10 +91,9 @@
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 4,
'doctype': u'DocPerm',
'permlevel': 0,
'role': 'Sales User',
'role': u'Sales User',
'write': 0
},
@ -104,10 +101,9 @@
{
'cancel': 1,
'create': 1,
'doctype': 'DocPerm',
'idx': 5,
'doctype': u'DocPerm',
'permlevel': 0,
'role': 'Sales Master Manager',
'role': u'Sales Master Manager',
'write': 1
},
@ -115,38 +111,35 @@
{
'cancel': 0,
'create': 0,
'doctype': 'DocPerm',
'idx': 6,
'doctype': u'DocPerm',
'permlevel': 1,
'role': 'Sales Master Manager',
'role': u'Sales Master Manager',
'write': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 1,
'label': 'Basic Info',
'oldfieldtype': 'Section Break',
'colour': u'White:FFF',
'description': u'Note: You Can Manage Multiple Address or Contacts via Addresses & Contacts',
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Basic Info',
'oldfieldtype': u'Section Break',
'permlevel': 0,
'reqd': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_name',
'fieldtype': 'Data',
'doctype': u'DocField',
'fieldname': u'customer_name',
'fieldtype': u'Data',
'hidden': 0,
'idx': 2,
'in_filter': 1,
'label': 'Customer Name',
'label': u'Customer Name',
'no_copy': 1,
'oldfieldname': 'customer_name',
'oldfieldtype': 'Data',
'oldfieldname': u'customer_name',
'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 0,
'report_hide': 0,
@ -156,330 +149,312 @@
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_type',
'fieldtype': 'Select',
'idx': 3,
'label': 'Customer Type',
'oldfieldname': 'customer_type',
'oldfieldtype': 'Select',
'options': '\nCompany\nIndividual',
'doctype': u'DocField',
'fieldname': u'customer_type',
'fieldtype': u'Select',
'label': u'Customer Type',
'oldfieldname': u'customer_type',
'oldfieldtype': u'Select',
'options': u'\nCompany\nIndividual',
'permlevel': 0,
'reqd': 1
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'naming_series',
'fieldtype': 'Select',
'idx': 4,
'label': 'Series',
'doctype': u'DocField',
'fieldname': u'naming_series',
'fieldtype': u'Select',
'label': u'Series',
'no_copy': 1,
'options': '\nCUST\nCUSTMUM\nCUSTOM',
'options': u'\nCUST\nCUSTMUM',
'permlevel': 0,
'print_hide': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'Fetch lead which will be converted into customer.',
'doctype': 'DocField',
'fieldname': 'lead_name',
'fieldtype': 'Link',
'colour': u'White:FFF',
'description': u'Fetch lead which will be converted into customer.',
'doctype': u'DocField',
'fieldname': u'lead_name',
'fieldtype': u'Link',
'hidden': 0,
'idx': 5,
'in_filter': 1,
'label': 'Lead Ref',
'label': u'Lead Ref',
'no_copy': 1,
'oldfieldname': 'lead_name',
'oldfieldtype': 'Link',
'options': 'Lead',
'oldfieldname': u'lead_name',
'oldfieldtype': u'Link',
'options': u'Lead',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'trigger': 'Client'
'trigger': u'Client'
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 6,
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': '50%'
'width': u'50%'
},
# DocField
{
'colour': 'White:FFF',
'description': '<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
'doctype': 'DocField',
'fieldname': 'customer_group',
'fieldtype': 'Link',
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.CGHelp();">To manage Customer Groups, click here</a>',
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'hidden': 0,
'idx': 7,
'in_filter': 1,
'label': 'Customer Group',
'oldfieldname': 'customer_group',
'oldfieldtype': 'Link',
'options': 'Customer Group',
'label': u'Customer Group',
'oldfieldname': u'customer_group',
'oldfieldtype': u'Link',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 0,
'reqd': 1,
'search_index': 1,
'trigger': 'Client'
'trigger': u'Client'
},
# DocField
{
'colour': 'White:FFF',
'description': '<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
'doctype': 'DocField',
'fieldname': 'territory',
'fieldtype': 'Link',
'idx': 8,
'label': 'Territory',
'oldfieldname': 'territory',
'oldfieldtype': 'Link',
'options': 'Territory',
'colour': u'White:FFF',
'description': u'<a href="javascript:cur_frm.cscript.TerritoryHelp();">To manage Territory, click here</a>',
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'label': u'Territory',
'oldfieldname': u'territory',
'oldfieldtype': u'Link',
'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'trigger': 'Client'
'trigger': u'Client'
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 9,
'label': 'Address & Contacts',
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Address & Contacts',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 10,
'label': 'Address Desc',
'options': '<em>Addresses will appear only when you save the customer</em>',
'colour': u'White:FFF',
'depends_on': u'eval:doc.__islocal',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Address Desc',
'options': u'<em>Addresses will appear only when you save the customer</em>',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 11,
'label': 'Address HTML',
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Address HTML',
'permlevel': 1
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 12,
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': '50%'
'width': u'50%'
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 13,
'label': 'Contact Desc',
'options': '<em>Contact Details will appear only when you save the customer</em>',
'colour': u'White:FFF',
'depends_on': u'eval:doc.__islocal',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Contact Desc',
'options': u'<em>Contact Details will appear only when you save the customer</em>',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 14,
'label': 'Contact HTML',
'oldfieldtype': 'HTML',
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Contact HTML',
'oldfieldtype': u'HTML',
'permlevel': 1
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 15,
'label': 'More Info',
'oldfieldtype': 'Section Break',
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'More Info',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'description': 'To create an Account Head under a different company, then set the company and click the button below.',
'doctype': 'DocField',
'fieldname': 'company',
'fieldtype': 'Link',
'idx': 16,
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'description': u'To create an Account Head under a different company, select the company and save customer.',
'doctype': u'DocField',
'fieldname': u'company',
'fieldtype': u'Link',
'in_filter': 1,
'label': 'Company',
'oldfieldname': 'company',
'oldfieldtype': 'Link',
'options': 'Company',
'label': u'Company',
'oldfieldname': u'company',
'oldfieldtype': u'Link',
'options': u'Company',
'permlevel': 0,
'reqd': 1,
'search_index': 0
'search_index': 1
},
# DocField
{
'colour': 'White:FFF',
'description': "Your Customer's TAX registration numbers (if applicable) or any general information",
'doctype': 'DocField',
'fieldname': 'customer_details',
'fieldtype': 'Text',
'idx': 17,
'label': 'Customer Details',
'oldfieldname': 'customer_details',
'oldfieldtype': 'Code',
'colour': u'White:FFF',
'description': u"Your Customer's TAX registration numbers (if applicable) or any general information",
'doctype': u'DocField',
'fieldname': u'customer_details',
'fieldtype': u'Text',
'label': u'Customer Details',
'oldfieldname': u'customer_details',
'oldfieldtype': u'Code',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Column Break',
'idx': 18,
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': '50%'
'width': u'50%'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'credit_days',
'fieldtype': 'Int',
'idx': 19,
'label': 'Credit Days',
'oldfieldname': 'credit_days',
'oldfieldtype': 'Int',
'doctype': u'DocField',
'fieldname': u'credit_days',
'fieldtype': u'Int',
'label': u'Credit Days',
'oldfieldname': u'credit_days',
'oldfieldtype': u'Int',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'credit_limit',
'fieldtype': 'Currency',
'idx': 20,
'label': 'Credit Limit',
'oldfieldname': 'credit_limit',
'oldfieldtype': 'Currency',
'doctype': u'DocField',
'fieldname': u'credit_limit',
'fieldtype': u'Currency',
'label': u'Credit Limit',
'oldfieldname': u'credit_limit',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'website',
'fieldtype': 'Data',
'idx': 21,
'label': 'Website',
'doctype': u'DocField',
'fieldname': u'website',
'fieldtype': u'Data',
'label': u'Website',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 22,
'label': 'Sales Team',
'oldfieldtype': 'Section Break',
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Sales Team',
'oldfieldtype': u'Section Break',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'default_sales_partner',
'fieldtype': 'Link',
'idx': 23,
'label': 'Default Sales Partner',
'oldfieldname': 'default_sales_partner',
'oldfieldtype': 'Link',
'options': 'Sales Partner',
'doctype': u'DocField',
'fieldname': u'default_sales_partner',
'fieldtype': u'Link',
'label': u'Default Sales Partner',
'oldfieldname': u'default_sales_partner',
'oldfieldtype': u'Link',
'options': u'Sales Partner',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'default_commission_rate',
'fieldtype': 'Currency',
'idx': 24,
'label': 'Default Commission Rate',
'oldfieldname': 'default_commission_rate',
'oldfieldtype': 'Currency',
'doctype': u'DocField',
'fieldname': u'default_commission_rate',
'fieldtype': u'Currency',
'label': u'Default Commission Rate',
'oldfieldname': u'default_commission_rate',
'oldfieldtype': u'Currency',
'permlevel': 0
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'sales_team',
'fieldtype': 'Table',
'idx': 25,
'label': 'Sales Team Details',
'oldfieldname': 'sales_team',
'oldfieldtype': 'Table',
'options': 'Sales Team',
'doctype': u'DocField',
'fieldname': u'sales_team',
'fieldtype': u'Table',
'label': u'Sales Team Details',
'oldfieldname': u'sales_team',
'oldfieldtype': u'Table',
'options': u'Sales Team',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'Section Break',
'idx': 26,
'label': 'Transaction History',
'colour': u'White:FFF',
'depends_on': u'eval:!doc.__islocal',
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Transaction History',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'depends_on': 'eval:!doc.__islocal',
'doctype': 'DocField',
'fieldtype': 'HTML',
'idx': 27,
'label': 'History HTML',
'colour': u'White:FFF',
'depends_on': u'eval:!doc.__islocal',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'History HTML',
'permlevel': 0
},
# DocField
{
'colour': 'White:FFF',
'doctype': 'DocField',
'fieldname': 'trash_reason',
'fieldtype': 'Small Text',
'idx': 28,
'label': 'Trash Reason',
'oldfieldname': 'trash_reason',
'oldfieldtype': 'Small Text',
'colour': u'White:FFF',
'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
}
]

View File

@ -50,8 +50,11 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
var callback = function(doc, dt, dn) {
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, dt, dn);
}
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
// hide - unhide fields based on lead or customer..
@ -83,10 +86,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
var callback = function() {
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
}
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(doc.docstatus == 1 && doc.status!='Order Lost') {

View File

@ -77,14 +77,16 @@ class DocType(TransactionBase):
# Get Item Details
# -----------------
def get_item_details(self, args=None):
args = eval(args)
if args['item_code']:
args = args and eval(args) or {}
if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
ret = obj.get_item_details(doc.item_code, self)
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@ -96,11 +98,6 @@ class DocType(TransactionBase):
get_obj('Sales Common').get_adj_percent(self)
def get_comp_base_currency(self):
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
def get_price_list_currency(self):
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
# OTHER CHARGES TRIGGER FUNCTIONS

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:17',
'docstatus': 0,
'modified': '2012-02-27 17:14:54',
'modified': '2012-03-02 12:20:40',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -41,7 +41,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s',
'tag_fields': u'status',
'version': 617
'version': 618
},
# These values are common for all DocFormat
@ -675,18 +675,6 @@
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
'doctype': u'DocField',
'fieldtype': u'HTML',
'label': u'Note HTML',
'oldfieldtype': u'HTML',
'options': u'<div style="margin-top:16px"><b>Note :</b> * In Base Currency\n</div>',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:18',
'docstatus': 0,
'modified': '2012-02-24 13:21:21',
'modified': '2012-03-05 10:48:27',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -23,7 +23,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 30
'version': 32
},
# These values are common for all DocField
@ -94,18 +94,33 @@
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldname': u'qty',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'in_filter': 0,
'label': u'Quantity',
'oldfieldname': u'qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'print_hide': 0,
'reqd': 1,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'width': u'100px'
},
# DocField
{
'default': u'0.00',
@ -116,7 +131,59 @@
'oldfieldname': u'adj_rate',
'oldfieldtype': u'Float',
'permlevel': 0,
'print_hide': 0,
'print_hide': 1,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'basic_rate',
'fieldtype': u'Currency',
'in_filter': 0,
'label': u'Basic Rate*',
'oldfieldname': u'basic_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'amount',
'fieldtype': u'Currency',
'in_filter': 0,
'label': u'Amount*',
'oldfieldname': u'amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
@ -139,24 +206,6 @@
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'qty',
'fieldtype': u'Currency',
'in_filter': 0,
'label': u'Quantity',
'oldfieldname': u'qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'reqd': 1,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
@ -174,37 +223,6 @@
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'basic_rate',
'fieldtype': u'Currency',
'in_filter': 0,
'label': u'Basic Rate*',
'oldfieldname': u'basic_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
@ -220,24 +238,6 @@
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'amount',
'fieldtype': u'Currency',
'in_filter': 0,
'label': u'Amount*',
'oldfieldname': u'amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',

View File

@ -26,13 +26,15 @@ cur_frm.cscript.load_taxes = function(doc, cdt, cdn, callback) {
// run if this is not executed from dt_map...
doc = locals[doc.doctype][doc.name];
if(doc.customer || getchildren('RV Tax Detail', doc.name, 'other_charges', doc.doctype).length) {
if(callback) callback(doc, cdt, cdn);
return;
if(callback) {
callback(doc, cdt, cdn);
}
} else {
$c_obj([doc],'load_default_taxes','',function(r,rt){
refresh_field('other_charges');
if(callback) callback(doc, cdt, cdn);
});
}
$c_obj([doc],'load_default_taxes','',function(r,rt){
refresh_field('other_charges');
if(callback) callback(doc, cdt, cdn);
});
}
@ -75,7 +77,6 @@ cur_frm.cscript.update_item_details = function(doc, dt, dn, callback) {
// ============== Customer and its primary contact Details ============================
cur_frm.cscript.customer = function(doc, cdt, cdn) {
if(doc.customer){
@ -120,7 +121,9 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
for (d in item_cols_export) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_export[d]+' ('+doc.currency+')');
var hide = (doc.currency == sys_defaults['currency']) ? false : true;
for (f in item_cols_base) cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
for (f in item_cols_export) {
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
}
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Total'};
@ -136,17 +139,11 @@ var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
// Change label dynamically based on currency
//------------------------------------------------------------------
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
var callback = function(r, rt) {
if (r.message) base_curr = r.message;
else base_curr = sys_defaults['currency'];
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, base_curr, callback) {
set_dynamic_label_par(doc, cdt, cdn, base_curr);
set_dynamic_label_child(doc, cdt, cdn, base_curr);
set_dynamic_label_par(doc, cdt, cdn, base_curr);
set_dynamic_label_child(doc, cdt, cdn, base_curr);
}
if (doc.company == sys_defaults['company']) callback('', '');
else $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
if (callback) callback(doc, cdt, cdn);
}
@ -155,27 +152,30 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
if (doc.price_list_name && doc.currency) {
var callback = function(r, rt) {
pl_currency = r.message[0]?r.message[0]:[];
if (pl_currency.length==1) {
if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1})
hide_field(['price_list_currency', 'plc_conversion_rate']);
} else unhide_field(['price_list_currency', 'plc_conversion_rate']);
wn.call({
method: 'selling.doctype.sales_common.sales_common.get_price_list_currency',
args: {'price_list':doc.price_list_name, 'company': doc.company},
callback: function(r, rt) {
pl_currency = r.message[0]?r.message[0]:[];
if (pl_currency.length==1) {
if (pl_currency[0] == doc.currency) set_multiple(cdt, cdn, {price_list_currency:doc.currency, plc_conversion_rate:doc.conversion_rate});
else if (pl_currency[0] = r.message[1]) set_multiple(cdt, cdn, {price_list_currency:pl_currency[0], plc_conversion_rate:1})
hide_field(['price_list_currency', 'plc_conversion_rate']);
} else unhide_field(['price_list_currency', 'plc_conversion_rate']);
if (r.message[1] == doc.currency) {
set_multiple(cdt, cdn, {conversion_rate:1});
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
if (r.message[1] == doc.currency) {
set_multiple(cdt, cdn, {conversion_rate:1});
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
if (r.message[1] == doc.price_list_currency) {
set_multiple(cdt, cdn, {plc_conversion_rate:1});
hide_field('plc_conversion_rate');
} else unhide_field('plc_conversion_rate');
callback1()
}
$c_obj(make_doclist(doc.doctype, doc.name), 'get_price_list_currency', '', callback);
if (r.message[1] == doc.price_list_currency) {
set_multiple(cdt, cdn, {plc_conversion_rate:1});
hide_field('plc_conversion_rate');
} else unhide_field('plc_conversion_rate');
cur_frm.cscript.dynamic_label(doc, cdt, cdn, r.message[1], callback1);
}
})
}
}
@ -213,12 +213,15 @@ cur_frm.cscript.conversion_rate = cur_frm.cscript.currency;
cur_frm.cscript.plc_conversion_rate = cur_frm.cscript.currency;
cur_frm.cscript.company = function(doc, dt, dn) {
var callback = function(r, rt) {
var doc = locals[dt][dn];
set_multiple(doc.doctype, doc.name, {currency:r.message,price_list_currency:r.message});
cur_frm.cscript.currency(doc, cdt, cdn);
}
$c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback);
wn.call({
method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
args: {company:doc.company},
callback: function(r, rt) {
var doc = locals[dt][dn];
set_multiple(doc.doctype, doc.name, {currency:r.message, price_list_currency:r.message});
cur_frm.cscript.currency(doc, cdt, cdn);
}
});
}
@ -234,7 +237,6 @@ cur_frm.cscript.price_list_name = function(doc, cdt, cdn) {
refresh_field(fname);
var doc = locals[cdt][cdn];
cur_frm.cscript.recalc(doc,3); //this is to re-calculate BASIC RATE and AMOUNT on basis of changed REF RATE
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
}
);
}
@ -557,11 +559,9 @@ cur_frm.cscript.consider_incl_rate = function(doc, other_fname) {
var tax_list = getchildren('RV Tax Detail', doc.name, other_fname, doc.doctype);
for(var i=0; i<tax_list.length; i++) {
if(tax_list[i].included_in_print_rate) {
//console.log('consider incl rate');
return true;
}
}
//console.log('do not consider incl rate');
return false;
}

View File

@ -32,6 +32,23 @@ convert_to_lists = webnotes.conn.convert_to_lists
from utilities.transaction_base import TransactionBase
@webnotes.whitelist()
def get_comp_base_currency(arg=None):
""" get default currency of company"""
res = webnotes.conn.sql("""select default_currency from `tabCompany`
where name = %s""", webnotes.form_dict.get('company'))
return res and res[0][0] or None
@webnotes.whitelist()
def get_price_list_currency(arg=None):
""" Get all currency in which price list is maintained"""
plc = webnotes.conn.sql("select distinct ref_currency from `tabRef Rate Detail` where price_list_name = %s", webnotes.form_dict['price_list'])
plc = [d[0] for d in plc]
base_currency = get_comp_base_currency(webnotes.form_dict['company'])
return plc, base_currency
class DocType(TransactionBase):
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
@ -178,18 +195,6 @@ class DocType(TransactionBase):
d.export_amount = flt(d.qty)*flt(base_ref_rate)/flt(obj.doc.conversion_rate)
def get_comp_base_currency(self, comp):
""" get default currency of company"""
return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", comp)[0][0]
def get_price_list_currency(self, price_list, comp):
""" Get all currency in which price list is maintained"""
plc = webnotes.conn.sql("select distinct ref_currency from `tabRef Rate Detail` where price_list_name = %s", price_list)
plc = [d[0] for d in plc]
base_currency = self.get_comp_base_currency(comp)
return plc, base_currency
# Load Default Taxes
# ====================
def load_default_taxes(self, obj):
@ -781,3 +786,4 @@ class StatusUpdater:
where
name="%(name)s"
""" % args)

View File

@ -41,10 +41,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
}
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.__islocal) {
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
var callback = function(doc, cdt, cdn) {
if(doc.__islocal) {
// defined in sales_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn);
}
}
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
}
@ -52,10 +57,8 @@ cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
//==================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
var callback = function() {
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
}
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(doc.docstatus==1) {

View File

@ -102,14 +102,16 @@ class DocType(TransactionBase):
# Get Item Details
# ----------------
def get_item_details(self, args=None):
args = eval(args)
if args['item_code']:
args = args and eval(args) or {}
if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
ret = obj.get_item_details(doc.item_code, self)
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@ -120,13 +122,6 @@ class DocType(TransactionBase):
def get_adj_percent(self, arg=''):
get_obj('Sales Common').get_adj_percent(self)
def get_comp_base_currency(self):
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
def get_price_list_currency(self):
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
# Get projected qty of item based on warehouse selected

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:21',
'docstatus': 0,
'modified': '2012-02-27 17:07:40',
'modified': '2012-03-02 14:34:02',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -21,7 +21,7 @@
# These values are common for all DocType
{
'_last_update': u'1330082514',
'_last_update': u'1330670942',
'allow_attach': 0,
'colour': u'White:FFF',
'default_print_format': u'Standard',
@ -38,7 +38,7 @@
'show_in_menu': 0,
'subject': u'From %(customer_name)s on %(transaction_date)s worth %(currency)s %(grand_total_export)s | %(per_delivered)s% delivered | %(per_billed)s% billed',
'tag_fields': u'delivery_status,billing_status',
'version': 629
'version': 631
},
# These values are common for all DocFormat
@ -322,6 +322,36 @@
'print_hide': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Territory',
'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Category of customer as entered in Customer master',
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Customer Group',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
@ -362,6 +392,7 @@
'oldfieldtype': u'Select',
'options': u'\nSales\nMaintenance',
'permlevel': 0,
'print_hide': 1,
'reqd': 1
},
@ -488,36 +519,6 @@
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'territory',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Territory',
'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Category of customer as entered in Customer master',
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Customer Group',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
@ -542,6 +543,40 @@
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Purchase Order sent by customer',
'doctype': u'DocField',
'fieldname': u'po_no',
'fieldtype': u'Data',
'hidden': 0,
'label': u'P.O. No',
'oldfieldname': u'po_no',
'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 0,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.po_no',
'doctype': u'DocField',
'fieldname': u'po_date',
'fieldtype': u'Date',
'hidden': 0,
'label': u'P.O. Date',
'oldfieldname': u'po_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'print_hide': 0,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
@ -965,7 +1000,7 @@
'oldfieldtype': u'Button',
'options': u'get_tc_details',
'permlevel': 0,
'print_hide': 0
'print_hide': 1
},
# DocField
@ -1059,40 +1094,6 @@
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'Purchase Order sent by customer',
'doctype': u'DocField',
'fieldname': u'po_no',
'fieldtype': u'Data',
'hidden': 0,
'label': u'P.O. No',
'oldfieldname': u'po_no',
'oldfieldtype': u'Data',
'permlevel': 0,
'print_hide': 0,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
'depends_on': u'eval:doc.po_no',
'doctype': u'DocField',
'fieldname': u'po_date',
'fieldtype': u'Date',
'hidden': 0,
'label': u'P.O. Date',
'oldfieldname': u'po_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'print_hide': 0,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
@ -1240,6 +1241,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1267,6 +1269,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1302,7 +1305,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:22',
'docstatus': 0,
'modified': '2012-02-24 10:38:06',
'modified': '2012-03-02 15:49:26',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 49
'version': 53
},
# These values are common for all DocField
@ -117,18 +117,15 @@
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'70px'
'width': u'100px'
},
# DocField
@ -146,49 +143,6 @@
'width': u'70px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'export_rate',
'fieldtype': u'Currency',
'label': u'Rate',
'oldfieldname': u'export_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'export_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'no_copy': 0,
'oldfieldname': u'export_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'width': u'100px'
},
# DocField
{
'default': u'0.00',
@ -221,6 +175,52 @@
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'oldfieldname': u'ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'70px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'export_rate',
'fieldtype': u'Currency',
'label': u'Rate',
'oldfieldname': u'export_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'export_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'no_copy': 0,
'oldfieldname': u'export_amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
@ -398,41 +398,6 @@
'report_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'description': u'required for production. will be used later.',
'doctype': u'DocField',
'fieldname': u'delivery_date',
'fieldtype': u'Date',
'hidden': 1,
'label': u'Expected Delivery Date',
'oldfieldname': u'delivery_date',
'oldfieldtype': u'Date',
'permlevel': 1,
'print_hide': 1,
'report_hide': 1
},
# DocField
{
'allow_on_submit': 1,
'colour': u'White:FFF',
'description': u'required for production. will be used later.',
'doctype': u'DocField',
'fieldname': u'confirmation_date',
'fieldtype': u'Date',
'hidden': 0,
'in_filter': 1,
'label': u'Confirmed Delivery Date',
'oldfieldname': u'confirmation_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'print_hide': 1,
'report_hide': 1,
'search_index': 0
},
# DocField
{
'colour': u'White:FFF',

View File

@ -60,7 +60,7 @@ elif based_on == 'Sales Partner':
if under == 'Receivable Voucher':
under_detail = 'RV'
dt = 'voucher_date'
dt = 'posting_date'
else:
under_detail = under
dt = "transaction_date"
@ -516,4 +516,4 @@ for r in res:
tot_target = 0
elif tl == 1:
out.append(r)
out.append(r)

View File

@ -0,0 +1,562 @@
// common partner functions
// =========================
/*
// make shipping list body
// ------------------------
cur_frm.cscript.make_sl_body = function(){
cur_frm.fields_dict['Shipping HTML'].wrapper.innerHTML = '';
cur_frm.shipping_html = $a(cur_frm.fields_dict['Shipping HTML'].wrapper,'div');
}
*/
// make history list body
// -----------------------
cur_frm.cscript.make_hl_body = function(){
cur_frm.fields_dict['History HTML'].wrapper.innerHTML = '';
cur_frm.history_html = $a(cur_frm.fields_dict['History HTML'].wrapper,'div');
}
/*
// set shipping list message
// --------------------------
cur_frm.cscript.set_sl_msg = function(doc){
cur_frm.shipping_html.innerHTML = 'Shipping Address Details will appear only when you save the ' + doc.doctype.toLowerCase();
}
*/
/*
// set history list message
// -------------------------
cur_frm.cscript.set_hl_msg = function(doc){
cur_frm.history_html.innerHTML= 'History Details will appear only when you save the ' + doc.doctype.toLowerCase();
}
*/
/*
// make shipping address
// -------------
cur_frm.cscript.make_shipping_address = function(doc, dt, dn){
cur_frm.shipping_html.innerHTML = '';
var dsn = cur_frm.doc.customer_name;
var dsa = cur_frm.doc.address;
cl = new AddressList(cur_frm.shipping_html,dt,dn,dsn,dsa);
}
*/
// make history
// -------------
cur_frm.cscript.make_history = function(doc,dt,dn){
cur_frm.history_html.innerHTML = '';
cur_frm.cscript.make_history_list(cur_frm.history_html,doc);
}
// make history list
// ------------------
cur_frm.cscript.make_history_list = function(parent,doc){
var sel = $a(parent,'select');
var ls = ['Select Transaction..'];
for(d in cur_frm.history_dict){
ls.push(d);
}
add_sel_options(sel,ls,'Select..');
var body = $a(parent,'div');
body.innerHTML = '<div class="help_box">Please select a transaction type to see History</div>';
sel.body = body;
sel.doc = doc;
sel.onchange = function(){
for(d in cur_frm.history_dict){
if(sel_val(this) == d){
this.body.innerHTML = '';
eval(cur_frm.history_dict[d]);
return;
}
else{
// pass
}
}
}
}
// run list
// ---------
cur_frm.cscript.run_list = function(lst,parent,q,q_max,doc,dn,nm){
parent.innerHTML = '';
$dh(parent);
lst.doc = doc;
lst.dn = dn;
lst.nm = nm;
lst.page_len = 10;
lst.get_query = function(){
this.query = q;
this.query_max = q_max;
}
lst.make(parent);
lst.run();
lst.onrun = function(){
$ds(parent);
if(!this.has_data()){
parent.innerHTML = '';
var dv = $a(parent,'div','help_box');
$a(dv,'span').innerHTML = "No " + this.dn + " found. ";
var lbl = 'Create the <b>first</b> ' + this.dn + ' for ' + this.doc.name;
var sp = $a(dv,'span');
sp.nm = this.nm;
$(sp).html(lbl).addClass('link_type').click(function(){ newdoc(this.nm); });
}
}
}
// get sates on country trigger
// -----------------------------
cur_frm.cscript.get_states=function(doc,dt,dn){
$c('runserverobj', args={'method':'check_state', 'docs':compress_doclist([doc])},
function(r,rt){
if(r.message) {
set_field_options('state', r.message);
}
}
);
}
cur_frm.cscript.country = function(doc, dt, dn) {
cur_frm.cscript.get_states(doc, dt, dn);
}
// territory help - cutsomer + sales partner
// -----------------------------------------
cur_frm.cscript.TerritoryHelp = function(doc,dt,dn){
var call_back = function(){
var sb_obj = new SalesBrowser();
sb_obj.set_val('Territory');
}
loadpage('Sales Browser',call_back);
}
// get query select Territory
// ---------------------------
if(cur_frm.fields_dict['territory']){
cur_frm.fields_dict['territory'].get_query = function(doc,dt,dn) {
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
}
}
// =======================================================================================================
// contact list
// --------------
ContactList = function(parent,dt,dn,dsn){
var me = this;
this.dt = dt;
this.dn = dn;
this.dsn = dsn ? dsn : dn;
this.wrapper = $a(parent,'div');
me.get_list();
}
// add contact
// ------------
ContactList.prototype.add_contact = function(){
var me = this;
// onload - set default values
var cont = LocalDB.create('Contact');
var c = locals['Contact'][cont];
if(me.dt == 'Customer') {
c.is_customer = 1;
c.customer = me.dn;
c.customer_name = me.dsn;
}
else if(me.dt == 'Supplier'){
c.is_supplier = 1;
c.supplier = me.dn;
c.supplier_name = me.dsn;
}
else if(me.dt == 'Sales Partner'){
c.is_sales_partner = 1;
c.sales_partner = me.dn;
//c.sales_partner_name = me.dsn;
}
loaddoc('Contact',c.name);
}
// get contact list
// -----------------
ContactList.prototype.get_list = function(){
var me = this;
me.make_list();
var dt = me.dt.toLowerCase().split(' ').join('_');
// build query
me.lst.get_query = function(){
this.query = repl("select name, first_name, last_name, concat_ws(' ', first_name, last_name), email_id, contact_no, department, designation, is_primary_contact, has_login, disable_login from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
this.query_max = repl("select count(name) from tabContact where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
}
// render list ui
me.lst.show_cell = function(cell,ri,ci,d){
me.render_list(cell,ri,ci,d);
}
// run query
me.lst.run();
// onrun
me.lst.onrun = function(){
if(!this.has_data()){
this.rec_label.innerHTML = '';
$a(this.rec_label,'span').innerHTML = "You do not have any contact. ";
$($a(this.rec_label,'span')).html('Add a new contact').addClass('link_type').click(function(){ me.add_contact(); });
$dh(this.results);
}
else{
$ds(this.results);
}
}
}
// make list
// -----------
ContactList.prototype.make_list = function(){
var me = this;
var l = new Listing();
l.colwidths = ['5%','30%','30%','20%','20%'];
l.colnames = ['Sr.','Contact Name','Email Id','Contact No', 'Action'];
l.page_len = 10;
me.lst = l;
l.make(me.wrapper);
// Add contact button
me.add_btn = $btn(l.btn_area,'+ Add Contact', function(){ me.add_contact();}, {fontWeight:'bold'});
}
// make contact cell
// ------------------
ContactList.prototype.render_list = function(cell,ri,ci,d){
var me = this;
// name
if(ci == 0){
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
nm.innerHTML = d[ri][3];
nm.id = d[ri][0];
nm.onclick = function(){
loaddoc('Contact', this.id);
// on save callback - refresh list
}
// department and designation
var des = d[ri][7] ? d[ri][7] : '';
var dep = d[ri][6] ? d[ri][6] : '';
var sp = $a(cell,'div','comment');
sp.innerHTML = des + (dep ? (', ' + dep) : '');
}
// email id, contact no, department, designation
// -----------------------------------------------------
if(ci == 1) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
if(ci == 2) cell.innerHTML = d[ri][5] ? d[ri][5] : '-';
// actions
// --------------------------------------
if(ci== 3) me.make_actions(cell,ri,ci,d);
}
// make actions
// ---------------
ContactList.prototype.make_actions = function(cell,ri,ci,d){
var me = this;
var tab = make_table(cell,1,2,'100%',['40%','60%']);
// Edit and Delete
var t = make_table($td(tab,0,0),1,2);
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
$(edit).click(function(){ loaddoc('Contact',d[ri][0]); });
edit.setAttribute('title','Edit');
// Below code should be uncommented once customer/venodr invitation process is stable
// ===========================================================================
/*
var del = $a($td(t,0,1),'div','wn-icon ic-trash');
$(del).click(function(){ me.delete_contact(d[ri][0],d[ri][4]) });
set_custom_tooltip(del, 'Delete');
// Invite, Enable and Disable - Integrate after gateway logic incorporated
if(d[ri][9] == 'Yes') {
if(d[ri][10] == 'Yes'){
var enb = $a($td(tab,0,1),'div','wn-icon ic-checkmark');
$(enb).click(function(){ me.enable_login(d[ri][0], d[ri][4]); });
}
else{
var dsb = $a($td(tab,0,1),'div','wn-icon ic-delete');
$(dsb).click(function(){ me.disable_login(d[ri][0], d[ri][4]) });
}
}
else{
var inv = $a($td(tab,0,1),'div','wn-icon ic-mail');
$(inv).click(function(){ me.invite_contact(d[ri][0], d[ri][4], d[ri][1], d[ri][2]) });
}*/
}
// enable login
// ----------------------------------------------------------
ContactList.prototype.enable_login = function(id, email_id){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Login for contact enabled',1);
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
$c_obj('Contact Control','enable_login',JSON.stringify(args),callback);
}
// disable login
// -------------------------------------------------------------
ContactList.prototype.disable_login = function(id, email_id){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Login for contact disabled',1);
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
$c_obj('Contact Control','disable_login',JSON.stringify(args),callback);
}
// delete contact
// -----------------
ContactList.prototype.delete_contact = function(id,email_id,has_login){
var me = this;
var callback = function(r,rt){
me.get_list();
if(!r.exc) msgprint('Contact deleted successfully');
else errprint(r.exc);
}
var args = {};
args.contact = id;
args.email = email_id;
args.has_login = has_login;
$c_obj('Contact Control','delete_contact',JSON.stringify(args),callback);
}
// invite user
// --------------------------------------------------------
ContactList.prototype.invite_contact = function(id,email_id,first_name,last_name){
var me = this;
if(!email_id){
msgprint("Please add email id and save the contact first. You can then invite contact to view transactions.")
}
else{
var callback = function(r,rt){
if(!r.exc) msgprint('Invitation sent');
else errprint(r.exc);
}
var args = {
'contact' : id,
'email' : email_id,
'first_name' : first_name ? first_name : '',
'last_name' : last_name ? last_name : '',
'usert_type' : 'Partner'
};
$c_obj('Contact Control','invite_contact',JSON.stringify(args),callback);
}
}
// address list
// --------------
AddressList = function(parent,dt,dn,dsn,dsa){
var me = this;
this.dt = dt;
this.dn = dn;
this.dsn = dsn ? dsn : dn;
this.dsa = dsa ? dsa : '';
this.wrapper = $a(parent,'div');
me.get_addr_list();
}
// add contact
// ------------
AddressList.prototype.add_address = function(){
var me = this;
// onload - set default values
var addr = LocalDB.create('Shipping Address');
var a = locals['Shipping Address'][addr];
a.customer = me.dn;
a.customer_name = me.dsn;
a.customer_address = me.dsa;
loaddoc('Shipping Address',a.name);
}
// get address list
// -----------------
AddressList.prototype.get_addr_list = function(){
var me = this;
me.make_addr_list();
var dt = me.dt.toLowerCase().split(' ').join('_');
// build query
me.lst.get_query = function(){
this.query = repl("select name, ship_to, shipping_address, is_primary_address, shipping_details from `tabShipping Address` where %(dt)s = '%(dn)s' and docstatus != 2",{'dt':dt, 'dn':me.dn});
this.query_max = repl("select count(name) from `tabShipping Address` where %(dt)s = '%(dn)s'",{'dt':dt, 'dn':me.dn});
}
// render list ui
me.lst.show_cell = function(cell,ri,ci,d){
me.render_list(cell,ri,ci,d);
}
// run query
me.lst.run();
// onrun
me.lst.onrun = function(){
if(!this.has_data()){
this.rec_label.innerHTML = '';
$a(this.rec_label,'span').innerHTML = "You do not have any shipping address.";
$($a(this.rec_label,'span')).html('Add a new address').addClass('link_type').click(function(){ me.add_address(); });
$dh(this.results);
}
else{
$ds(this.results);
}
}
}
// make list
// -----------
AddressList.prototype.make_addr_list = function(){
var me = this;
var l = new Listing();
l.colwidths = ['5%', '15%', '25%','10%','35%','10%'];
l.colnames = ['Sr.', 'Ship To', 'Shipping Address','Primary Address', 'Shipping Details', 'Action'];
l.page_len = 10;
me.lst = l;
l.make(me.wrapper);
// Add address button
me.add_btn = $btn(l.btn_area,'+ Add Address', function(){ me.add_address();}, {fontWeight:'bold'});
}
// make address cell
// ------------------
AddressList.prototype.render_list = function(cell,ri,ci,d){
var me = this;
// name
if(ci == 0){
var nm = $a($a(cell,'div'),'span','',{cursor:'pointer'});
nm.innerHTML = d[ri][1];
nm.id = d[ri][0];
nm.onclick = function(){
loaddoc('Shipping Address', this.id);
}
}
// shipping address, primary address, shipping details
// ----------------------------------------------------
if(ci == 1) cell.innerHTML = d[ri][2] ? d[ri][2] : '-';
if(ci == 2) cell.innerHTML = d[ri][3] ? d[ri][3] : '-';
if(ci == 3) cell.innerHTML = d[ri][4] ? d[ri][4] : '-';
// actions
// --------------------------------------
if(ci== 4) me.make_actions(cell,ri,ci,d);
}
// make actions
// ---------------
AddressList.prototype.make_actions = function(cell,ri,ci,d){
var me = this;
var tab = make_table(cell,1,2,'100%',['40%','60%']);
// Edit and Delete
var t = make_table($td(tab,0,0),1,2);
var edit = $a($td(t,0,0),'div','wn-icon ic-doc_edit');
$(edit).click(function(){ loaddoc('Shipping Address',d[ri][0]); });
edit.setAttribute('title','Edit');
}

View File

@ -0,0 +1,103 @@
# 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, removechild, getchildren, make_autoname, SuperDocType
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 enable_login(self,arg):
arg = eval(arg)
sql("update tabContact set disable_login = 'No' where name=%s",arg['contact'])
sql("update tabProfile set enabled=1 where name=%s",arg['email'])
def disable_login(self,arg):
arg = eval(arg)
sql("update tabContact set disable_login = 'Yes' where name=%s",arg['contact'])
sql("update tabProfile set enabled=0 where name=%s",arg['email'])
def create_login(self,arg):
arg = eval(arg)
cont_det = sql("select * from tabContact where name=%s",(arg['contact']),as_dict=1)
if cont_det[0]['docstatus'] !=0:
msgprint('Please save the corresponding contact first')
raise Exception
if sql("select name from tabProfile where name=%s",cont_det[0]['email_id']):
msgprint('Profile with same name already exist.')
raise Exception
else:
p = Document('Profile')
p.name = cont_det[0]['email_id']
p.first_name = cont_det[0]['first_name']
p.last_name = cont_det[0]['last_name']
p.email = cont_det[0]['email_id']
p.cell_no = cont_det[0]['contact_no']
p.password = 'password'
p.enabled = 1
p.user_type = 'Partner';
p.save(1)
get_obj(doc=p).on_update()
role = []
if cont_det[0]['contact_type'] == 'Individual':
role = ['Customer']
else:
if cont_det[0]['is_customer']:
role.append('Customer')
if cont_det[0]['is_supplier']:
role.append('Supplier')
if cont_det[0]['is_sales_partner']:
role.append('Partner')
if role:
prof_nm = p.name
for i in role:
r = Document('UserRole')
r.parent = p.name
r.role = i
r.parenttype = 'Profile'
r.parentfield = 'userroles'
r.save(1)
if i == 'Customer':
def_keys = ['from_company','customer_name','customer']
def_val = cont_det[0]['customer_name']
self.set_default_val(def_keys,def_val,prof_nm)
if i == 'Supplier':
def_keys = ['supplier_name','supplier']
def_val = cont_det[0]['supplier_name']
self.set_default_val(def_keys,def_val,prof_nm)
sql("update tabContact set has_login = 'Yes' where name=%s",cont_det[0]['name'])
sql("update tabContact set disable_login = 'No' where name=%s",cont_det[0]['name'])
msgprint('User login is created.')
#------set default values---------
def set_default_val(self,def_keys,def_val,prof_nm):
for d in def_keys:
kv = Document('DefaultValue')
kv.defkey = d
kv.defvalue = def_val
kv.parent = prof_nm
kv.parenttype = 'Profile'
kv.parentfield = 'defaults'
kv.save(1)

View File

@ -0,0 +1,88 @@
# DocType, Contact Control
[
# These values are common in all dictionaries
{
'creation': '2010-08-08 17:08:56',
'docstatus': 0,
'modified': '2010-09-20 14:06:57',
'modified_by': 'yogesh@webnotestech.com',
'owner': 'Administrator'
},
# These values are common for all DocType
{
'colour': 'White:FFF',
'doctype': 'DocType',
'in_create': 1,
'issingle': 1,
'module': 'Setup',
'name': '__common__',
'read_only': 1,
'section_style': 'Simple',
'server_code_error': ' ',
'show_in_menu': 0,
'version': 25
},
# These values are common for all DocField
{
'doctype': 'DocField',
'fieldtype': 'Text',
'name': '__common__',
'parent': 'Contact Control',
'parentfield': 'fields',
'parenttype': 'DocType',
'permlevel': 0
},
# These values are common for all DocPerm
{
'create': 0,
'doctype': 'DocPerm',
'idx': 1,
'name': '__common__',
'parent': 'Contact Control',
'parentfield': 'permissions',
'parenttype': 'DocType',
'permlevel': 0,
'read': 1,
'role': 'System Manager',
'write': 1
},
# DocType, Contact Control
{
'doctype': 'DocType',
'name': 'Contact Control'
},
# DocPerm
{
'doctype': 'DocPerm'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'header',
'idx': 1,
'label': 'Header'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'customer_intro',
'idx': 2,
'label': 'Customer Intro'
},
# DocField
{
'doctype': 'DocField',
'fieldname': 'supplier_intro',
'idx': 3,
'label': 'Supplier Intro'
}
]

View File

@ -34,26 +34,32 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.nsm_parent_field = 'parent_customer_group';
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
self.nsm_parent_field = 'parent_customer_group';
# update Node Set Model
def update_nsm_model(self):
import webnotes
import webnotes.utils.nestedset
webnotes.utils.nestedset.update_nsm(self)
# update Node Set Model
def update_nsm_model(self):
import webnotes
import webnotes.utils.nestedset
webnotes.utils.nestedset.update_nsm(self)
# ON UPDATE
#--------------------------------------
def on_update(self):
# update nsm
self.update_nsm_model()
# ON UPDATE
#--------------------------------------
def on_update(self):
# update nsm
self.update_nsm_model()
def validate(self):
def validate(self):
if sql("select name from `tabCustomer Group` where name = %s and docstatus = 2", (self.doc.customer_group_name)):
msgprint("""Another %s record is trashed.
To untrash please go to Setup & click on Trash."""%(self.doc.customer_group_name), raise_exception = 1)
if sql("select name from `tabCustomer Group` where name = %s and docstatus = 2", (self.doc.customer_group_name)):
msgprint("%s record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.customer_group_name), raise_exception = 1)
def on_trash(self):
cust = sql("select name from `tabCustomer` where ifnull(customer_group, '') = %s", self.doc.name)
if cust:
msgprint("""Customer Group: %s can not be trashed/deleted because it is used in customer: %s.
To trash/delete this, remove/change customer group in customer master""" % (self.doc.name, cust[0][0] or ''), raise_exception=1)

View File

@ -8,11 +8,11 @@
#
# 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
@ -34,30 +34,36 @@ convert_to_lists = webnotes.conn.convert_to_lists
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
self.nsm_parent_field = 'parent_item_group';
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
self.nsm_parent_field = 'parent_item_group';
# update Node Set Model
def update_nsm_model(self):
import webnotes
import webnotes.utils.nestedset
webnotes.utils.nestedset.update_nsm(self)
# update Node Set Model
def update_nsm_model(self):
import webnotes
import webnotes.utils.nestedset
webnotes.utils.nestedset.update_nsm(self)
# ON UPDATE
#--------------------------------------
def on_update(self):
# update nsm
self.update_nsm_model()
# ON UPDATE
#--------------------------------------
def on_update(self):
# update nsm
self.update_nsm_model()
def validate(self):
if self.doc.lft and self.doc.rgt:
res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
if not res:
msgprint("Please enter proper parent item group.")
raise Exception
r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
if r:
msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
raise Exception
def validate(self):
if self.doc.lft and self.doc.rgt:
res = sql("select name from `tabItem Group` where is_group = 'Yes' and docstatus!= 2 and (rgt > %s or lft < %s) and name ='%s' and name !='%s'"%(self.doc.rgt,self.doc.lft,self.doc.parent_item_group,self.doc.item_group_name))
if not res:
msgprint("Please enter proper parent item group.")
raise Exception
r = sql("select name from `tabItem Group` where name = '%s' and docstatus = 2"%(self.doc.item_group_name))
if r:
msgprint("'%s' record is trashed. To untrash please go to Setup & click on Trash."%(self.doc.item_group_name))
raise Exception
def on_trash(self):
ig = sql("select name from `tabItem` where ifnull(item_group, '') = %s", self.doc.name)
if ig:
msgprint("""Item Group: %s can not be trashed/deleted because it is used in item: %s.
To trash/delete this, remove/change item group in item master""" % (self.doc.name, ig[0][0] or ''), raise_exception=1)

View File

@ -14,24 +14,14 @@
# 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 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, removechild, getchildren, make_autoname, SuperDocType
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
from webnotes.utils import cint, cstr, flt, getdate, now, nowdate
from webnotes.model.doc import Document, addchild
from webnotes.model.code import get_obj
from webnotes import session, form, msgprint
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, d, dl):
@ -58,8 +48,8 @@ class DocType:
args = json.loads(args)
self.set_cp_defaults(args['company'], args['industry'], args['time_zone'], args['country'], args['account_name'])
self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd'))
self.create_profile(args['user'], args['first_name'], args['last_name'], args.get('pwd'))
# Domain related updates
try:
from server_tools.gateway_utils import add_domain_map
@ -68,38 +58,48 @@ class DocType:
pass
# add record in domain_list of Website Settings
webnotes.conn.set_value('Website Settings', 'Website Settings', 'subdomain', args['url_name'] + ".erpnext.com")
account_url = args['url_name'] + '.erpnext.com'
webnotes.conn.set_value('Website Settings', 'Website Settings',
'subdomain', account_url)
# Account Setup
# ---------------
def setup_account(self, args):
import webnotes
company_name, comp_abbr, fy_start, currency, first_name, last_name = eval(args)
curr_fiscal_year,fy_start_date = self.get_fy_details(fy_start)
self.currency = currency
import webnotes, json
args = json.loads(args)
curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
args['name'] = webnotes.session.get('user')
# Update Profile
if last_name=='None': last_name = None
if not args.get('last_name') or args.get('last_name')=='None': args['last_name'] = None
webnotes.conn.sql("""\
UPDATE `tabProfile` SET first_name=%s, last_name=%s
WHERE name=%s AND docstatus<2""", (first_name, last_name, webnotes.user.name))
UPDATE `tabProfile` SET first_name=%(first_name)s,
last_name=%(last_name)s
WHERE name=%(name)s AND docstatus<2""", args)
# Fiscal Year
master_dict = {'Fiscal Year':{'year':curr_fiscal_year, 'year_start_date':fy_start_date}}
master_dict = {'Fiscal Year':{
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
'abbreviation': fy_abbr,
'company': args.get('company_name'),
'is_fiscal_year_closed': 'No'}}
self.create_records(master_dict)
# Company
master_dict = {'Company':{'company_name':company_name,
'abbr':comp_abbr,
'default_currency':currency
}}
master_dict = {'Company':{'company_name':args.get('company_name'),
'abbr':args.get('company_abbr'),
'default_currency':args.get('currency')
}}
self.create_records(master_dict)
def_args = {'current_fiscal_year':curr_fiscal_year,
'default_currency': currency,
'default_company':company_name,
'default_currency': args.get('currency'),
'default_company':args.get('company_name'),
'default_valuation_method':'FIFO',
'default_stock_uom':'Nos',
'date_format':'dd-mm-yyyy',
@ -111,21 +111,51 @@ class DocType:
'emp_created_by':'Naming Series',
'cust_master_name':'Customer Name',
'supp_master_name':'Supplier Name',
'default_currency_format': (currency=='INR') and 'Lacs' or 'Millions'
'default_currency_format': \
(args.get('currency')=='INR') and 'Lacs' or 'Millions'
}
# Set
self.set_defaults(def_args)
# Set Registration Complete
set_default('registration_complete','1')
self.create_feed_and_todo()
msgprint("Great! Your company has now been created")
webnotes.clear_cache()
msgprint("Company setup is complete")
import webnotes.utils
user_fullname = (first_name or '') + (last_name and (" " + last_name) or '')
user_fullname = (args.get('first_name') or '') + (args.get('last_name')
and (" " + args.get('last_name')) or '')
return {'sys_defaults': webnotes.utils.get_defaults(), 'user_fullname': user_fullname}
def create_feed_and_todo(self):
"""update activty feed and create todo for creation of item, customer, vendor"""
import home
home.make_feed('Comment', 'ToDo Item', '', webnotes.session['user'],
'<i>"' + 'Setup Complete. Please check your <a href="#!todo">\
To Do List</a>' + '"</i>', '#6B24B3')
d = Document('ToDo Item')
d.description = 'Create your first Customer'
d.priority = 'High'
d.date = nowdate()
d.reference_type = 'Customer'
d.save(1)
d = Document('ToDo Item')
d.description = 'Create your first Item'
d.priority = 'High'
d.date = nowdate()
d.reference_type = 'Item'
d.save(1)
d = Document('ToDo Item')
d.description = 'Create your first Supplier'
d.priority = 'High'
d.date = nowdate()
d.reference_type = 'Supplier'
d.save(1)
# Get Fiscal year Details
# ------------------------
@ -138,9 +168,11 @@ class DocType:
#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
if(fy_start == '1st Jan'):
fy = cstr(getdate(nowdate()).year)
abbr = cstr(fy)[-2:]
else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1)
return fy,stdt
abbr = cstr(curr_year)[-2:] + '-' + cstr(curr_year+1)[-2:]
return fy, stdt, abbr
# Create Company and Fiscal Year
@ -207,14 +239,6 @@ class DocType:
d = addchild(pr,'userroles', 'UserRole', 1)
d.role = r
d.save(1)
# Sync DB
# -------
def sync_db(arg=''):
import webnotes.model.db_schema
sql("delete from `tabDocType Update Register`")
webnotes.model.db_schema.sync_all()
def is_setup_okay(self, args):
@ -224,21 +248,14 @@ class DocType:
from server_tools.gateway_utils import get_total_users
args = eval(args)
#webnotes.logger.error("args in set_account_details of setup_control: " + str(args))
args = eval(args)
cp_defaults = webnotes.conn.get_value('Control Panel', None, 'account_id')
user_profile = webnotes.conn.get_value('Profile', args['user'], 'name')
from webnotes.utils import cint
total_users = get_total_users()
#webnotes.logger.error("setup_control.is_setup_okay: " + cp_defaults + " " + user_profile + " " + str(total_users))
#webnotes.logger.error("setup_control.is_setup_okay: Passed Values:" + args['account_name'] + " " + args['user'] + " " + str(args['total_users']))
if (cp_defaults==args['account_name']) and user_profile and \
(total_users==cint(args['total_users'])):
return 'True'

View File

@ -74,4 +74,11 @@ class DocType:
for d in getlist(self.doclist, 'target_details'):
if not flt(d.target_qty) and not flt(d.target_amount):
msgprint("Either target qty or target amount is mandatory.")
raise Exception
raise Exception
def on_trash(self):
terr = sql("select name from `tabCustomer` where ifnull(territory, '') = %s", self.doc.name)
if terr:
msgprint("""Territory: %s can not be trashed/deleted because it is used in territory: %s.
To trash/delete this, remove/change territory in customer master""" % (self.doc.name, terr[0][0] or ''), raise_exception=1)

View File

@ -0,0 +1,14 @@
<div class="layout-wrapper">
<a class="close" onclick="window.history.back();">&times;</a>
<h1>Modules Setup</h1>
<hr>
<div class="help" style="width: 300px; float: right">
Select checkbox to show / hide module. Drag around to move order.
</div>
<div id="modules-list">
</div>
<div>
<button class="btn btn-small btn-primary" id="modules-update"
onclick="wn.pages.modules_setup.update()">Update</button>
</div>
</div>

View File

@ -0,0 +1,50 @@
wn.require('lib/js/lib/jquery-ui-sortable.min.js');
$.extend(wn.pages.modules_setup, {
modules: ['Activity', 'Accounts', 'Selling', 'Buying', 'Stock', 'Production', 'Projects',
'Support', 'HR', 'Website', 'To Do', 'Messages', 'Calendar', 'Knowledge Base'],
onload: function(wrapper) {
wn.pages.modules_setup.refresh(wn.boot.modules_list);
},
refresh: function(ml) {
$('#modules-list').empty();
// checked modules
for(i in ml) {
$('#modules-list').append(repl('<p style="cursor:move;">\
<input type="checkbox" data-module="%(m)s"> \
%(m)s</p>', {m:ml[i]}));
}
$('#modules-list [data-module]').attr('checked', true);
// unchecked modules
var all = wn.pages.modules_setup.modules;
for(i in all) {
if(!$('#modules-list [data-module="'+all[i]+'"]').length) {
$('#modules-list').append(repl('<p style="cursor:move;">\
<input type="checkbox" data-module="%(m)s"> \
%(m)s</p>', {m:all[i]}));
}
}
$('#modules-list').sortable();
},
update: function() {
var ml = [];
$('#modules-list [data-module]').each(function() {
if($(this).attr('checked'))
ml.push($(this).attr('data-module'));
});
wn.call({
method: 'setup.page.modules_setup.modules_setup.update',
args: {
ml: JSON.stringify(ml)
},
callback: function(r) {
},
btn: $('#modules-update').get(0)
});
}
});

View File

@ -0,0 +1,8 @@
import webnotes
@webnotes.whitelist()
def update(arg=None):
"""update modules"""
webnotes.conn.set_global('modules_list', webnotes.form_dict['ml'])
webnotes.msgprint('Updated')
webnotes.clear_cache()

View File

@ -0,0 +1,28 @@
# Page, modules_setup
[
# These values are common in all dictionaries
{
'creation': '2012-02-28 17:48:39',
'docstatus': 0,
'modified': '2012-02-28 17:48:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Page
{
'doctype': 'Page',
'module': u'Setup',
'name': '__common__',
'page_name': u'modules_setup',
'standard': u'Yes',
'title': u'Modules Setup'
},
# Page, modules_setup
{
'doctype': 'Page',
'name': u'modules_setup'
}
]

View File

@ -20,7 +20,7 @@
<div class="setup-column">
<h3>Users and Permissions</h3>
<p>
<b><a href="#!My Company">Users</a></b><br>
<b><a href="#!users">Users</a></b><br>
<span class="help">Add/remove users, set roles, passwords etc</span>
</p>
<p>
@ -31,6 +31,10 @@
<b><a href="#!List/Authorization Rule">Amount based Authorization Rules</a></b><br>
<span class="help">Restrict submission rights based on amount</span>
</p>
<p>
<b><a href="#!modules_setup">Modules Setup</a></b><br>
<span class="help">Show, hide modules</span>
</p>
</div>
<div class="setup-column">
<h3>Data</h3>

View File

@ -48,7 +48,7 @@ def on_login_post_session(login_manager):
sid!=%s""", \
(webnotes.session['user'], webnotes.session['sid']), as_list=1)
if webnotes.session['user'] not in ('Guest') and webnotes.conn.cur_db_name!='accounts':
if webnotes.session['user'] not in ('Guest', 'demo@webnotestech.com') and webnotes.conn.cur_db_name!='accounts':
# create feed
from webnotes.utils import nowtime
home.make_feed('Login', 'Profile', login_manager.user, login_manager.user,
@ -87,6 +87,14 @@ def boot_session(bootinfo):
import webnotes.model.doctype
bootinfo['docs'] += webnotes.model.doctype.get('Event')
bootinfo['modules_list'] = webnotes.conn.get_global('modules_list')
# if no company, show a dialog box to create a new company
bootinfo['setup_complete'] = webnotes.conn.sql("""select name from
tabCompany limit 1""") and 'Yes' or 'No'
bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or ''
def get_letter_heads():
"""load letter heads with startup"""

View File

@ -0,0 +1,93 @@
// 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/>.
// complete my company registration
// --------------------------------
erpnext.complete_setup = function() {
var currency_list = ['', 'AED', 'AFN', 'ALL', 'AMD', 'ANG', 'AOA', 'ARS', 'AUD', 'AZN',
'BAM', 'BBD', 'BDT', 'BGN', 'BHD', 'BIF', 'BMD', 'BND', 'BOB', 'BRL', 'BSD', 'BTN', 'BYR',
'BZD', 'CAD', 'CDF', 'CFA', 'CFP', 'CHF', 'CLP', 'CNY', 'COP', 'CRC', 'CUC', 'CZK', 'DJF',
'DKK', 'DOP', 'DZD', 'EEK', 'EGP', 'ERN', 'ETB', 'EUR', 'EURO', 'FJD', 'FKP', 'FMG', 'GBP',
'GEL', 'GHS', 'GIP', 'GMD', 'GNF', 'GQE', 'GTQ', 'GYD', 'HKD', 'HNL', 'HRK', 'HTG', 'HUF',
'IDR', 'ILS', 'INR', 'IQD', 'IRR', 'ISK', 'JMD', 'JOD', 'JPY', 'KES', 'KGS', 'KHR', 'KMF',
'KPW', 'KRW', 'KWD', 'KYD', 'KZT', 'LAK', 'LBP', 'LKR', 'LRD', 'LSL', 'LTL', 'LVL', 'LYD',
'MAD', 'MDL', 'MGA', 'MKD', 'MMK', 'MNT', 'MOP', 'MRO', 'MUR', 'MVR', 'MWK', 'MXN', 'MYR',
'MZM', 'NAD', 'NGN', 'NIO', 'NOK', 'NPR', 'NRs', 'NZD', 'OMR', 'PAB', 'PEN', 'PGK', 'PHP',
'PKR', 'PLN', 'PYG', 'QAR', 'RMB', 'RON', 'RSD', 'RUB', 'RWF', 'SAR', 'SCR', 'SDG', 'SDR',
'SEK', 'SGD', 'SHP', 'SOS', 'SRD', 'STD', 'SYP', 'SZL', 'THB', 'TJS', 'TMT', 'TND', 'TRY',
'TTD', 'TWD', 'TZS', 'UAE', 'UAH', 'UGX', 'USD', 'USh', 'UYU', 'UZS', 'VEB', 'VND', 'VUV',
'WST', 'XAF', 'XCD', 'XDR', 'XOF', 'XPF', 'YEN', 'YER', 'YTL', 'ZAR', 'ZMK', 'ZWR'];
var d = new wn.widgets.Dialog({
title: "Setup",
fields: [
{fieldname:'first_name', label:'Your First Name', fieldtype:'Data', reqd: 1},
{fieldname:'last_name', label:'Your Last Name', fieldtype:'Data'},
{fieldname:'company_name', label:'Company Name', fieldtype:'Data', reqd:1,
description: 'e.g. "My Company LLC"'},
{fieldname:'company_abbr', label:'Company Abbreviation', fieldtype:'Data',
description:'e.g. "MC"',reqd:1},
{fieldname:'fy_start', label:'Financial Year Start Date', fieldtype:'Select',
description:'Your financial year begins on"', reqd:1,
options: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'].join('\n')},
{fieldname:'currency', label: 'Default Currency', reqd:1,
options: currency_list.join('\n'), fieldtype: 'Select'},
{fieldname:'update', label:'Setup',fieldtype:'Button'}
]
})
// prepare
if(user != 'Administrator'){
d.no_cancel(); // Hide close image
$('header').toggle(false); // hide toolbar
}
// company name already set
if(wn.control_panel.company_name) {
var inp = d.fields_dict.company_name.input;
inp.value = wn.control_panel.company_name;
inp.disabled = true;
}
// set first name, last name
if(user_fullname) {
u = user_fullname.split(' ');
if(u[0]) {
d.fields_dict.first_name.input.value = u[0];
}
if(u[1]) {
d.fields_dict.last_name.input.value = u[1];
}
}
// setup
d.fields_dict.update.input.onclick = function() {
var data = d.get_values();
if(!data) return;
$(this).set_working();
$c_obj('Setup Control','setup_account',data,function(r, rt){
sys_defaults = r.message;
user_fullname = r.message.user_fullname;
wn.boot.user_info[user].fullname = user_fullname;
d.hide();
$('header').toggle(true);
page_body.wntoolbar.set_user_name();
});
}
d.show();
}

View File

@ -122,13 +122,13 @@ pscript.feature_dict = {
'Sales Order': {'sales_order_details':['page_break']}
},
'fs_exports': {
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['base_ref_rate','export_amount','export_rate']},
'Delivery Note': {'fields':['Note','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'delivery_note_details':['ref_rate','export_amount','export_rate']},
'POS Setting': {'fields':['conversion_rate','currency']},
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['base_ref_rate','export_amount','export_rate']},
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['base_ref_rate','export_amount','export_rate']},
'Quotation': {'fields':['Note HTML','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'quotation_details':['ref_rate','export_amount','export_rate']},
'Receivable Voucher': {'fields':['conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'entries':['ref_rate','export_amount','export_rate']},
'Item': {'ref_rate_details':['ref_currency']},
'Sales BOM': {'fields':['currency']},
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['base_ref_rate','export_amount','export_rate']}
'Sales Order': {'fields':['Note1','OT Notes','conversion_rate','currency','grand_total_export','in_words_export','rounded_total_export'],'sales_order_details':['ref_rate','export_amount','export_rate']}
},
'fs_imports': {
'Payable Voucher': {'fields':['conversion_rate','currency','grand_total_import','in_words_import','net_total_import','other_charges_added_import','other_charges_deducted_import'],'entries':['import_amount','import_rate']},
@ -149,7 +149,6 @@ pscript.feature_dict = {
'Sales Order': {'fields':['sales_team','Packing List']}
},
'fs_more_info': {
'Customer': {'fields':['More Info']},
'Delivery Note': {'fields':['More Info']},
'Enquiry': {'fields':['More Info']},
'Indent': {'fields':['More Info']},
@ -160,8 +159,6 @@ pscript.feature_dict = {
'Quotation': {'fields':['More Info']},
'Receivable Voucher': {'fields':['More Info']},
'Sales Order': {'fields':['More Info']},
'Serial No': {'fields':['More Info']},
'Supplier': {'fields':['More Info']}
},
'fs_quality': {
'Item': {'fields':['Item Inspection Criteria','inspection_required']},

View File

@ -32,7 +32,7 @@ erpnext.module_page.hide_links = function(wrapper) {
$(wrapper).find('[href*="List/"]').each(function() {
var href = $(this).attr('href');
var dt = href.split('/')[1];
if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1) {
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@ -41,7 +41,7 @@ erpnext.module_page.hide_links = function(wrapper) {
// reports
$(wrapper).find('[data-doctype]').each(function() {
var dt = $(this).attr('data-doctype');
if(wn.boot.profile.can_read.indexOf(dt)==-1) {
if(wn.boot.profile.all_read.indexOf(dt)==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@ -51,7 +51,7 @@ erpnext.module_page.hide_links = function(wrapper) {
$(wrapper).find('[href*="Form/"]').each(function() {
var href = $(this).attr('href');
var dt = href.split('/')[1];
if(wn.boot.profile.can_read.indexOf(get_label_doctype(dt))==-1) {
if(wn.boot.profile.all_read.indexOf(get_label_doctype(dt))==-1) {
var txt = $(this).text();
$(this).parent().css('color', '#999').html(txt);
}
@ -73,7 +73,10 @@ erpnext.module_page.make_list = function(module, wrapper) {
args: {
module: module
},
no_refresh: true
no_refresh: true,
callback: function(r) {
erpnext.module_page.hide_links(wrapper)
}
});
wrapper.list.run();
}

View File

@ -73,20 +73,43 @@ erpnext.toolbar.add_modules = function() {
$('<li class="dropdown">\
<a class="dropdown-toggle" data-toggle="dropdown" href="#"\
onclick="return false;">Modules<b class="caret"></b></a>\
<ul class="dropdown-menu">\
<li><a href="#!accounts-home" data-module="Accounts">Accounts</a></li>\
<li><a href="#!selling-home" data-module="Selling">Selling</a></li>\
<li><a href="#!stock-home" data-module="Stock">Stock</a></li>\
<li><a href="#!buying-home" data-module="Buying">Buying</a></li>\
<li><a href="#!support-home" data-module="Support">Support</a></li>\
<li><a href="#!hr-home" data-module="HR">Human Resources</a></li>\
<li><a href="#!projects-home" data-module="Projects">Projects</a></li>\
<li><a href="#!production-home" data-module="Production">Production</a></li>\
<li><a href="#!website-home" data-module="Website">Website</a></li>\
<li class="divider"></li>\
<li><a href="#!Setup" data-module="Setup">Setup</a></li>\
<ul class="dropdown-menu modules">\
</ul>\
</li>').prependTo('.navbar .nav:first');
$('.navbar .nav:first')
// if no modules list then show all
if(wn.boot.modules_list)
wn.boot.modules_list = JSON.parse(wn.boot.modules_list);
else
wn.boot.modules_list = keys(erpnext.modules).sort();
// add to dropdown
for(var i in wn.boot.modules_list) {
var m = wn.boot.modules_list[i]
if(m!='Setup' && wn.boot.profile.allow_modules.indexOf(m)!=-1) {
args = {
module: m,
module_page: erpnext.modules[m],
module_label: m=='HR' ? 'Human Resources' : m
}
$('.navbar .modules').append(repl('<li><a href="#!%(module_page)s" \
data-module="%(module)s">%(module_label)s</a></li>', args));
}
}
// dasboard for accounts system manager
if(user_roles.indexOf("Accounts Manager")!=-1) {
$('.navbar .modules').append('<li><a href="#!dashboard" \
data-module="Dashboard">Dashboard</a></li>');
}
// setup for system manager
if(user_roles.indexOf("System Manager")!=-1) {
$('.navbar .modules').append('<li class="divider"></li>\
<li><a href="#!Setup" data-module="Setup">Setup</a></li>');
}
}

View File

@ -13,10 +13,11 @@ span, div, td, input, textarea, button, select {
}
body {
background: url(../images/stripedbg.png) repeat;
}
.erpnext-footer {
margin: 3px auto;
margin: 11px auto;
text-align: center;
}

View File

@ -19,6 +19,25 @@ var is_system_manager = 0;
wn.provide('erpnext.startup');
erpnext.modules = {
'Selling': 'selling-home',
'Accounts': 'accounts-home',
'Stock': 'stock-home',
'Buying': 'buying-home',
'Support': 'support-home',
'Projects': 'projects-home',
'Production': 'production-home',
'Website': 'website-home',
'HR': 'hr-home',
'Setup': 'Setup',
'Activity': 'activity',
'To Do': 'todo',
'Calendar': 'calendar',
'Messages': 'messages',
'Knowledge Base': 'questions',
'Dashboard': 'dashboard'
}
erpnext.startup.set_globals = function() {
pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
if(inList(user_roles,'System Manager')) is_system_manager = 1;
@ -27,27 +46,42 @@ erpnext.startup.set_globals = function() {
erpnext.startup.start = function() {
$('#startup_div').html('Starting up...').toggle(true);
erpnext.startup.set_globals();
if(wn.boot.custom_css) {
set_style(wn.boot.custom_css);
}
if(wn.boot.user_background) {
erpnext.set_user_background(wn.boot.user_background);
}
if(user == 'Guest'){
if(wn.boot.website_settings.title_prefix) {
wn.title_prefix = wn.boot.website_settings.title_prefix;
}
} else {
// always allow apps
wn.boot.profile.allow_modules = wn.boot.profile.allow_modules.concat(
['To Do', 'Knowledge Base', 'Calendar', 'Activity', 'Messages'])
// setup toolbar
erpnext.toolbar.setup();
// set interval for updates
erpnext.startup.set_periodic_updates();
// border to the body
// ------------------
$('footer').html('<div class="web-footer erpnext-footer">\
Powered by <a href="https://erpnext.com">ERPNext</a></div>');
<a href="#!attributions">ERPNext | Attributions and License</a></div>');
// complete registration
if(in_list(user_roles,'System Manager') && (wn.boot.setup_complete=='No')) {
wn.require("erpnext/startup/js/complete_setup.js");
erpnext.complete_setup();
}
}
$('#startup_div').toggle(false);
@ -69,53 +103,36 @@ show_chart_browser = function(nm, chart_type){
}
// Module Page
// ====================================================================
ModulePage = function(parent, module_name, module_label, help_page, callback) {
this.parent = parent;
// add to current page
page_body.cur_page.module_page = this;
this.wrapper = $a(parent,'div');
this.module_name = module_name;
this.transactions = [];
this.page_head = new PageHeader(this.wrapper, module_label);
if(help_page) {
var btn = this.page_head.add_button('Help', function() { loadpage(this.help_page) }, 1, 'ui-icon-help')
btn.help_page = help_page;
}
if(callback) this.callback = function(){ callback(); }
}
// ========== Update Messages ============
var update_messages = function() {
var update_messages = function(reset) {
// Updates Team Messages
if(inList(['Guest'], user)) { return; }
$c_page('home', 'event_updates', 'get_unread_messages', null,
function(r,rt) {
if(!r.exc) {
// This function is defined in toolbar.js
page_body.wntoolbar.set_new_comments(r.message);
var circle = $('#msg_count')
if(circle) {
if(r.message.length) {
circle.find('span:first').text(r.message.length);
circle.toggle(true);
} else {
circle.toggle(false);
if(!reset) {
$c_page('home', 'event_updates', 'get_unread_messages', null,
function(r,rt) {
if(!r.exc) {
// This function is defined in toolbar.js
page_body.wntoolbar.set_new_comments(r.message);
var circle = $('#msg_count')
if(circle) {
if(r.message.length) {
circle.find('span:first').text(r.message.length);
circle.toggle(true);
} else {
circle.toggle(false);
}
}
} else {
clearInterval(wn.updates.id);
}
} else {
clearInterval(wn.updates.id);
}
}
);
);
} else {
page_body.wntoolbar.set_new_comments(0);
$('#msg_count').toggle(false);
}
}
erpnext.startup.set_periodic_updates = function() {
@ -129,7 +146,9 @@ erpnext.startup.set_periodic_updates = function() {
wn.updates.id = setInterval(update_messages, 60000);
}
// =======================================
erpnext.set_user_background = function(src) {
set_style(repl('body { background: url("files/%(src)s") repeat;}', {src:src}))
}
// start
$(document).bind('startup', function() {

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
'modified': '2012-02-07 13:28:20',
'modified': '2012-03-01 17:58:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},

View File

@ -5,273 +5,263 @@
{
'creation': '2010-08-08 17:09:35',
'docstatus': 0,
'modified': '2011-09-14 12:36:25',
'modified_by': 'Administrator',
'owner': 'Administrator'
'modified': '2012-03-01 17:58:16',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'doctype': u'Table Mapper Detail',
'name': '__common__',
'parent': 'Sales Order-Delivery Note',
'parentfield': 'table_mapper_details',
'parenttype': 'DocType Mapper'
'parent': u'Sales Order-Delivery Note',
'parentfield': u'table_mapper_details',
'parenttype': u'DocType Mapper'
},
# These values are common for all Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'doctype': u'Field Mapper Detail',
'name': '__common__',
'parent': 'Sales Order-Delivery Note',
'parentfield': 'field_mapper_details',
'parenttype': 'DocType Mapper'
'parent': u'Sales Order-Delivery Note',
'parentfield': u'field_mapper_details',
'parenttype': u'DocType Mapper'
},
# These values are common for all DocType Mapper
{
'doctype': u'DocType Mapper',
'from_doctype': 'Sales Order',
'module': 'Stock',
'from_doctype': u'Sales Order',
'module': u'Stock',
'name': '__common__',
'ref_doc_submitted': 1,
'to_doctype': 'Delivery Note'
'to_doctype': u'Delivery Note'
},
# DocType Mapper, Sales Order-Delivery Note
{
'doctype': u'DocType Mapper',
'name': 'Sales Order-Delivery Note'
'name': u'Sales Order-Delivery Note'
},
# Field Mapper Detail
{
'checking_operator': '>=',
'doctype': 'Field Mapper Detail',
'from_field': 'transaction_date',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'name',
'map': u'Yes',
'match_id': 0,
'to_field': 'transaction_date'
'to_field': u'sales_order_no'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'map': 'Yes',
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'company',
'map': u'Yes',
'match_id': 0,
'to_field': 'sales_order_no'
'to_field': u'company'
},
# Field Mapper Detail
{
'checking_operator': '=',
'doctype': 'Field Mapper Detail',
'from_field': 'company',
'map': 'Yes',
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'currency',
'map': u'Yes',
'match_id': 0,
'to_field': 'company'
'to_field': u'currency'
},
# Field Mapper Detail
{
'checking_operator': '=',
'doctype': 'Field Mapper Detail',
'from_field': 'currency',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'shipping_address_name',
'map': u'Yes',
'match_id': 0,
'to_field': 'currency'
'to_field': u'customer_address'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'shipping_address_name',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'shipping_address',
'map': u'Yes',
'match_id': 0,
'to_field': 'customer_address'
'to_field': u'address_display'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'shipping_address',
'map': 'Yes',
'match_id': 0,
'to_field': 'address_display'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'parent',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'parent',
'map': u'Yes',
'match_id': 1,
'to_field': 'prevdoc_docname'
'to_field': u'prevdoc_docname'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'parenttype',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'parenttype',
'map': u'Yes',
'match_id': 1,
'to_field': 'prevdoc_doctype'
'to_field': u'prevdoc_doctype'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'name',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'name',
'map': u'Yes',
'match_id': 1,
'to_field': 'prevdoc_detail_docname'
'to_field': u'prevdoc_detail_docname'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.export_rate)',
'map': u'Yes',
'match_id': 1,
'to_field': 'export_amount'
'to_field': u'export_amount'
},
# Field Mapper Detail
{
'checking_operator': '=',
'doctype': 'Field Mapper Detail',
'from_field': 'basic_rate',
'map': 'Yes',
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'basic_rate',
'map': u'Yes',
'match_id': 1,
'to_field': 'basic_rate'
'to_field': u'basic_rate'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'eval: flt(obj.qty) - flt(obj.delivered_qty)',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'eval: flt(obj.qty) - flt(obj.delivered_qty)',
'map': u'Yes',
'match_id': 1,
'to_field': 'qty'
'to_field': u'qty'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'eval: (flt(obj.qty) - flt(obj.delivered_qty)) * flt(obj.basic_rate)',
'map': u'Yes',
'match_id': 1,
'to_field': 'amount'
'to_field': u'amount'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'reserved_warehouse',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'reserved_warehouse',
'map': u'Yes',
'match_id': 1,
'to_field': 'warehouse'
'to_field': u'warehouse'
},
# Field Mapper Detail
{
'checking_operator': '=',
'doctype': 'Field Mapper Detail',
'from_field': 'project_name',
'map': 'Yes',
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'project_name',
'map': u'Yes',
'match_id': 0,
'to_field': 'project_name'
'to_field': u'project_name'
},
# Field Mapper Detail
{
'checking_operator': '=',
'doctype': 'Field Mapper Detail',
'from_field': 'customer',
'map': 'Yes',
'checking_operator': u'=',
'doctype': u'Field Mapper Detail',
'from_field': u'customer',
'map': u'Yes',
'match_id': 0,
'to_field': 'customer'
'to_field': u'customer'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'naming_series',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'naming_series',
'map': u'No',
'match_id': 0,
'to_field': 'naming_series'
'to_field': u'naming_series'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'status',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'status',
'map': u'No',
'match_id': 0,
'to_field': 'status'
'to_field': u'status'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'incentives',
'map': 'No',
'doctype': u'Field Mapper Detail',
'from_field': u'incentives',
'map': u'No',
'match_id': 3,
'to_field': 'incentives'
'to_field': u'incentives'
},
# Field Mapper Detail
{
'doctype': 'Field Mapper Detail',
'from_field': 'allocated_amount',
'map': 'Yes',
'doctype': u'Field Mapper Detail',
'from_field': u'allocated_amount',
'map': u'Yes',
'match_id': 0,
'to_field': 'customer_mobile_no'
'to_field': u'customer_mobile_no'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_field': 'sales_team',
'from_table': 'Sales Team',
'doctype': u'Table Mapper Detail',
'from_field': u'sales_team',
'from_table': u'Sales Team',
'match_id': 3,
'to_field': 'sales_team',
'to_table': 'Sales Team',
'validation_logic': 'name is not null'
'to_field': u'sales_team',
'to_table': u'Sales Team',
'validation_logic': u'name is not null'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_field': 'other_charges',
'from_table': 'RV Tax Detail',
'doctype': u'Table Mapper Detail',
'from_field': u'other_charges',
'from_table': u'RV Tax Detail',
'match_id': 2,
'to_field': 'other_charges',
'to_table': 'RV Tax Detail',
'validation_logic': 'name is not null'
'to_field': u'other_charges',
'to_table': u'RV Tax Detail',
'validation_logic': u'name is not null'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_field': 'sales_order_details',
'from_table': 'Sales Order Detail',
'doctype': u'Table Mapper Detail',
'from_field': u'sales_order_details',
'from_table': u'Sales Order Detail',
'match_id': 1,
'reference_doctype_key': 'prevdoc_doctype',
'reference_key': 'prevdoc_detail_docname',
'to_field': 'delivery_note_details',
'to_table': 'Delivery Note Detail',
'validation_logic': 'qty > ifnull(delivered_qty,0) and docstatus = 1'
'reference_doctype_key': u'prevdoc_doctype',
'reference_key': u'prevdoc_detail_docname',
'to_field': u'delivery_note_details',
'to_table': u'Delivery Note Detail',
'validation_logic': u'qty > ifnull(delivered_qty,0) and docstatus = 1'
},
# Table Mapper Detail
{
'doctype': 'Table Mapper Detail',
'from_table': 'Sales Order',
'doctype': u'Table Mapper Detail',
'from_table': u'Sales Order',
'match_id': 0,
'reference_key': 'prevdoc_docname',
'to_table': 'Delivery Note',
'validation_logic': 'docstatus = 1'
'reference_key': u'prevdoc_docname',
'to_table': u'Delivery Note',
'validation_logic': u'docstatus = 1'
}
]

View File

@ -30,7 +30,7 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
if(doc.__islocal && doc.customer) cur_frm.cscript.pull_item_details_onload(doc,dt,dn);
if(doc.__islocal && doc.customer) cur_frm.cscript.customer(doc,dt,dn,onload=true);
if(!doc.price_list_currency) {
set_multiple(dt, dn, {price_list_currency: doc.currency, plc_conversion_rate:1});
}
@ -43,17 +43,19 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
// defined in sales_common.js
if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
var callback = function(doc, dt, dn) {
if(doc.__islocal) cur_frm.cscript.update_item_details(doc, dt, dn);
}
cur_frm.cscript.hide_price_list_currency(doc, dt, dn, callback);
}
// REFRESH
// ================================================================================================
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.clear_custom_buttons();
var callback = function() {
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
}
cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn, callback);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.hide_price_list_currency(doc, cdt, cdn);
if(doc.per_billed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Invoice', cur_frm.cscript['Make Sales Invoice']);
@ -123,16 +125,6 @@ cur_frm.cscript['Get Items'] = function(doc,dt,dn) {
}
//RV-DN : Pull Item details - UOM, Item Group as it was not in Sales Invoice
//---------------------------------------------------------------------
cur_frm.cscript.pull_item_details_onload = function(doc,dt,dn){
var callback = function(r,rt){
refresh_field('delivery_note_details');
cur_frm.cscript.customer(doc,dt,dn,onload=true);
}
$c_obj(make_doclist(dt,dn),'set_item_details','',callback);
}
//================ create new contact ============================================================================
cur_frm.cscript.new_contact = function(){
tn = createLocal('Contact');

View File

@ -74,16 +74,6 @@ class DocType(TransactionBase):
return cstr(self.doc.sales_order_no)
#-------------------set item details -uom and item group----------------
def set_item_details(self):
for d in getlist(self.doclist,'delivery_note_details'):
res = sql("select stock_uom, item_group from `tabItem` where name ='%s'"%d.item_code)
if not d.stock_uom: d.stock_uom = res and cstr(res[0][0]) or ''
if not d.item_group: d.item_group = res and cstr(res[0][1]) or ''
d.save()
# ::::: Validates that Sales Order is not pulled twice :::::::
def validate_prev_docname(self):
for d in getlist(self.doclist, 'delivery_note_details'):
@ -117,14 +107,16 @@ class DocType(TransactionBase):
# ***************** Get Item Details ******************************
def get_item_details(self, args=None):
args = eval(args)
if args['item_code']:
args = args and eval(args) or {}
if args.get('item_code'):
return get_obj('Sales Common').get_item_details(args, self)
else:
obj = get_obj('Sales Common')
for doc in self.doclist:
if doc.fields.get('item_code'):
ret = obj.get_item_details(doc.item_code, self)
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
ret = obj.get_item_details(arg, self)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@ -135,13 +127,6 @@ class DocType(TransactionBase):
get_obj('Sales Common').get_adj_percent(self)
def get_comp_base_currency(self):
return get_obj('Sales Common').get_comp_base_currency(self.doc.company)
def get_price_list_currency(self):
return get_obj('Sales Common').get_price_list_currency(self.doc.price_list_name, self.doc.company)
# ********** Get Actual Qty of item in warehouse selected *************
def get_actual_qty(self,args):
args = eval(args)
@ -245,9 +230,9 @@ class DocType(TransactionBase):
if prevdoc_docname and prevdoc:
# ::::::::::: Validates Transaction Date of DN and previous doc (i.e. SO , PO, PR) *********
trans_date = sql("select transaction_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0]
if trans_date and getdate(self.doc.transaction_date) < (trans_date):
msgprint("Your Voucher Date cannot be before "+cstr(prevdoc)+" Date.")
trans_date = sql("select posting_date from `tab%s` where name = '%s'" %(prevdoc,prevdoc_docname))[0][0]
if trans_date and getdate(self.doc.posting_date) < (trans_date):
msgprint("Your Posting Date cannot be before "+cstr(prevdoc)+" Date.")
raise Exception
# ::::::::: Validates DN and previous doc details ::::::::::::::::::
get_name = sql("select name from `tab%s` where name = '%s'" % (prevdoc, prevdoc_docname))
@ -356,16 +341,17 @@ class DocType(TransactionBase):
"""
Validate that if packed qty exists, it should be equal to qty
"""
if not any([d.fields.get('packed_qty') for d in self.doclist]):
if not any([flt(d.fields.get('packed_qty')) for d in self.doclist if
d.doctype=='Delivery Note Detail']):
return
packing_error_list = []
for d in self.doclist:
if d.doctype != 'Delivery Note Detail': continue
if d.fields.get('qty') != d.fields.get('packed_qty'):
if flt(d.fields.get('qty')) != flt(d.fields.get('packed_qty')):
packing_error_list.append([
d.fields.get('item_code', ''),
d.fields.get('qty', ''),
d.fields.get('packed_qty', '')
d.fields.get('qty', 0),
d.fields.get('packed_qty', 0)
])
if packing_error_list:
from webnotes.utils import cstr
@ -457,7 +443,7 @@ class DocType(TransactionBase):
self.values.append({
'item_code' : d[1],
'warehouse' : wh,
'transaction_date' : self.doc.transaction_date,
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Delivery Note',

View File

@ -5,7 +5,7 @@
{
'creation': '2011-04-18 15:58:20',
'docstatus': 0,
'modified': '2012-02-27 17:35:31',
'modified': '2012-03-02 12:15:44',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -21,7 +21,7 @@
# These values are common for all DocType
{
'_last_update': u'1330343754',
'_last_update': u'1330593645',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@ -37,7 +37,7 @@
'show_in_menu': 0,
'subject': u'To %(customer_name)s on %(transaction_date)s | %(per_billed)s% billed',
'tag_fields': u'billing_status',
'version': 474
'version': 475
},
# These values are common for all DocFormat
@ -285,29 +285,37 @@
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
'fieldname': u'territory',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 1,
'label': u'Territory',
'options': u'Territory',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
},
# DocField
{
'colour': u'White:FFF',
'default': u'Today',
'description': u'The date at which current entry is made in system.',
'doctype': u'DocField',
'fieldname': u'transaction_date',
'fieldtype': u'Date',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Voucher Date',
'no_copy': 1,
'oldfieldname': u'transaction_date',
'oldfieldtype': u'Date',
'label': u'Customer Group',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1,
'width': u'100px'
'search_index': 1
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0
},
# DocField
@ -467,30 +475,41 @@
# DocField
{
'colour': u'White:FFF',
'description': u'Track this Delivery Note against any Project',
'doctype': u'DocField',
'fieldname': u'territory',
'fieldname': u'project_name',
'fieldtype': u'Link',
'hidden': 0,
'in_filter': 1,
'label': u'Territory',
'options': u'Territory',
'label': u'Project Name',
'oldfieldname': u'project_name',
'oldfieldtype': u'Link',
'options': u'Project',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'search_index': 1
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'customer_group',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Customer Group',
'options': u'Customer Group',
'permlevel': 0,
'print_hide': 1,
'search_index': 1
'fieldname': u'challan_no',
'fieldtype': u'Data',
'label': u'Challan No',
'oldfieldname': u'challan_no',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'challan_date',
'fieldtype': u'Date',
'label': u'Challan Date',
'oldfieldname': u'challan_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
@ -885,6 +904,7 @@
'oldfieldtype': u'Button',
'options': u'get_tc_details',
'permlevel': 0,
'print_hide': 1,
'trigger': u'Server'
},
@ -917,7 +937,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'label': u'Transporter Info',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -925,6 +946,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -979,36 +1001,6 @@
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'width': u'50%'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'challan_no',
'fieldtype': u'Data',
'label': u'Challan No',
'oldfieldname': u'challan_no',
'oldfieldtype': u'Data',
'permlevel': 0
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'challan_date',
'fieldtype': u'Date',
'label': u'Challan Date',
'oldfieldname': u'challan_date',
'oldfieldtype': u'Date',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
@ -1017,7 +1009,8 @@
'fieldtype': u'Section Break',
'label': u'More Info',
'oldfieldtype': u'Section Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -1056,29 +1049,13 @@
'width': u'150px'
},
# DocField
{
'colour': u'White:FFF',
'description': u'Track this Delivery Note against any Project',
'doctype': u'DocField',
'fieldname': u'project_name',
'fieldtype': u'Link',
'in_filter': 1,
'label': u'Project Name',
'oldfieldname': u'project_name',
'oldfieldtype': u'Link',
'options': u'Project',
'permlevel': 0,
'search_index': 1,
'trigger': u'Client'
},
# DocField
{
'doctype': u'DocField',
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1244,7 +1221,8 @@
'fieldtype': u'Section Break',
'label': u'Packing List',
'oldfieldtype': u'Section Break',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -1268,7 +1246,7 @@
'label': u'Sales Team',
'oldfieldtype': u'Section Break',
'permlevel': 0,
'print_hide': 0
'print_hide': 1
},
# DocField
@ -1276,6 +1254,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1300,6 +1279,7 @@
'doctype': u'DocField',
'fieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1338,7 +1318,8 @@
'doctype': u'DocField',
'fieldtype': u'Section Break',
'options': u'Simple',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:08:58',
'docstatus': 0,
'modified': '2012-02-24 11:33:58',
'modified': '2012-03-05 10:49:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -23,7 +23,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 53
'version': 55
},
# These values are common for all DocField
@ -117,18 +117,14 @@
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'no_copy': 0,
'oldfieldname': u'ref_rate',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
@ -147,6 +143,53 @@
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'basic_rate',
'fieldtype': u'Currency',
'label': u'Rate*',
'oldfieldname': u'basic_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'150px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amount',
'fieldtype': u'Currency',
'label': u'Amount*',
'oldfieldname': u'amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate',
'no_copy': 0,
'oldfieldname': u'ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
@ -176,49 +219,6 @@
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'base_ref_rate',
'fieldtype': u'Currency',
'label': u'Price List Rate*',
'oldfieldname': u'base_ref_rate',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'width': u'100px'
},
# DocField
{
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'basic_rate',
'fieldtype': u'Currency',
'label': u'Rate*',
'oldfieldname': u'basic_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 0,
'trigger': u'Client',
'width': u'150px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'amount',
'fieldtype': u'Currency',
'label': u'Amount*',
'oldfieldname': u'amount',
'oldfieldtype': u'Currency',
'permlevel': 1,
'print_hide': 1,
'reqd': 0,
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
@ -245,7 +245,7 @@
'oldfieldname': u'serial_no',
'oldfieldtype': u'Text',
'permlevel': 0,
'print_hide': 1,
'print_hide': 0,
'trigger': u'Client'
},

View File

@ -40,12 +40,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
var callback1 = function(doc, dt, dn) {
if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
}
//========================== Refresh ===============================================================
@ -55,7 +58,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// ---------------------------------
cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if(doc.docstatus == 1){
var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');

View File

@ -57,7 +57,7 @@ class DocType(TransactionBase):
#-----------------Validation For Fiscal Year------------------------
def validate_fiscal_year(self):
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.transaction_date,'Transaction Date')
get_obj(dt = 'Purchase Common').validate_fiscal_year(self.doc.fiscal_year,self.doc.posting_date,'Transaction Date')
# Get Item Details
@ -88,10 +88,6 @@ class DocType(TransactionBase):
def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self)
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# get available qty at warehouse
def get_bin_details(self, arg = ''):
@ -230,7 +226,7 @@ class DocType(TransactionBase):
ord_qty = -flt(curr_qty)
# update order qty in bin
bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.transaction_date)
bin = get_obj('Warehouse', d.warehouse).update_bin(0, 0, (is_submit and 1 or -1) * flt(ord_qty), 0, 0, d.item_code, self.doc.posting_date)
# UPDATE actual qty to warehouse by pr_qty
self.make_sl_entry(d, d.warehouse, flt(pr_qty), d.valuation_rate, is_submit)
@ -249,7 +245,7 @@ class DocType(TransactionBase):
self.values.append({
'item_code' : d.fields.has_key('item_code') and d.item_code or d.rm_item_code,
'warehouse' : wh,
'transaction_date' : self.doc.transaction_date,
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
'posting_date' : self.doc.posting_date,
'posting_time' : self.doc.posting_time,
'voucher_type' : 'Purchase Receipt',

View File

@ -5,14 +5,14 @@
{
'creation': '2010-08-08 17:09:15',
'docstatus': 0,
'modified': '2012-02-27 17:54:59',
'modified': '2012-03-02 12:26:39',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
# These values are common for all DocType
{
'_last_update': u'1330345245',
'_last_update': u'1330593645',
'colour': u'White:FFF',
'default_print_format': u'Standard',
'doctype': 'DocType',
@ -26,7 +26,7 @@
'server_code_error': u' ',
'show_in_menu': 0,
'subject': u'From %(supplier_name)s against %(purchase_order)s on %(transaction_date)s',
'version': 324
'version': 325
},
# These values are common for all DocField
@ -302,25 +302,6 @@
'width': u'50%'
},
# DocField
{
'colour': u'White:FFF',
'description': u'The date at which current entry is made in system.',
'doctype': u'DocField',
'fieldname': u'transaction_date',
'fieldtype': u'Date',
'in_filter': 1,
'label': u'Transaction Date',
'no_copy': 1,
'oldfieldname': u'transaction_date',
'oldfieldtype': u'Date',
'permlevel': 0,
'reqd': 1,
'search_index': 1,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'colour': u'White:FFF',
@ -948,6 +929,7 @@
'fieldtype': u'Column Break',
'oldfieldtype': u'Column Break',
'permlevel': 0,
'print_hide': 1,
'width': u'50%'
},
@ -1120,7 +1102,8 @@
'fieldtype': u'Section Break',
'label': u'Raw Material Details',
'oldfieldtype': u'Section Break',
'permlevel': 1
'permlevel': 1,
'print_hide': 1
},
# DocField
@ -1130,7 +1113,8 @@
'label': u'Get Current Stock',
'oldfieldtype': u'Button',
'options': u'get_current_stock',
'permlevel': 0
'permlevel': 0,
'print_hide': 1
},
# DocField

View File

@ -5,7 +5,7 @@
{
'creation': '2010-08-08 17:09:16',
'docstatus': 0,
'modified': '2012-02-27 18:43:39',
'modified': '2012-03-05 10:51:18',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -22,7 +22,7 @@
'section_style': u'Tray',
'server_code_error': u' ',
'show_in_menu': 0,
'version': 74
'version': 76
},
# These values are common for all DocField
@ -95,6 +95,7 @@
'oldfieldname': u'received_qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'trigger': u'Client',
'width': u'100px'
@ -125,6 +126,7 @@
'oldfieldname': u'rejected_qty',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 1,
'search_index': 0,
'trigger': u'Client',
'width': u'100px'
@ -133,10 +135,11 @@
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'permlevel': 0
'label': u'Ref Rate *',
'permlevel': 0,
'print_hide': 1
},
# DocField
@ -145,43 +148,8 @@
'fieldname': u'discount_rate',
'fieldtype': u'Currency',
'label': u'Discount %',
'permlevel': 0
},
# DocField
{
'colour': u'White:FFF',
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'label': u'Rate',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'purchase_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate *',
'permlevel': 0
'print_hide': 1
},
# DocField
@ -217,6 +185,43 @@
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_ref_rate',
'fieldtype': u'Currency',
'label': u'Ref Rate ',
'permlevel': 0,
'print_hide': 1
},
# DocField
{
'colour': u'White:FFF',
'default': u'0.00',
'doctype': u'DocField',
'fieldname': u'import_rate',
'fieldtype': u'Currency',
'label': u'Rate',
'oldfieldname': u'import_rate',
'oldfieldtype': u'Currency',
'permlevel': 0,
'print_hide': 0,
'trigger': u'Client',
'width': u'100px'
},
# DocField
{
'doctype': u'DocField',
'fieldname': u'import_amount',
'fieldtype': u'Currency',
'label': u'Amount',
'oldfieldname': u'import_amount',
'oldfieldtype': u'Currency',
'permlevel': 1
},
# DocField
{
'doctype': u'DocField',
@ -228,7 +233,7 @@
'oldfieldtype': u'Link',
'options': u'Warehouse',
'permlevel': 0,
'print_hide': 0,
'print_hide': 1,
'width': u'100px'
},
@ -243,6 +248,7 @@
'oldfieldtype': u'Link',
'options': u'UOM',
'permlevel': 0,
'print_hide': 1,
'reqd': 1,
'trigger': u'Client',
'width': u'100px'
@ -441,7 +447,7 @@
'oldfieldtype': u'Link',
'options': u'Purchase Order',
'permlevel': 1,
'print_hide': 0,
'print_hide': 1,
'reqd': 0,
'search_index': 1,
'width': u'150px'

Some files were not shown because too many files have changed in this diff Show More