aii: patch: update valuation rate in purchase invoice item
This commit is contained in:
parent
0fc2454384
commit
456465770b
13
patches/march_2013/p07_update_valuation_rate.py
Normal file
13
patches/march_2013/p07_update_valuation_rate.py
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute():
|
||||||
|
for purchase_invoice in webnotes.conn.sql("""select distinct parent
|
||||||
|
from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(valuation_rate, 0)=0"""):
|
||||||
|
pi = webnotes.get_obj("Purchase Invoice", purchase_invoice)
|
||||||
|
pi.calculate_taxes_and_totals()
|
||||||
|
pi.update_raw_material_cost()
|
||||||
|
pi.update_valuation_rate("entries")
|
||||||
|
for item in pi.doclist.get({"parentfield": "entries"}):
|
||||||
|
webnotes.conn.set_value("Purchase Invoice Item", item.name, "valuation_rate",
|
||||||
|
item.valuation_rate)
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user