Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-12-31 13:02:14 +05:30
commit a9ff53c5a4
3 changed files with 16 additions and 5 deletions

View File

@ -81,7 +81,12 @@ class DocType:
# get default values
# ------------------
def get_defaults(self, arg):
match_key, with_profiles = arg.split('~~~')
if isinstance(arg, basestring):
import json
arg = json.loads(arg)
match_key = arg["match"]
with_profiles = arg["profiles"]
pl = ol = []
@ -89,7 +94,9 @@ class DocType:
dl = [a for a in sql("select parent, ifnull(parenttype,'') as parenttype, ifnull(defvalue,'') as defvalue from tabDefaultValue where defkey=%s order by parenttype desc, parent asc", match_key, as_dict=1)]
# options
tn = sql("select options from tabDocField where fieldname=%s and fieldtype='Link' and docstatus=0 limit 1", match_key)[0][0]
tn = webnotes.get_doctype(arg["doctype"]).get_options(match_key)
# tn = sql("select options from tabDocField where fieldname=%s and fieldtype='Link' and docstatus=0 limit 1", match_key)[0][0]
ol = [''] + [a[0] for a in sql("select name from `tab%s` where ifnull(docstatus,0)=0" % tn)]
# roles

View File

@ -287,7 +287,11 @@ pscript.PermEngine.prototype.show_match_dialog=function(details) {
me.render_match_dialog(r, details);
}
// load the rules
$c_obj('Permission Control','get_defaults', details.match + '~~~' + (this.profiles ? 'No' : 'Yes'), callback);
$c_obj('Permission Control','get_defaults', {
match: details.match,
profiles: this.profiles ? "No" : "Yes",
doctype: sel_val(me.type_select)
}, callback);
}
// --------------------------------------------

View File

@ -110,8 +110,8 @@ erpnext.StockBalance = erpnext.StockAnalytics.extend({
item.opening += diff;
} else if(posting_datetime <= to_date) {
var ignore_inflow_outflow = this.is_default("warehouse")
&& item.voucher_type=="Stock Entry"
&& this.stock_entry_map[item.voucher_no].purpose=="Material Transfer";
&& sl.voucher_type=="Stock Entry"
&& this.stock_entry_map[sl.voucher_no].purpose=="Material Transfer";
if(!ignore_inflow_outflow) {
if(diff < 0) {