[minor] Set expense account as Stock RBNB for perpetual inventory after mapping
This commit is contained in:
parent
621f4cd7c9
commit
ddc295b4b3
@ -134,6 +134,14 @@ class AccountsController(TransactionBase):
|
|||||||
"""set missing item values"""
|
"""set missing item values"""
|
||||||
from erpnext.stock.get_item_details import get_item_details
|
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"):
|
if hasattr(self, "items"):
|
||||||
parent_dict = {}
|
parent_dict = {}
|
||||||
for fieldname in self.meta.get_valid_columns():
|
for fieldname in self.meta.get_valid_columns():
|
||||||
@ -171,6 +179,15 @@ class AccountsController(TransactionBase):
|
|||||||
item.rate = flt(item.price_list_rate *
|
item.rate = flt(item.price_list_rate *
|
||||||
(1.0 - (flt(item.discount_percentage) / 100.0)), item.precision("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):
|
def set_taxes(self):
|
||||||
if not self.meta.get_field("taxes"):
|
if not self.meta.get_field("taxes"):
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user