aii fixes

This commit is contained in:
Nabin Hait
2013-03-29 16:42:33 +05:30
parent acecb94a0f
commit 787c02ee42
27 changed files with 294 additions and 150 deletions

View File

@@ -41,9 +41,10 @@ class SellingController(StockController):
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)
def set_buying_amount(self):
def set_buying_amount(self, stock_ledger_entries = None):
from stock.utils import get_buying_amount
stock_ledger_entries = self.get_stock_ledger_entries()
if not stock_ledger_entries:
stock_ledger_entries = self.get_stock_ledger_entries()
item_sales_bom = {}
for d in self.doclist.get({"parentfield": "packing_details"}):
@@ -65,4 +66,8 @@ class SellingController(StockController):
def check_expense_account(self, item):
if item.buying_amount and not item.expense_account:
msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
raise_exception=1)
if item.buying_amount and not item.cost_center:
msgprint(_("""Cost Center is mandatory for item: """) + item.item_code,
raise_exception=1)

View File

@@ -16,7 +16,8 @@
from __future__ import unicode_literals
import webnotes
from webnotes import msgprint, _
from webnotes.utils import cint
import webnotes.defaults
from controllers.accounts_controller import AccountsController
class StockController(AccountsController):
@@ -72,4 +73,10 @@ class StockController(AccountsController):
item_list.append(item.item_code)
warehouse_list.append(item.warehouse)
return list(set(item_list)), list(set(warehouse_list))
return list(set(item_list)), list(set(warehouse_list))
def make_cancel_gl_entries(self):
if webnotes.conn.sql("""select name from `tabGL Entry` where voucher_type=%s
and voucher_no=%s and ifnull(is_cancelled, 'No')='No'""",
(self.doc.doctype, self.doc.name)):
self.make_gl_entries()