This commit is contained in:
Rushabh Mehta 2012-03-01 13:32:06 +05:30
commit 5ce587be33
13 changed files with 85 additions and 67 deletions

View File

@ -45,11 +45,14 @@ cur_frm.cscript.onload = function(doc,dt,dn) {
//------------------------ //------------------------
cur_frm.cscript.onload_post_render = function(doc, dt, dn) { cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) { var callback = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn); var callback1 = function(doc, dt, dn) {
if(doc.__islocal && doc.supplier) cur_frm.cscript.supplier(doc,dt,dn);
}
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
} }
cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
} }
// Refresh // Refresh
@ -58,7 +61,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.clear_custom_buttons(); cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn); if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, dt, dn);
// Show / Hide button // Show / Hide button

View File

@ -168,9 +168,6 @@ class DocType(TransactionBase):
return ret return ret
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# *************************** Server Utility Functions ***************************** # *************************** Server Utility Functions *****************************
# Get Company abbr # Get Company abbr

View File

@ -92,39 +92,36 @@ var set_dynamic_label_par = function(doc, cdt, cdn, base_curr) {
var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) { var set_dynamic_label_child = function(doc, cdt, cdn, base_curr) {
// item table flds // item table flds
item_cols_base = {'purchase_ref_rate': 'Ref Rate', 'amount': 'Amount'}; item_cols_base = {'purchase_ref_rate': 'Ref Rate', 'amount': 'Amount'};
item_cols_import = {'import_rate': 'Rate', 'import_ref_rate': 'Ref Rate', 'import_amount': 'Amount'}; item_cols_import = {'import_rate': 'Rate', 'import_ref_rate': 'Ref Rate', 'import_amount': 'Amount'};
for (d in item_cols_base) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_base[d]+' ('+base_curr+')'); for (d in item_cols_base) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_base[d]+' ('+base_curr+')');
for (d in item_cols_import) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_import[d]+' ('+doc.currency+')'); for (d in item_cols_import) $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-'+d+'"]').html(item_cols_import[d]+' ('+doc.currency+')');
var hide = (doc.currency == sys_defaults['currency']) ? false : true; var hide = (doc.currency == sys_defaults['currency']) ? false : true;
for (f in item_cols_base) cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide); for (f in item_cols_base) cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp(f, hide);
if (doc.doctype == 'Payable Voucher') {
if (doc.doctype == 'Payable Voucher') { $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')');
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-rate"]').html('Rate ('+base_curr+')'); cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('rate', hide); // advance table flds
// advance table flds adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'}
adv_cols = {'advance_amount': 'Advance Amount', 'allocated_amount': 'Allocated Amount', 'tds_amount': 'TDS Amount', 'tds_allocated': 'TDS Allocated'} for (d in adv_cols) $('[data-grid-fieldname="Advance Allocation Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')');
for (d in adv_cols) $('[data-grid-fieldname="Advance Allocation Detail-'+d+'"]').html(adv_cols[d]+' ('+base_curr+')'); }
} else {
else { $('[data-grid-fieldname="'+cur_frm.cscript.tname+'-purchase_rate"]').html('Rate ('+base_curr+')');
$('[data-grid-fieldname="'+cur_frm.cscript.tname+'-purchase_rate"]').html('Rate ('+base_curr+')'); cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('purchase_rate', hide);
cur_frm.fields_dict[cur_frm.cscript.fname].grid.set_column_disp('purchase_rate', hide); }
}
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Aggregate Total'};
for (d in tax_cols) $('[data-grid-fieldname="Purchase Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
//tax table flds
tax_cols = {'tax_amount': 'Amount', 'total': 'Aggregate Total'};
for (d in tax_cols) $('[data-grid-fieldname="Purchase Tax Detail-'+d+'"]').html(tax_cols[d]+' ('+base_curr+')');
} }
// Change label dynamically based on currency // Change label dynamically based on currency
//------------------------------------------------------------------ //------------------------------------------------------------------
cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) { cur_frm.cscript.dynamic_label = function(doc, cdt, cdn, callback1) {
var callback = function(r, rt) { var callback = function(r, rt) {
if (r.message) base_curr = r.message; if (r.message) base_curr = r.message;
else base_curr = sys_defaults['currency']; else base_curr = sys_defaults['currency'];
@ -136,10 +133,16 @@ cur_frm.cscript.dynamic_label = function(doc, cdt, cdn) {
set_dynamic_label_par(doc, cdt, cdn, base_curr); set_dynamic_label_par(doc, cdt, cdn, base_curr);
set_dynamic_label_child(doc, cdt, cdn, base_curr); set_dynamic_label_child(doc, cdt, cdn, base_curr);
if(callback1) callback1(doc, cdt, cdn);
} }
if (doc.company == sys_defaults['company']) callback('', ''); if (doc.company == sys_defaults['company']) callback('', '');
else $c_obj(make_doclist(doc.doctype, doc.name), 'get_comp_base_currency', '', callback); else wn.call({
method: 'selling.doctype.sales_common.sales_common.get_comp_base_currency',
args: {company: doc.company},
callback: callback
});
} }
cur_frm.cscript.currency = function(doc, cdt, cdn) { cur_frm.cscript.currency = function(doc, cdt, cdn) {

View File

@ -197,11 +197,6 @@ class DocType(TransactionBase):
msgprint("%s has no Last Purchase Rate."% d.item_code) msgprint("%s has no Last Purchase Rate."% d.item_code)
def get_comp_base_currency(self, comp):
""" get default currency of company"""
return webnotes.conn.sql("select default_currency from `tabCompany` where name = %s", comp)[0][0]
# validation # validation
# ------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------

View File

@ -41,9 +41,12 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
} }
cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) { cur_frm.cscript.onload_post_render = function(doc, cdt, cdn) {
if(doc.__islocal){ var callback = function(doc, cdt, cdn) {
cur_frm.cscript.get_default_schedule_date(doc); if(doc.__islocal){
} cur_frm.cscript.get_default_schedule_date(doc);
}
}
cur_frm.cscript.dynamic_label(doc, cdt, cdn, callback);
} }
// ================================== Refresh ========================================== // ================================== Refresh ==========================================
@ -52,7 +55,7 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// --------------------------------- // ---------------------------------
cur_frm.clear_custom_buttons(); cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn); if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if(doc.docstatus == 1 && doc.status != 'Stopped'){ if(doc.docstatus == 1 && doc.status != 'Stopped'){
var ch = getchildren('PO Detail',doc.name,'po_details'); var ch = getchildren('PO Detail',doc.name,'po_details');

View File

@ -100,10 +100,6 @@ class DocType(TransactionBase):
return get_obj('Purchase Common').get_tc_details(self) return get_obj('Purchase Common').get_tc_details(self)
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# validate if indent has been pulled twice # validate if indent has been pulled twice
def validate_prev_docname(self): def validate_prev_docname(self):

View File

@ -41,10 +41,15 @@
.case-border { .case-border {
border-radius: 10px; border-radius: 10px;
-moz-border-radius: 10px;
-webkit-border-radius: 10px;
width: 56px; width: 56px;
height: 56px; height: 56px;
border: 4px solid white; border: 4px solid white;
box-shadow: 0 0 10px 1px black; box-shadow: 0 0 10px 1px black;
-moz-box-shadow: 0 0 10px 1px black;
-webkit-box-shadow: 0 0 10px 1px black;
-o-box-shadow: 0 0 10px 1px black;
margin: auto; margin: auto;
} }
@ -66,6 +71,9 @@
/* Hover and click effects */ /* Hover and click effects */
.case-border:hover, .circle:hover { .case-border:hover, .circle:hover {
box-shadow: 0 0 2px 0px black, 0 0 10px 1px white; box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-moz-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-webkit-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
-o-box-shadow: 0 0 2px 0px black, 0 0 10px 1px white;
} }
.case-border:active, .case-border:focus, .circle:active, .circle:focus { .case-border:active, .case-border:focus, .circle:active, .circle:focus {
@ -78,6 +86,8 @@
.circle { .circle {
border-radius: 100%; border-radius: 100%;
-moz-border-radius: 100%;
-webkit-border-radius: 100%;
height: 15px; height: 15px;
min-width: 15px; min-width: 15px;
background: #B00D07; background: #B00D07;
@ -88,6 +98,9 @@
margin-right: 10px; margin-right: 10px;
border: 2px solid white; border: 2px solid white;
box-shadow: 0 0 10px 1px black; box-shadow: 0 0 10px 1px black;
-moz-box-shadow: 0 0 10px 1px black;
-webkit-box-shadow: 0 0 10px 1px black;
-o-box-shadow: 0 0 10px 1px black;
} }
.circle-text { .circle-text {

View File

@ -3,12 +3,12 @@ wn.provide('erpnext.desktop');
erpnext.desktop.gradient = "<style>\ erpnext.desktop.gradient = "<style>\
.case-%(name)s {\ .case-%(name)s {\
background: %(start)s; /* Old browsers */\ background: %(start)s; /* Old browsers */\
background: -moz-radial-gradient(center, ellipse cover, %(start)s 0%%, %(middle)s 44%%, %(end)s 100%%); /* FF3.6+ */\ background: -moz-radial-gradient(center, ellipse cover, %(start)s 0%, %(middle)s 44%, %(end)s 100%); /* FF3.6+ */\
background: -webkit-gradient(radial, center center, 0px, center center, 100%%, color-stop(0%%,%(start)s), color-stop(44%%,%(middle)s), color-stop(100%%,%(end)s)); /* Chrome,Safari4+ */\ background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%,%(start)s), color-stop(44%,%(middle)s), color-stop(100%,%(end)s)); /* Chrome,Safari4+ */\
background: -webkit-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* Chrome10+,Safari5.1+ */\ background: -webkit-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* Chrome10+,Safari5.1+ */\
background: -o-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* Opera 12+ */\ background: -o-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* Opera 12+ */\
background: -ms-radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* IE10+ */\ background: -ms-radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* IE10+ */\
background: radial-gradient(center, ellipse cover, %(start)s 0%%,%(middle)s 44%%,%(end)s 100%%); /* W3C */\ background: radial-gradient(center, ellipse cover, %(start)s 0%,%(middle)s 44%,%(end)s 100%); /* W3C */\
}\ }\
</style>" </style>"

View File

@ -69,7 +69,7 @@ class DocType:
import webnotes, json import webnotes, json
args = json.loads(args) args = json.loads(args)
curr_fiscal_year, fy_start_date = self.get_fy_details(args.get('fy_start')) curr_fiscal_year, fy_start_date, fy_abbr = self.get_fy_details(args.get('fy_start'))
args['name'] = webnotes.session.get('user') args['name'] = webnotes.session.get('user')
@ -82,7 +82,12 @@ class DocType:
# Fiscal Year # Fiscal Year
master_dict = {'Fiscal Year':{'year':curr_fiscal_year, 'year_start_date':fy_start_date}} master_dict = {'Fiscal Year':{
'year': curr_fiscal_year,
'year_start_date': fy_start_date,
'abbreviation': fy_abbr,
'company': args.get('company_name'),
'is_fiscal_year_closed': 'No'}}
self.create_records(master_dict) self.create_records(master_dict)
# Company # Company
@ -163,9 +168,11 @@ class DocType:
#eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0])) #eddt = sql("select DATE_FORMAT(DATE_SUB(DATE_ADD('%s', INTERVAL 1 YEAR), INTERVAL 1 DAY),'%%d-%%m-%%Y')" % (stdt.split('-')[2]+ '-' + stdt.split('-')[1] + '-' + stdt.split('-')[0]))
if(fy_start == '1st Jan'): if(fy_start == '1st Jan'):
fy = cstr(getdate(nowdate()).year) fy = cstr(getdate(nowdate()).year)
abbr = cstr(fy)[-2:]
else: else:
fy = cstr(curr_year) + '-' + cstr(curr_year+1) fy = cstr(curr_year) + '-' + cstr(curr_year+1)
return fy,stdt abbr = cstr(curr_year)[-2:] + '-' + cstr(curr_year+1)[-2:]
return fy, stdt, abbr
# Create Company and Fiscal Year # Create Company and Fiscal Year

View File

@ -40,12 +40,15 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
cur_frm.cscript.onload_post_render = function(doc, dt, dn) { cur_frm.cscript.onload_post_render = function(doc, dt, dn) {
var callback = function(doc, dt, dn) { var callback = function(doc, dt, dn) {
if(doc.__islocal){ var callback1 = function(doc, dt, dn) {
cur_frm.cscript.get_default_schedule_date(doc); if(doc.__islocal){
cur_frm.cscript.get_default_schedule_date(doc);
}
} }
// defined in purchase_common.js
cur_frm.cscript.update_item_details(doc, dt, dn, callback1);
} }
// defined in purchase_common.js cur_frm.cscript.dynamic_label(doc, dt, dn, callback);
cur_frm.cscript.update_item_details(doc, cdt, cdn, callback);
} }
//========================== Refresh =============================================================== //========================== Refresh ===============================================================
@ -55,7 +58,8 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
// --------------------------------- // ---------------------------------
cur_frm.clear_custom_buttons(); cur_frm.clear_custom_buttons();
cur_frm.cscript.dynamic_label(doc, cdt, cdn); if (!cur_frm.cscript.is_onload) cur_frm.cscript.dynamic_label(doc, cdt, cdn);
if(doc.docstatus == 1){ if(doc.docstatus == 1){
var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details'); var ch = getchildren('Purchase Receipt Detail',doc.name,'purchase_receipt_details');

View File

@ -88,10 +88,6 @@ class DocType(TransactionBase):
def get_tc_details(self): def get_tc_details(self):
return get_obj('Purchase Common').get_tc_details(self) return get_obj('Purchase Common').get_tc_details(self)
def get_comp_base_currency(self):
return get_obj('Purchase Common').get_comp_base_currency(self.doc.company)
# get available qty at warehouse # get available qty at warehouse
def get_bin_details(self, arg = ''): def get_bin_details(self, arg = ''):

View File

@ -178,7 +178,8 @@ EmailMessage = function(parent, args, list, idx) {
// email text // email text
this.message = $a(w, 'div', '', this.message = $a(w, 'div', '',
// style // style
{lineHeight:'1.7em', display:'none', padding: '7px'}, {lineHeight:'1.7em', display:'none', padding: '7px', width: '575px',
wordWrap: 'break-word', textWrap: 'normal', overflowX: 'auto'},
// newlines for text email // newlines for text email
(this.content_type=='text/plain' ? this.mail (this.content_type=='text/plain' ? this.mail

View File

@ -1 +1 @@
780 781