[minor] Set expense account as Stock RBNB for perpetual inventory after mapping
This commit is contained in:
parent
621f4cd7c9
commit
ddc295b4b3
@ -133,6 +133,14 @@ class AccountsController(TransactionBase):
|
||||
def set_missing_item_details(self):
|
||||
"""set missing item values"""
|
||||
from erpnext.stock.get_item_details import get_item_details
|
||||
|
||||
if self.doctype == "Purchase Invoice":
|
||||
auto_accounting_for_stock = cint(frappe.defaults.get_global_default("auto_accounting_for_stock"))
|
||||
|
||||
if auto_accounting_for_stock:
|
||||
stock_not_billed_account = self.get_company_default("stock_received_but_not_billed")
|
||||
|
||||
stock_items = self.get_stock_items()
|
||||
|
||||
if hasattr(self, "items"):
|
||||
parent_dict = {}
|
||||
@ -170,6 +178,15 @@ class AccountsController(TransactionBase):
|
||||
if item.price_list_rate:
|
||||
item.rate = flt(item.price_list_rate *
|
||||
(1.0 - (flt(item.discount_percentage) / 100.0)), item.precision("rate"))
|
||||
|
||||
if self.doctype == "Purchase Invoice":
|
||||
if auto_accounting_for_stock and item.item_code in stock_items \
|
||||
and self.is_opening == 'No' \
|
||||
and (not item.po_detail or not frappe.db.get_value("Purchase Order Item",
|
||||
item.po_detail, "delivered_by_supplier")):
|
||||
|
||||
item.expense_account = stock_not_billed_account
|
||||
item.cost_center = None
|
||||
|
||||
def set_taxes(self):
|
||||
if not self.meta.get_field("taxes"):
|
||||
|
Loading…
x
Reference in New Issue
Block a user