shifted get_company_currency from transaction base to setup/utils.py

This commit is contained in:
Anand Doshi
2013-01-17 15:44:57 +05:30
parent 03fa78597d
commit 9d9aec1ed4
15 changed files with 65 additions and 55 deletions

View File

@@ -17,12 +17,11 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, load_json
from webnotes.model import db_exists
from webnotes.model.doc import Document
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.utils import cstr, getdate
from webnotes.model.wrapper import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from setup.utils import get_company_currency
sql = webnotes.conn.sql
@@ -194,7 +193,7 @@ class DocType(TransactionBase):
sales_com_obj.check_conversion_rate(self)
# 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_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)

View File

@@ -23,6 +23,7 @@ from webnotes.model.doc import addchild
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.model.code import get_obj
from webnotes import form, msgprint, _
from setup.utils import get_company_currency
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)
# ===========================================================================
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:
msgprint('Message: Please enter default currency in Company Master')
raise Exception

View File

@@ -17,11 +17,11 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cstr, date_diff, flt, getdate
from webnotes.model import db_exists
from webnotes.model.wrapper import getlist, copy_doclist
from webnotes.utils import cstr, flt, getdate
from webnotes.model.wrapper import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from setup.utils import get_company_currency
sql = webnotes.conn.sql
@@ -222,7 +222,7 @@ class DocType(TransactionBase):
self.doclist = sales_com_obj.make_packing_list(self,'sales_order_details')
# 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_export = sales_com_obj.get_total_in_words(self.doc.currency, self.doc.rounded_total_export)