mirror of
https://github.com/frappe/erpnext.git
synced 2026-06-02 19:59:12 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,3 +5,4 @@ server_tools
|
|||||||
patch.log
|
patch.log
|
||||||
lib
|
lib
|
||||||
versions-local.db
|
versions-local.db
|
||||||
|
*.sql*
|
||||||
|
|||||||
@@ -203,6 +203,7 @@ class DocType:
|
|||||||
if flt(d.qty):
|
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.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()
|
d.save()
|
||||||
|
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))
|
sql("update `tabStock Ledger Entry` set incoming_rate = '%s' where voucher_detail_no = '%s'"%(flt(d.valuation_rate), d.name))
|
||||||
|
|
||||||
bin = sql("select t1.name, t2.posting_date, t2.posting_time from `tabBin` t1, `tabStock Ledger Entry` t2 where t2.voucher_detail_no = '%s' and t2.item_code = t1.item_code and t2.warehouse = t1.warehouse LIMIT 1" % d.name)
|
bin = sql("select t1.name, t2.posting_date, t2.posting_time from `tabBin` t1, `tabStock Ledger Entry` t2 where t2.voucher_detail_no = '%s' and t2.item_code = t1.item_code and t2.warehouse = t1.warehouse LIMIT 1" % d.name)
|
||||||
@@ -212,6 +213,13 @@ class DocType:
|
|||||||
obj = get_obj('Bin', bin[0][0]).update_entries_after(bin[0][1], bin[0][2])
|
obj = get_obj('Bin', bin[0][0]).update_entries_after(bin[0][1], bin[0][2])
|
||||||
|
|
||||||
|
|
||||||
|
def update_serial_no(self, sr_no, rate):
|
||||||
|
""" update valuation rate in serial no"""
|
||||||
|
sr_no = sr_no.split('\n')
|
||||||
|
for d in sr_no:
|
||||||
|
sql("update `tabSerial No` set purchase_rate = %s where name = %s", (rate, d))
|
||||||
|
|
||||||
|
|
||||||
def update_landed_cost(self):
|
def update_landed_cost(self):
|
||||||
"""
|
"""
|
||||||
Add extra cost and recalculate all values in pr,
|
Add extra cost and recalculate all values in pr,
|
||||||
|
|||||||
@@ -93,27 +93,27 @@ class DocType:
|
|||||||
# ---------------------
|
# ---------------------
|
||||||
def set_pur_serial_no_values(self, obj, serial_no, d, s, new_rec):
|
def set_pur_serial_no_values(self, obj, serial_no, d, s, new_rec):
|
||||||
item_details = 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)
|
item_details = 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)
|
||||||
s.purchase_document_type= obj.doc.doctype
|
s.purchase_document_type = obj.doc.doctype
|
||||||
s.purchase_document_no = obj.doc.name
|
s.purchase_document_no = obj.doc.name
|
||||||
s.purchase_date = obj.doc.posting_date
|
s.purchase_date = obj.doc.posting_date
|
||||||
s.purchase_time = obj.doc.posting_time
|
s.purchase_time = obj.doc.posting_time
|
||||||
s.purchase_rate = d.purchase_rate or d.incoming_rate
|
s.purchase_rate = d.valuation_rate or d.incoming_rate
|
||||||
s.item_code = d.item_code
|
s.item_code = d.item_code
|
||||||
s.brand = d.brand
|
s.brand = d.brand
|
||||||
s.description = d.description
|
s.description = d.description
|
||||||
s.item_group = item_details and item_details[0]['item_group'] or ''
|
s.item_group = item_details and item_details[0]['item_group'] or ''
|
||||||
s.warranty_period = item_details and item_details[0]['warranty_period'] or 0
|
s.warranty_period = item_details and item_details[0]['warranty_period'] or 0
|
||||||
s.supplier = obj.doc.supplier
|
s.supplier = obj.doc.supplier
|
||||||
s.supplier_name = obj.doc.supplier_name
|
s.supplier_name = obj.doc.supplier_name
|
||||||
s.supplier_address = obj.doc.supplier_address
|
s.supplier_address = obj.doc.supplier_address
|
||||||
s.warehouse = d.warehouse or d.t_warehouse
|
s.warehouse = d.warehouse or d.t_warehouse
|
||||||
s.docstatus = 0
|
s.docstatus = 0
|
||||||
s.status = 'In Store'
|
s.status = 'In Store'
|
||||||
s.modified = nowdate()
|
s.modified = nowdate()
|
||||||
s.modified_by = session['user']
|
s.modified_by = session['user']
|
||||||
s.serial_no = serial_no
|
s.serial_no = serial_no
|
||||||
s.fiscal_year = obj.doc.fiscal_year
|
s.fiscal_year = obj.doc.fiscal_year
|
||||||
s.company = obj.doc.company
|
s.company = obj.doc.company
|
||||||
s.save(new_rec)
|
s.save(new_rec)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user