shifted get_company_currency from transaction base to setup/utils.py
This commit is contained in:
parent
03fa78597d
commit
9d9aec1ed4
@ -17,26 +17,17 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, get_defaults, now, sendmail
|
from webnotes.utils import cstr, flt, get_defaults
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.doc import Document, addchild
|
from webnotes.model.doc import Document, addchild
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
from webnotes.utils.email_lib import sendmail
|
|
||||||
|
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
self.doc, self.doclist = d, dl
|
self.doc, self.doclist = d, dl
|
||||||
self.entries = []
|
self.entries = []
|
||||||
|
|
||||||
def get_company_currency(self,arg=''):
|
|
||||||
dcc = TransactionBase().get_company_currency(arg)
|
|
||||||
return dcc
|
|
||||||
|
|
||||||
def get_period_difference(self,arg, cost_center =''):
|
def get_period_difference(self,arg, cost_center =''):
|
||||||
# used in General Ledger Page Report
|
# used in General Ledger Page Report
|
||||||
# used for Budget where cost center passed as extra argument
|
# used for Budget where cost center passed as extra argument
|
||||||
|
@ -18,15 +18,14 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
|
from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.doc import addchild, make_autoname
|
from webnotes.model.doc import addchild, make_autoname
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import form, msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
from utilities.transaction_base import TransactionBase
|
|
||||||
|
|
||||||
class DocType:
|
class DocType:
|
||||||
def __init__(self,d,dl):
|
def __init__(self,d,dl):
|
||||||
@ -238,7 +237,7 @@ class DocType:
|
|||||||
self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
|
self.doc.pay_to_recd_from = webnotes.conn.get_value(master_type, ' - '.join(d.account.split(' - ')[:-1]), master_type == 'Customer' and 'customer_name' or 'supplier_name')
|
||||||
|
|
||||||
if acc_type == 'Bank or Cash':
|
if acc_type == 'Bank or Cash':
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
amt = cint(d.debit) and d.debit or d.credit
|
amt = cint(d.debit) and d.debit or d.credit
|
||||||
self.doc.total_amount = dcc +' '+ cstr(amt)
|
self.doc.total_amount = dcc +' '+ cstr(amt)
|
||||||
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(dcc, cstr(amt))
|
self.doc.total_amount_in_words = get_obj('Sales Common').get_total_in_words(dcc, cstr(amt))
|
||||||
|
@ -21,6 +21,7 @@ from webnotes.utils import add_days, cint, cstr, flt, formatdate, get_defaults
|
|||||||
from webnotes.model.wrapper import getlist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -159,7 +160,7 @@ class DocType(BuyingController):
|
|||||||
# Check Conversion Rate
|
# Check Conversion Rate
|
||||||
# ----------------------
|
# ----------------------
|
||||||
def check_conversion_rate(self):
|
def check_conversion_rate(self):
|
||||||
default_currency = super(DocType, self).get_company_currency(self.doc.company)
|
default_currency = get_company_currency(self.doc.company)
|
||||||
if not default_currency:
|
if not default_currency:
|
||||||
msgprint('Message: Please enter default currency in Company Master')
|
msgprint('Message: Please enter default currency in Company Master')
|
||||||
raise Exception
|
raise Exception
|
||||||
@ -370,7 +371,7 @@ class DocType(BuyingController):
|
|||||||
pc_obj = get_obj(dt='Purchase Common')
|
pc_obj = get_obj(dt='Purchase Common')
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
|
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency,
|
||||||
self.doc.grand_total_import)
|
self.doc.grand_total_import)
|
||||||
|
@ -26,6 +26,7 @@ from webnotes.model.doc import make_autoname
|
|||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist, copy_doclist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import session, form, msgprint
|
from webnotes import session, form, msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
session = webnotes.session
|
session = webnotes.session
|
||||||
|
|
||||||
@ -412,7 +413,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
|
|
||||||
def set_in_words(self):
|
def set_in_words(self):
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
self.doc.in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = get_obj('Sales Common').get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
@ -503,7 +504,7 @@ class DocType(TransactionBase):
|
|||||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||||
|
|
||||||
for d in getlist(self.doclist, 'packing_details'):
|
for d in getlist(self.doclist, 'packing_details'):
|
||||||
bin = sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
bin = webnotes.conn.sql("select actual_qty, projected_qty from `tabBin` where item_code = %s and warehouse = %s", (d.item_code, d.warehouse), as_dict = 1)
|
||||||
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
d.actual_qty = bin and flt(bin[0]['actual_qty']) or 0
|
||||||
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
|
d.projected_qty = bin and flt(bin[0]['projected_qty']) or 0
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from webnotes.model.wrapper import getlist
|
|||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
from buying.utils import get_last_purchase_details
|
from buying.utils import get_last_purchase_details
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -57,9 +58,6 @@ class DocType(BuyingController):
|
|||||||
# Step 4:=> validate for items
|
# Step 4:=> validate for items
|
||||||
pc_obj.validate_for_items(self)
|
pc_obj.validate_for_items(self)
|
||||||
|
|
||||||
# Step 5:=> validate conversion rate
|
|
||||||
pc_obj.validate_conversion_rate(self)
|
|
||||||
|
|
||||||
# Get po date
|
# Get po date
|
||||||
pc_obj.get_prevdoc_date(self)
|
pc_obj.get_prevdoc_date(self)
|
||||||
|
|
||||||
@ -70,7 +68,7 @@ class DocType(BuyingController):
|
|||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
from controllers.buying_controller import BuyingController
|
from controllers.buying_controller import BuyingController
|
||||||
class DocType(BuyingController):
|
class DocType(BuyingController):
|
||||||
@ -77,12 +78,11 @@ class DocType(BuyingController):
|
|||||||
pc = get_obj('Purchase Common')
|
pc = get_obj('Purchase Common')
|
||||||
pc.validate_mandatory(self)
|
pc.validate_mandatory(self)
|
||||||
pc.validate_for_items(self)
|
pc.validate_for_items(self)
|
||||||
pc.validate_conversion_rate(self)
|
|
||||||
pc.get_prevdoc_date(self)
|
pc.get_prevdoc_date(self)
|
||||||
pc.validate_reference_value(self)
|
pc.validate_reference_value(self)
|
||||||
|
|
||||||
def set_in_words(self):
|
def set_in_words(self):
|
||||||
pc = get_obj('Purchase Common')
|
pc = get_obj('Purchase Common')
|
||||||
company_currency = super(DocType, self).get_company_currency(self.doc.company)
|
company_currency = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = pc.get_total_in_words(company_currency, self.doc.grand_total)
|
self.doc.in_words = pc.get_total_in_words(company_currency, self.doc.grand_total)
|
||||||
self.doc.in_words_import = pc.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
self.doc.in_words_import = pc.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||||
|
@ -18,11 +18,11 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import add_days, cint, cstr, flt, getdate
|
from webnotes.utils import add_days, cint, cstr, flt, getdate
|
||||||
from webnotes.model import db_exists
|
|
||||||
from webnotes.model.doc import make_autoname
|
from webnotes.model.doc import make_autoname
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ class DocType(TransactionBase):
|
|||||||
|
|
||||||
def validate(self):
|
def validate(self):
|
||||||
self.check_existing()
|
self.check_existing()
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.total_in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
self.doc.total_in_words = get_obj('Sales Common').get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
|
|
||||||
|
|
||||||
|
@ -17,12 +17,11 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, load_json
|
from webnotes.utils import cstr, getdate
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.doc import Document
|
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ class DocType(TransactionBase):
|
|||||||
sales_com_obj.check_conversion_rate(self)
|
sales_com_obj.check_conversion_rate(self)
|
||||||
|
|
||||||
# Get total in words
|
# Get total in words
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from webnotes.model.doc import addchild
|
|||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
from webnotes.model.wrapper import getlist, copy_doclist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import form, msgprint, _
|
from webnotes import form, msgprint, _
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
get_value = webnotes.conn.get_value
|
get_value = webnotes.conn.get_value
|
||||||
|
|
||||||
@ -351,7 +352,7 @@ class DocType(TransactionBase):
|
|||||||
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
# Check Conversion Rate (i.e. it will not allow conversion rate to be 1 for Currency other than default currency set in Global Defaults)
|
||||||
# ===========================================================================
|
# ===========================================================================
|
||||||
def check_conversion_rate(self, obj):
|
def check_conversion_rate(self, obj):
|
||||||
default_currency = TransactionBase().get_company_currency(obj.doc.company)
|
default_currency = get_company_currency(obj.doc.company)
|
||||||
if not default_currency:
|
if not default_currency:
|
||||||
msgprint('Message: Please enter default currency in Company Master')
|
msgprint('Message: Please enter default currency in Company Master')
|
||||||
raise Exception
|
raise Exception
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, date_diff, flt, getdate
|
from webnotes.utils import cstr, flt, getdate
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -222,7 +222,7 @@ class DocType(TransactionBase):
|
|||||||
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
|
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
|
@ -18,9 +18,9 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, has_common, make_esc
|
from webnotes.utils import cstr, flt, has_common, make_esc
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
|
||||||
from webnotes import session, msgprint
|
from webnotes import session, msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
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']]):
|
if not has_common(appr_roles, webnotes.user.get_roles()) and not has_common(appr_users, [session['user']]):
|
||||||
msg, add_msg = '',''
|
msg, add_msg = '',''
|
||||||
if max_amount:
|
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))
|
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 == '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)+'%')
|
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
|
@ -18,10 +18,10 @@ from __future__ import unicode_literals
|
|||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cstr, flt, getdate
|
from webnotes.utils import cstr, flt, getdate
|
||||||
from webnotes.model import db_exists
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.wrapper import getlist, copy_doclist
|
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -149,7 +149,7 @@ class DocType(TransactionBase):
|
|||||||
sales_com_obj.check_conversion_rate(self)
|
sales_com_obj.check_conversion_rate(self)
|
||||||
|
|
||||||
# Get total in Words
|
# Get total in Words
|
||||||
dcc = TransactionBase().get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
self.doc.in_words = sales_com_obj.get_total_in_words(dcc, self.doc.rounded_total)
|
||||||
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
self.doc.in_words_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ from webnotes.model.doc import addchild
|
|||||||
from webnotes.model.wrapper import getlist
|
from webnotes.model.wrapper import getlist
|
||||||
from webnotes.model.code import get_obj
|
from webnotes.model.code import get_obj
|
||||||
from webnotes import msgprint
|
from webnotes import msgprint
|
||||||
|
from setup.utils import get_company_currency
|
||||||
|
|
||||||
sql = webnotes.conn.sql
|
sql = webnotes.conn.sql
|
||||||
|
|
||||||
@ -131,13 +132,12 @@ class DocType(BuyingController):
|
|||||||
pc_obj = get_obj(dt='Purchase Common')
|
pc_obj = get_obj(dt='Purchase Common')
|
||||||
pc_obj.validate_for_items(self)
|
pc_obj.validate_for_items(self)
|
||||||
pc_obj.validate_mandatory(self)
|
pc_obj.validate_mandatory(self)
|
||||||
pc_obj.validate_conversion_rate(self)
|
|
||||||
pc_obj.get_prevdoc_date(self)
|
pc_obj.get_prevdoc_date(self)
|
||||||
pc_obj.validate_reference_value(self)
|
pc_obj.validate_reference_value(self)
|
||||||
self.check_for_stopped_status(pc_obj)
|
self.check_for_stopped_status(pc_obj)
|
||||||
|
|
||||||
# get total in words
|
# get total in words
|
||||||
dcc = super(DocType, self).get_company_currency(self.doc.company)
|
dcc = get_company_currency(self.doc.company)
|
||||||
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
self.doc.in_words = pc_obj.get_total_in_words(dcc, self.doc.grand_total)
|
||||||
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
self.doc.in_words_import = pc_obj.get_total_in_words(self.doc.currency, self.doc.grand_total_import)
|
||||||
# update valuation rate
|
# update valuation rate
|
||||||
|
@ -229,14 +229,6 @@ class TransactionBase(DocListController):
|
|||||||
ch.incentives = d and flt(d[3]) or 0
|
ch.incentives = d and flt(d[3]) or 0
|
||||||
ch.idx = idx
|
ch.idx = idx
|
||||||
idx += 1
|
idx += 1
|
||||||
|
|
||||||
# Get Company Specific Default Currency
|
|
||||||
# -------------------------------------
|
|
||||||
def get_company_currency(self, name):
|
|
||||||
ret = webnotes.conn.sql("select default_currency from tabCompany where name = '%s'" %(name))
|
|
||||||
dcc = ret and ret[0][0] or get_defaults()['currency']
|
|
||||||
return dcc
|
|
||||||
|
|
||||||
|
|
||||||
def load_notification_message(self):
|
def load_notification_message(self):
|
||||||
dt = self.doc.doctype.lower().replace(" ", "_")
|
dt = self.doc.doctype.lower().replace(" ", "_")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user