Преглед на файлове

amendment_date is not mandatory for amendment

version-14
Nabin Hait преди 12 години
родител
ревизия
49bae6e5d0
променени са 2 файла, в които са добавени 5 реда и са изтрити 17 реда
  1. +1
    -15
      core/doctype/doctype/doctype.py
  2. +4
    -2
      public/js/legacy/widgets/form/form.js

+ 1
- 15
core/doctype/doctype/doctype.py Целия файл

@@ -138,7 +138,7 @@ class DocType:

def make_amendable(self):
"""
if is_submittable is set, add amendment_date and amended_from
if is_submittable is set, add amended_from
docfields
"""
if self.doc.is_submittable:
@@ -146,20 +146,6 @@ class DocType:
temp_doclist = webnotes.model.doctype.get(self.doc.name)
max_idx = max([d.idx for d in temp_doclist if d.idx])
max_idx = max_idx and max_idx or 0
if 'amendment_date' not in [d.fieldname for d in temp_doclist if \
d.doctype=='DocField']:
new = self.doc.addchild('fields', 'DocField', 1, self.doclist)
new.label = 'Amendment Date'
new.fieldtype = 'Date'
new.fieldname = 'amendment_date'
new.permlevel = 0
new.print_hide = 1
new.no_copy = 1
new.idx = max_idx + 1
new.description = "The date at which current entry is corrected in the system."
new.depends_on = "eval:doc.amended_from"
new.save()
max_idx += 1
if 'amended_from' not in [d.fieldname for d in temp_doclist if \
d.doctype=='DocField']:
new = self.doc.addchild('fields', 'DocField', 1, self.doclist)


+ 4
- 2
public/js/legacy/widgets/form/form.js Целия файл

@@ -643,9 +643,11 @@ _f.Frm.prototype.cleanup_refresh = function() {
var me = this;
if(me.fields_dict['amended_from']) {
if (me.doc.amended_from) {
unhide_field('amended_from'); unhide_field('amendment_date');
unhide_field('amended_from');
if (me.fields_dict['amendment_date']) unhide_field('amendment_date');
} else {
hide_field('amended_from'); hide_field('amendment_date');
hide_field('amended_from');
if (me.fields_dict['amendment_date']) hide_field('amendment_date');
}
}



Зареждане…
Отказ
Запис