fix: Test Cases
This commit is contained in:
parent
c70eb30e7e
commit
ded3ab1cd7
@ -571,16 +571,18 @@ class PurchaseInvoice(BuyingController):
|
||||
amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount"))
|
||||
|
||||
auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items'))
|
||||
service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed")
|
||||
|
||||
if item.purchase_receipt and auto_accounting_for_non_stock_items:
|
||||
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
|
||||
expense_booked_in_pr = frappe.db.get_value('GL Entry', {'is_cancelled': 0,
|
||||
'voucher_type': 'Purchase Receipt', 'voucher_no': item.purchase_receipt, 'voucher_detail_no': item.pr_detail,
|
||||
'account':service_received_but_not_billed_account}, ['name'])
|
||||
if auto_accounting_for_non_stock_items:
|
||||
service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed")
|
||||
|
||||
if expense_booked_in_pr:
|
||||
expense_account = service_received_but_not_billed_account
|
||||
if item.purchase_receipt:
|
||||
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
|
||||
expense_booked_in_pr = frappe.db.get_value('GL Entry', {'is_cancelled': 0,
|
||||
'voucher_type': 'Purchase Receipt', 'voucher_no': item.purchase_receipt, 'voucher_detail_no': item.pr_detail,
|
||||
'account':service_received_but_not_billed_account}, ['name'])
|
||||
|
||||
if expense_booked_in_pr:
|
||||
expense_account = service_received_but_not_billed_account
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
"account": expense_account,
|
||||
|
@ -46,6 +46,7 @@ class Company(NestedSet):
|
||||
self.validate_currency()
|
||||
self.validate_coa_input()
|
||||
self.validate_perpetual_inventory()
|
||||
self.validate_perpetual_inventory_for_non_stock_items()
|
||||
self.check_country_change()
|
||||
self.set_chart_of_accounts()
|
||||
self.validate_parent_company()
|
||||
@ -182,6 +183,12 @@ class Company(NestedSet):
|
||||
frappe.msgprint(_("Set default inventory account for perpetual inventory"),
|
||||
alert=True, indicator='orange')
|
||||
|
||||
def validate_perpetual_inventory_for_non_stock_items(self):
|
||||
if not self.get("__islocal"):
|
||||
if cint(self.enable_perpetual_inventory_for_non_stock_items) == 1 and not self.service_received_but_not_billed:
|
||||
frappe.throw(_("Set default {0} account for perpetual inventory for non stock items").format(
|
||||
frappe.bold('Service Received But Not Billed')))
|
||||
|
||||
def check_country_change(self):
|
||||
frappe.flags.country_change = False
|
||||
|
||||
|
@ -211,7 +211,6 @@ class PurchaseReceipt(BuyingController):
|
||||
stock_rbnb = self.get_company_default("stock_received_but_not_billed")
|
||||
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
|
||||
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
|
||||
service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed")
|
||||
auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items'))
|
||||
|
||||
gl_entries = []
|
||||
@ -305,6 +304,7 @@ class PurchaseReceipt(BuyingController):
|
||||
warehouse_with_no_account.append(d.warehouse)
|
||||
elif d.item_code not in stock_items and flt(d.qty) and auto_accounting_for_non_stock_items:
|
||||
|
||||
service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed")
|
||||
credit_currency = get_account_currency(service_received_but_not_billed_account)
|
||||
|
||||
gl_entries.append(self.get_gl_dict({
|
||||
|
Loading…
x
Reference in New Issue
Block a user