Explorar el Código

[salary structure] Cleanup, Fixed Monthly Register Report and other minor changes

version-14
Rushabh Mehta hace 12 años
padre
commit
348db9c49b
Se han modificado 6 ficheros con 31 adiciones y 18 borrados
  1. +6
    -6
      core/page/data_import_tool/data_import_tool.py
  2. +1
    -1
      public/js/wn/form/control.js
  3. +11
    -6
      public/js/wn/form/grid.js
  4. +3
    -3
      webnotes/widgets/query_report.py
  5. +3
    -2
      webnotes/widgets/reportview.py
  6. +7
    -0
      wnf.py

+ 6
- 6
core/page/data_import_tool/data_import_tool.py Ver fichero

@@ -43,11 +43,11 @@ def get_template():
if all_doctypes:
doctype_parentfield = {}
doctypes = []
child_doctypes = []
for d in get_table_fields(doctype):
doctypes.append(d[0])
child_doctypes.append(d[0])
doctype_parentfield[d[0]] = d[1]
def add_main_header():
w.writerow(['Data Import Template'])
w.writerow([data_keys.main_table, doctype])
@@ -187,9 +187,9 @@ def get_template():
if all_doctypes:
# add child tables
for child_doctype in doctypes[1:]:
for child_doctype in child_doctypes:
for ci, child in enumerate(webnotes.conn.sql("""select * from `tab%s`
where parent=%s""" % (child_doctype, "%s"), doc.name, as_dict=1)):
where parent=%s order by idx""" % (child_doctype, "%s"), doc.name, as_dict=1)):
add_data_row(row_group, child_doctype, child, ci)
for row in row_group:
@@ -211,7 +211,7 @@ def get_template():

build_field_columns(doctype)
if all_doctypes:
for d in doctypes[1:]:
for d in child_doctypes:
append_empty_field_column()
build_field_columns(d)


+ 1
- 1
public/js/wn/form/control.js Ver fichero

@@ -29,7 +29,7 @@ wn.ui.form.Control = Class.extend({
// if developer_mode=1, show fieldname as tooltip
if(wn.boot.profile && wn.boot.profile.name==="Administrator" &&
wn.boot.developer_mode===1 && this.$wrapper) {
this.$wrapper.tooltip({title: this.df.fieldname});
this.$wrapper.attr("title", this.df.fieldname);
}
},
make: function() {


+ 11
- 6
public/js/wn/form/grid.js Ver fichero

@@ -287,7 +287,7 @@ wn.ui.form.GridRow = Class.extend({
}
// append button column
if(me.doc) {
if(me.doc && this.is_editable()) {
if(!me.grid.$row_actions) {
me.grid.$row_actions = $('<div class="col col-lg-1" \
style="text-align: right; padding-right: 5px;">\
@@ -298,11 +298,13 @@ wn.ui.form.GridRow = Class.extend({
</div>');
}
$col = me.grid.$row_actions.clone().appendTo(me.row);

$col.find(".grid-insert-row").click(function() { me.insert(); return false; });
$col.find(".grid-delete-row").click(function() { me.remove(); return false; });
this.toggle_add_delete_button_display($col);
if($col.width() < 50) {
$col.remove();
} else {
$col.find(".grid-insert-row").click(function() { me.insert(); return false; });
$col.find(".grid-delete-row").click(function() { me.remove(); return false; });
}
}

$(this.frm.wrapper).trigger("grid-row-render", [this]);
@@ -350,9 +352,12 @@ wn.ui.form.GridRow = Class.extend({
callback && callback();
});
},
is_editable: function() {
return this.grid.display_status=="Write" && !this.grid.static_rows
},
toggle_add_delete_button_display: function($parent) {
$parent.find(".grid-delete-row, .grid-insert-row")
.toggle(this.grid.display_status=="Write" && !this.grid.static_rows);
.toggle(this.is_editable());
},
render_form: function() {
this.make_form();


+ 3
- 3
webnotes/widgets/query_report.py Ver fichero

@@ -80,7 +80,7 @@ def get_filtered_data(ref_doctype, columns, data):

linked_doctypes = get_linked_doctypes(columns)
match_filters = get_user_match_filters(linked_doctypes, ref_doctype)
if match_filters:
matched_columns = get_matched_columns(linked_doctypes, match_filters)
for row in data:
@@ -122,8 +122,8 @@ def get_user_match_filters(doctypes, ref_doctype):
webnotes.widgets.reportview.doctypes = doctypes_meta

for dt in doctypes:
match_filters = webnotes.widgets.reportview.build_match_conditions(dt,
None, False, match_filters)
match_filters.update(webnotes.widgets.reportview.build_match_conditions(dt,
None, False))

return match_filters



+ 3
- 2
webnotes/widgets/reportview.py Ver fichero

@@ -177,11 +177,11 @@ def build_filter_conditions(filters, conditions):
conditions.append('ifnull(' + tname + '.' + f[1] + ",0) " + f[2] \
+ " " + cstr(f[3]))
def build_match_conditions(doctype, fields=None, as_condition=True, match_filters=None):
def build_match_conditions(doctype, fields=None, as_condition=True):
"""add match conditions if applicable"""
global tables, roles
if not match_filters: match_filters = {}
match_filters = {}
match_conditions = []
match = True
@@ -215,6 +215,7 @@ def build_match_conditions(doctype, fields=None, as_condition=True, match_filter
# don't restrict if another read permission at level 0
# exists without a match restriction
match = False
match_filters = {}
if as_condition:
if match_conditions and match:


+ 7
- 0
wnf.py Ver fichero

@@ -139,6 +139,9 @@ def setup_options():
parser.add_option('--install_fresh', nargs=1, metavar = "NEW_DB_NAME",
help="install fresh db")

parser.add_option('--make_demo', default=False, action="store_true",
help="install in database 'demo'")

# update
parser.add_option("-u", "--update",
help="Pull, run latest patches and sync all",
@@ -391,6 +394,10 @@ def run():
inst = Installer('root')
inst.import_from_db(options.install_fresh, verbose = 1)

elif options.make_demo:
import utilities.make_demo
utilities.make_demo.make()

elif options.diff_ref_file is not None:
import webnotes.modules.diff
webnotes.modules.diff.diff_ref_file()


Cargando…
Cancelar
Guardar