Skip to content

Commit

Permalink
fix: validate if asset account is set against company
Browse files Browse the repository at this point in the history
(cherry picked from commit c3e0de2)
  • Loading branch information
nextchamp-saqib authored and mergify-bot committed Dec 13, 2021
1 parent 33eeb64 commit 7d1953b
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,15 @@ def set_expense_account(self, for_validate=False):
else:
item.expense_account = stock_not_billed_account
elif item.is_fixed_asset and not is_cwip_accounting_enabled(asset_category):
item.expense_account = get_asset_category_account('fixed_asset_account', item=item.item_code,
asset_category_account = get_asset_category_account('fixed_asset_account', item=item.item_code,
company = self.company)
if not asset_category_account:
form_link = get_link_to_form('Asset Category', asset_category)
throw(
_("Please set Fixed Asset Account in {} against {}.").format(form_link, self.company),
title=_("Missing Account")
)
item.expense_account = asset_category_account
elif item.is_fixed_asset and item.pr_detail:
item.expense_account = asset_received_but_not_billed
elif not item.expense_account and for_validate:
Expand Down

0 comments on commit 7d1953b

Please sign in to comment.