production order: test fixed and added in test_stock_entry.py

This commit is contained in:
Rushabh Mehta
2014-04-16 19:20:11 +05:30
parent 166bc2a0e0
commit 052fe82688
4 changed files with 34 additions and 35 deletions

View File

@@ -45,6 +45,7 @@ class StockController(AccountsController):
for sle in sle_list:
if warehouse_account.get(sle.warehouse):
# from warehouse account
self.check_expense_account(detail)
gl_list.append(self.get_gl_dict({
@@ -230,10 +231,10 @@ class StockController(AccountsController):
make_gl_entries(gl_entries)
def check_expense_account(self, item):
if item.meta.get_field("expense_account") and not item.expense_account:
if not item.get("expense_account"):
frappe.throw(_("Expense or Difference account is mandatory for Item {0} as there is difference in value").format(item.item_code))
if getattr(item, "expense_account", None) and not item.cost_center:
if item.get("expense_account") and not item.cost_center:
frappe.throw(_("""Cost Center is mandatory for Item {0}""").format(item.item_code))
def get_sl_entries(self, d, args):