refactor get_voucher_details in stock_controller
This commit is contained in:
parent
052fe82688
commit
eea802298e
@ -74,14 +74,11 @@ class StockController(AccountsController):
|
|||||||
return process_gl_map(gl_list)
|
return process_gl_map(gl_list)
|
||||||
|
|
||||||
def get_voucher_details(self, stock_ledger, default_expense_account, default_cost_center):
|
def get_voucher_details(self, stock_ledger, default_expense_account, default_cost_center):
|
||||||
if not default_expense_account:
|
details = self.get(self.fname)
|
||||||
details = self.get(self.fname)
|
if default_expense_account:
|
||||||
else:
|
for d in details:
|
||||||
details = [frappe._dict({
|
d.expense_account = default_expense_account
|
||||||
"name":d,
|
d.cost_center = default_cost_center
|
||||||
"expense_account": default_expense_account,
|
|
||||||
"cost_center": default_cost_center
|
|
||||||
}) for d in stock_ledger.keys()]
|
|
||||||
|
|
||||||
return details
|
return details
|
||||||
|
|
||||||
@ -234,8 +231,8 @@ class StockController(AccountsController):
|
|||||||
if not item.get("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))
|
frappe.throw(_("Expense or Difference account is mandatory for Item {0} as there is difference in value").format(item.item_code))
|
||||||
|
|
||||||
if item.get("expense_account") and not item.cost_center:
|
if item.get("expense_account") and not item.get("cost_center"):
|
||||||
frappe.throw(_("""Cost Center is mandatory for Item {0}""").format(item.item_code))
|
frappe.throw(_("""Cost Center is mandatory for Item {0}""").format(item.get("item_code")))
|
||||||
|
|
||||||
def get_sl_entries(self, d, args):
|
def get_sl_entries(self, d, args):
|
||||||
sl_dict = {
|
sl_dict = {
|
||||||
|
Loading…
Reference in New Issue
Block a user