mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-03 12:19:12 +00:00
[patch][serial no] for striped serial nos
This commit is contained in:
@@ -212,7 +212,8 @@ class DocType:
|
||||
if flt(d.qty):
|
||||
d.valuation_rate = (flt(d.purchase_rate) + (flt(d.rm_supp_cost)/flt(d.qty)) + (flt(d.item_tax_amount)/flt(d.qty))) / flt(d.conversion_factor)
|
||||
d.save()
|
||||
self.update_serial_no(d.serial_no, d.valuation_rate)
|
||||
if d.serial_no:
|
||||
self.update_serial_no(d.serial_no, d.valuation_rate)
|
||||
sql("update `tabStock Ledger Entry` set incoming_rate = '%s' where voucher_detail_no = '%s'"%(flt(d.valuation_rate), d.name))
|
||||
|
||||
res = sql("""select item_code, warehouse, posting_date, posting_time
|
||||
@@ -226,10 +227,10 @@ class DocType:
|
||||
|
||||
def update_serial_no(self, sr_no, rate):
|
||||
""" update valuation rate in serial no"""
|
||||
sr_no = cstr(sr_no).split('\n')
|
||||
for d in sr_no:
|
||||
sql("update `tabSerial No` set purchase_rate = %s where name = %s", (rate, d))
|
||||
|
||||
sr_no = map(lambda x: x.strip(), cstr(sr_no).split('\n'))
|
||||
|
||||
webnotes.conn.sql("""update `tabSerial No` set purchase_rate = %s where name in (%s)""" %
|
||||
('%s', ', '.join(['%s']*len(sr_no))), tuple([rate] + sr_no))
|
||||
|
||||
def update_landed_cost(self):
|
||||
"""
|
||||
|
||||
@@ -38,10 +38,10 @@ class DocType:
|
||||
|
||||
for d in getlist(obj.doclist, table_name):
|
||||
if d.serial_no:
|
||||
d.serial_no = cstr(d.serial_no).strip().replace(',', '\n')
|
||||
serial_nos = cstr(d.serial_no).strip().replace(',', '\n').split('\n')
|
||||
d.serial_nos = ", ".join(map(lambda x: x.strip(), serial_nos))
|
||||
d.save()
|
||||
|
||||
|
||||
def validate_serial_no_warehouse(self, obj, fname):
|
||||
for d in getlist(obj.doclist, fname):
|
||||
wh = d.warehouse or d.s_warehouse
|
||||
@@ -84,6 +84,7 @@ class DocType:
|
||||
item_details = webnotes.conn.sql("""select item_group, warranty_period
|
||||
from `tabItem` where name = '%s' and (ifnull(end_of_life,'')='' or
|
||||
end_of_life = '0000-00-00' or end_of_life > now()) """ %(d.item_code), as_dict=1)
|
||||
webnotes.errprint([d.item_code, d.valuation_rate])
|
||||
|
||||
s.purchase_document_type = obj.doc.doctype
|
||||
s.purchase_document_no = obj.doc.name
|
||||
|
||||
Reference in New Issue
Block a user