mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-03 21:48:27 +00:00
shifted get_company_currency from transaction base to setup/utils.py
This commit is contained in:
@@ -18,9 +18,9 @@ from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import cstr, flt, has_common, make_esc
|
||||
from webnotes.model import db_exists
|
||||
from webnotes.model.wrapper import getlist, copy_doclist
|
||||
from webnotes.model.wrapper import getlist
|
||||
from webnotes import session, msgprint
|
||||
from setup.utils import get_company_currency
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
|
||||
@@ -52,7 +52,7 @@ class DocType(TransactionBase):
|
||||
if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, [session['user']]):
|
||||
msg, add_msg = '',''
|
||||
if max_amount:
|
||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
||||
dcc = get_company_currency(self.doc.company)
|
||||
if based_on == 'Grand Total': msg = "since Grand Total exceeds %s. %s" % (dcc, flt(max_amount))
|
||||
elif based_on == 'Itemwise Discount': msg = "since Discount exceeds %s for Item Code : %s" % (cstr(max_amount)+'%', item)
|
||||
elif based_on == 'Average Discount' or based_on == 'Customerwise Discount': msg = "since Discount exceeds %s" % (cstr(max_amount)+'%')
|
||||
|
||||
28
setup/utils.py
Normal file
28
setup/utils.py
Normal file
@@ -0,0 +1,28 @@
|
||||
# ERPNext - web based ERP (http://erpnext.com)
|
||||
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
def get_company_currency(company):
|
||||
currency = webnotes.conn.get_value("Company", company, "default_currency")
|
||||
if not currency:
|
||||
currency = webnotes.conn.get_default("currency")
|
||||
if not currency:
|
||||
msgprint(_('Please specify Default Currency in Company Master \
|
||||
and Global Defaults'), raise_exception=True)
|
||||
|
||||
return currency
|
||||
Reference in New Issue
Block a user