Update last purchase rate from the purchase invoice (#12189)
This commit is contained in:
committed by
Nabin Hait
parent
31d7433946
commit
fe22686a8f
@@ -8,7 +8,7 @@ from frappe.utils import flt,cint, cstr, getdate
|
||||
|
||||
from erpnext.accounts.party import get_party_details
|
||||
from erpnext.stock.get_item_details import get_conversion_factor
|
||||
from erpnext.buying.utils import validate_for_items
|
||||
from erpnext.buying.utils import validate_for_items, update_last_purchase_rate
|
||||
from erpnext.stock.stock_ledger import get_valuation_rate
|
||||
|
||||
from erpnext.controllers.stock_controller import StockController
|
||||
@@ -409,6 +409,18 @@ class BuyingController(StockController):
|
||||
"actual_qty": -1*flt(d.consumed_qty),
|
||||
}))
|
||||
|
||||
def on_submit(self):
|
||||
if self.get('is_return'):
|
||||
return
|
||||
|
||||
update_last_purchase_rate(self, is_submit = 1)
|
||||
|
||||
def on_cancel(self):
|
||||
if self.get('is_return'):
|
||||
return
|
||||
|
||||
update_last_purchase_rate(self, is_submit = 0)
|
||||
|
||||
def validate_schedule_date(self):
|
||||
if not self.schedule_date:
|
||||
self.schedule_date = min([d.schedule_date for d in self.get("items")])
|
||||
|
||||
Reference in New Issue
Block a user