[fix] [minor] repost order qty patch
This commit is contained in:
parent
5f2bc144e4
commit
0948b2a9d3
@ -4,15 +4,18 @@
|
|||||||
def execute():
|
def execute():
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes.utils import flt
|
from webnotes.utils import flt
|
||||||
bins = webnotes.conn.sql("select item_code, warehouse, name, ordered_qty from `tabBin`")
|
|
||||||
for d in bins:
|
|
||||||
ordered_qty = webnotes.conn.sql("""
|
|
||||||
select sum(ifnull(po_item.qty, 0) - ifnull(po_item.received_qty, 0))
|
|
||||||
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
|
|
||||||
where po_item.parent = po.name and po.docstatus = 1 and po.status != 'Stopped'
|
|
||||||
and po_item.item_code = %s and po_item.warehouse = %s
|
|
||||||
""", (d[0], d[1]))
|
|
||||||
|
|
||||||
if flt(d[3]) != flt(ordered_qty[0][0]):
|
for d in webnotes.conn.sql("select name, item_code, warehouse, ordered_qty from tabBin",
|
||||||
webnotes.conn.sql("""update `tabBin` set ordered_qty = %s where name = %s""",
|
as_dict=1):
|
||||||
(ordered_qty and ordered_qty[0][0] or 0, d[2]))
|
ordered_qty = webnotes.conn.sql("""
|
||||||
|
select sum((po_item.qty - po_item.received_qty)*po_item.conversion_factor)
|
||||||
|
from `tabPurchase Order Item` po_item, `tabPurchase Order` po
|
||||||
|
where po_item.item_code=%s and po_item.warehouse=%s
|
||||||
|
and po_item.qty > po_item.received_qty and po_item.parent=po.name
|
||||||
|
and po.status!='Stopped' and po.docstatus=1""", (d.item_code, d.warehouse))
|
||||||
|
|
||||||
|
if flt(d.ordered_qty) != flt(ordered_qty[0][0]):
|
||||||
|
webnotes.conn.set_value("Bin", d.name, "ordered_qty", flt(ordered_qty[0][0]))
|
||||||
|
|
||||||
|
webnotes.conn.sql("""update tabBin set projected_qty = actual_qty + planned_qty +
|
||||||
|
indented_qty + ordered_qty - reserved_qty where name = %s""", d.name)
|
@ -220,4 +220,5 @@ patch_list = [
|
|||||||
"patches.september_2013.p04_unsubmit_serial_nos",
|
"patches.september_2013.p04_unsubmit_serial_nos",
|
||||||
"patches.september_2013.p05_fix_customer_in_pos",
|
"patches.september_2013.p05_fix_customer_in_pos",
|
||||||
"patches.october_2013.fix_is_cancelled_in_sle",
|
"patches.october_2013.fix_is_cancelled_in_sle",
|
||||||
|
"patches.october_2013.repost_ordered_qty",
|
||||||
]
|
]
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
|
|
||||||
from webnotes.utils import cint, getdate, nowdate, cstr, flt, add_days
|
from webnotes.utils import cint, getdate, cstr, flt, add_days
|
||||||
import datetime
|
import datetime
|
||||||
from webnotes import msgprint, _, ValidationError
|
from webnotes import msgprint, _, ValidationError
|
||||||
|
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
|
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import webnotes
|
import webnotes
|
||||||
from webnotes import _, msgprint
|
from webnotes import msgprint
|
||||||
from webnotes.utils import cint, flt, getdate, cstr
|
from webnotes.utils import flt, getdate
|
||||||
from webnotes.model.controller import DocListController
|
from webnotes.model.controller import DocListController
|
||||||
|
|
||||||
class DocType(DocListController):
|
class DocType(DocListController):
|
||||||
@ -52,7 +52,7 @@ class DocType(DocListController):
|
|||||||
<b>%(item_code)s</b> at Warehouse <b>%(warehouse)s</b> \
|
<b>%(item_code)s</b> at Warehouse <b>%(warehouse)s</b> \
|
||||||
as on %(posting_date)s %(posting_time)s""" % self.doc.fields)
|
as on %(posting_date)s %(posting_time)s""" % self.doc.fields)
|
||||||
|
|
||||||
sself.doc.fields.pop('batch_bal')
|
self.doc.fields.pop('batch_bal')
|
||||||
|
|
||||||
def validate_mandatory(self):
|
def validate_mandatory(self):
|
||||||
mandatory = ['warehouse','posting_date','voucher_type','voucher_no','actual_qty','company']
|
mandatory = ['warehouse','posting_date','voucher_type','voucher_no','actual_qty','company']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user