Merge branch 'shf_rename' of github.com:webnotes/erpnext into shf_rename
Conflicts: css/all-app.css version.num
This commit is contained in:
commit
45a4edc9c9
5
.gitignore
vendored
5
.gitignore
vendored
@ -1,11 +1,10 @@
|
||||
*.pyc
|
||||
*.comp.js
|
||||
.DS_Store
|
||||
server_tools
|
||||
services
|
||||
user_files
|
||||
patch.log
|
||||
lib
|
||||
versions-local.db
|
||||
conf.py
|
||||
version.num
|
||||
user_files
|
||||
*.sql*
|
||||
|
200
build.json
200
build.json
@ -1,181 +1,19 @@
|
||||
[
|
||||
{
|
||||
"lib/js/core.min.js": [
|
||||
"lib/js/wn/class.js",
|
||||
"lib/js/wn/provide.js",
|
||||
"lib/js/wn/versions.js",
|
||||
"lib/js/wn/assets.js",
|
||||
"lib/js/wn/require.js",
|
||||
"lib/js/wn/dom.js",
|
||||
"lib/js/wn/model.js",
|
||||
"lib/js/wn/misc/tools.js",
|
||||
"lib/js/wn/misc/user.js",
|
||||
"lib/js/lib/json2.js",
|
||||
"lib/js/wn/router.js",
|
||||
"lib/js/wn/ui/listing.js",
|
||||
"lib/js/wn/views/container.js",
|
||||
"lib/js/wn/views/doclistview.js",
|
||||
"lib/js/wn/views/pageview.js",
|
||||
"lib/js/wn/views/formview.js",
|
||||
"lib/js/wn/views/reportview.js",
|
||||
"lib/js/wn/request.js",
|
||||
"lib/js/core.js"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"lib/js/wn/ui/toolbar.min.js": [
|
||||
"lib/js/wn/ui/toolbar/selector_dialog.js",
|
||||
"lib/js/wn/ui/toolbar/new.js",
|
||||
"lib/js/wn/ui/toolbar/search.js",
|
||||
"lib/js/wn/ui/toolbar/report.js",
|
||||
"lib/js/wn/ui/toolbar/recent.js",
|
||||
"lib/js/wn/ui/toolbar/toolbar.js"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"lib/js/legacy/report.compressed.js": [
|
||||
"lib/js/legacy/widgets/report_builder/report_builder.js",
|
||||
"lib/js/legacy/widgets/report_builder/datatable.js",
|
||||
"lib/js/legacy/widgets/report_builder/calculator.js"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"css/all-web.css": [
|
||||
"lib/css/legacy/body.css",
|
||||
"lib/css/legacy/messages.css",
|
||||
"lib/css/legacy/dialog.css",
|
||||
"lib/css/bootstrap/headings.css",
|
||||
"lib/css/bootstrap/buttons.css",
|
||||
"lib/css/bootstrap/navbar.css",
|
||||
"lib/css/bootstrap/dropdown.css",
|
||||
"lib/css/bootstrap/tooltip.css",
|
||||
"lib/css/ui/fonts.css",
|
||||
"lib/css/ui/list.css",
|
||||
"erpnext/startup/startup.css",
|
||||
"erpnext/website/css/website.css"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"css/all-app.css": [
|
||||
"lib/css/legacy/body.css",
|
||||
"lib/css/legacy/messages.css",
|
||||
"lib/css/legacy/forms.css",
|
||||
"lib/css/legacy/grid.css",
|
||||
"lib/css/legacy/listing.css",
|
||||
"lib/css/legacy/report.css",
|
||||
"lib/css/legacy/dialog.css",
|
||||
"lib/css/legacy/tabs.css",
|
||||
"lib/css/legacy/sidebar.css",
|
||||
"lib/css/Aristo/aristo.selected.css",
|
||||
"lib/css/ui/list.css",
|
||||
"lib/css/ui/views.css",
|
||||
"lib/css/ui/fonts.css",
|
||||
"lib/css/bootstrap/headings.css",
|
||||
"lib/css/bootstrap/buttons.css",
|
||||
"lib/css/bootstrap/navbar.css",
|
||||
"lib/css/bootstrap/dropdown.css",
|
||||
"lib/css/bootstrap/tooltip.css",
|
||||
"lib/css/bootstrap/label.css",
|
||||
"lib/css/bootstrap/icons.css",
|
||||
"lib/css/bootstrap/popover.css",
|
||||
"erpnext/startup/startup.css"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"js/all-web.js": [
|
||||
"lib/js/lib/history/history.min.js:concat",
|
||||
"lib/js/lib/bootstrap.min.js:concat",
|
||||
"lib/js/core.min.js:concat",
|
||||
"lib/js/legacy/globals.js",
|
||||
"lib/js/legacy/utils/datatype.js",
|
||||
"lib/js/legacy/utils/datetime.js",
|
||||
"lib/js/legacy/utils/dom.js",
|
||||
"lib/js/legacy/utils/handler.js",
|
||||
"lib/js/legacy/utils/msgprint.js",
|
||||
"lib/js/wn/ui/appframe.js",
|
||||
"lib/js/wn/ui/dialog.js",
|
||||
"lib/js/legacy/widgets/dialog.js",
|
||||
"lib/js/wn/ui/listing.js",
|
||||
"lib/js/legacy/webpage/page_header.js",
|
||||
"lib/js/legacy/webpage/spinner.js",
|
||||
"lib/js/legacy/webpage/loaders.js",
|
||||
"lib/js/legacy/wn/widgets/footer.js",
|
||||
"lib/js/legacy/model/local_data.js",
|
||||
"lib/js/legacy/model/doclist.js",
|
||||
"lib/js/legacy/app.js",
|
||||
"js/app.js",
|
||||
"erpnext/startup/startup.js",
|
||||
"erpnext/website/js/topbar.js"
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"js/all-app.js": [
|
||||
"lib/js/lib/history/history.min.js:concat",
|
||||
"lib/js/lib/jquery/jquery.ui.core.js:concat",
|
||||
"lib/js/lib/jquery/jquery.ui.datepicker.js:concat",
|
||||
"lib/js/lib/jquery/jquery.ui.autocomplete.js:concat",
|
||||
"lib/js/lib/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/datetime.js",
|
||||
"lib/js/legacy/utils/dom.js",
|
||||
"lib/js/legacy/utils/handler.js",
|
||||
"lib/js/legacy/utils/msgprint.js",
|
||||
"lib/js/legacy/utils/printElement.js",
|
||||
"lib/js/legacy/widgets/form/fields.js",
|
||||
"lib/js/wn/ui/appframe.js",
|
||||
"lib/js/wn/ui/dialog.js",
|
||||
"lib/js/wn/ui/button.js",
|
||||
"lib/js/legacy/widgets/dialog.js",
|
||||
"lib/js/legacy/widgets/layout.js",
|
||||
"lib/js/legacy/widgets/tabbedpage.js",
|
||||
"lib/js/legacy/webpage/page_header.js",
|
||||
"lib/js/legacy/widgets/tags.js",
|
||||
"lib/js/legacy/widgets/export_query.js",
|
||||
"lib/js/legacy/webpage/search.js",
|
||||
"lib/js/legacy/webpage/spinner.js",
|
||||
"lib/js/legacy/webpage/error_console.js",
|
||||
"lib/js/legacy/webpage/loaders.js",
|
||||
"lib/js/legacy/webpage/uploader.js",
|
||||
"lib/js/legacy/wn/page_layout.js",
|
||||
"lib/js/legacy/wn/widgets/page_sidebar.js",
|
||||
"lib/js/legacy/wn/widgets/footer.js",
|
||||
"lib/js/legacy/model/local_data.js",
|
||||
"lib/js/legacy/model/doclist.js",
|
||||
"lib/js/wn/ui/toolbar.min.js:concat",
|
||||
"lib/js/wn/views/breadcrumbs.js",
|
||||
"lib/js/legacy/widgets/form/fields.js",
|
||||
"lib/js/legacy/widgets/form/form_dialog.js",
|
||||
"lib/js/legacy/widgets/form/form_header.js",
|
||||
"lib/js/legacy/widgets/form/form.js",
|
||||
"lib/js/legacy/widgets/form/form_fields.js",
|
||||
"lib/js/legacy/widgets/form/grid.js",
|
||||
"lib/js/legacy/widgets/form/form_grid.js",
|
||||
"lib/js/legacy/widgets/form/print_format.js",
|
||||
"lib/js/legacy/widgets/form/email.js",
|
||||
"lib/js/legacy/widgets/form/clientscriptAPI.js",
|
||||
"lib/js/legacy/widgets/form/form_comments.js",
|
||||
"lib/js/legacy/wn/widgets/form/sidebar.js",
|
||||
"lib/js/legacy/wn/widgets/form/comments.js",
|
||||
"lib/js/legacy/wn/widgets/form/attachments.js",
|
||||
"lib/js/legacy/wn/widgets/form/assign_to.js",
|
||||
"lib/js/legacy/app.js",
|
||||
"js/app.js",
|
||||
"erpnext/startup/startup.js",
|
||||
"erpnext/startup/js/modules.js",
|
||||
"erpnext/startup/js/toolbar.js",
|
||||
"erpnext/startup/js/feature_setup.js"
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
|
||||
{
|
||||
"css/all-web.css": [
|
||||
"erpnext/startup/startup.css",
|
||||
"erpnext/website/css/website.css"
|
||||
],
|
||||
"css/all-app.css": [
|
||||
"erpnext/startup/startup.css"
|
||||
],
|
||||
"js/all-web.js": [
|
||||
"erpnext/startup/startup.js",
|
||||
"erpnext/website/js/topbar.js"
|
||||
],
|
||||
"js/all-app.js": [
|
||||
"erpnext/startup/startup.js",
|
||||
"erpnext/startup/js/modules.js",
|
||||
"erpnext/startup/js/toolbar.js",
|
||||
"erpnext/startup/js/feature_setup.js"
|
||||
]
|
||||
}
|
3680
css/all-app.css
3680
css/all-app.css
File diff suppressed because it is too large
Load Diff
913
css/all-web.css
913
css/all-web.css
@ -1,415 +1,4 @@
|
||||
|
||||
/*
|
||||
* lib/css/legacy/body.css
|
||||
*/
|
||||
html {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-family: Arial, Helvetica, Sans;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
|
||||
pre { margin: 0px; padding: 0px; }
|
||||
|
||||
button { margin: 2px; margin-left: 0px; }
|
||||
|
||||
label {
|
||||
padding-top: 15px;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
select, input, textarea {
|
||||
border: 1px solid #ccc;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
font-size: inherit;
|
||||
padding: 4px;
|
||||
color: #444;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
height: 120px;
|
||||
width: 90%;
|
||||
font-size: inherit;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
table { padding: 0px; border-collapse: 'collapse'}
|
||||
|
||||
td {
|
||||
padding:0px;
|
||||
margin: 0px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0px 0px 9px 0px;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
li {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 18px 0;
|
||||
border: 0;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
|
||||
/* links */
|
||||
|
||||
a:active { outline:none; }
|
||||
|
||||
a {
|
||||
color: #0088cc;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #005580;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.link_type {
|
||||
padding:2px;
|
||||
color: #0088cc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link_type:hover {
|
||||
color: #005580;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
:focus { -moz-outline-style:none; }
|
||||
|
||||
table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
|
||||
table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
|
||||
|
||||
div.fix_ff_cursor { overflow: auto; }
|
||||
|
||||
/* --- Layout --- */
|
||||
|
||||
div.comment { color: #444; }
|
||||
|
||||
.small {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.help {
|
||||
margin-bottom: 3px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
div#body_div {
|
||||
display: none;
|
||||
padding-right: 7px;
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
margin-top: 56px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 900px;
|
||||
}
|
||||
|
||||
.background-fade-in {
|
||||
-webkit-transition: background 1s ease-in; /* property duration timing-function delay */
|
||||
-moz-transition: background 1s ease-in;
|
||||
-o-transition: background 1s ease-in;
|
||||
transition: background 1s ease-in;
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
header .container {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
div#body_div, header .container, .content, #opened-page-selector, footer {
|
||||
width: 900px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
div#body_div, header .container, .content, #opened-page-selector, footer {
|
||||
width: 1100px;
|
||||
}
|
||||
}
|
||||
|
||||
div.no_script {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.loading_div {
|
||||
background-color: #FFFFCC;
|
||||
z-index: 1999;
|
||||
right: 5px;
|
||||
width: 90px;
|
||||
display: none;
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
border: 1px solid #FF4;
|
||||
}
|
||||
|
||||
div.std-footer {
|
||||
margin: 13px -15px;
|
||||
border-top: 1px solid #AAA;
|
||||
padding: 13px;
|
||||
}
|
||||
|
||||
div.std-footer-item {
|
||||
margin: 0px 13px 13px 0px;
|
||||
}
|
||||
|
||||
.shadow {
|
||||
-moz-box-shadow: 0px 2px 2px #888;
|
||||
-webkit-box-shadow: 0px 2px 2px #888;
|
||||
box-shadow: 0px 2px 2px #888;
|
||||
}
|
||||
|
||||
.round {
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.layout_wrapper, .layout-wrapper {
|
||||
-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 30px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.layout-wrapper-appframe {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
background-color: #fafafa !important;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-main-section {
|
||||
width: 71%;
|
||||
float: left;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 2px 0px 1px #ddd;
|
||||
-webkit-box-shadow: 2px 0px 1px #ddd;
|
||||
box-shadow: 2px 0px 1px #ddd;
|
||||
}
|
||||
|
||||
.layout-side-section {
|
||||
width: 22%;
|
||||
/*float: right;*/
|
||||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
zoom: 1;
|
||||
}
|
||||
.container:before, .container:after {
|
||||
display: table;
|
||||
content: "";
|
||||
zoom: 1;
|
||||
}
|
||||
.container:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.well {
|
||||
min-height: 20px;
|
||||
padding: 19px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #eee;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.avatar-small {
|
||||
display: inline-block;
|
||||
width: 24px;
|
||||
height: 20px;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
margin: 0px 3px;
|
||||
}
|
||||
.avatar-small img {
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/legacy/messages.css
|
||||
*/
|
||||
|
||||
/* FLOATING MESSAGE */
|
||||
|
||||
.btn-img { cursor: pointer; }
|
||||
|
||||
div.fetching { color: #888; text-align:right; }
|
||||
|
||||
div.notice {
|
||||
postion: absolute;
|
||||
background-color: #000;
|
||||
-moz-border-radius: 5px; -webkit-border-radius: 5px;
|
||||
opacity: 0.6;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin-top: 8px;
|
||||
z-index: -1;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/** help **/
|
||||
|
||||
.info-box {
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
line-height: 1.6em;
|
||||
overflow: auto;
|
||||
padding: 6px 10px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.help_box, .help-box {
|
||||
background-color:#FFC;
|
||||
font-size: 13px;
|
||||
color: #864;
|
||||
padding: 7px;
|
||||
margin: 11px 0px;
|
||||
border: 1px solid #EEB;
|
||||
}
|
||||
|
||||
.help_box_big {
|
||||
background-color:#FFC;
|
||||
color: #864;
|
||||
padding: 7px;
|
||||
margin: 7px 0px;
|
||||
border: 1px solid #EEB;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/legacy/dialog.css
|
||||
*/
|
||||
/***** Dialogs *******/
|
||||
|
||||
div.dialog_wrapper {
|
||||
position: absolute;
|
||||
width: 440px;
|
||||
display: none;
|
||||
z-index: 90;
|
||||
background-color: #FFF;
|
||||
box-shadow:1px 1px 8px #444;
|
||||
-moz-box-shadow: 1px 1px 8px #444;
|
||||
-webkit-box-shadow: 1px 1px 8px #444;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.dialog_head {
|
||||
height: 22px;
|
||||
padding: 4px;
|
||||
background-color: #222;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
div.dialog_body {
|
||||
padding: 8px 8px 16px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
div.dialog_back {
|
||||
position: fixed;
|
||||
display: none;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
background-color: #aaa;
|
||||
opacity: 0.6;
|
||||
z-index: 50;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.dialog_message {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 250px;
|
||||
font-size: 12px;
|
||||
z-index: 91;
|
||||
background-color:#FFF;
|
||||
padding: 12px;
|
||||
border: 1px solid #444;
|
||||
}
|
||||
|
||||
div.dialog_row {
|
||||
padding: 8px 8px 0px 8px;
|
||||
}
|
||||
|
||||
div.dialog_row table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.dialog_row table td {
|
||||
}
|
||||
|
||||
div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
|
||||
width: 80%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
div.dialog_row table td textarea {
|
||||
width: 80%;
|
||||
height: 200px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* lib/css/bootstrap/headings.css
|
||||
*/
|
||||
@ -1606,6 +1195,456 @@ button.btn.small, input[type="submit"].btn.small {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/legacy/body.css
|
||||
*/
|
||||
html {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
font-size: 14px;
|
||||
color: #000;
|
||||
background-color: #e2e2e2;
|
||||
}
|
||||
|
||||
/* font settings */
|
||||
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Helvetica Neue", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
span, div, td, input, textarea, button, select {
|
||||
font-family: inherit;
|
||||
}
|
||||
|
||||
|
||||
pre { margin: 0px; padding: 0px; }
|
||||
|
||||
button { margin: 2px; margin-left: 0px; }
|
||||
|
||||
label {
|
||||
padding-top: 15px;
|
||||
color: #404040;
|
||||
}
|
||||
|
||||
select, input, textarea {
|
||||
border: 1px solid #ccc;
|
||||
-moz-border-radius: 4px;
|
||||
-webkit-border-radius: 4px;
|
||||
font-size: inherit;
|
||||
padding: 4px;
|
||||
color: #444;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.075);
|
||||
}
|
||||
|
||||
textarea {
|
||||
font-family: inherit;
|
||||
height: 120px;
|
||||
width: 90%;
|
||||
font-size: inherit;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
table { padding: 0px; border-collapse: 'collapse'}
|
||||
|
||||
td {
|
||||
padding:0px;
|
||||
margin: 0px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
p {
|
||||
margin: 0px 0px 9px 0px;
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
li {
|
||||
line-height: 1.5em;
|
||||
}
|
||||
|
||||
hr {
|
||||
margin: 18px 0;
|
||||
border: 0;
|
||||
border-top: 1px solid #e5e5e5;
|
||||
border-bottom: 1px solid #ffffff;
|
||||
}
|
||||
|
||||
/* links */
|
||||
|
||||
a:active { outline:none; }
|
||||
|
||||
a {
|
||||
color: #0088cc;
|
||||
text-decoration: none;
|
||||
}
|
||||
a:hover {
|
||||
color: #005580;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.link_type {
|
||||
padding:2px;
|
||||
color: #0088cc;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.link_type:hover {
|
||||
color: #005580;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
:focus { -moz-outline-style:none; }
|
||||
|
||||
table.simpletable { border-collapse: collapse; margin-bottom: 10px;}
|
||||
table.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }
|
||||
|
||||
div.fix_ff_cursor { overflow: auto; }
|
||||
|
||||
/* --- Layout --- */
|
||||
|
||||
div.comment { color: #444; }
|
||||
|
||||
.small {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.help {
|
||||
margin-bottom: 3px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
div#body_div {
|
||||
display: none;
|
||||
padding-right: 7px;
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
margin-top: 56px;
|
||||
}
|
||||
|
||||
.content {
|
||||
width: 900px;
|
||||
}
|
||||
|
||||
.background-fade-in {
|
||||
-webkit-transition: background 1s ease-in; /* property duration timing-function delay */
|
||||
-moz-transition: background 1s ease-in;
|
||||
-o-transition: background 1s ease-in;
|
||||
transition: background 1s ease-in;
|
||||
}
|
||||
|
||||
footer {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
header .container {
|
||||
width: 900px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
@media (max-width: 1200px) {
|
||||
div#body_div, header .container, .content, #opened-page-selector, footer {
|
||||
width: 900px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 1200px) {
|
||||
div#body_div, header .container, .content, #opened-page-selector, footer {
|
||||
width: 1100px;
|
||||
}
|
||||
}
|
||||
|
||||
div.no_script {
|
||||
display: none;
|
||||
}
|
||||
|
||||
div.loading_div {
|
||||
background-color: #FFFFCC;
|
||||
z-index: 1999;
|
||||
right: 5px;
|
||||
width: 90px;
|
||||
display: none;
|
||||
text-align: center;
|
||||
padding: 2px;
|
||||
border: 1px solid #FF4;
|
||||
}
|
||||
|
||||
div.std-footer {
|
||||
margin: 13px -15px;
|
||||
border-top: 1px solid #AAA;
|
||||
padding: 13px;
|
||||
}
|
||||
|
||||
div.std-footer-item {
|
||||
margin: 0px 13px 13px 0px;
|
||||
}
|
||||
|
||||
.shadow {
|
||||
-moz-box-shadow: 0px 2px 2px #888;
|
||||
-webkit-box-shadow: 0px 2px 2px #888;
|
||||
box-shadow: 0px 2px 2px #888;
|
||||
}
|
||||
|
||||
.round {
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.layout_wrapper, .layout-wrapper {
|
||||
-moz-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
-webkit-box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
box-shadow: 0px 0px 6px rgba(0,0,0,0.3);
|
||||
background-color: #fff;
|
||||
padding: 15px;
|
||||
-webkit-border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
border-radius: 5px;
|
||||
margin-bottom: 30px;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.layout-wrapper-appframe {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-wrapper-background {
|
||||
background-color: #fafafa !important;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.layout-section {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.layout-main-section {
|
||||
width: 71%;
|
||||
float: left;
|
||||
padding: 15px;
|
||||
background-color: #FFF;
|
||||
min-height: 600px;
|
||||
-moz-box-shadow: 2px 0px 1px #ddd;
|
||||
-webkit-box-shadow: 2px 0px 1px #ddd;
|
||||
box-shadow: 2px 0px 1px #ddd;
|
||||
}
|
||||
|
||||
.layout-side-section {
|
||||
width: 22%;
|
||||
/*float: right;*/
|
||||
color: #606060;
|
||||
overflow-x: hidden;
|
||||
padding: 15px;
|
||||
min-height: 600px;
|
||||
}
|
||||
|
||||
/* from bootstrap */
|
||||
.container {
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
zoom: 1;
|
||||
}
|
||||
.container:before, .container:after {
|
||||
display: table;
|
||||
content: "";
|
||||
zoom: 1;
|
||||
}
|
||||
.container:after {
|
||||
clear: both;
|
||||
}
|
||||
|
||||
.well {
|
||||
min-height: 20px;
|
||||
padding: 19px;
|
||||
margin-bottom: 20px;
|
||||
background-color: #f5f5f5;
|
||||
border: 1px solid #eee;
|
||||
border: 1px solid rgba(0, 0, 0, 0.05);
|
||||
-webkit-border-radius: 4px;
|
||||
-moz-border-radius: 4px;
|
||||
border-radius: 4px;
|
||||
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
-moz-box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
|
||||
}
|
||||
|
||||
.avatar-small {
|
||||
display: inline-block;
|
||||
width: 24px;
|
||||
height: 20px;
|
||||
vertical-align: middle;
|
||||
overflow: hidden;
|
||||
margin: 0px 3px;
|
||||
}
|
||||
.avatar-small img {
|
||||
width: 24px;
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/legacy/messages.css
|
||||
*/
|
||||
|
||||
/* FLOATING MESSAGE */
|
||||
|
||||
.btn-img { cursor: pointer; }
|
||||
|
||||
div.fetching { color: #888; text-align:right; }
|
||||
|
||||
div.notice {
|
||||
postion: absolute;
|
||||
background-color: #000;
|
||||
-moz-border-radius: 5px; -webkit-border-radius: 5px;
|
||||
opacity: 0.6;
|
||||
right: 0;
|
||||
top: 0;
|
||||
margin-top: 8px;
|
||||
z-index: -1;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
/** help **/
|
||||
|
||||
.info-box {
|
||||
background-color: #F8F8F8;
|
||||
border: 1px solid #CCCCCC;
|
||||
border-radius: 3px 3px 3px 3px;
|
||||
line-height: 1.6em;
|
||||
overflow: auto;
|
||||
padding: 6px 10px;
|
||||
margin-bottom: 9px;
|
||||
}
|
||||
|
||||
.help_box, .help-box {
|
||||
background-color:#FFC;
|
||||
font-size: 13px;
|
||||
color: #864;
|
||||
padding: 7px;
|
||||
margin: 11px 0px;
|
||||
border: 1px solid #EEB;
|
||||
}
|
||||
|
||||
.help_box_big {
|
||||
background-color:#FFC;
|
||||
color: #864;
|
||||
padding: 7px;
|
||||
margin: 7px 0px;
|
||||
border: 1px solid #EEB;
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
/*
|
||||
* lib/css/legacy/dialog.css
|
||||
*/
|
||||
/***** Dialogs *******/
|
||||
|
||||
div.dialog_wrapper {
|
||||
position: absolute;
|
||||
width: 440px;
|
||||
display: none;
|
||||
z-index: 90;
|
||||
background-color: #FFF;
|
||||
box-shadow:1px 1px 8px #444;
|
||||
-moz-box-shadow: 1px 1px 8px #444;
|
||||
-webkit-box-shadow: 1px 1px 8px #444;
|
||||
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
div.dialog_head {
|
||||
height: 22px;
|
||||
padding: 4px;
|
||||
background-color: #222;
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
div.dialog_body {
|
||||
padding: 8px 8px 16px;
|
||||
border-radius: 5px;
|
||||
-moz-border-radius: 5px;
|
||||
-webkit-border-radius: 5px;
|
||||
}
|
||||
|
||||
div.dialog_back {
|
||||
position: fixed;
|
||||
display: none;
|
||||
top: 0px;
|
||||
left: 0px;
|
||||
bottom: 0px;
|
||||
right: 0px;
|
||||
background-color: #aaa;
|
||||
opacity: 0.6;
|
||||
z-index: 50;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
div.dialog_message {
|
||||
display: none;
|
||||
position: absolute;
|
||||
width: 250px;
|
||||
font-size: 12px;
|
||||
z-index: 91;
|
||||
background-color:#FFF;
|
||||
padding: 12px;
|
||||
border: 1px solid #444;
|
||||
}
|
||||
|
||||
div.dialog_row {
|
||||
padding: 8px 8px 0px 8px;
|
||||
}
|
||||
|
||||
div.dialog_row table {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
div.dialog_row table td {
|
||||
}
|
||||
|
||||
div.dialog_row input[type="text"], div.dialog_row input[type="password"], div.dialog_row textarea, div.dialog_row select {
|
||||
width: 80%;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
div.dialog_row table td textarea {
|
||||
width: 80%;
|
||||
height: 200px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* lib/css/ui/common.css
|
||||
*/
|
||||
.navbar-icon-home {
|
||||
vertical-align: middle;
|
||||
opacity: 0.4;
|
||||
Filter:alpha(opacity=40); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
.navbar-icon-home:hover,
|
||||
.navbar-icon-home:focus,
|
||||
.navbar-icon-home:active,
|
||||
.navbar-icon-home-hover{
|
||||
opacity:1;
|
||||
Filter:alpha(opacity=100); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* lib/css/ui/fonts.css
|
||||
*/
|
||||
@ -1811,17 +1850,50 @@ div.stat-bar {
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* lib/css/ui/views.css
|
||||
*/
|
||||
|
||||
.breadcrumbs {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.breadcrumbs a {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
div.appframe-titlebar {
|
||||
padding: 6px;
|
||||
background: #eeeeee; /* Old browsers */
|
||||
background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); /* FF3.6+ */
|
||||
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); /* Chrome,Safari4+ */
|
||||
background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Chrome10+,Safari5.1+ */
|
||||
background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* Opera 11.10+ */
|
||||
background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* IE10+ */
|
||||
background: linear-gradient(top, #eeeeee 0%,#cccccc 100%); /* W3C */
|
||||
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); /* IE6-9 */
|
||||
border-bottom: 1px solid #aaa;
|
||||
min-height: 1.2em;
|
||||
}
|
||||
|
||||
div.appframe-toolbar {
|
||||
padding: 4px;
|
||||
background: #eeeeee;
|
||||
border-top: 1px solid #f8f8f8;
|
||||
border-bottom: 1px solid #ccc;
|
||||
}
|
||||
|
||||
/*
|
||||
* erpnext/startup/startup.css
|
||||
*/
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Open Sans", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Open Sans", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@ -1860,26 +1932,11 @@ body {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.navbar-new-comments-true {
|
||||
color: #fff;
|
||||
background-color: #B00D07;
|
||||
}
|
||||
|
||||
.navbar-icon-home {
|
||||
vertical-align: middle;
|
||||
opacity:0.4;
|
||||
Filter:alpha(opacity=40); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
.navbar-icon-home:hover,
|
||||
.navbar-icon-home:focus,
|
||||
.navbar-icon-home:active,
|
||||
.navbar-icon-home-hover{
|
||||
opacity:1;
|
||||
Filter:alpha(opacity=100); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
/*extra size menus for recent*/
|
||||
.dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
|
||||
min-width: 160px !important;
|
||||
|
@ -35,12 +35,6 @@ class DocType:
|
||||
self.doc, self.doclist = d, dl
|
||||
self.entries = []
|
||||
|
||||
# Get Company List
|
||||
# ----------------
|
||||
def get_companies(self,arg=''):
|
||||
ret = webnotes.conn.sql("select name, abbr from tabCompany where docstatus != 2")
|
||||
return {'cl':[r[0] for r in ret]}
|
||||
|
||||
def get_company_currency(self,arg=''):
|
||||
dcc = TransactionBase().get_company_currency(arg)
|
||||
return dcc
|
||||
|
@ -1,9 +1,20 @@
|
||||
h1 { padding: 8px 0px; margin: 0px; }
|
||||
#ledger_area { padding: 16px;}
|
||||
.ac_head { display: none; }
|
||||
.ac_head div { padding: 2px; }
|
||||
.ac_ledger { display: none; padding: 8px; margin-top: 8px; border-top: 1px solid #DDD; }
|
||||
.ac_balance { margin-left: 4px; font-size: 16px; font-weight: bold; background-color: #FFFAB0; }
|
||||
select.accbrowser-company-select {
|
||||
width: 200px;
|
||||
margin-top: 2px;
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
.ac_page_sel_tab { width:90%; background-color: #EEE; margin-bottom: 8px }
|
||||
.ac_page_sel_tab td { vertical-align: middle; padding: 3px; }
|
||||
span.accbrowser-node-toolbar {
|
||||
padding: 2px;
|
||||
margin-left: 15px;
|
||||
border-radius: 3px;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background-color: #ddd;
|
||||
}
|
||||
|
||||
.tree-area a.selected {
|
||||
font-weight: bold;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
@ -1,7 +1,12 @@
|
||||
<div class="layout-wrapper layout-wrapper-appframe">
|
||||
<div class="layout-wrapper layout-wrapper-background">
|
||||
<div class="appframe-area"></div>
|
||||
<div style="padding: 15px;">
|
||||
<div id="ab_header"></div>
|
||||
<div id="ab_body" style="margin: 16px;"></div>
|
||||
<div class="layout-main-section">
|
||||
<div class="tree-area"></div>
|
||||
</div>
|
||||
<div class="layout-side-section">
|
||||
<div class="help">1. To add child nodes, explore tree and click on the node under which you want to add more nodes.<br><br>
|
||||
2. Please do NOT create accounts (ledgers) for Customers and Suppliers. They are created directly from the Customer / Supplier masters.<br>
|
||||
</div>
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
</div>
|
@ -14,37 +14,235 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
pscript['onshow_Accounts Browser'] = function(wrapper){
|
||||
wn.require('lib/js/legacy/widgets/tree.js');
|
||||
// tree of chart of accounts / cost centers
|
||||
// multiple companies
|
||||
// add node
|
||||
// edit node
|
||||
// see ledger
|
||||
|
||||
pscript['onload_Accounts Browser'] = function(wrapper){
|
||||
wn.require('lib/js/wn/ui/tree.js');
|
||||
wrapper.appframe = new wn.ui.AppFrame($(wrapper).find('.appframe-area'));
|
||||
wrapper.appframe.add_button('New Company', function() { newdoc('Company'); }, 'icon-plus');
|
||||
wrapper.appframe.add_button('Refresh', function() {
|
||||
wrapper.$company_select.change();
|
||||
}, 'icon-refresh');
|
||||
|
||||
var route = decodeURIComponent(location.hash);
|
||||
if(route.indexOf('/')!=-1) {
|
||||
var chart_type = route.split('/')[1];
|
||||
pscript.make_chart(chart_type);
|
||||
return;
|
||||
// company-select
|
||||
wrapper.$company_select = $('<select class="accbrowser-company-select"></select>')
|
||||
.change(function() {
|
||||
var ctype = wn.get_route()[1] || 'Account';
|
||||
erpnext.account_chart = new erpnext.AccountsChart(ctype, $(this).val(), wrapper);
|
||||
})
|
||||
.appendTo(wrapper.appframe.$w.find('.appframe-toolbar'));
|
||||
|
||||
// default company
|
||||
if(sys_defaults.company) {
|
||||
$('<option>')
|
||||
.html(sys_defaults.company)
|
||||
.attr('value', sys_defaults.company)
|
||||
.appendTo(wrapper.$company_select);
|
||||
|
||||
wrapper.$company_select
|
||||
.val(sys_defaults.company).change();
|
||||
}
|
||||
|
||||
// if the user directly loads the page, ask to select the chart
|
||||
var parent = $i('ab_body');
|
||||
parent.innerHTML = 'Please select your chart: '
|
||||
var sel = $a(parent,'select');
|
||||
add_sel_options(sel, ['Account', 'Cost Center'], 'Account');
|
||||
var btn = $btn(parent, 'Go', function() { pscript.make_chart(sel_val(sel)); }, {marginTop:'8px'});
|
||||
|
||||
// load up companies
|
||||
wn.call({
|
||||
method:'accounts.page.accounts_browser.accounts_browser.get_companies',
|
||||
callback: function(r) {
|
||||
wrapper.$company_select.empty();
|
||||
$.each(r.message, function(i, v) {
|
||||
$('<option>').html(v).attr('value', v).appendTo(wrapper.$company_select);
|
||||
});
|
||||
wrapper.$company_select.val(sys_defaults.company || r[0]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
pscript.make_chart = function(b) {
|
||||
pscript.chart_type = b;
|
||||
$i('ab_header').innerHTML ='';
|
||||
$i('ab_body').innerHTML ='';
|
||||
pscript['onshow_Accounts Browser'] = function(wrapper){
|
||||
// set route
|
||||
var ctype = wn.get_route()[1] || 'Account';
|
||||
wrapper.appframe.title('Chart of '+ctype+'s');
|
||||
|
||||
//===============comment area========================================
|
||||
var comment = $a($i('ab_body'),'div','comment',{marginBottom:"8px"});
|
||||
comment.innerHTML = "Note: Explore and click on the tree node to add a new child";
|
||||
|
||||
var select_area = $a('ab_body', 'div', '', {margin:'8px 0px'});
|
||||
if(erpnext.account_chart && erpnext.account_chart.ctype != ctype) {
|
||||
wrapper.$company_select.change();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
erpnext.AccountsChart = Class.extend({
|
||||
init: function(ctype, company, wrapper) {
|
||||
$(wrapper).find('.tree-area').empty();
|
||||
var me = this;
|
||||
me.ctype = ctype;
|
||||
me.company = company;
|
||||
this.tree = new wn.ui.Tree({
|
||||
parent: $(wrapper).find('.tree-area'),
|
||||
label: company,
|
||||
args: {ctype: ctype},
|
||||
method: 'accounts.page.accounts_browser.accounts_browser.get_children',
|
||||
click: function(link) {
|
||||
if(me.cur_toolbar)
|
||||
$(me.cur_toolbar).toggle(false);
|
||||
|
||||
if(!link.toolbar)
|
||||
me.make_link_toolbar(link);
|
||||
|
||||
if(link.toolbar) {
|
||||
me.cur_toolbar = link.toolbar;
|
||||
$(me.cur_toolbar).toggle(true);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
this.tree.rootnode.$a.click();
|
||||
},
|
||||
make_link_toolbar: function(link) {
|
||||
var data = $(link).data('node-data');
|
||||
if(!data) return;
|
||||
|
||||
link.toolbar = $('<span class="accbrowser-node-toolbar"></span>').insertAfter(link);
|
||||
|
||||
// edit
|
||||
$('<a href="#!Form/'+encodeURIComponent(this.ctype)+'/'
|
||||
+encodeURIComponent(data.value)+'">Edit</a>').appendTo(link.toolbar);
|
||||
|
||||
if(data.expandable) {
|
||||
link.toolbar.append(' | <a onclick="erpnext.account_chart.new_node();">Add Child</a>');
|
||||
} else if(this.ctype=='Account') {
|
||||
link.toolbar.append(' | <a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
|
||||
}
|
||||
},
|
||||
show_ledger: function() {
|
||||
var me = this;
|
||||
var node = me.selected_node();
|
||||
wn.set_route('Report', 'GL Entry', 'General Ledger',
|
||||
this.ctype + '=' + node.data('label'));
|
||||
},
|
||||
new_node: function() {
|
||||
if(this.ctype=='Account') {
|
||||
this.new_account();
|
||||
} else {
|
||||
this.new_cost_center();
|
||||
}
|
||||
},
|
||||
selected_node: function() {
|
||||
return this.tree.$w.find('.tree-link.selected');
|
||||
},
|
||||
new_account: function() {
|
||||
var me = this;
|
||||
|
||||
// the dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:'New Account',
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:'New Account Name', reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
|
||||
options:'Group\nLedger'},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:'Account Type',
|
||||
options: ['', 'Fixed Asset Account', 'Bank or Cash', 'Expense Account', 'Tax',
|
||||
'Income Account', 'Chargeable'].join('\n') },
|
||||
{fieldtype:'Float', fieldname:'tax_rate', label:'Tax Rate'},
|
||||
{fieldtype:'Select', fieldname:'master_type', label:'Master Type',
|
||||
options: ['NA', 'Supplier', 'Customer', 'Employee'].join('\n') },
|
||||
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
|
||||
]
|
||||
})
|
||||
|
||||
var fd = d.fields_dict;
|
||||
|
||||
// account type if ledger
|
||||
$(fd.group_or_ledger.input).change(function() {
|
||||
if($(this).val()=='Group') {
|
||||
$(fd.account_type.wrapper).toggle(false);
|
||||
$(fd.master_type.wrapper).toggle(false);
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
} else {
|
||||
$(fd.account_type.wrapper).toggle(true);
|
||||
$(fd.master_type.wrapper).toggle(true);
|
||||
if(fd.account_type.get_value()=='Tax') {
|
||||
$(fd.tax_rate.wrapper).toggle(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// tax rate if tax
|
||||
$(fd.account_type.input).change(function() {
|
||||
if($(this).val()=='Tax') {
|
||||
$(fd.tax_rate.wrapper).toggle(true);
|
||||
} else {
|
||||
$(fd.tax_rate.wrapper).toggle(false);
|
||||
}
|
||||
})
|
||||
|
||||
// create
|
||||
$(fd.create_new.input).click(function() {
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
var v = d.get_values();
|
||||
if(!v) return;
|
||||
|
||||
var node = me.selected_node();
|
||||
v.parent_account = node.data('label');
|
||||
v.company = me.company;
|
||||
|
||||
$c_obj('GL Control', 'add_ac', v,
|
||||
function(r,rt) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
node.trigger('reload');
|
||||
});
|
||||
});
|
||||
|
||||
// show
|
||||
d.onshow = function() {
|
||||
$(fd.group_or_ledger.input).change();
|
||||
}
|
||||
d.show();
|
||||
},
|
||||
|
||||
new_cost_center: function(){
|
||||
var me = this;
|
||||
// the dialog
|
||||
var d = new wn.ui.Dialog({
|
||||
title:'New Cost Center',
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'cost_center_name', label:'New Cost Center Name', reqd:true},
|
||||
{fieldtype:'Select', fieldname:'group_or_ledger', label:'Group or Ledger',
|
||||
options:'Group\nLedger'},
|
||||
{fieldtype:'Button', fieldname:'create_new', label:'Create New' }
|
||||
]
|
||||
})
|
||||
|
||||
// create
|
||||
$(d.fields_dict.create_new.input).click(function() {
|
||||
var btn = this;
|
||||
$(btn).set_working();
|
||||
var v = d.get_values();
|
||||
if(!v) return;
|
||||
|
||||
var node = me.selected_node();
|
||||
|
||||
v.parent_cost_center = node.data('label');
|
||||
v.company_name = me.company;
|
||||
|
||||
$c_obj('GL Control', 'add_cc', v,
|
||||
function(r,rt) {
|
||||
$(btn).done_working();
|
||||
d.hide();
|
||||
node.trigger('reload');
|
||||
});
|
||||
});
|
||||
d.show();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
pscript.make_chart = function(b, wrapper) {
|
||||
pscript.ctype = b;
|
||||
$(wrapper).find('.tree-area').empty()
|
||||
$(wrapper).find('.layout-sidesection').empty()
|
||||
|
||||
//================== table body======================================
|
||||
var ac_main_grid = make_table($i('ab_body'),1,2,'100%',['60%','40%'],{border:"0px", padding:"4px",tableLayout: "fixed", borderCollapse: "collapse"});
|
||||
@ -55,7 +253,7 @@ pscript.make_chart = function(b) {
|
||||
pscript.acc_period_bal = $a($td(ac_main_grid,0,1),'div');
|
||||
|
||||
//=====================footer area ==================================
|
||||
if (pscript.chart_type == 'Account') {
|
||||
if (pscript.ctype == 'Account') {
|
||||
var footer = $a($i('ab_body'),'div','',{backgroundColor: "#FFD", padding: "8px", color: "#444", fontSize: "12px", marginTop: "14px"});
|
||||
|
||||
var help1 = $a(footer,'span');
|
||||
@ -65,12 +263,7 @@ pscript.make_chart = function(b) {
|
||||
|
||||
// header and toolbar
|
||||
// ------------------
|
||||
|
||||
var h1 = 'Chart of '+pscript.chart_type+'s';
|
||||
if(pscript.chart_type == 'Account') var d = 'accounting';
|
||||
else var d = 'cost center';
|
||||
var desc = 'Manage multiple companies and the '+d+' structures of each company.';
|
||||
$i('ab_body').page_head = new PageHeader('ab_header',h1,desc);
|
||||
wrapper.appframe.$titlebar.find('.appframe-title').html('Chart of '+pscript.ctype+'s');
|
||||
|
||||
// select company
|
||||
// --------------
|
||||
@ -115,8 +308,8 @@ pscript.make_chart = function(b) {
|
||||
}
|
||||
|
||||
pscript.make_ac_tree = function() {
|
||||
//var type= sel_val($i('chart_type'))
|
||||
var type= pscript.chart_type;
|
||||
//var type= sel_val($i('ctype'))
|
||||
var type= pscript.ctype;
|
||||
var tree = new Tree(pscript.account_tree, '90%');
|
||||
pscript.ac_tree = tree;
|
||||
|
||||
@ -171,9 +364,9 @@ pscript.make_ac_tree = function() {
|
||||
}
|
||||
|
||||
if (type=='Account'){
|
||||
var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.chart_type];
|
||||
var arg = [node.rec.name, node.rec.account_name, sel_val(pscript.ab_company_sel), pscript.ctype];
|
||||
} else{
|
||||
var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.chart_type];
|
||||
var arg = [node.rec.name, node.rec.cost_center_name,sel_val(pscript.ab_company_sel), pscript.ctype];
|
||||
}
|
||||
|
||||
$c_obj('GL Control','get_cl',arg.join(','),callback);
|
||||
@ -338,10 +531,6 @@ pscript.make_ledger_area = function() {
|
||||
pscript.gl_rep.innerHTML = '<img src="lib/images/icons/report.png" style="margin-right: 8px"><span class="link_type">Open Ledger</span>';
|
||||
pscript.gl_rep.onclick = function(){ pscript.make_report('gl'); }
|
||||
|
||||
//Budget report link
|
||||
/*pscript.cc_rep = $a(pscript.ledger_area, 'div','', {fontSize: '14px',marginBottom: '8px', fontWeight: 'bold'});
|
||||
pscript.cc_rep.innerHTML = '<img src="images/icons/report.png" style="margin-right: 8px"><span class="link_type">Budget vs Actual Analysis Report</span>';
|
||||
pscript.cc_rep.onclick = function(){ pscript.make_report('budget'); }*/
|
||||
}
|
||||
|
||||
pscript.make_report = function(flag){
|
||||
@ -352,12 +541,6 @@ pscript.make_report = function(flag){
|
||||
}
|
||||
loadreport('GL Entry','General Ledger',callback);
|
||||
}
|
||||
/*else {
|
||||
loadreport('Budget Detail','Periodical Budget Report',function(f){
|
||||
f.set_filter('Cost Center','ID',pscript.cur_node.rec.name);
|
||||
f.dt.run();
|
||||
});
|
||||
}*/
|
||||
}
|
||||
|
||||
// New Account
|
||||
@ -435,3 +618,4 @@ pscript.make_new_cost_center_dialog = function(){
|
||||
|
||||
pscript.new_cost_center_dialog = pscript.cc_dialog;
|
||||
}
|
||||
*/
|
31
erpnext/accounts/page/accounts_browser/accounts_browser.py
Normal file
31
erpnext/accounts/page/accounts_browser/accounts_browser.py
Normal file
@ -0,0 +1,31 @@
|
||||
import webnotes
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_companies():
|
||||
return [r[0] for r in webnotes.conn.sql("""select name from tabCompany where docstatus!=2""")]
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_children():
|
||||
args = webnotes.form_dict
|
||||
ctype = args['ctype']
|
||||
company_field = ctype=='Account' and 'company' or 'company_name'
|
||||
|
||||
# root
|
||||
if args['parent'] in get_companies():
|
||||
return webnotes.conn.sql("""select
|
||||
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
||||
from `tab%s`
|
||||
where ifnull(parent_%s,'') = ''
|
||||
and %s = %s
|
||||
and docstatus<2
|
||||
order by name""" % (ctype, ctype.lower().replace(' ','_'), company_field, '%s'),
|
||||
args['parent'], as_dict=1)
|
||||
|
||||
# other
|
||||
return webnotes.conn.sql("""select
|
||||
name as value, if(group_or_ledger='Group', 1, 0) as expandable
|
||||
from `tab%s`
|
||||
where ifnull(parent_%s,'') = %s
|
||||
and docstatus<2
|
||||
order by name""" % (ctype, ctype.lower().replace(' ','_'), '%s'),
|
||||
args['parent'], as_dict=1)
|
@ -71,15 +71,7 @@ class DocType:
|
||||
pr.save(1)
|
||||
|
||||
# Update Membership Type at Gateway
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
if 'System Manager' in role_list : membership_type = 'Administrator'
|
||||
else : membership_type = 'Member'
|
||||
|
||||
import server_tools.gateway_utils
|
||||
server_tools.gateway_utils.update_membership_type(cstr(arg['usr']), membership_type)
|
||||
|
||||
sql("delete from __SessionCache where user=%s", cstr(arg['usr']))
|
||||
|
||||
|
@ -28,13 +28,6 @@ def change_password(arg):
|
||||
if not webnotes.conn.sql('select name from tabProfile where name=%s and password=password(%s)', (webnotes.session['user'], arg['old_password'])):
|
||||
webnotes.msgprint('Old password is not correct', raise_exception=1)
|
||||
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
import server_tools.gateway_utils
|
||||
webnotes.msgprint(server_tools.gateway_utils.change_password(arg['old_password'], arg['new_password'])['message'])
|
||||
|
||||
from webnotes.utils import nowdate
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s), modified=%s where name=%s",(arg['new_password'], nowdate(), webnotes.session['user']))
|
||||
webnotes.msgprint('Password Updated');
|
||||
|
@ -59,48 +59,15 @@ class DocType:
|
||||
msgprint("Employee's attendance already marked.")
|
||||
raise Exception
|
||||
|
||||
#validation - leave_type is mandatory for status absent/ half day else not required to entered.
|
||||
def validate_status(self):
|
||||
if self.doc.status == 'Present' and self.doc.leave_type:
|
||||
msgprint("You can not enter leave type for attendance status 'Present'")
|
||||
raise Exception
|
||||
|
||||
elif (self.doc.status == 'Absent' or self.doc.status == 'Half Day') and not self.doc.leave_type:
|
||||
msgprint("Please enter leave type for attendance status 'Absent'")
|
||||
raise Exception
|
||||
|
||||
#check for already record present in leave transaction for same date
|
||||
def check_leave_record(self):
|
||||
if self.doc.status == 'Present':
|
||||
chk = sql("select name from `tabLeave Transaction` where employee=%s and (from_date <= %s and to_date >= %s) and status = 'Submitted' and leave_transaction_type = 'Deduction' and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
|
||||
chk = sql("select name from `tabLeave Application` where employee=%s and (from_date <= %s and to_date >= %s) and docstatus!=2", (self.doc.employee, self.doc.att_date, self.doc.att_date))
|
||||
if chk:
|
||||
msgprint("Leave Application created for employee "+self.doc.employee+" whom you are trying to mark as 'Present' ")
|
||||
raise Exception
|
||||
|
||||
#For absent/ half day record - check for leave balances of the employees
|
||||
def validate_leave_type(self):
|
||||
if not self.doc.status =='Present' and self.doc.leave_type not in ('Leave Without Pay','Compensatory Off'):
|
||||
#check for leave allocated to employee from leave transaction
|
||||
ret = sql("select name from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and leave_transaction_type = 'Allocation' and fiscal_year = '%s'"%(self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
|
||||
|
||||
#if leave allocation is present then calculate leave balance i.e. sum(allocation) - sum(deduction)
|
||||
if ret:
|
||||
q1 = 'SUM(CASE WHEN leave_transaction_type = "Allocation" THEN total_leave ELSE 0 END)-SUM(CASE WHEN leave_transaction_type = "Deduction" THEN total_leave ELSE 0 END)'
|
||||
q2 = "select %s from `tabLeave Transaction` where employee = '%s' and leave_type = '%s' and fiscal_year = '%s' and docstatus = 1"
|
||||
|
||||
res = sql(q2%(q1,self.doc.employee,self.doc.leave_type,self.doc.fiscal_year))
|
||||
|
||||
if res:
|
||||
if self.doc.status == 'Absent' and flt(res[0][0]) < 1:
|
||||
msgprint("%s balances are insufficient to cover a day absence, please select other leave type."%self.doc.leave_type)
|
||||
raise Exception
|
||||
if self.doc.status == 'Half Day' and flt(res[0][0]) < 0.5:
|
||||
msgprint("%s balances are insufficient to cover a half day absence, please select other leave type."%self.doc.leave_type)
|
||||
raise Exception
|
||||
|
||||
else:
|
||||
msgprint("Leave Allocation for employee %s not done.\n You can allocate leaves from HR -> Leave Transaction OR HR -> Leave Control Panel."%self.doc.employee)
|
||||
raise Exception
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"% self.doc.fiscal_year)
|
||||
@ -129,7 +96,6 @@ class DocType:
|
||||
def validate(self):
|
||||
self.validate_fiscal_year()
|
||||
self.validate_att_date()
|
||||
#self.validate_leave_type()
|
||||
self.validate_duplicate_record()
|
||||
#self.validate_status()
|
||||
self.check_leave_record()
|
||||
|
@ -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,126 +34,126 @@ convert_to_lists = webnotes.conn.convert_to_lists
|
||||
|
||||
|
||||
class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_employee_name(self):
|
||||
emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm = emp_dtl and emp_dtl[0][0] or ''
|
||||
self.doc.employee_name = emp_nm
|
||||
self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
|
||||
def get_employee_name(self):
|
||||
emp_dtl = sql("select employee_name,company_email from `tabEmployee` where name=%s", self.doc.employee)
|
||||
emp_nm = emp_dtl and emp_dtl[0][0] or ''
|
||||
self.doc.employee_name = emp_nm
|
||||
self.doc.email_id = emp_dtl and emp_dtl[0][1] or ''
|
||||
|
||||
return cstr(emp_nm)
|
||||
|
||||
def get_approver_lst(self):
|
||||
approver_lst =[]
|
||||
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
|
||||
if approver_lst1:
|
||||
approver_lst=approver_lst1
|
||||
else:
|
||||
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
|
||||
return approver_lst
|
||||
return cstr(emp_nm)
|
||||
|
||||
def get_approver_lst(self):
|
||||
approver_lst =[]
|
||||
approver_lst1 = get_obj('Authorization Control').get_approver_name(self.doc.doctype,0,self)
|
||||
if approver_lst1:
|
||||
approver_lst=approver_lst1
|
||||
else:
|
||||
approver_lst = [x[0] for x in sql("select distinct name from `tabProfile` where enabled=1 and name!='Administrator' and name!='Guest' and docstatus!=2")]
|
||||
return approver_lst
|
||||
|
||||
def set_approver(self):
|
||||
ret={}
|
||||
approver_lst =[]
|
||||
emp_nm = self.get_employee_name()
|
||||
approver_lst = self.get_approver_lst()
|
||||
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
|
||||
return ret
|
||||
def set_approver(self):
|
||||
ret={}
|
||||
approver_lst =[]
|
||||
emp_nm = self.get_employee_name()
|
||||
approver_lst = self.get_approver_lst()
|
||||
ret = {'app_lst':"\n" + "\n".join(approver_lst), 'emp_nm':cstr(emp_nm)}
|
||||
return ret
|
||||
|
||||
def update_voucher(self):
|
||||
sql("delete from `tabExpense Claim Detail` where parent = '%s'"%self.doc.name)
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if not d.expense_type or not d.claim_amount:
|
||||
msgprint("Please remove the extra blank row added")
|
||||
raise Exception
|
||||
d.save(1)
|
||||
if self.doc.total_sanctioned_amount:
|
||||
set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
|
||||
def approve_voucher(self):
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if not d.sanctioned_amount:
|
||||
msgprint("Please add 'Sanctioned Amount' for all expenses")
|
||||
return cstr('Incomplete')
|
||||
|
||||
if not self.doc.total_sanctioned_amount:
|
||||
msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
|
||||
return cstr('No Amount')
|
||||
self.update_voucher()
|
||||
|
||||
set(self.doc, 'approval_status', 'Approved')
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Claim Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
def update_voucher(self):
|
||||
sql("delete from `tabExpense Claim Detail` where parent = '%s'"%self.doc.name)
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if not d.expense_type or not d.claim_amount:
|
||||
msgprint("Please remove the extra blank row added")
|
||||
raise Exception
|
||||
d.save(1)
|
||||
if self.doc.total_sanctioned_amount:
|
||||
set(self.doc,'total_sanctioned_amount',self.doc.total_sanctioned_amount)
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
|
||||
def approve_voucher(self):
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if not d.sanctioned_amount:
|
||||
msgprint("Please add 'Sanctioned Amount' for all expenses")
|
||||
return cstr('Incomplete')
|
||||
|
||||
if not self.doc.total_sanctioned_amount:
|
||||
msgprint("Please calculate total sanctioned amount using button 'Calculate Total Amount'")
|
||||
return cstr('No Amount')
|
||||
self.update_voucher()
|
||||
|
||||
set(self.doc, 'approval_status', 'Approved')
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Claim Approved', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
|
||||
return cstr('Approved')
|
||||
|
||||
def reject_voucher(self):
|
||||
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
set(self.doc, 'approval_status', 'Rejected')
|
||||
return cstr('Approved')
|
||||
|
||||
def reject_voucher(self):
|
||||
|
||||
if self.doc.remark:
|
||||
set(self.doc, 'remark', self.doc.remark)
|
||||
set(self.doc, 'approval_status', 'Rejected')
|
||||
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Claim Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
# on approval notification
|
||||
#get_obj('Notification Control').notify_contact('Expense Claim Rejected', self.doc.doctype, self.doc.name, self.doc.email_id, self.doc.employee_name)
|
||||
|
||||
return cstr('Rejected')
|
||||
|
||||
def validate_curr_exp(self):
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if flt(d.sanctioned_amount) > 0:
|
||||
if self.doc.approval_status == 'Draft':
|
||||
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Claim")
|
||||
raise Exception
|
||||
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
|
||||
msgprint("Sanctioned amount can be added only by expense voucher Approver")
|
||||
raise Exception
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
|
||||
msgprint("Posting Date is not within the Fiscal Year selected")
|
||||
raise Exception
|
||||
|
||||
def validate(self):
|
||||
self.validate_curr_exp()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'approval_status', 'Draft')
|
||||
|
||||
def validate_exp_details(self):
|
||||
if not getlist(self.doclist, 'expense_voucher_details'):
|
||||
msgprint("Please add expense voucher details")
|
||||
raise Exception
|
||||
|
||||
if not self.doc.total_claimed_amount:
|
||||
msgprint("Please calculate Total Claimed Amount")
|
||||
raise Exception
|
||||
|
||||
if not self.doc.exp_approver:
|
||||
msgprint("Please select Expense Claim approver")
|
||||
raise Exception
|
||||
|
||||
def validate_approver(self):
|
||||
app_lst = self.get_approver_lst()
|
||||
if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
|
||||
msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
|
||||
valid_app = 'No'
|
||||
else:
|
||||
valid_app = 'Yes'
|
||||
ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
|
||||
return ret
|
||||
|
||||
def on_submit(self):
|
||||
self.validate_exp_details()
|
||||
set(self.doc, 'approval_status', 'Submitted')
|
||||
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'approval_status', 'Cancelled')
|
||||
return cstr('Rejected')
|
||||
|
||||
def validate_curr_exp(self):
|
||||
for d in getlist(self.doclist, 'expense_voucher_details'):
|
||||
if flt(d.sanctioned_amount) > 0:
|
||||
if self.doc.approval_status == 'Draft':
|
||||
msgprint("Sanctioned amount can be added by Approver person only for submitted Expense Claim")
|
||||
raise Exception
|
||||
elif self.doc.approval_status == 'Submitted' and session['user'] != self.doc.exp_approver:
|
||||
msgprint("Sanctioned amount can be added only by expense voucher Approver")
|
||||
raise Exception
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
fy=sql("select year_start_date from `tabFiscal Year` where name='%s'"%self.doc.fiscal_year)
|
||||
ysd=fy and fy[0][0] or ""
|
||||
yed=add_days(str(ysd),365)
|
||||
if str(self.doc.posting_date) < str(ysd) or str(self.doc.posting_date) > str(yed):
|
||||
msgprint("Posting Date is not within the Fiscal Year selected")
|
||||
raise Exception
|
||||
|
||||
def validate(self):
|
||||
self.validate_curr_exp()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
def on_update(self):
|
||||
set(self.doc, 'approval_status', 'Draft')
|
||||
|
||||
def validate_exp_details(self):
|
||||
if not getlist(self.doclist, 'expense_voucher_details'):
|
||||
msgprint("Please add expense voucher details")
|
||||
raise Exception
|
||||
|
||||
if not self.doc.total_claimed_amount:
|
||||
msgprint("Please calculate Total Claimed Amount")
|
||||
raise Exception
|
||||
|
||||
if not self.doc.exp_approver:
|
||||
msgprint("Please select Expense Claim approver")
|
||||
raise Exception
|
||||
|
||||
def validate_approver(self):
|
||||
app_lst = self.get_approver_lst()
|
||||
if self.doc.exp_approver and self.doc.exp_approver not in app_lst:
|
||||
msgprint("Approver "+self.doc.exp_approver+" is not authorized to approve this expense voucher. Please select another approver")
|
||||
valid_app = 'No'
|
||||
else:
|
||||
valid_app = 'Yes'
|
||||
ret = {'app_lst':("\n" + "\n".join(app_lst)), 'valid_approver':valid_app}
|
||||
return ret
|
||||
|
||||
def on_submit(self):
|
||||
self.validate_exp_details()
|
||||
set(self.doc, 'approval_status', 'Submitted')
|
||||
|
||||
def on_cancel(self):
|
||||
set(self.doc, 'approval_status', 'Cancelled')
|
||||
|
@ -29,7 +29,6 @@ cur_frm.cscript.onload = function(doc, dt, dn){
|
||||
//=======================================================================
|
||||
cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
if((!doc.__islocal) && (doc.is_active == 'Yes')){
|
||||
cur_frm.add_custom_button('Make IT Checklist', cur_frm.cscript['Make IT Checklist']);
|
||||
cur_frm.add_custom_button('Make Salary Slip', cur_frm.cscript['Make Salary Slip']);
|
||||
|
||||
get_field(doc.doctype, 'employee', doc.name).permlevel = 1;
|
||||
@ -37,16 +36,6 @@ cur_frm.cscript.refresh = function(doc, dt, dn){
|
||||
}
|
||||
}
|
||||
|
||||
// Make IT checklist
|
||||
//=======================================================================
|
||||
cur_frm.cscript['Make IT Checklist']=function(){
|
||||
var itc = LocalDB.create('IT Checklist');
|
||||
itc = locals['IT Checklist'][itc];
|
||||
itc.employee = cur_frm.doc.employee;
|
||||
itc.fiscal_year = sys_defaults.fiscal_year;
|
||||
itc.is_cheklist_active='Yes';
|
||||
loaddoc('IT Checklist', itc.name);
|
||||
}
|
||||
|
||||
// Make Salry Slip
|
||||
//=======================================================================
|
||||
|
@ -57,7 +57,7 @@
|
||||
<div class="section-item">
|
||||
<a class="section-link"
|
||||
title = "List of holidays"
|
||||
href="#!List/Leave Allocation">Holiday List</a>
|
||||
href="#!List/Holiday List">Holiday List</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -43,8 +43,8 @@ for r in res:
|
||||
for d1 in li:
|
||||
d2 = '%s'%d1
|
||||
|
||||
earn_ret=convert_to_lists(sql("select e_type,e_amount from `tabSS Earning Detail` where parent = '%s'"%r[col_idx['ID']]))
|
||||
ded_ret=convert_to_lists(sql("select d_type,d_amount from `tabSS Deduction Detail` where parent = '%s'"%r[col_idx['ID']]))
|
||||
earn_ret=convert_to_lists(sql("select e_type,e_amount from `tabSalary Slip Earning` where parent = '%s'"%r[col_idx['ID']]))
|
||||
ded_ret=convert_to_lists(sql("select d_type,d_amount from `tabSalary Slip Deduction` where parent = '%s'"%r[col_idx['ID']]))
|
||||
|
||||
|
||||
for e in earn_ret:
|
||||
@ -78,7 +78,7 @@ for lst in earn_type_lst:
|
||||
for r in res:
|
||||
|
||||
lst0 = '%s'%lst[0]
|
||||
total_ear += r[col_idx[lst0]]
|
||||
total_ear += flt(r[col_idx[lst0]])
|
||||
|
||||
total.append(total_ear)
|
||||
|
||||
@ -87,7 +87,7 @@ for lst in ded_type_lst:
|
||||
total_ded = 0
|
||||
for r in res:
|
||||
lst0 = '%s'%lst[0]
|
||||
total_ded += r[col_idx[lst0]]
|
||||
total_ded += flt(r[col_idx[lst0]])
|
||||
|
||||
total.append(total_ded)
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
import webnotes
|
||||
import conf
|
||||
from webnotes.model import rename, delete_doc
|
||||
from webnotes.model.code import get_obj
|
||||
from wnf import replace_code
|
||||
@ -54,7 +55,7 @@ def execute():
|
||||
#for d in webnotes.conn.sql("""select name, module from
|
||||
# `tabSearch Criteria` where ifnull(standard, 'No') = 'Yes' and ifnull(disabled, 0) = 0"""):
|
||||
#
|
||||
for path, folders, files in os.walk(webnotes.defs.modules_path):
|
||||
for path, folders, files in os.walk(conf.modules_path):
|
||||
if not path.endswith('search_criteria'): continue
|
||||
module = path.split(os.sep)[-2]
|
||||
for sc in folders:
|
||||
@ -128,7 +129,8 @@ def delete_search_criteria():
|
||||
'periodic_sales_summary', 'monthly_despatched_trend', 'sales', 'sales_order',
|
||||
'sales_order1', 'sales_agentwise_commission', 'test_report',
|
||||
'territory_wise_sales_-_target_vs_actual_',
|
||||
'pending_po_items_to_bill1', 'pending_po_items_to_receive1')""")
|
||||
'pending_po_items_to_bill1', 'pending_po_items_to_receive1',
|
||||
'expense_vouchers', 'pending_expense_vouchers', 'shortage_to_indent')""")
|
||||
|
||||
webnotes.conn.sql("""
|
||||
DELETE FROM `tabSearch Criteria`
|
||||
@ -142,7 +144,7 @@ def delete_search_criteria():
|
||||
def change_report_module():
|
||||
reports = {'itemwise_receipt_details': 'Stock'}
|
||||
for k in reports:
|
||||
sql("update `tabSearch Criteria` set module = %s where name = %s", (reports[k], k))
|
||||
webnotes.conn.sql("update `tabSearch Criteria` set module = %s where name = %s", (reports[k], k))
|
||||
|
||||
def rename_in_db(ren_data, data_type, is_doctype):
|
||||
for d in ren_data:
|
||||
@ -420,7 +422,7 @@ def prepare_dict_of_label_fieldname(module_path):
|
||||
modules_list = folders
|
||||
for f in files:
|
||||
if f.endswith(".txt"):
|
||||
rel_path = os.path.relpath(path, webnotes.defs.modules_path)
|
||||
rel_path = os.path.relpath(path, conf.modules_path)
|
||||
path_tuple = rel_path.split(os.sep)
|
||||
if (len(path_tuple)==3 and path_tuple[0] in modules_list and
|
||||
path_tuple[1] == 'doctype'):
|
||||
|
@ -195,7 +195,7 @@ class DocType:
|
||||
"""Update workstation rate and calculates totals"""
|
||||
total_op_cost = 0
|
||||
for d in getlist(self.doclist, 'bom_operations'):
|
||||
hour_rate = sql("select hour_rate from `tabWorkstation` where name = %s", d.workstation)
|
||||
hour_rate = sql("select hour_rate from `tabWorkstation` where name = %s", cstr(d.workstation))
|
||||
d.hour_rate = hour_rate and flt(hour_rate[0][0]) or 0
|
||||
d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60
|
||||
total_op_cost += d.operating_cost
|
||||
|
@ -52,4 +52,4 @@ cur_frm.cscript.project_value = function(doc, cdt, cdn){
|
||||
//--------- calculate gross profit --------------------------------
|
||||
cur_frm.cscript.est_material_cost = function(doc, cdt, cdn){
|
||||
get_server_fields('get_gross_profit','','',doc, cdt, cdn, 1);
|
||||
}
|
||||
}
|
||||
|
@ -119,4 +119,4 @@ cur_frm.cscript.declare_completed = function(){
|
||||
cur_frm.cscript.refresh(cur_frm.doc, cur_frm.doc.doctype, cur_frm.doc.name);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ class DocType:
|
||||
|
||||
def get_allocated_to_name(self):
|
||||
as_em = sql("select first_name, last_name from `tabProfile` where name=%s",str(self.doc.allocated_to))
|
||||
ret = { 'allocated_to_name' : as_em and (as_em[0][0] + ' ' + as_em[0][1]) or ''}
|
||||
ret = { 'allocated_to_name' : as_em and (cstr(as_em[0][0]) + ' ' + cstr(as_em[0][1])) or ''}
|
||||
return ret
|
||||
|
||||
# validate
|
||||
@ -95,7 +95,7 @@ class DocType:
|
||||
sql("delete from tabEvent where ref_type='Task' and ref_name=%s", self.doc.name)
|
||||
self.add_calendar_event()
|
||||
else:
|
||||
msgprint("An Expeted start date has not been set for this task.Please set a, 'Expected Start date'\
|
||||
msgprint("An Expeted start date has not been set for this task.Please set 'Expected Start date'\
|
||||
to add an event to allocated persons calender.You can save a task without this also.")
|
||||
|
||||
|
||||
|
@ -47,7 +47,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
//---------------
|
||||
cur_frm.clear_custom_buttons()
|
||||
if(!doc.__islocal && !in_list(['Converted', 'Lead Lost'], doc.status)) {
|
||||
cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
|
||||
if (doc.source != 'Existing Customer') cur_frm.add_custom_button('Create Customer', cur_frm.cscript['Create Customer']);
|
||||
cur_frm.add_custom_button('Create Opportunity', cur_frm.cscript['Create Opportunity']);
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
}
|
||||
|
@ -86,15 +86,10 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
// stop
|
||||
if(doc.per_delivered < 100 || doc.per_billed < 100)
|
||||
cur_frm.add_custom_button('Stop!', cur_frm.cscript['Stop Sales Order']);
|
||||
} else {
|
||||
|
||||
} else {
|
||||
// un-stop
|
||||
cur_frm.add_custom_button('Unstop', cur_frm.cscript['Unstop Sales Order']);
|
||||
}
|
||||
|
||||
unhide_field(['Send SMS', 'message', 'customer_mobile_no'])
|
||||
} else {
|
||||
hide_field(['Send SMS', 'message', 'customer_mobile_no'])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -15,25 +15,9 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import webnotes
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
import home
|
||||
|
||||
def on_login(login_manager):
|
||||
"""
|
||||
called from login manager, before login
|
||||
"""
|
||||
if login_manager.user not in ('Guest', None, '') and webnotes.conn.cur_db_name!='accounts' and webnotes.conn.get_value('Control Panel', 'Control Panel', 'account_id')!='s5u011':
|
||||
try:
|
||||
login_manager = login_as(login_manager)
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
update_account_details()
|
||||
import server_tools.gateway_utils
|
||||
server_tools.gateway_utils.check_login(login_manager.user)
|
||||
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
def on_login_post_session(login_manager):
|
||||
"""
|
||||
@ -99,6 +83,11 @@ def boot_session(bootinfo):
|
||||
|
||||
bootinfo['user_background'] = webnotes.conn.get_value("Profile", webnotes.session['user'], 'background_image') or ''
|
||||
|
||||
import conf
|
||||
bootinfo['sync_with_gateway'] = hasattr(conf, 'sync_with_gateway') and \
|
||||
cint(conf.sync_with_gateway) or 0
|
||||
|
||||
|
||||
def get_letter_heads():
|
||||
"""load letter heads with startup"""
|
||||
import webnotes
|
||||
@ -123,45 +112,9 @@ def login_as(login_manager):
|
||||
|
||||
login_manager.user_fullname = (first_name and first_name or "") + (last_name and " " + last_name or "")
|
||||
|
||||
if hasattr(webnotes.defs, 'validate_ip'):
|
||||
msg = getattr(webnotes.defs, 'validate_ip')()
|
||||
if msg: webnotes.msgprint(msg, raise_exception=1)
|
||||
|
||||
# alisaing here... so check if the user is disabled
|
||||
if not webnotes.conn.sql("select ifnull(enabled,0) from tabProfile where name=%s", user)[0][0]:
|
||||
# throw execption
|
||||
webnotes.msgprint("Authentication Failed", raise_exception=1)
|
||||
|
||||
return login_manager
|
||||
|
||||
#
|
||||
# update account details
|
||||
#
|
||||
def update_account_details():
|
||||
# additional details (if from gateway)
|
||||
if webnotes.form_dict.get('is_trial'):
|
||||
webnotes.conn.set_global('is_trial', cint(webnotes.form_dict.get('is_trial')))
|
||||
|
||||
if webnotes.form_dict.get('days_to_expiry'):
|
||||
webnotes.conn.set_global('days_to_expiry', webnotes.form_dict.get('days_to_expiry'))
|
||||
|
||||
if webnotes.form_dict.get('first_name'):
|
||||
from server_tools.gateway_utils import update_user_details
|
||||
update_user_details()
|
||||
|
||||
if webnotes.form_dict.get('xpassword') and webnotes.form_dict.get('login_as')!='Administrator':
|
||||
webnotes.conn.sql("""update tabProfile set password=password(%(xpassword)s) where name=%(login_as)s""", (webnotes.form_dict))
|
||||
|
||||
if webnotes.form_dict.get('url_name'):
|
||||
from webnotes.utils import set_default
|
||||
set_default('account_url', 'http://'+webnotes.form_dict.get('url_name'))
|
||||
|
||||
#
|
||||
# logout the user from SSO
|
||||
#
|
||||
def on_logout(login_manager):
|
||||
import webnotes.defs
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import logout_sso
|
||||
logout_sso(user=login_manager.user)
|
||||
return login_manager
|
@ -1,11 +1,11 @@
|
||||
h1, h2, h3, h4, h5 {
|
||||
font-family: "Open Sans", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-weight: normal;
|
||||
margin-top: 0.2em;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "Open Sans", Helvetica, "Helvetica Neue", sans-serif;
|
||||
font-family: "Helvetica Neue", "Open Sans", Helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
@ -44,26 +44,11 @@ body {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
|
||||
.navbar-new-comments-true {
|
||||
color: #fff;
|
||||
background-color: #B00D07;
|
||||
}
|
||||
|
||||
.navbar-icon-home {
|
||||
vertical-align: middle;
|
||||
opacity:0.4;
|
||||
Filter:alpha(opacity=40); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
.navbar-icon-home:hover,
|
||||
.navbar-icon-home:focus,
|
||||
.navbar-icon-home:active,
|
||||
.navbar-icon-home-hover{
|
||||
opacity:1;
|
||||
Filter:alpha(opacity=100); /* For IE8 and earlier */
|
||||
}
|
||||
|
||||
/*extra size menus for recent*/
|
||||
.dropdown-menu#toolbar-recent, .dropdown-menu#toolbar-options, .dropdown-menu#toolbar-help{
|
||||
min-width: 160px !important;
|
||||
|
@ -39,6 +39,7 @@ erpnext.modules = {
|
||||
}
|
||||
|
||||
erpnext.startup.set_globals = function() {
|
||||
wn.control_panel.sync_with_gateway = wn.boot.sync_with_gateway
|
||||
pscript.is_erpnext_saas = cint(wn.control_panel.sync_with_gateway)
|
||||
if(inList(user_roles,'System Manager')) is_system_manager = 1;
|
||||
}
|
||||
|
@ -78,10 +78,7 @@ class DocType:
|
||||
msg = """Actual Qty(%s) in Bin is mismatched with total number(%s) of serial no in store
|
||||
for item: '%s' and warehouse: '%s'""" % \
|
||||
(self.doc.actual_qty, sr_count, self.doc.item_code, self.doc.warehouse)
|
||||
|
||||
if getattr(webnotes.defs,'admin_email_notification',1):
|
||||
sendmail(['developers@iwebnotes.com'], sender='automail@webnotestech.com', \
|
||||
subject='Serial No Count vs Bin Actual Qty', parts=[['text/plain', msg]])
|
||||
|
||||
msgprint(msg, raise_exception=1)
|
||||
|
||||
# --------------------------------
|
||||
|
@ -63,12 +63,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
|
||||
if(doc.per_installed < 100 && doc.docstatus==1) cur_frm.add_custom_button('Make Installation Note', cur_frm.cscript['Make Installation Note']);
|
||||
|
||||
if (doc.docstatus!=1) {
|
||||
hide_field(['Send SMS', 'message', 'customer_mobile_no');
|
||||
} else {
|
||||
cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
unhide_field(['Send SMS', 'message', 'customer_mobile_no');
|
||||
}
|
||||
if (doc.docstatus==1) cur_frm.add_custom_button('Send SMS', cur_frm.cscript.send_sms);
|
||||
|
||||
if(doc.docstatus==0 && !doc.__islocal) {
|
||||
cur_frm.add_custom_button('Make Packing Slip', cur_frm.cscript['Make Packing Slip']);
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2009-05-12 16:46:45',
|
||||
'creation': '2012-04-16 15:08:16',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-13 14:12:02',
|
||||
'modified': '2012-04-16 15:54:45',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -41,7 +41,7 @@
|
||||
'subject': u'%(remarks)s',
|
||||
'tag_fields': u'purpose',
|
||||
'use_template': 0,
|
||||
'version': 263
|
||||
'version': 264
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -69,18 +69,6 @@
|
||||
'name': u'Stock Entry'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Material User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
@ -93,30 +81,6 @@
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Production User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Production Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
@ -124,11 +88,54 @@
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'All',
|
||||
'role': u'Material Manager',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Material User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 0,
|
||||
'cancel': 0,
|
||||
'create': 0,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Material User',
|
||||
'submit': 0,
|
||||
'write': 0
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Production User',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Production User'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'create': 0,
|
||||
@ -138,6 +145,25 @@
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'amend': 1,
|
||||
'cancel': 1,
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 0,
|
||||
'role': u'Production Manager',
|
||||
'submit': 1,
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
'permlevel': 1,
|
||||
'role': u'Production Manager'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm',
|
||||
@ -149,6 +175,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'warehouse_section',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Warehouse',
|
||||
'oldfieldtype': u'Section Break',
|
||||
@ -158,6 +185,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'col1',
|
||||
'fieldtype': u'Column Break',
|
||||
'oldfieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
@ -498,6 +526,7 @@
|
||||
{
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'warehouse_html',
|
||||
'fieldtype': u'HTML',
|
||||
'label': u'Warehouse HTML',
|
||||
'no_copy': 0,
|
||||
@ -568,6 +597,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'col2',
|
||||
'fieldtype': u'Column Break',
|
||||
'oldfieldtype': u'Column Break',
|
||||
'permlevel': 0,
|
||||
@ -773,6 +803,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'items_section',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Items',
|
||||
'oldfieldtype': u'Section Break',
|
||||
@ -782,6 +813,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'get_stock_and_rate',
|
||||
'fieldtype': u'Button',
|
||||
'label': u'Get Stock and Rate',
|
||||
'oldfieldtype': u'Button',
|
||||
@ -793,6 +825,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'col3',
|
||||
'fieldtype': u'Column Break',
|
||||
'oldfieldtype': u'Column Break',
|
||||
'permlevel': 0
|
||||
@ -803,6 +836,7 @@
|
||||
'allow_on_submit': 0,
|
||||
'colour': u'White:FFF',
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'get_items',
|
||||
'fieldtype': u'Button',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
@ -820,6 +854,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'item_section',
|
||||
'fieldtype': u'Section Break',
|
||||
'oldfieldtype': u'Section Break',
|
||||
'options': u'Simple',
|
||||
@ -869,6 +904,7 @@
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'other_details_section',
|
||||
'fieldtype': u'Section Break',
|
||||
'label': u'Other Details',
|
||||
'oldfieldtype': u'Section Break',
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-04-03 12:49:53',
|
||||
'creation': '2012-04-16 11:42:44',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-04-03 12:49:53',
|
||||
'modified': '2012-04-16 16:00:35',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -15,13 +15,16 @@
|
||||
'add_col': u'`tabItem`.`item_name`\n`tabItem`.`description`',
|
||||
'add_cond': u'`tabItem`.`name` = `tabStock Ledger Entry`.`item_code`',
|
||||
'add_tab': u'`tabItem`',
|
||||
'columns': u'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Voucher Detail No,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction',
|
||||
'columns': u'Stock Ledger Entry\x01Item Code,Stock Ledger Entry\x01Warehouse,Stock Ledger Entry\x01Posting Date,Stock Ledger Entry\x01Posting Time,Stock Ledger Entry\x01Actual Quantity,Stock Ledger Entry\x01Bin Actual Qty After Transaction,Stock Ledger Entry\x01Voucher Type,Stock Ledger Entry\x01Voucher No',
|
||||
'criteria_name': u'Stock Ledger',
|
||||
'doc_type': u'Stock Ledger Entry',
|
||||
'doctype': 'Search Criteria',
|
||||
'filters': u"{'Stock Ledger Entry\x01Is Cancelled':'','Stock Ledger Entry\x01Is Stock Entry':''}",
|
||||
'filters': u'{"Stock Ledger Entry\\u0001Warehouse Type":[""],"Stock Ledger Entry\\u0001Company":[""],"Stock Ledger Entry\\u0001Is Cancelled":[""],"Stock Ledger Entry\\u0001Is Stock Entry":[""]}',
|
||||
'module': u'Stock',
|
||||
'name': '__common__',
|
||||
'page_len': 50,
|
||||
'sort_by': u'`tabStock Ledger Entry`.`item_code`',
|
||||
'sort_order': u'DESC',
|
||||
'standard': u'Yes'
|
||||
},
|
||||
|
||||
|
@ -1,213 +0,0 @@
|
||||
# DocType, ToDo
|
||||
[
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:47',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:47',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
|
||||
# These values are common for all DocType
|
||||
{
|
||||
'allow_attach': 0,
|
||||
'allow_copy': 0,
|
||||
'allow_email': 0,
|
||||
'allow_print': 0,
|
||||
'allow_rename': 0,
|
||||
'allow_trash': 0,
|
||||
'autoname': u'TDI.########',
|
||||
'colour': u'White:FFF',
|
||||
'doctype': 'DocType',
|
||||
'hide_heading': 0,
|
||||
'hide_toolbar': 0,
|
||||
'in_create': 1,
|
||||
'in_dialog': 0,
|
||||
'is_transaction_doc': 0,
|
||||
'issingle': 0,
|
||||
'max_attachments': 0,
|
||||
'module': u'Utilities',
|
||||
'name': '__common__',
|
||||
'read_only': 1,
|
||||
'read_only_onload': 0,
|
||||
'section_style': u'Simple',
|
||||
'server_code_error': u' ',
|
||||
'show_in_menu': 0,
|
||||
'use_template': 0,
|
||||
'version': 5
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'name': '__common__',
|
||||
'parent': u'ToDo',
|
||||
'parentfield': u'fields',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
# These values are common for all DocPerm
|
||||
{
|
||||
'create': 1,
|
||||
'doctype': u'DocPerm',
|
||||
'name': '__common__',
|
||||
'parent': u'ToDo',
|
||||
'parentfield': u'permissions',
|
||||
'parenttype': u'DocType',
|
||||
'permlevel': 0,
|
||||
'read': 1,
|
||||
'role': u'All',
|
||||
'write': 1
|
||||
},
|
||||
|
||||
# DocType, ToDo
|
||||
{
|
||||
'doctype': 'DocType',
|
||||
'name': u'ToDo'
|
||||
},
|
||||
|
||||
# DocPerm
|
||||
{
|
||||
'doctype': u'DocPerm'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'description',
|
||||
'fieldtype': u'Text',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Description',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'description',
|
||||
'oldfieldtype': u'Text',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0,
|
||||
'width': u'300px'
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'date',
|
||||
'fieldtype': u'Date',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Date',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'date',
|
||||
'oldfieldtype': u'Date',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'priority',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Priority',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'priority',
|
||||
'oldfieldtype': u'Data',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'reference_type',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Reference Type',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'reference_type',
|
||||
'oldfieldtype': u'Data',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'reference_name',
|
||||
'fieldtype': u'Data',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Reference Name',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'reference_name',
|
||||
'oldfieldtype': u'Data',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'checked',
|
||||
'fieldtype': u'Check',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Checked',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'checked',
|
||||
'oldfieldtype': u'Check',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'allow_on_submit': 0,
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'role',
|
||||
'fieldtype': u'Link',
|
||||
'hidden': 0,
|
||||
'in_filter': 0,
|
||||
'label': u'Role',
|
||||
'no_copy': 0,
|
||||
'oldfieldname': u'role',
|
||||
'oldfieldtype': u'Link',
|
||||
'options': u'Role',
|
||||
'print_hide': 0,
|
||||
'report_hide': 0,
|
||||
'reqd': 0,
|
||||
'search_index': 0
|
||||
},
|
||||
|
||||
# DocField
|
||||
{
|
||||
'doctype': u'DocField',
|
||||
'fieldname': u'assigned_by',
|
||||
'fieldtype': u'Link',
|
||||
'label': u'Assigned By',
|
||||
'options': u'Profile'
|
||||
}
|
||||
]
|
@ -83,15 +83,7 @@ def update_security(args=''):
|
||||
webnotes.conn.set_value('Profile', args['user'], 'enabled', int(args.get('enabled',0)) or 0)
|
||||
|
||||
if args.get('new_password') and args.get('sys_admin_pwd'):
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
import server_tools.gateway_utils
|
||||
res = server_tools.gateway_utils.change_password('', args['new_password'],
|
||||
args['user'], args['sys_admin_pwd'])
|
||||
if 'Traceback' not in res['message']:
|
||||
webnotes.msgprint(res['message'])
|
||||
webnotes.conn.sql("update tabProfile set password=password(%s) where name=%s",
|
||||
(args['new_password'], args['user']))
|
||||
else:
|
||||
@ -106,14 +98,6 @@ def update_security(args=''):
|
||||
@webnotes.whitelist()
|
||||
def add_user(args):
|
||||
args = json.loads(args)
|
||||
# erpnext-saas
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import add_user_gateway
|
||||
add_user_gateway(args)
|
||||
|
||||
add_profile(args)
|
||||
|
||||
@webnotes.whitelist()
|
||||
@ -174,14 +158,6 @@ def delete(arg=None):
|
||||
"""delete user"""
|
||||
webnotes.conn.sql("update tabProfile set enabled=0, docstatus=2 where name=%s",
|
||||
webnotes.form_dict['uid'])
|
||||
# erpnext-saas
|
||||
import webnotes.defs
|
||||
from webnotes.utils import cint
|
||||
if hasattr(webnotes.defs, 'sync_with_gateway') and \
|
||||
cint(webnotes.defs.sync_with_gateway) or 0:
|
||||
from server_tools.gateway_utils import remove_user_gateway
|
||||
remove_user_gateway(webnotes.form_dict['uid'])
|
||||
|
||||
webnotes.login_manager.logout(user=webnotes.form_dict['uid'])
|
||||
|
||||
welcome_txt = """
|
||||
|
@ -3,9 +3,9 @@
|
||||
|
||||
# These values are common in all dictionaries
|
||||
{
|
||||
'creation': '2012-03-27 14:36:48',
|
||||
'creation': '2012-04-02 16:02:43',
|
||||
'docstatus': 0,
|
||||
'modified': '2012-03-27 14:36:48',
|
||||
'modified': '2012-04-16 13:36:48',
|
||||
'modified_by': u'Administrator',
|
||||
'owner': u'Administrator'
|
||||
},
|
||||
@ -23,7 +23,7 @@
|
||||
'name': '__common__',
|
||||
'section_style': u'Simple',
|
||||
'show_in_menu': 0,
|
||||
'version': 18
|
||||
'version': 19
|
||||
},
|
||||
|
||||
# These values are common for all DocField
|
||||
@ -95,7 +95,7 @@
|
||||
'fieldname': u'font',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Font',
|
||||
'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
|
||||
'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
@ -115,7 +115,7 @@
|
||||
'fieldname': u'heading_font',
|
||||
'fieldtype': u'Select',
|
||||
'label': u'Heading Font',
|
||||
'options': u'\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
|
||||
'options': u'\nHelvetica Neue\nLucida Grande\nVerdana\nArial\nGeorgia\nTahoma\nLato\nOpen Sans',
|
||||
'permlevel': 0
|
||||
},
|
||||
|
||||
@ -153,4 +153,4 @@
|
||||
'permlevel': 0,
|
||||
'print_hide': 1
|
||||
}
|
||||
]
|
||||
]
|
41
index.cgi
41
index.cgi
@ -1,33 +1,42 @@
|
||||
#!/usr/bin/python
|
||||
#!/usr/bin/env python
|
||||
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
# Copyright (c) 2012 Web Notes Technologies Pvt Ltd (http://erpnext.com)
|
||||
#
|
||||
# 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.
|
||||
# MIT License (MIT)
|
||||
#
|
||||
# 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.
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
# INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
# PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
||||
# CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
import cgi, cgitb, os, sys
|
||||
cgitb.enable()
|
||||
|
||||
# import libs
|
||||
sys.path.append('.')
|
||||
|
||||
import conf
|
||||
|
||||
sys.path.append('lib/py')
|
||||
sys.path.append('erpnext')
|
||||
sys.path.append(conf.modules_path)
|
||||
|
||||
import webnotes
|
||||
import webnotes.handler
|
||||
import webnotes.auth
|
||||
import webnotes.defs
|
||||
|
||||
def init():
|
||||
# make the form_dict
|
||||
@ -42,7 +51,7 @@ def init():
|
||||
except webnotes.AuthenticationError, e:
|
||||
return True
|
||||
except webnotes.UnknownDomainError, e:
|
||||
print "Location: " + (webnotes.defs.redirect_404)
|
||||
print "Location: " + (conf.redirect_404)
|
||||
except webnotes.SessionStopped, e:
|
||||
if 'cmd' in webnotes.form_dict:
|
||||
webnotes.handler.print_json()
|
||||
|
151
js/all-app.js
151
js/all-app.js
@ -188,7 +188,7 @@ $(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/tools.js
|
||||
*/
|
||||
@ -236,11 +236,13 @@ throw new SyntaxError('JSON.parse');};}}());
|
||||
/*
|
||||
* lib/js/wn/router.js
|
||||
*/
|
||||
wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
|
||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
|
||||
/*
|
||||
@ -262,7 +264,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div style="margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
|
||||
</div>\
|
||||
<div style="display:inline-block; width: 24px; margin-left: 4px">\
|
||||
@ -288,15 +290,16 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
||||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){wn.views.formview.create(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
this.onrun=a0;if(a0&&a0.callback)
|
||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
|
||||
if(this.args)
|
||||
$.extend(args,this.args)
|
||||
if(this.get_args){$.extend(args,this.get_args());}
|
||||
if(this.get_args){$.extend(args,this.get_args(opts));}
|
||||
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
|
||||
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
|
||||
this.start+=m;if(values.length>=this.page_length)
|
||||
@ -352,7 +355,7 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span clas
|
||||
/*
|
||||
* lib/js/wn/views/doclistview.js
|
||||
*/
|
||||
wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
|
||||
wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(r){if(r&&r['403'])return;var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
|
||||
document.title=page.doclistview.label;wn.container.change_to(pagename);})}
|
||||
wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doctype=doctype;this.$page=$(page);this.label=get_doctype_label(doctype);this.label=(this.label.toLowerCase().substr(-4)=='list')?this.label:(this.label+' List');this.make_page();this.setup();},make_page:function(){var me=this;this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="appframe-area"></div>\
|
||||
@ -424,21 +427,30 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da
|
||||
/*
|
||||
* lib/js/wn/views/pageview.js
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){wn.views.pageview.with_page(name,function(){if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){if(!name)name=wn.boot.home_page;wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
<p>Sorry we were unable to find what you were looking for.</p>\
|
||||
<p><a href="#">Go back to home</a></p>\
|
||||
</div>').toggle(false);};wn.views.make_403=function(){var page=wn.container.add_page('403');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Permitted</h1><br>\
|
||||
<p>Sorry you are not permitted to view this page.</p>\
|
||||
<p><a href="#">Go back to home</a></p>\
|
||||
</div>').toggle(false);};
|
||||
/*
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})}}
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})},create:function(dt){var new_name=LocalDB.create(dt);wn.set_route('Form',dt,new_name);}}
|
||||
/*
|
||||
* lib/js/wn/views/reportview.js
|
||||
*/
|
||||
wn.views.reportview={show:function(dt,rep_name){wn.require('lib/js/legacy/report.compressed.js');dt=get_label_doctype(dt);if(!_r.rb_con){_r.rb_con=new _r.ReportContainer();}
|
||||
_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if(onload)
|
||||
onload(rb);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
|
||||
_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
|
||||
rb.dt.run();}
|
||||
if(!rb.forbidden){wn.container.change_to('Report Builder');}});}}
|
||||
/*
|
||||
@ -446,9 +458,10 @@ if(!rb.forbidden){wn.container.change_to('Report Builder');}});}}
|
||||
*/
|
||||
wn.provide('wn.request');wn.request.url='index.cgi';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
|
||||
throw"Incomplete Request";}}
|
||||
wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){msgprint('Session expired');setTimeout('redirect_to_login()',3000);return;}
|
||||
wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){msgprint('Session expired');setTimeout('wn.app.redirect_to_login()',3000);return;}
|
||||
if(r.server_messages)msgprint(r.server_messages)
|
||||
if(r.exc){errprint(r.exc);console.log(r.exc);};if(r.docs)LocalDB.sync(r.docs);}
|
||||
if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');}
|
||||
if(r.docs)LocalDB.sync(r.docs);}
|
||||
wn.request.call=function(opts){wn.request.prepare(opts);$.ajax({url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
|
||||
if(opts.error)opts.error(xhr)}})}
|
||||
wn.call=function(opts){var args=$.extend({},opts.args)
|
||||
@ -458,14 +471,14 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
|
||||
/*
|
||||
* lib/js/core.js
|
||||
*/
|
||||
if(!console){var console={log:function(txt){errprint(txt);}}}
|
||||
wn.versions.check();$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});
|
||||
if(!console){var console={log:function(txt){alert(txt);}}}
|
||||
wn.versions.check();$(document).bind('ready',function(){wn.app=new wn.Application();});
|
||||
|
||||
/*
|
||||
* lib/js/legacy/globals.js
|
||||
*/
|
||||
wn.provide('wn.widgets.form');wn.provide('wn.widgets.report');wn.provide('wn.utils');wn.provide('wn.model');wn.provide('wn.profile');wn.provide('wn.session');wn.provide('_f');wn.provide('_p');wn.provide('_r');wn.provide('_c');wn.provide('_e');wn.provide('_startup_data')
|
||||
wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;
|
||||
wn.settings.no_history=1;var NEWLINE='\n';var profile=null;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;
|
||||
/*
|
||||
* lib/js/legacy/utils/datatype.js
|
||||
*/
|
||||
@ -677,7 +690,8 @@ var t=make_table(msg_dialog.rows['Msg'],1,2,'100%',['20px','250px'],{padding:'2p
|
||||
if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='lib/images/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='lib/images/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='lib/images/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);}
|
||||
m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})}
|
||||
msg_dialog.custom_onhide=callback;}
|
||||
var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
|
||||
var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
|
||||
growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
|
||||
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
|
||||
$(wrapper).hide().fadeIn(1000);}
|
||||
/*
|
||||
@ -913,14 +927,15 @@ if(f.init)f.init();f.make_body();return f;}
|
||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||
<span class="appframe-title"></span>\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').text(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
|
||||
/*
|
||||
* lib/js/wn/ui/dialog.js
|
||||
*/
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){if(!window.make_field){wn.require('lib/css/legacy/fields.css');wn.require('lib/js/legacy/widgets/form/fields.js');wn.require('lib/js/wn/ui/button.js');}
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
|
||||
f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-info');this.first_button=true;}}}
|
||||
this.get_values=function(){var ret={};var errors=[];for(var key in this.fields_dict){var f=this.fields_dict[key];var v=f.get_value?f.get_value():null;if(f.df.reqd&&!v)
|
||||
@ -931,7 +946,8 @@ this.set_value=function(key,val){var f=this.fields_dict[key];if(f){f.set_input(v
|
||||
this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}}
|
||||
this.clear=function(){for(key in this.fields_dict){var f=this.fields_dict[key];if(f){f.set_input(f.df['default']||'');}}}}
|
||||
wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts)
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
|
||||
this.wrapper=$('<div class="dialog_wrapper">').appendTo('#dialog-container').get(0);if(this.opts.width)
|
||||
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
|
||||
this.make_fields(this.body,this.opts.fields);}
|
||||
this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
|
||||
@ -942,7 +958,8 @@ $ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this
|
||||
this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;}
|
||||
this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);}
|
||||
if(opts)this.make();}
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();wn.provide('wn.ui');wn.ui.Dialog=wn.widgets.Dialog
|
||||
$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
/*
|
||||
* lib/js/wn/ui/button.js
|
||||
*/
|
||||
@ -1158,7 +1175,7 @@ function loadreport(dt,rep_name,onload){if(rep_name)
|
||||
wn.set_route('Report',dt,rep_name);else
|
||||
wn.set_route('Report',dt);}
|
||||
function loaddoc(doctype,name,onload){wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,name);}else{wn.set_route('Form',doctype,name);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,'New '+doctype);}else{wn.set_route('Form',doctype,'New '+doctype);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){var new_name=LocalDB.create(doctype);_f.edit_record(doctype,new_name);}else{wn.views.formview.create(doctype);}})}
|
||||
var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
|
||||
function loaddocbrowser(dt){wn.set_route('List',dt);}
|
||||
/*
|
||||
@ -1257,14 +1274,8 @@ var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_docli
|
||||
Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(fields[dt])var d=fields[dt][fn];if(d)return d;}
|
||||
return{};}
|
||||
Meta.set_field_property=function(fn,key,val,doc){if(!doc&&(cur_frm.doc))doc=cur_frm.doc;try{local_dt[doc.doctype][doc.name][fn][key]=val;refresh_field(fn);}catch(e){alert("Client Script Error: Unknown values for "+doc.name+','+fn+'.'+key+'='+val);}}
|
||||
function get_doctype_label(dt){if(session.dt_labels&&session.dt_labels[dt])
|
||||
return session.dt_labels[dt]
|
||||
else
|
||||
return dt}
|
||||
function get_label_doctype(label){if(session.rev_dt_labels&&session.rev_dt_labels[label])
|
||||
return session.rev_dt_labels[label]
|
||||
else
|
||||
return label}
|
||||
function get_doctype_label(dt){return dt}
|
||||
function get_label_doctype(label){return label}
|
||||
var getchildren=LocalDB.getchildren;var get_field=Meta.get_field;var createLocal=LocalDB.create;
|
||||
/*
|
||||
* lib/js/legacy/model/doclist.js
|
||||
@ -1278,8 +1289,10 @@ function expand_doclist(docs){var l=[];for(var i=0;i<docs._vl.length;i++)
|
||||
l[l.length]=zip(docs._kl[docs._vl[i][0]],docs._vl[i]);return l;}
|
||||
function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
return obj;}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
|
||||
all_clear=tmp;}}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_reqd_ok=true;if(save_action!='Cancel'){for(var n in doclist){var reqd_ok=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_reqd_ok)
|
||||
all_reqd_ok=reqd_ok;}}
|
||||
if(!all_reqd_ok){onerr()
|
||||
return;}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
@ -1343,7 +1356,7 @@ wn.ui.toolbar.Toolbar=Class.extend({init:function(){this.make();this.make_home()
|
||||
</ul>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>');},make_home:function(){$('.navbar .brand').attr('href',"#!"+home_page);},make_document:function(){wn.ui.toolbar.new_dialog=new wn.ui.toolbar.NewDialog();wn.ui.toolbar.search=new wn.ui.toolbar.Search();wn.ui.toolbar.report=new wn.ui.toolbar.Report();$('.navbar .nav:first').append('<li class="dropdown">\
|
||||
</div>');},make_home:function(){$('.navbar .brand').attr('href',"#");},make_document:function(){wn.ui.toolbar.new_dialog=new wn.ui.toolbar.NewDialog();wn.ui.toolbar.search=new wn.ui.toolbar.Search();wn.ui.toolbar.report=new wn.ui.toolbar.Report();$('.navbar .nav:first').append('<li class="dropdown">\
|
||||
<a class="dropdown-toggle" href="#" data-toggle="dropdown"\
|
||||
onclick="return false;">Document<b class="caret"></b></a>\
|
||||
<ul class="dropdown-menu" id="toolbar-document">\
|
||||
@ -1364,7 +1377,7 @@ wn.ui.toolbar.Toolbar=Class.extend({init:function(){this.make();this.make_home()
|
||||
</ul>\
|
||||
</li>');if(has_common(user_roles,['Administrator','System Manager'])){$('#toolbar-tools').append('<li><a href="#" \
|
||||
onclick="return wn.ui.toolbar.download_backup();">\
|
||||
Download Backup</a></li>');}},set_user_name:function(){var fn=user_fullname;if(fn.length>15)fn=fn.substr(0,12)+'...';$('#toolbar-user-link').html(fn+'<b class="caret"></b>');},make_logout:function(){$('#toolbar-user').append('<li><a href="#" onclick="return logout();">Logout</a></li>');}});wn.ui.toolbar.clear_cache=function(){localStorage&&localStorage.clear();$c('webnotes.session_cache.clear',{},function(r,rt){show_alert(r.message);});return false;}
|
||||
Download Backup</a></li>');}},set_user_name:function(){var fn=user_fullname;if(fn.length>15)fn=fn.substr(0,12)+'...';$('#toolbar-user-link').html(fn+'<b class="caret"></b>');},make_logout:function(){$('#toolbar-user').append('<li><a href="#" onclick="return wn.app.logout();">Logout</a></li>');}});wn.ui.toolbar.clear_cache=function(){localStorage&&localStorage.clear();$c('webnotes.session_cache.clear',{},function(r,rt){show_alert(r.message);});return false;}
|
||||
wn.ui.toolbar.download_backup=function(){$c('webnotes.utils.backups.get_backup',{},function(r,rt){});return false;}
|
||||
wn.ui.toolbar.show_about=function(){try{wn.require('lib/js/wn/misc/about.js');wn.ui.misc.about();}catch(e){console.log(e);}
|
||||
return false;}
|
||||
@ -1647,7 +1660,7 @@ c.appendChild(this.print_sel);c.cur_sel=this.print_sel;_e.dialog.widgets['Send W
|
||||
_e.dialog.widgets['Subject'].value=get_doctype_label(this.meta.name)+': '+this.docname;_e.dialog.show();}
|
||||
_f.Frm.prototype.rename_notify=function(dt,old,name){this.is_editable[name]=this.is_editable[old];delete this.is_editable[old];if(this.docname==old)
|
||||
this.docname=name;if(this&&this.opendocs[old]){local_dt[dt][name]=local_dt[dt][old];local_dt[dt][old]=null;}
|
||||
delete this.opendocs[old];this.opendocs[name]=true;}
|
||||
delete this.opendocs[old];this.opendocs[name]=true;wn.re_route[window.location.hash]='Form/'+encodeURIComponent(this.doctype)+'/'+encodeURIComponent(name);wn.set_route('Form',this.doctype,name);}
|
||||
_f.Frm.prototype.setup_meta=function(){this.meta=get_local('DocType',this.doctype);this.perm=get_perm(this.doctype);if(this.meta.istable){this.meta.in_dialog=1}
|
||||
this.setup_print();}
|
||||
_f.Frm.prototype.setup_sidebar=function(){this.sidebar=new wn.widgets.form.sidebar.Sidebar(this);}
|
||||
@ -1750,7 +1763,7 @@ this.copy_doc(fn,1);}
|
||||
_f.get_value=function(dt,dn,fn){if(locals[dt]&&locals[dt][dn])
|
||||
return locals[dt][dn][fn];}
|
||||
_f.set_value=function(dt,dn,fn,v){var d=locals[dt][dn];if(!d){console.log('_f.set_value - '+fn+': "'+dt+','+dn+'" not found');return;}
|
||||
var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))changed=0;if(changed){d[fn]=v;d.__unsaved=1;if(d.parent&&d.parenttype){locals[d.parenttype][d.parent].__unsaved=1;var frm=wn.views.formview[d.parenttype].frm;}else{locals[d.doctype][d.name].__unsaved=1;var frm=wn.views.formview[d.doctype].frm;}
|
||||
var changed=d[fn]!=v;if(changed&&(d[fn]==null||v==null)&&(cstr(d[fn])==cstr(v)))changed=0;if(changed){d[fn]=v;d.__unsaved=1;if(d.parent&&d.parenttype){locals[d.parenttype][d.parent].__unsaved=1;var frm=wn.views.formview[d.parenttype].frm;}else{locals[d.doctype][d.name].__unsaved=1;var frm=wn.views.formview[d.doctype]&&wn.views.formview[d.doctype].frm;}
|
||||
if(frm&&frm==cur_frm&&frm.frm_head){frm.frm_head.refresh_labels();}}}
|
||||
_f.Frm.prototype.show_comments=function(){if(!cur_frm.comments){cur_frm.comments=new Dialog(540,400,'Comments');cur_frm.comments.comment_body=$a(cur_frm.comments.body,'div','dialog_frm');$y(cur_frm.comments.body,{backgroundColor:'#EEE'});cur_frm.comments.list=new CommentList(cur_frm.comments.comment_body);}
|
||||
cur_frm.comments.list.dt=cur_frm.doctype;cur_frm.comments.list.dn=cur_frm.docname;cur_frm.comments.show();cur_frm.comments.list.run();}
|
||||
@ -1909,6 +1922,15 @@ if(swap_row){var cidx=_f.cur_grid_cell.cellIndex;this.cell_deselect();var aidx=l
|
||||
/*
|
||||
* lib/js/legacy/widgets/form/print_format.js
|
||||
*/
|
||||
_p.def_print_style_body="html, body, div, span, td { font-family: Arial, Helvetica; font-size: 12px; }"+"\npre { margin:0; padding:0;}"
|
||||
_p.def_print_style_other="\n.simpletable, .noborder { border-collapse: collapse; margin-bottom: 10px;}"
|
||||
+"\n.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }"
|
||||
+"\n.noborder td { vertical-align: top; }"
|
||||
_p.go=function(html){var d=document.createElement('div')
|
||||
d.innerHTML=html
|
||||
$(d).printElement();}
|
||||
_p.preview=function(html){var w=window.open('');w.document.write(html)
|
||||
w.document.close();}
|
||||
$.extend(_p,{show_dialog:function(){if(!_p.dialog){_p.make_dialog();}
|
||||
_p.dialog.show();},make_dialog:function(){var d=new Dialog(360,140,'Print Formats',[['HTML','Select'],['Check','No Letterhead'],['HTML','Buttons']]);$btn(d.widgets.Buttons,'Print',function(){_p.build(sel_val(cur_frm.print_sel),_p.go,d.widgets['No Letterhead'].checked);},{cssFloat:'right',marginBottom:'16px',marginLeft:'7px'},'green');$btn(d.widgets.Buttons,'Preview',function(){_p.build(sel_val(cur_frm.print_sel),_p.preview,d.widgets['No Letterhead'].checked);},{cssFloat:'right',marginBottom:'16px'},'');d.onshow=function(){var c=_p.dialog.widgets['Select'];if(c.cur_sel&&c.cur_sel.parentNode==c){c.removeChild(c.cur_sel);}
|
||||
c.appendChild(cur_frm.print_sel);c.cur_sel=cur_frm.print_sel;}
|
||||
@ -1942,7 +1964,7 @@ jslist=container.getElementsByTagName('script');}},show_letterhead:function(cont
|
||||
var finished=header
|
||||
+stat
|
||||
+container.innerHTML.replace(/<div/g,'\n<div').replace(/<td/g,'\n<td')
|
||||
+footer;return finished;},get_letter_head:function(){var cp=wn.control_panel;var lh='';if(cur_frm.doc.letter_head){lh=cstr(_p.letter_heads[cur_frm.doc.letter_head]);}else if(cp.letter_head){lh=cp.letter_head;}
|
||||
+footer;return finished;},get_letter_head:function(){var cp=wn.control_panel;var lh='';if(cur_frm.doc.letter_head){lh=cstr(wn.boot.letter_heads[cur_frm.doc.letter_head]);}else if(cp.letter_head){lh=cp.letter_head;}
|
||||
return lh;},print_style:"\
|
||||
.datalabelcell { \
|
||||
padding: 2px 0px; \
|
||||
@ -2120,57 +2142,28 @@ for(var i=0;i<d.length;i++){$(this.body).append(repl('<div>%(owner)s \
|
||||
$(this.body).find('a.close').click(function(){$c('webnotes.widgets.form.assign_to.remove',{doctype:me.doctype,name:me.name,assign_to:$(this).attr('data-owner')},function(r,rt){me.render(r.message);});return false;});},add:function(){var me=this;if(!me.dialog){me.dialog=new wn.widgets.Dialog({title:'Add to To Do',width:350,fields:[{fieldtype:'Link',fieldname:'assign_to',options:'Profile',label:'Assign To',description:'Add to To Do List of',reqd:true},{fieldtype:'Data',fieldname:'description',label:'Comment'},{fieldtype:'Date',fieldname:'date',label:'Complete By'},{fieldtype:'Select',fieldname:'priority',label:'Priority',options:'Low\nMedium\nHigh','default':'Medium'},{fieldtype:'Check',fieldname:'notify',label:'Notify By Email'},{fieldtype:'Button',label:'Add',fieldname:'add_btn'}]});me.dialog.fields_dict.add_btn.input.onclick=function(){var assign_to=me.dialog.fields_dict.assign_to.get_value();if(assign_to){$c('webnotes.widgets.form.assign_to.add',{doctype:me.doctype,name:me.name,assign_to:assign_to,description:me.dialog.fields_dict.description.get_value(),priority:me.dialog.fields_dict.priority.get_value(),date:me.dialog.fields_dict.date.get_value(),notify:me.dialog.fields_dict.notify.get_value()},function(r,rt){me.render(r.message);});}}}
|
||||
me.dialog.clear();me.dialog.show();}});
|
||||
/*
|
||||
* lib/js/legacy/app.js
|
||||
* lib/js/wn/app.js
|
||||
*/
|
||||
var popup_cont;var session={};if(!wn)var wn={};function startup(){popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
|
||||
if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;}
|
||||
wn.control_panel=r.control_panel;}
|
||||
var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Guest')
|
||||
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
|
||||
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
|
||||
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
|
||||
var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);}
|
||||
wn.route();$dh('startup_div');$ds('body_div');}
|
||||
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
|
||||
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
|
||||
wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.user=wn.boot.profile.name;wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
console.log(wn.boot.error_messages)
|
||||
if(wn.boot.server_messages)
|
||||
msgprint(wn.boot.server_messages);}else{if($i('startup_div'))
|
||||
$c('startup',{},callback,null,1);}}
|
||||
function to_open(){if(get_url_arg('page'))
|
||||
return get_url_arg('page');var h=location.hash;if(h){return h.substr(1);}}
|
||||
function logout(){$c('logout',args={},function(r,rt){if(r.exc){msgprint(r.exc);return;}
|
||||
redirect_to_login();});}
|
||||
function redirect_to_login(){if(login_file)
|
||||
window.location.href=login_file;else{window.location.reload();}}
|
||||
_p.def_print_style_body="html, body, div, span, td { font-family: Arial, Helvetica; font-size: 12px; }"+"\npre { margin:0; padding:0;}"
|
||||
_p.def_print_style_other="\n.simpletable, .noborder { border-collapse: collapse; margin-bottom: 10px;}"
|
||||
+"\n.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }"
|
||||
+"\n.noborder td { vertical-align: top; }"
|
||||
_p.go=function(html){var d=document.createElement('div')
|
||||
d.innerHTML=html
|
||||
$(d).printElement();}
|
||||
_p.preview=function(html){var w=window.open('');w.document.write(html)
|
||||
w.document.close();}
|
||||
var resize_observers=[]
|
||||
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
|
||||
window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
|
||||
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;return ht;}
|
||||
function set_favicon(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
|
||||
<link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
|
||||
<link rel="icon" href="'+link+'" type="image/x-icon">'
|
||||
$(favicon).appendTo('head');}
|
||||
msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
|
||||
me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
|
||||
<link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
|
||||
<link rel="icon" href="'+link+'" type="image/x-icon">'
|
||||
$(favicon).appendTo('head');}})
|
||||
/*
|
||||
* js/app.js
|
||||
*/
|
||||
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
|
||||
wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
|
||||
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
|
||||
<i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
|
||||
/*
|
||||
* erpnext/startup/startup.js
|
||||
*/
|
||||
var current_module;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)
|
||||
erpnext.startup.set_globals=function(){wn.control_panel.sync_with_gateway=wn.boot.sync_with_gateway
|
||||
pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
|
||||
if(inList(user_roles,'System Manager'))is_system_manager=1;}
|
||||
erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);}
|
||||
if(user=='Guest'){if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
|
||||
|
143
js/all-web.js
143
js/all-web.js
@ -75,7 +75,7 @@ $(ele).css('-box-shadow','0px 0px '+spread+'px rgba(0,0,0,0.3);')}
|
||||
/*
|
||||
* lib/js/wn/model.js
|
||||
*/
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{if(name&&name.indexOf('New '+doctype)!=-1){name=LocalDB.create(doctype);callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
wn.provide('wn.model');wn.model={no_value_type:['Section Break','Column Break','HTML','Table','Button','Image'],new_names:{},with_doctype:function(doctype,callback){if(locals.DocType[doctype]){callback();}else{wn.call({method:'webnotes.widgets.form.load.getdoctype',args:{doctype:doctype},callback:callback});}},with_doc:function(doctype,name,callback){if(!name)name=doctype;if(locals[doctype]&&locals[doctype][name]){callback(name);}else{wn.call({method:'webnotes.widgets.form.load.getdoc',args:{doctype:doctype,name:name},callback:function(r){callback(name);}});}},can_delete:function(doctype){if(!doctype)return false;return locals.DocType[doctype].allow_trash&&wn.boot.profile.can_cancel.indexOf(doctype)!=-1;}}
|
||||
/*
|
||||
* lib/js/wn/misc/tools.js
|
||||
*/
|
||||
@ -123,11 +123,13 @@ throw new SyntaxError('JSON.parse');};}}());
|
||||
/*
|
||||
* lib/js/wn/router.js
|
||||
*/
|
||||
wn.route=function(){wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.re_route={}
|
||||
wn.route=function(){if(wn.re_route[window.location.hash]){window.location.hash=wn.re_route[window.location.hash];}
|
||||
wn._cur_route=window.location.hash;route=wn.get_route();switch(route[0]){case"List":wn.views.doclistview.show(route[1]);break;case"Form":if(route.length>3){route[2]=route.splice(2).join('/');}
|
||||
wn.views.formview.show(route[1],route[2]);break;case"Report":wn.views.reportview.show(route[1],route[2]);break;default:wn.views.pageview.show(route[0]);}}
|
||||
wn.get_route=function(route){if(!route)
|
||||
route=window.location.hash;if(route.substr(0,1)=='#')route=route.substr(1);if(route.substr(0,1)=='!')route=route.substr(1);return $.map(route.split('/'),function(r){return decodeURIComponent(r);});}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;set_favicon();}
|
||||
wn.set_route=function(){route=$.map(arguments,function(a){return encodeURIComponent(a)}).join('/');window.location.hash=route;wn.app.set_favicon();}
|
||||
wn._cur_route=null;$(window).bind('hashchange',function(){if(location.hash==wn._cur_route)
|
||||
return;wn.route();if(wn.boot.analytics_code){try{eval(wn.boot.analytics_code);}catch(e){console.log(e);}}});
|
||||
/*
|
||||
@ -149,7 +151,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div style="margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
|
||||
</div>\
|
||||
<div style="display:inline-block; width: 24px; margin-left: 4px">\
|
||||
@ -175,15 +177,16 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
||||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){wn.views.formview.create(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
this.onrun=a0;if(a0&&a0.callback)
|
||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
|
||||
if(this.args)
|
||||
$.extend(args,this.args)
|
||||
if(this.get_args){$.extend(args,this.get_args());}
|
||||
if(this.get_args){$.extend(args,this.get_args(opts));}
|
||||
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
|
||||
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
|
||||
this.start+=m;if(values.length>=this.page_length)
|
||||
@ -239,7 +242,7 @@ wn.views.add_list_btn=function(parent,doctype){$(parent).append(repl('<span clas
|
||||
/*
|
||||
* lib/js/wn/views/doclistview.js
|
||||
*/
|
||||
wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
|
||||
wn.provide('wn.views.doclistview');wn.provide('wn.doclistviews');wn.views.doclistview.pages={};wn.views.doclistview.show=function(doctype){var pagename=doctype+' List';var doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(r){if(r&&r['403'])return;var page=wn.views.doclistview.pages[pagename];if(!page){var page=wn.container.add_page(pagename);page.doclistview=new wn.views.DocListView(doctype,page);wn.views.doclistview.pages[pagename]=page;}
|
||||
document.title=page.doclistview.label;wn.container.change_to(pagename);})}
|
||||
wn.views.DocListView=wn.ui.Listing.extend({init:function(doctype,page){this.doctype=doctype;this.$page=$(page);this.label=get_doctype_label(doctype);this.label=(this.label.toLowerCase().substr(-4)=='list')?this.label:(this.label+' List');this.make_page();this.setup();},make_page:function(){var me=this;this.$page.html(repl('<div class="layout-wrapper layout-wrapper-background">\
|
||||
<div class="appframe-area"></div>\
|
||||
@ -311,21 +314,30 @@ if(data.docstatus==0||data.docstatus==null){data.docstatus_icon='icon-pencil';da
|
||||
/*
|
||||
* lib/js/wn/views/pageview.js
|
||||
*/
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){wn.views.pageview.with_page(name,function(){if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.provide('wn.views.pageview');wn.views.pageview={pages:{},with_page:function(name,callback){if(!locals.Page[name]){wn.call({method:'webnotes.widgets.page.getpage',args:{'name':name},callback:callback});}else{callback();}},show:function(name){if(!name)name=wn.boot.home_page;wn.views.pageview.with_page(name,function(r){if(r&&r.exc){if(!r['403'])wn.container.change_to('404');}else if(!wn.pages[name]){wn.views.pageview.pages[name]=new wn.views.Page(name);}
|
||||
wn.container.change_to(name);});}}
|
||||
wn.views.Page=Class.extend({init:function(name){this.name=name;var me=this;this.pagedoc=locals.Page[this.name];this.wrapper=wn.container.add_page(this.name);this.wrapper.label=this.pagedoc.title||this.pagedoc.name;this.wrapper.innerHTML=this.pagedoc.content;wn.dom.eval(this.pagedoc.__script||this.pagedoc.script||'');wn.dom.set_style(this.pagedoc.style);this.trigger('onload');$(this.wrapper).bind('show',function(){cur_frm=null;me.trigger('onshow');me.trigger('refresh');});},trigger:function(eventname){var me=this;try{if(pscript[eventname+'_'+this.name]){pscript[eventname+'_'+this.name](me.wrapper);}else if(me.wrapper[eventname]){me.wrapper[eventname](me.wrapper);}}catch(e){console.log(e);}}})
|
||||
wn.views.make_404=function(){var page=wn.container.add_page('404');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Found</h1><br>\
|
||||
<p>Sorry we were unable to find what you were looking for.</p>\
|
||||
<p><a href="#">Go back to home</a></p>\
|
||||
</div>').toggle(false);};wn.views.make_403=function(){var page=wn.container.add_page('403');$(page).html('<div class="layout-wrapper">\
|
||||
<h1>Not Permitted</h1><br>\
|
||||
<p>Sorry you are not permitted to view this page.</p>\
|
||||
<p><a href="#">Go back to home</a></p>\
|
||||
</div>').toggle(false);};
|
||||
/*
|
||||
* lib/js/wn/views/formview.js
|
||||
*/
|
||||
wn.provide('wn.views.formview');wn.views.formview={show:function(dt,dn){if(wn.model.new_names[dn])
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})}}
|
||||
dn=wn.model.new_names[dn];wn.model.with_doctype(dt,function(){wn.model.with_doc(dt,dn,function(dn){if(!(locals[dt]&&locals[dt][dn])){wn.container.change_to('404');return;}
|
||||
if(!wn.views.formview[dt]){wn.views.formview[dt]=wn.container.add_page('Form - '+dt);wn.views.formview[dt].frm=new _f.Frm(dt,wn.views.formview[dt]);}
|
||||
wn.container.change_to('Form - '+dt);wn.views.formview[dt].frm.refresh(dn);});})},create:function(dt){var new_name=LocalDB.create(dt);wn.set_route('Form',dt,new_name);}}
|
||||
/*
|
||||
* lib/js/wn/views/reportview.js
|
||||
*/
|
||||
wn.views.reportview={show:function(dt,rep_name){wn.require('lib/js/legacy/report.compressed.js');dt=get_label_doctype(dt);if(!_r.rb_con){_r.rb_con=new _r.ReportContainer();}
|
||||
_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if(onload)
|
||||
onload(rb);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
|
||||
_r.rb_con.set_dt(dt,function(rb){if(rep_name){var t=rb.current_loaded;rb.load_criteria(rep_name);if((rb.dt)&&(!rb.dt.has_data()||rb.current_loaded!=t))
|
||||
rb.dt.run();}
|
||||
if(!rb.forbidden){wn.container.change_to('Report Builder');}});}}
|
||||
/*
|
||||
@ -333,9 +345,10 @@ if(!rb.forbidden){wn.container.change_to('Report Builder');}});}}
|
||||
*/
|
||||
wn.provide('wn.request');wn.request.url='index.cgi';wn.request.prepare=function(opts){if(opts.btn)$(opts.btn).set_working();if(opts.show_spinner)set_loading();if(opts.freeze)freeze();if(!opts.args.cmd){console.log(opts)
|
||||
throw"Incomplete Request";}}
|
||||
wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){msgprint('Session expired');setTimeout('redirect_to_login()',3000);return;}
|
||||
wn.request.cleanup=function(opts,r){if(opts.btn)$(opts.btn).done_working();if(opts.show_spinner)hide_loading();if(opts.freeze)unfreeze();if(wn.boot.sid&&wn.get_cookie('sid')!=wn.boot.sid){msgprint('Session expired');setTimeout('wn.app.redirect_to_login()',3000);return;}
|
||||
if(r.server_messages)msgprint(r.server_messages)
|
||||
if(r.exc){errprint(r.exc);console.log(r.exc);};if(r.docs)LocalDB.sync(r.docs);}
|
||||
if(r.exc){console.log(r.exc);};if(r['403']){wn.container.change_to('403');}
|
||||
if(r.docs)LocalDB.sync(r.docs);}
|
||||
wn.request.call=function(opts){wn.request.prepare(opts);$.ajax({url:opts.url||wn.request.url,data:opts.args,type:opts.type||'POST',dataType:opts.dataType||'json',success:function(r,xhr){wn.request.cleanup(opts,r);opts.success(r,xhr.responseText);},error:function(xhr,textStatus){wn.request.cleanup(opts,{});show_alert('Unable to complete request: '+textStatus)
|
||||
if(opts.error)opts.error(xhr)}})}
|
||||
wn.call=function(opts){var args=$.extend({},opts.args)
|
||||
@ -345,14 +358,14 @@ wn.request.call({args:args,success:opts.callback,error:opts.error,btn:opts.btn,f
|
||||
/*
|
||||
* lib/js/core.js
|
||||
*/
|
||||
if(!console){var console={log:function(txt){errprint(txt);}}}
|
||||
wn.versions.check();$(document).bind('ready',function(){var base=window.location.href.split('#')[0];$.each($('a[softlink!="false"]'),function(i,v){if(v.href.substr(0,base.length)==base){var path=(v.href.substr(base.length));if(path.substr(0,1)!='#'){v.href=base+'#'+path;}}});if(!wn.settings.no_history&&window.location.hash){wn.page.set(window.location.hash.substr(1));}});
|
||||
if(!console){var console={log:function(txt){alert(txt);}}}
|
||||
wn.versions.check();$(document).bind('ready',function(){wn.app=new wn.Application();});
|
||||
|
||||
/*
|
||||
* lib/js/legacy/globals.js
|
||||
*/
|
||||
wn.provide('wn.widgets.form');wn.provide('wn.widgets.report');wn.provide('wn.utils');wn.provide('wn.model');wn.provide('wn.profile');wn.provide('wn.session');wn.provide('_f');wn.provide('_p');wn.provide('_r');wn.provide('_c');wn.provide('_e');wn.provide('_startup_data')
|
||||
wn.settings.no_history=1;var NEWLINE='\n';var login_file='';var version='v170';var profile=null;var session={};var is_testing=false;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var home_page=null;var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;
|
||||
wn.settings.no_history=1;var NEWLINE='\n';var profile=null;var user=null;var user_defaults=null;var user_roles=null;var user_fullname=null;var user_email=null;var user_img={};var pscript={};var selector=null;var top_index=91;var _f={};var _p={};var _e={};var _r={};var FILTER_SEP='\1';var frms={};var cur_frm=null;var pscript={};var validated=true;var validation_message='';var tinymce_loaded=null;
|
||||
/*
|
||||
* lib/js/legacy/utils/datatype.js
|
||||
*/
|
||||
@ -564,7 +577,8 @@ var t=make_table(msg_dialog.rows['Msg'],1,2,'100%',['20px','250px'],{padding:'2p
|
||||
if(!msg_dialog.display)msg_dialog.show();var has_msg=msg_dialog.msg_area.innerHTML?1:0;var m=$a(msg_dialog.msg_area,'div','');if(has_msg)$y(m,{marginTop:'4px'});$dh(msg_dialog.msg_icon);if(msg.substr(0,6).toLowerCase()=='error:'){msg_dialog.msg_icon.src='lib/images/icons/error.gif';$di(msg_dialog.msg_icon);msg=msg.substr(6);}else if(msg.substr(0,8).toLowerCase()=='message:'){msg_dialog.msg_icon.src='lib/images/icons/application.gif';$di(msg_dialog.msg_icon);msg=msg.substr(8);}else if(msg.substr(0,3).toLowerCase()=='ok:'){msg_dialog.msg_icon.src='lib/images/icons/accept.gif';$di(msg_dialog.msg_icon);msg=msg.substr(3);}
|
||||
m.innerHTML=replace_newlines(msg);if(m.offsetHeight>200){$y(m,{height:'200px',width:'400px',overflow:'auto'})}
|
||||
msg_dialog.custom_onhide=callback;}
|
||||
var growl_area;function show_alert(txt,id){if(!growl_area){growl_area=$a(popup_cont,'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
|
||||
var growl_area;function show_alert(txt,id){if(!growl_area){if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
|
||||
growl_area=$a($i('dialog-container'),'div','',{position:'fixed',bottom:'8px',right:'8px',width:'320px',zIndex:10});}
|
||||
var wrapper=$a(growl_area,'div','',{position:'relative'});var body=$a(wrapper,'div','notice');var c=$a(body,'i','icon-remove-sign',{cssFloat:'right',cursor:'pointer'});$(c).click(function(){$dh(this.wrapper)});c.wrapper=wrapper;var t=$a(body,'div','',{color:'#FFF'});$(t).html(txt);if(id){$(t).attr('id',id);}
|
||||
$(wrapper).hide().fadeIn(1000);}
|
||||
/*
|
||||
@ -573,14 +587,15 @@ $(wrapper).hide().fadeIn(1000);}
|
||||
wn.ui.AppFrame=Class.extend({init:function(parent){this.buttons={};this.$w=$('<div></div>').appendTo(parent);this.$titlebar=$('<div class="appframe-titlebar">\
|
||||
<span class="appframe-title"></span>\
|
||||
<span class="close">×</span>\
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
</div>').appendTo(this.$w);this.$w.find('.close').click(function(){window.history.back();})},title:function(txt){this.$titlebar.find('.appframe-title').text(txt);},add_button:function(label,click,icon){if(!this.$w.find('.appframe-toolbar').length)
|
||||
this.$w.append('<div class="appframe-toolbar"></div>');args={label:label,icon:''};if(icon){args.icon='<i class="'+icon+'"></i>';}
|
||||
this.buttons[label]=$(repl('<button class="btn btn-small">\
|
||||
%(icon)s %(label)s</button>',args)).click(click).appendTo(this.$w.find('.appframe-toolbar'));return this.buttons[label];},clear_buttons:function(){this.$w.find('.appframe-toolbar').empty();}})
|
||||
/*
|
||||
* lib/js/wn/ui/dialog.js
|
||||
*/
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
wn.widgets.FieldGroup=function(){this.first_button=false;this.make_fields=function(body,fl){if(!window.make_field){wn.require('lib/css/legacy/fields.css');wn.require('lib/js/legacy/widgets/form/fields.js');wn.require('lib/js/wn/ui/button.js');}
|
||||
$y(this.body,{padding:'11px'});this.fields_dict={};for(var i=0;i<fl.length;i++){var df=fl[i];var div=$a(body,'div','',{margin:'6px 0px'})
|
||||
f=make_field(df,null,div,null);f.not_in_form=1;this.fields_dict[df.fieldname]=f
|
||||
f.refresh();if(df.fieldtype=='Button'&&!this.first_button){$(f.input).addClass('btn-info');this.first_button=true;}}}
|
||||
this.get_values=function(){var ret={};var errors=[];for(var key in this.fields_dict){var f=this.fields_dict[key];var v=f.get_value?f.get_value():null;if(f.df.reqd&&!v)
|
||||
@ -591,7 +606,8 @@ this.set_value=function(key,val){var f=this.fields_dict[key];if(f){f.set_input(v
|
||||
this.set_values=function(dict){for(var key in dict){if(this.fields_dict[key]){this.set_value(key,dict[key]);}}}
|
||||
this.clear=function(){for(key in this.fields_dict){var f=this.fields_dict[key];if(f){f.set_input(f.df['default']||'');}}}}
|
||||
wn.widgets.Dialog=function(opts){this.opts=opts;this.display=false;this.make=function(opts){if(opts)
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;this.wrapper=$a(popup_cont,'div','dialog_wrapper');if(this.opts.width)
|
||||
this.opts=opts;if(!this.opts.width)this.opts.width=480;if(!$('#dialog-container').length){$('<div id="dialog-container">').appendTo('body');}
|
||||
this.wrapper=$('<div class="dialog_wrapper">').appendTo('#dialog-container').get(0);if(this.opts.width)
|
||||
this.wrapper.style.width=this.opts.width+'px';this.make_head();this.body=$a(this.wrapper,'div','dialog_body');if(this.opts.fields)
|
||||
this.make_fields(this.body,this.opts.fields);}
|
||||
this.make_head=function(){var me=this;this.appframe=new wn.ui.AppFrame(this.wrapper);this.appframe.$titlebar.find('.close').unbind('click').click(function(){if(me.oncancel)me.oncancel();me.hide();});this.set_title(this.opts.title);}
|
||||
@ -602,7 +618,8 @@ $ds(this.wrapper);freeze();this.display=true;cur_dialog=this;if(this.onshow)this
|
||||
this.hide=function(){if(this.onhide)this.onhide();unfreeze();$dh(this.wrapper);this.display=false;cur_dialog=null;}
|
||||
this.no_cancel=function(){this.appframe.$titlebar.find('.close').toggle(false);}
|
||||
if(opts)this.make();}
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
wn.widgets.Dialog.prototype=new wn.widgets.FieldGroup();wn.provide('wn.ui');wn.ui.Dialog=wn.widgets.Dialog
|
||||
$(document).bind('keydown',function(e){if(cur_dialog&&!cur_dialog.no_cancel_flag&&e.which==27){cur_dialog.hide();}});
|
||||
/*
|
||||
* lib/js/legacy/widgets/dialog.js
|
||||
*/
|
||||
@ -643,7 +660,7 @@ this.prepare_opts();$.extend(this,this.opts);$(this.parent).html(repl('\
|
||||
</div>\
|
||||
</div>\
|
||||
\
|
||||
<div style="height: 37px; margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div style="margin-bottom:9px" class="list-toolbar-wrapper">\
|
||||
<div class="list-toolbar" style="display:inline-block; margin-right: 10px;">\
|
||||
</div>\
|
||||
<div style="display:inline-block; width: 24px; margin-left: 4px">\
|
||||
@ -669,15 +686,16 @@ if(this.show_filters){this.make_filters();}},add_button:function(label,click,ico
|
||||
if(icon){$('<i>').addClass(icon).appendTo($button);}
|
||||
$button.html(label).click(click);return $button}},show_view:function($btn,$div,$btn_unsel,$div_unsel){$btn_unsel.removeClass('btn-info');$btn_unsel.find('i').removeClass('icon-white');$div_unsel.toggle(false);$btn.addClass('btn-info');$btn.find('i').addClass('icon-white');$div.toggle(true);},set_events:function(){var me=this;this.$w.find('.btn-more').click(function(){me.run({append:true});});if(this.title){this.$w.find('h3').html(this.title).toggle(true);}
|
||||
if(!(this.hide_refresh||this.no_refresh)){this.add_button('Refresh',function(){me.run();},'icon-refresh');}
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){newdoc(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
if(this.new_doctype){this.add_button('New '+this.new_doctype,function(){wn.views.formview.create(me.new_doctype)},'icon-plus');}
|
||||
if(me.show_filters){this.add_button('Show Filters',function(){me.filter_list.show_filters();},'icon-search').addClass('btn-filter');}
|
||||
if(me.no_toolbar||me.hide_toolbar){me.$w.find('.list-toolbar-wrapper').toggle(false);}},make_filters:function(){this.filter_list=new wn.ui.FilterList({listobj:this,$parent:this.$w.find('.list-filters').toggle(true),doctype:this.doctype,filter_fields:this.filter_fields});},clear:function(){this.data=[];this.$w.find('.result-list').empty();this.$w.find('.result').toggle(true);this.$w.find('.no-result').toggle(false);this.start=0;},run:function(){var me=this;var a0=arguments[0];var a1=arguments[1];if(a0&&typeof a0=='function')
|
||||
this.onrun=a0;if(a0&&a0.callback)
|
||||
this.onrun=a0.callback;if(!a1&&!(a0&&a0.append))
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
this.start=0;me.set_working(true);wn.call({method:this.opts.method||'webnotes.widgets.query_builder.runquery',args:this.get_call_args(a0),callback:function(r){me.set_working(false);me.render_results(r)},no_spinner:this.opts.no_loading});},set_working:function(flag){this.$w.find('.img-load').toggle(flag);},get_call_args:function(opts){if(!this.method){this.query=this.get_query?this.get_query():this.query;this.add_limits();var args={query_max:this.query_max,as_dict:1}
|
||||
args.simple_query=this.query;}else{var args={limit_start:this.start,limit_page_length:this.page_length}}
|
||||
if(this.args)
|
||||
$.extend(args,this.args)
|
||||
if(this.get_args){$.extend(args,this.get_args());}
|
||||
if(this.get_args){$.extend(args,this.get_args(opts));}
|
||||
return args;},render_results:function(r){if(this.start==0)this.clear();this.$w.find('.btn-more').toggle(false);if(r.message)r.values=r.message;if(r.values&&r.values.length){this.data=this.data.concat(r.values);this.render_list(r.values);}else{if(this.start==0){this.$w.find('.result').toggle(false);this.$w.find('.no-result').toggle(true);}}
|
||||
if(this.onrun)this.onrun();if(this.callback)this.callback(r);},render_list:function(values){var m=Math.min(values.length,this.page_length);for(var i=0;i<m;i++){this.render_row(this.add_row(),values[i],this,i);}
|
||||
this.start+=m;if(values.length>=this.page_length)
|
||||
@ -737,7 +755,7 @@ function loadreport(dt,rep_name,onload){if(rep_name)
|
||||
wn.set_route('Report',dt,rep_name);else
|
||||
wn.set_route('Report',dt);}
|
||||
function loaddoc(doctype,name,onload){wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,name);}else{wn.set_route('Form',doctype,name);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){_f.edit_record(doctype,'New '+doctype);}else{wn.set_route('Form',doctype,'New '+doctype);}})}
|
||||
var load_doc=loaddoc;function new_doc(doctype,onload,in_dialog,on_save_callback,cdt,cdn,cnic){doctype=get_label_doctype(doctype);wn.model.with_doctype(doctype,function(){if(locals.DocType[doctype].in_dialog){var new_name=LocalDB.create(doctype);_f.edit_record(doctype,new_name);}else{wn.views.formview.create(doctype);}})}
|
||||
var newdoc=new_doc;var pscript={};function loadpage(page_name,call_back,no_history){wn.set_route(page_name);}
|
||||
function loaddocbrowser(dt){wn.set_route('List',dt);}
|
||||
/*
|
||||
@ -797,14 +815,8 @@ var Meta={};var local_dt={};Meta.make_local_dt=function(dt,dn){var dl=make_docli
|
||||
Meta.get_field=function(dt,fn,dn){if(dn&&local_dt[dt]&&local_dt[dt][dn]){return local_dt[dt][dn][fn];}else{if(fields[dt])var d=fields[dt][fn];if(d)return d;}
|
||||
return{};}
|
||||
Meta.set_field_property=function(fn,key,val,doc){if(!doc&&(cur_frm.doc))doc=cur_frm.doc;try{local_dt[doc.doctype][doc.name][fn][key]=val;refresh_field(fn);}catch(e){alert("Client Script Error: Unknown values for "+doc.name+','+fn+'.'+key+'='+val);}}
|
||||
function get_doctype_label(dt){if(session.dt_labels&&session.dt_labels[dt])
|
||||
return session.dt_labels[dt]
|
||||
else
|
||||
return dt}
|
||||
function get_label_doctype(label){if(session.rev_dt_labels&&session.rev_dt_labels[label])
|
||||
return session.rev_dt_labels[label]
|
||||
else
|
||||
return label}
|
||||
function get_doctype_label(dt){return dt}
|
||||
function get_label_doctype(label){return label}
|
||||
var getchildren=LocalDB.getchildren;var get_field=Meta.get_field;var createLocal=LocalDB.create;
|
||||
/*
|
||||
* lib/js/legacy/model/doclist.js
|
||||
@ -818,8 +830,10 @@ function expand_doclist(docs){var l=[];for(var i=0;i<docs._vl.length;i++)
|
||||
l[l.length]=zip(docs._kl[docs._vl[i][0]],docs._vl[i]);return l;}
|
||||
function zip(k,v){var obj={};for(var i=0;i<k.length;i++){obj[k[i]]=v[i];}
|
||||
return obj;}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_clear=true;if(save_action!='Cancel'){for(var n in doclist){var tmp=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_clear)
|
||||
all_clear=tmp;}}
|
||||
function save_doclist(dt,dn,save_action,onsave,onerr){var doc=locals[dt][dn];var doctype=locals['DocType'][dt];var tmplist=[];var doclist=make_doclist(dt,dn,1);var all_reqd_ok=true;if(save_action!='Cancel'){for(var n in doclist){var reqd_ok=check_required(doclist[n].doctype,doclist[n].name,doclist[0].doctype);if(doclist[n].docstatus+''!='2'&&all_reqd_ok)
|
||||
all_reqd_ok=reqd_ok;}}
|
||||
if(!all_reqd_ok){onerr()
|
||||
return;}
|
||||
var _save=function(){$c('webnotes.widgets.form.save.savedocs',{'docs':compress_doclist(doclist),'docname':dn,'action':save_action,'user':user},function(r,rtxt){if(f){f.savingflag=false;}
|
||||
if(r.saved){if(onsave)onsave(r);}else{if(onerr)onerr(r);}},function(){if(f){f.savingflag=false;}},0,(f?'Saving...':''));}
|
||||
if(doc.__islocal&&(doctype&&doctype.autoname&&doctype.autoname.toLowerCase()=='prompt')){var newname=prompt('Enter the name of the new '+dt,'');if(newname){doc.__newname=strip(newname);_save();}else{msgprint('Not Saved');onerr();}}else{_save();}}
|
||||
@ -828,57 +842,28 @@ if(all_clear)all_clear=false;}}
|
||||
if(errfld.length)msgprint('<b>Mandatory fields required in '+
|
||||
(doc.parenttype?(fields[doc.parenttype][doc.parentfield].label+' (Table)'):get_doctype_label(doc.doctype))+':</b>\n'+errfld.join('\n'));return all_clear;}
|
||||
/*
|
||||
* lib/js/legacy/app.js
|
||||
* lib/js/wn/app.js
|
||||
*/
|
||||
var popup_cont;var session={};if(!wn)var wn={};function startup(){popup_cont=$a(document.getElementsByTagName('body')[0],'div');var setup_globals=function(r){wn.boot=r;profile=r.profile;user=r.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;home_page=r.home_page;_p.letter_heads=r.letter_heads;sys_defaults=r.sysdefaults;session.rt=profile.can_read;if(r.ipinfo)session.ipinfo=r.ipinfo;session.dt_labels=r.dt_labels;session.rev_dt_labels={}
|
||||
if(r.dt_labels){for(key in r.dt_labels)session.rev_dt_labels[r.dt_labels[key]]=key;}
|
||||
wn.control_panel=r.control_panel;}
|
||||
var setup_viewport=function(){wn.container=new wn.views.Container();if(user=='Guest')
|
||||
user_defaults.hide_webnotes_toolbar=1;if(!cint(user_defaults.hide_webnotes_toolbar)||user=='Administrator'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}
|
||||
$(document).trigger('startup');try{if(wn.control_panel.custom_startup_code)
|
||||
eval(wn.control_panel.custom_startup_code);}catch(e){errprint(e);}
|
||||
var t=to_open();if(t){window.location.hash=t;set_favicon();}else if(home_page){loadpage(home_page);}
|
||||
wn.route();$dh('startup_div');$ds('body_div');}
|
||||
var callback=function(r,rt){if(r.exc)console.log(r.exc);setup_globals(r);setup_viewport();}
|
||||
if(wn.boot){LocalDB.sync(wn.boot.docs);callback(wn.boot,'');if(wn.boot.error_messages)
|
||||
wn.Application=Class.extend({init:function(){this.load_bootinfo();this.make_page_container();this.make_nav_bar();this.set_favicon();$(document).trigger('startup');wn.route();},load_bootinfo:function(){LocalDB.sync(wn.boot.docs);wn.user=wn.boot.profile.name;wn.control_panel=wn.boot.control_panel;if(wn.boot.error_messages)
|
||||
console.log(wn.boot.error_messages)
|
||||
if(wn.boot.server_messages)
|
||||
msgprint(wn.boot.server_messages);}else{if($i('startup_div'))
|
||||
$c('startup',{},callback,null,1);}}
|
||||
function to_open(){if(get_url_arg('page'))
|
||||
return get_url_arg('page');var h=location.hash;if(h){return h.substr(1);}}
|
||||
function logout(){$c('logout',args={},function(r,rt){if(r.exc){msgprint(r.exc);return;}
|
||||
redirect_to_login();});}
|
||||
function redirect_to_login(){if(login_file)
|
||||
window.location.href=login_file;else{window.location.reload();}}
|
||||
_p.def_print_style_body="html, body, div, span, td { font-family: Arial, Helvetica; font-size: 12px; }"+"\npre { margin:0; padding:0;}"
|
||||
_p.def_print_style_other="\n.simpletable, .noborder { border-collapse: collapse; margin-bottom: 10px;}"
|
||||
+"\n.simpletable td {border: 1pt solid #000; vertical-align: top; padding: 2px; }"
|
||||
+"\n.noborder td { vertical-align: top; }"
|
||||
_p.go=function(html){var d=document.createElement('div')
|
||||
d.innerHTML=html
|
||||
$(d).printElement();}
|
||||
_p.preview=function(html){var w=window.open('');w.document.write(html)
|
||||
w.document.close();}
|
||||
var resize_observers=[]
|
||||
function set_resize_observer(fn){if(resize_observers.indexOf(fn)==-1)resize_observers.push(fn);}
|
||||
window.onresize=function(){return;var ht=get_window_height();for(var i=0;i<resize_observers.length;i++){resize_observers[i](ht);}}
|
||||
get_window_height=function(){var ht=window.innerHeight?window.innerHeight:document.documentElement.offsetHeight?document.documentElement.offsetHeight:document.body.offsetHeight;return ht;}
|
||||
function set_favicon(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
|
||||
<link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
|
||||
<link rel="icon" href="'+link+'" type="image/x-icon">'
|
||||
$(favicon).appendTo('head');}
|
||||
msgprint(wn.boot.server_messages);this.set_globals();},set_globals:function(){profile=wn.boot.profile;user=wn.boot.profile.name;user_fullname=wn.user_info(user).fullname;user_defaults=profile.defaults;user_roles=profile.roles;user_email=profile.email;sys_defaults=wn.boot.sysdefaults;},make_page_container:function(){wn.container=new wn.views.Container();wn.views.make_403();wn.views.make_404();$('#startup_div').toggle(false);$('#body_div').toggle(true);},make_nav_bar:function(){if(wn.user!='Guest'){wn.container.wntoolbar=new wn.ui.toolbar.Toolbar();}},logout:function(){var me=this;wn.call({method:'logout',callback:function(r){if(r.exc){console.log(r.exc);return;}
|
||||
me.redirect_to_login();}})},redirect_to_login:function(){window.location.hash='';window.location.reload();},set_favicon:function(){var link=$('link[type="image/x-icon"]').remove().attr("href");var favicon='\
|
||||
<link rel="shortcut icon" href="'+link+'" type="image/x-icon"> \
|
||||
<link rel="icon" href="'+link+'" type="image/x-icon">'
|
||||
$(favicon).appendTo('head');}})
|
||||
/*
|
||||
* js/app.js
|
||||
*/
|
||||
wn.app={name:'ERPNext',license:'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',source:'https://github.com/webnotes/erpnext',publisher:'Web Notes Technologies Pvt Ltd, Mumbai',copyright:'© Web Notes Technologies Pvt Ltd',version:'2.'+window._version_number}
|
||||
wn.modules_path='erpnext';wn.settings.no_history=true;$(document).bind('ready',function(){startup();});$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
|
||||
wn.modules_path='erpnext';$(document).bind('toolbar_setup',function(){$('.brand').html('<b>erp</b>next\
|
||||
<i class="icon-home icon-white navbar-icon-home" ></i>').hover(function(){$(this).find('.icon-home').addClass('navbar-icon-home-hover');},function(){$(this).find('.icon-home').removeClass('navbar-icon-home-hover');});});
|
||||
/*
|
||||
* erpnext/startup/startup.js
|
||||
*/
|
||||
var current_module;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)
|
||||
erpnext.startup.set_globals=function(){wn.control_panel.sync_with_gateway=wn.boot.sync_with_gateway
|
||||
pscript.is_erpnext_saas=cint(wn.control_panel.sync_with_gateway)
|
||||
if(inList(user_roles,'System Manager'))is_system_manager=1;}
|
||||
erpnext.startup.start=function(){$('#startup_div').html('Starting up...').toggle(true);erpnext.startup.set_globals();if(wn.boot.user_background){erpnext.set_user_background(wn.boot.user_background);}
|
||||
if(user=='Guest'){if(wn.boot.custom_css){set_style(wn.boot.custom_css);}
|
||||
|
21
js/app.js
21
js/app.js
@ -1,19 +1,3 @@
|
||||
// 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/>.
|
||||
|
||||
wn.app = {
|
||||
name: 'ERPNext',
|
||||
license: 'GNU/GPL - Usage Condition: All "erpnext" branding must be kept as it is',
|
||||
@ -24,11 +8,6 @@ wn.app = {
|
||||
}
|
||||
|
||||
wn.modules_path = 'erpnext';
|
||||
wn.settings.no_history = true;
|
||||
|
||||
$(document).bind('ready', function() {
|
||||
startup();
|
||||
});
|
||||
|
||||
$(document).bind('toolbar_setup', function() {
|
||||
$('.brand').html('<b>erp</b>next\
|
||||
|
@ -1 +0,0 @@
|
||||
1694
|
256
wnf.py
256
wnf.py
@ -1,256 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# 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/>.
|
||||
|
||||
import os, sys
|
||||
|
||||
def replace_code(start, txt1, txt2, extn, search=None):
|
||||
"""replace all txt1 by txt2 in files with extension (extn)"""
|
||||
import webnotes.utils
|
||||
import os, re
|
||||
esc = webnotes.utils.make_esc('[]')
|
||||
if not search: search = esc(txt1)
|
||||
for wt in os.walk(start, followlinks=1):
|
||||
for fn in wt[2]:
|
||||
if fn.split('.')[-1]==extn:
|
||||
fpath = os.path.join(wt[0], fn)
|
||||
if fpath != '/var/www/erpnext/erpnext/patches/jan_mar_2012/rename_dt.py': # temporary
|
||||
with open(fpath, 'r') as f:
|
||||
content = f.read()
|
||||
|
||||
if re.search(search, content):
|
||||
res = search_replace_with_prompt(fpath, txt1, txt2)
|
||||
if res == 'skip':
|
||||
return 'skip'
|
||||
|
||||
|
||||
|
||||
def search_replace_with_prompt(fpath, txt1, txt2):
|
||||
""" Search and replace all txt1 by txt2 in the file with confirmation"""
|
||||
|
||||
from termcolor import colored
|
||||
with open(fpath, 'r') as f:
|
||||
content = f.readlines()
|
||||
|
||||
tmp = []
|
||||
for c in content:
|
||||
if c.find(txt1) != -1:
|
||||
print '\n', fpath
|
||||
print colored(txt1, 'red').join(c[:-1].split(txt1))
|
||||
a = ''
|
||||
while a.lower() not in ['y', 'n', 'skip']:
|
||||
a = raw_input('Do you want to Change [y/n/skip]?')
|
||||
if a.lower() == 'y':
|
||||
c = c.replace(txt1, txt2)
|
||||
elif a.lower() == 'skip':
|
||||
return 'skip'
|
||||
tmp.append(c)
|
||||
|
||||
with open(fpath, 'w') as f:
|
||||
f.write(''.join(tmp))
|
||||
print colored('Updated', 'green')
|
||||
|
||||
|
||||
def setup_options():
|
||||
from optparse import OptionParser
|
||||
parser = OptionParser()
|
||||
|
||||
parser.add_option("-d", "--db",
|
||||
dest="db_name",
|
||||
help="Apply the patches on given db")
|
||||
|
||||
# build
|
||||
parser.add_option("-b", "--build", default=False, action="store_true",
|
||||
help="minify + concat js files")
|
||||
parser.add_option("-c", "--clear", default=False, action="store_true",
|
||||
help="increment version")
|
||||
|
||||
# git
|
||||
parser.add_option("--status", default=False, action="store_true",
|
||||
help="git status")
|
||||
parser.add_option("--pull", nargs=2, default=False,
|
||||
metavar = "remote branch",
|
||||
help="git pull (both repos)")
|
||||
parser.add_option("--push", nargs=3, default=False,
|
||||
metavar = "remote branch comment",
|
||||
help="git commit + push (both repos) [remote] [branch] [comment]")
|
||||
parser.add_option("-l", "--latest",
|
||||
action="store_true", dest="run_latest", default=False,
|
||||
help="Apply the latest patches")
|
||||
|
||||
# patch
|
||||
parser.add_option("-p", "--patch", nargs=1, dest="patch_list", metavar='patch_module',
|
||||
action="append",
|
||||
help="Apply patch")
|
||||
parser.add_option("-f", "--force",
|
||||
action="store_true", dest="force", default=False,
|
||||
help="Force Apply all patches specified using option -p or --patch")
|
||||
parser.add_option('--reload_doc', nargs=3, metavar = "module doctype docname",
|
||||
help="reload doc")
|
||||
parser.add_option('--export_doc', nargs=2, metavar = "doctype docname",
|
||||
help="export doc")
|
||||
|
||||
# install
|
||||
parser.add_option('--install', nargs=3, metavar = "rootpassword dbname source",
|
||||
help="install fresh db")
|
||||
|
||||
# diff
|
||||
parser.add_option('--diff_ref_file', nargs=0, \
|
||||
help="Get missing database records and mismatch properties, with file as reference")
|
||||
parser.add_option('--diff_ref_db', nargs=0, \
|
||||
help="Get missing .txt files and mismatch properties, with database as reference")
|
||||
|
||||
# scheduler
|
||||
parser.add_option('--run_scheduler', default=False, action="store_true",
|
||||
help="Trigger scheduler")
|
||||
parser.add_option('--run_scheduler_event', nargs=1, metavar="[all|daily|weekly|monthly]",
|
||||
help="Run scheduler event")
|
||||
|
||||
# misc
|
||||
parser.add_option("--replace", nargs=3, default=False,
|
||||
metavar = "search replace_by extension",
|
||||
help="file search-replace")
|
||||
|
||||
parser.add_option("--cci", nargs=1, metavar="CacheItem Key or all",
|
||||
help="Clear Cache Item")
|
||||
|
||||
parser.add_option("--sync_all", help="Synchronize all DocTypes using txt files",
|
||||
nargs=0)
|
||||
|
||||
parser.add_option("--sync", help="Synchronize given DocType using txt file",
|
||||
nargs=2, metavar="module doctype (use their folder names)")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
def run():
|
||||
sys.path.append('lib')
|
||||
sys.path.append('lib/py')
|
||||
import webnotes
|
||||
import webnotes.defs
|
||||
sys.path.append(webnotes.defs.modules_path)
|
||||
|
||||
(options, args) = setup_options()
|
||||
|
||||
|
||||
from webnotes.db import Database
|
||||
import webnotes.modules.patch_handler
|
||||
|
||||
# connect
|
||||
if options.db_name is not None:
|
||||
webnotes.connect(options.db_name)
|
||||
|
||||
# build
|
||||
if options.build:
|
||||
import build.project
|
||||
build.project.build()
|
||||
|
||||
elif options.clear:
|
||||
from build.project import increment_version
|
||||
print "Version:" + str(increment_version())
|
||||
|
||||
# code replace
|
||||
elif options.replace:
|
||||
replace_code('.', options.replace[0], options.replace[1], options.replace[2])
|
||||
|
||||
# git
|
||||
elif options.status:
|
||||
os.system('git status')
|
||||
os.chdir('lib')
|
||||
os.system('git status')
|
||||
|
||||
elif options.pull:
|
||||
os.system('git pull %s %s' % (options.pull[0], options.pull[1]))
|
||||
os.chdir('lib')
|
||||
os.system('git pull %s %s' % (options.pull[0], options.pull[1]))
|
||||
|
||||
elif options.push:
|
||||
os.system('git commit -a -m "%s"' % options.push[2])
|
||||
os.system('git push %s %s' % (options.push[0], options.push[1]))
|
||||
os.chdir('lib')
|
||||
os.system('git commit -a -m "%s"' % options.push[2])
|
||||
os.system('git push %s %s' % (options.push[0], options.push[1]))
|
||||
|
||||
# patch
|
||||
elif options.patch_list:
|
||||
# clear log
|
||||
webnotes.modules.patch_handler.log_list = []
|
||||
|
||||
# run individual patches
|
||||
for patch in options.patch_list:
|
||||
webnotes.modules.patch_handler.run_single(\
|
||||
patchmodule = patch, force = options.force)
|
||||
|
||||
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
||||
|
||||
# reload
|
||||
elif options.reload_doc:
|
||||
webnotes.modules.patch_handler.reload_doc(\
|
||||
{"module":options.reload_doc[0], "dt":options.reload_doc[1], "dn":options.reload_doc[2]})
|
||||
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
||||
|
||||
elif options.export_doc:
|
||||
from webnotes.modules import export_doc
|
||||
export_doc(options.export_doc[0], options.export_doc[1])
|
||||
|
||||
# run all pending
|
||||
elif options.run_latest:
|
||||
webnotes.modules.patch_handler.run_all()
|
||||
print '\n'.join(webnotes.modules.patch_handler.log_list)
|
||||
|
||||
elif options.install:
|
||||
from webnotes.install_lib.install import Installer
|
||||
inst = Installer('root', options.install[0])
|
||||
inst.import_from_db(options.install[1], source_path=options.install[2], \
|
||||
password='admin', verbose = 1)
|
||||
|
||||
elif options.diff_ref_file is not None:
|
||||
import webnotes.modules.diff
|
||||
webnotes.modules.diff.diff_ref_file()
|
||||
|
||||
elif options.diff_ref_db is not None:
|
||||
import webnotes.modules.diff
|
||||
webnotes.modules.diff.diff_ref_db()
|
||||
|
||||
elif options.run_scheduler:
|
||||
import webnotes.utils.scheduler
|
||||
print webnotes.utils.scheduler.execute()
|
||||
|
||||
elif options.run_scheduler_event is not None:
|
||||
import webnotes.utils.scheduler
|
||||
print webnotes.utils.scheduler.trigger('execute_' + options.run_scheduler_event)
|
||||
|
||||
elif options.cci is not None:
|
||||
if options.cci=='all':
|
||||
webnotes.conn.sql("DELETE FROM __CacheItem")
|
||||
else:
|
||||
from webnotes.utils.cache import CacheItem
|
||||
CacheItem(options.cci).clear()
|
||||
|
||||
elif options.sync_all is not None:
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync_all(options.force or 0)
|
||||
|
||||
elif options.sync is not None:
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync(options.sync[0], options.sync[1], options.force or 0)
|
||||
|
||||
# print messages
|
||||
if webnotes.message_log:
|
||||
print '\n'.join(webnotes.message_log)
|
||||
|
||||
if __name__=='__main__':
|
||||
run()
|
Loading…
x
Reference in New Issue
Block a user