Merge pull request #312 from saurabh6790/master
updated accounts_controller.py, buying_controller.py, selling_controller.py
This commit is contained in:
commit
2d12a42145
@ -22,6 +22,10 @@ from webnotes.utils import flt
|
|||||||
from utilities.transaction_base import TransactionBase
|
from utilities.transaction_base import TransactionBase
|
||||||
|
|
||||||
class AccountsController(TransactionBase):
|
class AccountsController(TransactionBase):
|
||||||
|
def validate(self):
|
||||||
|
if self.meta.get_field("grand_total"):
|
||||||
|
self.validate_value("grand_total", ">=", 0)
|
||||||
|
|
||||||
def get_gl_dict(self, args, cancel=None):
|
def get_gl_dict(self, args, cancel=None):
|
||||||
"""this method populates the common properties of a gl entry record"""
|
"""this method populates the common properties of a gl entry record"""
|
||||||
if cancel is None:
|
if cancel is None:
|
||||||
@ -101,4 +105,4 @@ class AccountsController(TransactionBase):
|
|||||||
|
|
||||||
@webnotes.whitelist()
|
@webnotes.whitelist()
|
||||||
def get_default_account(account_for, company):
|
def get_default_account(account_for, company):
|
||||||
return webnotes.conn.get_value("Company", company, account_for)
|
return webnotes.conn.get_value("Company", company, account_for)
|
||||||
|
@ -27,7 +27,8 @@ from webnotes.model.utils import round_floats_in_doc
|
|||||||
from controllers.stock_controller import StockController
|
from controllers.stock_controller import StockController
|
||||||
|
|
||||||
class BuyingController(StockController):
|
class BuyingController(StockController):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
super(BuyingController, self).validate()
|
||||||
if self.meta.get_field("currency"):
|
if self.meta.get_field("currency"):
|
||||||
self.company_currency = get_company_currency(self.doc.company)
|
self.company_currency = get_company_currency(self.doc.company)
|
||||||
self.validate_conversion_rate("currency", "conversion_rate")
|
self.validate_conversion_rate("currency", "conversion_rate")
|
||||||
@ -37,7 +38,7 @@ class BuyingController(StockController):
|
|||||||
|
|
||||||
# IMPORTANT: enable this only when client side code is similar to this one
|
# IMPORTANT: enable this only when client side code is similar to this one
|
||||||
# self.calculate_taxes_and_totals()
|
# self.calculate_taxes_and_totals()
|
||||||
|
|
||||||
# set total in words
|
# set total in words
|
||||||
self.set_total_in_words()
|
self.set_total_in_words()
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ from controllers.stock_controller import StockController
|
|||||||
|
|
||||||
class SellingController(StockController):
|
class SellingController(StockController):
|
||||||
def validate(self):
|
def validate(self):
|
||||||
|
super(SellingController, self).validate()
|
||||||
self.set_total_in_words()
|
self.set_total_in_words()
|
||||||
|
|
||||||
def set_total_in_words(self):
|
def set_total_in_words(self):
|
||||||
@ -37,4 +38,4 @@ class SellingController(StockController):
|
|||||||
self.doc.grand_total or self.doc.rounded_total, company_currency)
|
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(disable_rounded_total and
|
self.doc.in_words_export = money_in_words(disable_rounded_total and
|
||||||
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
||||||
|
Loading…
Reference in New Issue
Block a user