mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-12 17:51:20 +00:00
[fix] [minor] material request sales order wise through production planning tool
This commit is contained in:
@@ -38,18 +38,18 @@ class DocType(BuyingController):
|
||||
for so_no in so_items.keys():
|
||||
for item in so_items[so_no].keys():
|
||||
already_indented = webnotes.conn.sql("""select sum(qty) from `tabMaterial Request Item`
|
||||
where item_code = '%s' and sales_order_no = '%s' and
|
||||
docstatus = 1 and parent != '%s'""" % (item, so_no, self.doc.name))
|
||||
where item_code = %s and sales_order_no = %s and
|
||||
docstatus = 1 and parent != %s""", (item, so_no, self.doc.name))
|
||||
already_indented = already_indented and flt(already_indented[0][0]) or 0
|
||||
|
||||
actual_so_qty = webnotes.conn.sql("""select sum(qty) from `tabSales Order Item`
|
||||
where parent = '%s' and item_code = '%s' and docstatus = 1
|
||||
group by parent""" % (so_no, item))
|
||||
where parent = %s and item_code = %s and docstatus = 1
|
||||
group by parent""", (so_no, item))
|
||||
actual_so_qty = actual_so_qty and flt(actual_so_qty[0][0]) or 0
|
||||
|
||||
if actual_so_qty and (flt(so_items[so_no][item]) + already_indented > actual_so_qty):
|
||||
webnotes.throw(_("You can raise indent of maximum qty: %s for item: %s against sales order: %s\
|
||||
\n Anyway, you can add more qty in new row for the same item.")
|
||||
webnotes.throw("You can raise indent of maximum qty: %s for item: %s against sales order: %s\
|
||||
\n Anyway, you can add more qty in new row for the same item."
|
||||
% (actual_so_qty - already_indented, item, so_no))
|
||||
|
||||
def validate_schedule_date(self):
|
||||
@@ -105,8 +105,10 @@ class DocType(BuyingController):
|
||||
self.update_bin(is_submit = 1, is_stopped = 0)
|
||||
|
||||
def check_modified_date(self):
|
||||
mod_db = webnotes.conn.sql("select modified from `tabMaterial Request` where name = '%s'" % self.doc.name)
|
||||
date_diff = webnotes.conn.sql("select TIMEDIFF('%s', '%s')" % (mod_db[0][0], cstr(self.doc.modified)))
|
||||
mod_db = webnotes.conn.sql("""select modified from `tabMaterial Request` where name = %s""",
|
||||
self.doc.name)
|
||||
date_diff = webnotes.conn.sql("""select TIMEDIFF('%s', '%s')"""
|
||||
% (mod_db[0][0], cstr(self.doc.modified)))
|
||||
|
||||
if date_diff and date_diff[0][0]:
|
||||
webnotes.throw(cstr(self.doc.doctype) + " => " + cstr(self.doc.name) + " has been modified. Please Refresh.")
|
||||
@@ -120,7 +122,7 @@ class DocType(BuyingController):
|
||||
webnotes.conn.set(self.doc, 'status', cstr(status))
|
||||
|
||||
# Step 3:=> Acknowledge User
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + _(" has been %s.") % ((status == 'Submitted') and 'Unstopped' or cstr(status)) )
|
||||
msgprint(self.doc.doctype + ": " + self.doc.name + " has been %s." % ((status == 'Submitted') and 'Unstopped' or cstr(status)))
|
||||
|
||||
|
||||
def on_cancel(self):
|
||||
|
||||
Reference in New Issue
Block a user