mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 07:29:22 +00:00
committed by
mergify-bot
parent
12f1f8e111
commit
51ce1e1d4e
@@ -588,16 +588,18 @@ class PurchaseInvoice(BuyingController):
|
|||||||
amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount"))
|
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'))
|
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:
|
if auto_accounting_for_non_stock_items:
|
||||||
# Post reverse entry for Stock-Received-But-Not-Billed if it is booked in Purchase Receipt
|
service_received_but_not_billed_account = self.get_company_default("service_received_but_not_billed")
|
||||||
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:
|
if item.purchase_receipt:
|
||||||
expense_account = service_received_but_not_billed_account
|
# 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({
|
gl_entries.append(self.get_gl_dict({
|
||||||
"account": expense_account,
|
"account": expense_account,
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ class Company(NestedSet):
|
|||||||
self.validate_currency()
|
self.validate_currency()
|
||||||
self.validate_coa_input()
|
self.validate_coa_input()
|
||||||
self.validate_perpetual_inventory()
|
self.validate_perpetual_inventory()
|
||||||
|
self.validate_perpetual_inventory_for_non_stock_items()
|
||||||
self.check_country_change()
|
self.check_country_change()
|
||||||
self.set_chart_of_accounts()
|
self.set_chart_of_accounts()
|
||||||
self.validate_parent_company()
|
self.validate_parent_company()
|
||||||
@@ -182,6 +183,12 @@ class Company(NestedSet):
|
|||||||
frappe.msgprint(_("Set default inventory account for perpetual inventory"),
|
frappe.msgprint(_("Set default inventory account for perpetual inventory"),
|
||||||
alert=True, indicator='orange')
|
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):
|
def check_country_change(self):
|
||||||
frappe.flags.country_change = False
|
frappe.flags.country_change = False
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,6 @@ class PurchaseReceipt(BuyingController):
|
|||||||
stock_rbnb = self.get_company_default("stock_received_but_not_billed")
|
stock_rbnb = self.get_company_default("stock_received_but_not_billed")
|
||||||
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
|
landed_cost_entries = get_item_account_wise_additional_cost(self.name)
|
||||||
expenses_included_in_valuation = self.get_company_default("expenses_included_in_valuation")
|
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'))
|
auto_accounting_for_non_stock_items = cint(frappe.db.get_value('Company', self.company, 'enable_perpetual_inventory_for_non_stock_items'))
|
||||||
|
|
||||||
gl_entries = []
|
gl_entries = []
|
||||||
@@ -305,6 +304,7 @@ class PurchaseReceipt(BuyingController):
|
|||||||
warehouse_with_no_account.append(d.warehouse)
|
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:
|
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)
|
credit_currency = get_account_currency(service_received_but_not_billed_account)
|
||||||
|
|
||||||
gl_entries.append(self.get_gl_dict({
|
gl_entries.append(self.get_gl_dict({
|
||||||
|
|||||||
Reference in New Issue
Block a user