Merge branch 'edge' of github.com:webnotes/wnframework into webshop
This commit is contained in:
commit
aa87a3a9ae
6 changed files with 2295 additions and 2105 deletions
|
|
@ -213,3 +213,31 @@ CREATE TABLE `__Auth` (
|
|||
`password` VARCHAR(180) NOT NULL,
|
||||
KEY `user` (`user`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
--
|
||||
-- Table structure for table `tabFile Data`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tabFile Data`;
|
||||
CREATE TABLE `tabFile Data` (
|
||||
`name` varchar(120) NOT NULL,
|
||||
`creation` datetime DEFAULT NULL,
|
||||
`modified` datetime DEFAULT NULL,
|
||||
`modified_by` varchar(40) DEFAULT NULL,
|
||||
`owner` varchar(40) DEFAULT NULL,
|
||||
`docstatus` int(1) DEFAULT '0',
|
||||
`parent` varchar(120) DEFAULT NULL,
|
||||
`parentfield` varchar(120) DEFAULT NULL,
|
||||
`parenttype` varchar(120) DEFAULT NULL,
|
||||
`idx` int(8) DEFAULT NULL,
|
||||
`file_name` varchar(180) DEFAULT NULL,
|
||||
`file_url` varchar(180) DEFAULT NULL,
|
||||
`module` varchar(180) DEFAULT NULL,
|
||||
`attached_to_name` varchar(180) DEFAULT NULL,
|
||||
`file_size` int(11) DEFAULT NULL,
|
||||
`attached_to_doctype` varchar(180) DEFAULT NULL,
|
||||
PRIMARY KEY (`name`),
|
||||
KEY `parent` (`parent`),
|
||||
KEY `attached_to_name` (`attached_to_name`),
|
||||
KEY `attached_to_doctype` (`attached_to_doctype`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
|
|
|||
|
|
@ -202,6 +202,7 @@ def upload():
|
|||
|
||||
ret = []
|
||||
error = False
|
||||
parent_list = []
|
||||
for i, row in enumerate(data):
|
||||
# bypass empty rows
|
||||
if not row: continue
|
||||
|
|
@ -223,6 +224,7 @@ def upload():
|
|||
doc.save()
|
||||
ret.append('Inserted row for %s at #%s' % (getlink(parenttype,
|
||||
doc.parent), unicode(doc.idx)))
|
||||
parent_list.append(doc.parent)
|
||||
else:
|
||||
ret.append(import_doc(d, doctype, overwrite, row_idx, params.get("_submit")))
|
||||
except Exception, e:
|
||||
|
|
@ -231,6 +233,8 @@ def upload():
|
|||
len(row)>1 and row[1] or "", cstr(e)))
|
||||
webnotes.errprint(webnotes.getTraceback())
|
||||
|
||||
ret, error = validate_parent(parent_list, parenttype, ret, error)
|
||||
|
||||
if error:
|
||||
webnotes.conn.rollback()
|
||||
else:
|
||||
|
|
@ -240,6 +244,21 @@ def upload():
|
|||
|
||||
return {"messages": ret, "error": error}
|
||||
|
||||
def validate_parent(parent_list, parenttype, ret, error):
|
||||
if parent_list:
|
||||
parent_list = list(set(parent_list))
|
||||
for p in parent_list:
|
||||
try:
|
||||
obj = webnotes.bean(parenttype, p)
|
||||
obj.run_method("validate")
|
||||
obj.run_method("on_update")
|
||||
except Exception, e:
|
||||
error = True
|
||||
ret.append('Validation Error for %s %s: %s' % (parenttype, p, cstr(e)))
|
||||
webnotes.errprint(webnotes.getTraceback())
|
||||
|
||||
return ret, error
|
||||
|
||||
def get_parent_field(doctype, parenttype):
|
||||
parentfield = None
|
||||
|
||||
|
|
|
|||
|
|
@ -157,4 +157,15 @@ wn.utils = {
|
|||
|
||||
return list;
|
||||
},
|
||||
unique: function(list) {
|
||||
var dict = {},
|
||||
arr = [];
|
||||
for(var i=0, l=list.length; i < l; i++) {
|
||||
if(!dict.hasOwnProperty(list[i])) {
|
||||
dict[list[i]] = null;
|
||||
arr.push(list[i]);
|
||||
}
|
||||
}
|
||||
return arr;
|
||||
},
|
||||
};
|
||||
|
|
@ -907,7 +907,7 @@ wn.views.TreeGridReport = wn.views.GridReportWithPlot.extend({
|
|||
if(with_groups && (item.group_or_ledger == "Group" || item.is_group)) {
|
||||
return true;
|
||||
}
|
||||
if(with_ledgers && (item.group_or_ledger == "Ledger" || !item.is_group)) {
|
||||
if(with_ledgers && (item.group_or_ledger != "Group" && !item.is_group)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -11,12 +11,19 @@ def get_country_info(country=None):
|
|||
|
||||
return data
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_all():
|
||||
with open(os.path.join(os.path.dirname(__file__), "country_info.json"), "r") as local_info:
|
||||
all_data = json.loads(local_info.read())
|
||||
return all_data
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_country_timezone_info():
|
||||
import pytz
|
||||
return {
|
||||
"country_info": get_all(),
|
||||
"all_timezones": pytz.all_timezones
|
||||
}
|
||||
|
||||
def update():
|
||||
with open(os.path.join(os.path.dirname(__file__), "currency_info.json"), "r") as nformats:
|
||||
nformats = json.loads(nformats.read())
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue