mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-05 22:48:27 +00:00
[fix] [minor] buying amount for sales bom item
This commit is contained in:
@@ -85,7 +85,7 @@ class SellingController(StockController):
|
||||
self.doc.grand_total_export or self.doc.rounded_total_export, self.doc.currency)
|
||||
|
||||
def set_buying_amount(self, stock_ledger_entries = None):
|
||||
from stock.utils import get_buying_amount
|
||||
from stock.utils import get_buying_amount, get_sales_bom_buying_amount
|
||||
if not stock_ledger_entries:
|
||||
stock_ledger_entries = self.get_stock_ledger_entries()
|
||||
|
||||
@@ -99,13 +99,18 @@ class SellingController(StockController):
|
||||
for item in self.doclist.get({"parentfield": self.fname}):
|
||||
if item.item_code in self.stock_items or \
|
||||
(item_sales_bom and item_sales_bom.get(item.item_code)):
|
||||
buying_amount = get_buying_amount(item.item_code, self.doc.doctype, self.doc.name, item.name,
|
||||
stock_ledger_entries.get((item.item_code, item.warehouse), []),
|
||||
item_sales_bom)
|
||||
if item.item_code in self.stock_items:
|
||||
buying_amount = get_buying_amount(self.doc.doctype, self.doc.name,
|
||||
item.name, stock_ledger_entries.get((item.item_code,
|
||||
item.warehouse), []))
|
||||
elif item_sales_bom and item_sales_bom.get(item.item_code):
|
||||
buying_amount = get_sales_bom_buying_amount(item.item_code, item.warehouse,
|
||||
self.doc.doctype, self.doc.name, item.name, stock_ledger_entries,
|
||||
item_sales_bom)
|
||||
|
||||
item.buying_amount = buying_amount >= 0.01 and buying_amount or 0
|
||||
webnotes.conn.set_value(item.doctype, item.name, "buying_amount",
|
||||
item.buying_amount)
|
||||
item.buying_amount = buying_amount >= 0.01 and buying_amount or 0
|
||||
webnotes.conn.set_value(item.doctype, item.name, "buying_amount",
|
||||
item.buying_amount)
|
||||
|
||||
def check_expense_account(self, item):
|
||||
if item.buying_amount and not item.expense_account:
|
||||
|
||||
Reference in New Issue
Block a user