Disable rounded total feature
This commit is contained in:
parent
150d98d786
commit
6f1a5ec209
@ -29,6 +29,7 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
// On Load
|
// On Load
|
||||||
// -------
|
// -------
|
||||||
cur_frm.cscript.onload = function(doc,dt,dn) {
|
cur_frm.cscript.onload = function(doc,dt,dn) {
|
||||||
|
cur_frm.cscript.manage_rounded_total();
|
||||||
if(!doc.customer && doc.debit_to) wn.meta.get_docfield(dt, 'debit_to', dn).print_hide = 0;
|
if(!doc.customer && doc.debit_to) wn.meta.get_docfield(dt, 'debit_to', dn).print_hide = 0;
|
||||||
if (doc.__islocal) {
|
if (doc.__islocal) {
|
||||||
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
|
if(!doc.due_date) set_multiple(dt,dn,{due_date:get_today()});
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
from webnotes.utils import cint
|
||||||
from setup.utils import get_company_currency
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
from controllers.accounts_controller import AccountsController
|
from controllers.accounts_controller import AccountsController
|
||||||
@ -27,8 +28,13 @@ class SellingController(AccountsController):
|
|||||||
def set_total_in_words(self):
|
def set_total_in_words(self):
|
||||||
from webnotes.utils import money_in_words
|
from webnotes.utils import money_in_words
|
||||||
company_currency = get_company_currency(self.doc.company)
|
company_currency = get_company_currency(self.doc.company)
|
||||||
|
|
||||||
|
disable_rounded_total = cint(webnotes.conn.get_value("Global Defaults", None,
|
||||||
|
"disable_rounded_total"))
|
||||||
|
|
||||||
if self.meta.get_field("in_words"):
|
if self.meta.get_field("in_words"):
|
||||||
self.doc.in_words = money_in_words(self.doc.rounded_total, company_currency)
|
self.doc.in_words = money_in_words(disable_rounded_total and
|
||||||
|
self.doc.grand_total or self.doc.rounded_total, company_currency)
|
||||||
if self.meta.get_field("in_words_export"):
|
if self.meta.get_field("in_words_export"):
|
||||||
self.doc.in_words_export = money_in_words(self.doc.rounded_total_export,
|
self.doc.in_words_export = money_in_words(disable_rounded_total and
|
||||||
self.doc.currency)
|
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
@ -28,6 +28,7 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
// ONLOAD
|
// ONLOAD
|
||||||
// ===================================================================================
|
// ===================================================================================
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.manage_rounded_total();
|
||||||
if(!doc.quotation_to) hide_field(['customer','customer_address','contact_person','customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
|
if(!doc.quotation_to) hide_field(['customer','customer_address','contact_person','customer_name','lead', 'lead_name', 'address_display', 'contact_display', 'contact_mobile', 'contact_email', 'territory', 'customer_group']);
|
||||||
if(!doc.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
|
if(!doc.price_list_name) set_multiple(cdt,cdn,{price_list_name:sys_defaults.price_list_name});
|
||||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||||
|
@ -182,27 +182,37 @@ cur_frm.cscript.hide_price_list_currency = function(doc, cdt, cdn, callback1) {
|
|||||||
if (doc.plc_conversion_rate != 1)
|
if (doc.plc_conversion_rate != 1)
|
||||||
set_multiple(cdt, cdn, {plc_conversion_rate:1})
|
set_multiple(cdt, cdn, {plc_conversion_rate:1})
|
||||||
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
hide_field(['price_list_currency', 'plc_conversion_rate']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r.message[1] == doc.currency) {
|
if (r.message[1] == doc.currency) {
|
||||||
if (doc.conversion_rate != 1)
|
if (doc.conversion_rate != 1)
|
||||||
set_multiple(cdt, cdn, {conversion_rate:1});
|
set_multiple(cdt, cdn, {conversion_rate:1});
|
||||||
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
hide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
||||||
} else unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export', 'rounded_total_export']);
|
} else {
|
||||||
|
unhide_field(['conversion_rate', 'grand_total_export', 'in_words_export']);
|
||||||
|
if(!cint(sys_defaults.disable_rounded_total))
|
||||||
|
unhide_field("rounded_total_export");
|
||||||
|
}
|
||||||
if (r.message[1] == doc.price_list_currency) {
|
if (r.message[1] == doc.price_list_currency) {
|
||||||
if (doc.plc_conversion_rate != 1)
|
if (doc.plc_conversion_rate != 1)
|
||||||
set_multiple(cdt, cdn, {plc_conversion_rate:1});
|
set_multiple(cdt, cdn, {plc_conversion_rate:1});
|
||||||
hide_field('plc_conversion_rate');
|
hide_field('plc_conversion_rate');
|
||||||
} else unhide_field('plc_conversion_rate');
|
} else unhide_field('plc_conversion_rate');
|
||||||
|
|
||||||
cur_frm.cscript.dynamic_label(doc, cdt, cdn, r.message[1], callback1);
|
cur_frm.cscript.dynamic_label(doc, cdt, cdn, r.message[1], callback1);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cur_frm.cscript.manage_rounded_total = function() {
|
||||||
|
if(cint(sys_defaults.disable_rounded_total)) {
|
||||||
|
cur_frm.set_df_property("rounded_total", "print_hide", 1);
|
||||||
|
cur_frm.set_df_property("rounded_total_export", "print_hide", 1);
|
||||||
|
hide_field(["rounded_total", "rounded_total_export"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TRIGGERS FOR CALCULATIONS
|
// TRIGGERS FOR CALCULATIONS
|
||||||
// =====================================================================================================
|
// =====================================================================================================
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
|
|
||||||
|
|
||||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||||
|
cur_frm.cscript.manage_rounded_total();
|
||||||
|
|
||||||
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
if(!doc.status) set_multiple(cdt,cdn,{status:'Draft'});
|
||||||
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
if(!doc.transaction_date) set_multiple(cdt,cdn,{transaction_date:get_today()});
|
||||||
if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
|
if(!doc.price_list_currency) set_multiple(cdt, cdn, {price_list_currency: doc.currency, plc_conversion_rate: 1});
|
||||||
|
@ -40,7 +40,8 @@ keydict = {
|
|||||||
'account_url':'account_url',
|
'account_url':'account_url',
|
||||||
'allow_negative_stock' : 'allow_negative_stock',
|
'allow_negative_stock' : 'allow_negative_stock',
|
||||||
'maintain_same_rate' : 'maintain_same_rate',
|
'maintain_same_rate' : 'maintain_same_rate',
|
||||||
'session_expiry': 'session_expiry'
|
'session_expiry': 'session_expiry',
|
||||||
|
'disable_rounded_total': 'disable_rounded_total',
|
||||||
}
|
}
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
[
|
[
|
||||||
{
|
{
|
||||||
"creation": "2013-01-29 19:25:56",
|
"creation": "2013-02-19 12:28:27",
|
||||||
"docstatus": 0,
|
"docstatus": 0,
|
||||||
"modified": "2013-02-13 09:56:28",
|
"modified": "2013-02-20 14:08:59",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"owner": "Administrator"
|
"owner": "Administrator"
|
||||||
},
|
},
|
||||||
@ -27,6 +27,8 @@
|
|||||||
"permlevel": 0
|
"permlevel": 0
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"amend": 0,
|
||||||
|
"cancel": 0,
|
||||||
"create": 1,
|
"create": 1,
|
||||||
"doctype": "DocPerm",
|
"doctype": "DocPerm",
|
||||||
"name": "__common__",
|
"name": "__common__",
|
||||||
@ -332,6 +334,13 @@
|
|||||||
"label": "Delivery Note Required",
|
"label": "Delivery Note Required",
|
||||||
"options": "No\nYes"
|
"options": "No\nYes"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"description": "If disable, 'Rounded Total' field will not be visible in any transaction",
|
||||||
|
"doctype": "DocField",
|
||||||
|
"fieldname": "disable_rounded_total",
|
||||||
|
"fieldtype": "Check",
|
||||||
|
"label": "Disable Rounded Total"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"doctype": "DocField",
|
"doctype": "DocField",
|
||||||
"fieldname": "buying",
|
"fieldname": "buying",
|
||||||
@ -408,11 +417,6 @@
|
|||||||
"fieldtype": "Data",
|
"fieldtype": "Data",
|
||||||
"label": "SMS Sender Name"
|
"label": "SMS Sender Name"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"amend": 0,
|
|
||||||
"cancel": 0,
|
|
||||||
"doctype": "DocPerm"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"doctype": "DocPerm"
|
"doctype": "DocPerm"
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ wn.require('app/utilities/doctype/sms_control/sms_control.js');
|
|||||||
// ONLOAD
|
// ONLOAD
|
||||||
// ================================================================================================
|
// ================================================================================================
|
||||||
cur_frm.cscript.onload = function(doc, dt, dn) {
|
cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||||
|
cur_frm.cscript.manage_rounded_total();
|
||||||
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
if(!doc.status) set_multiple(dt,dn,{status:'Draft'});
|
||||||
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
|
if(!doc.transaction_date) set_multiple(dt,dn,{transaction_date:get_today()});
|
||||||
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
if(!doc.posting_date) set_multiple(dt,dn,{posting_date:get_today()});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user