Merge branch 'master' of github.com:webnotes/erpnext

This commit is contained in:
Rushabh Mehta 2012-08-06 14:20:46 +05:30
commit cea0e795b0
6 changed files with 130 additions and 120 deletions

View File

@ -5,7 +5,7 @@
<h4><a href="#!List/Purchase Request">Purchase Request</a></h4>
<p class="help">Request for purchase</p>
<br>
<h4><a href="#!List/Supplier Quotation">Supplier Quotation</a></h4>
<h4><a href="#!List/Supplier Quotation">Supplier Quotation (beta)</a></h4>
<p class="help">Track Quotations received from Suppliers</p>
<br>
<h4><a href="#!List/Purchase Order">Purchase Order</a></h4>

View File

@ -1,23 +1,47 @@
def repost_reserved_qty():
import webnotes
def execute():
# add index
webnotes.conn.commit()
try:
webnotes.conn.sql("""create index item_code_warehouse
on `tabDelivery Note Packing Item` (item_code, warehouse)""")
except:
pass
webnotes.conn.begin()
repost_reserved_qty()
cleanup_wrong_sle()
def repost_reserved_qty():
from webnotes.utils import flt
bins = webnotes.conn.sql("select item_code, warehouse, name, reserved_qty from `tabBin`")
i = 0
for d in bins:
i += 1
print i
reserved_qty = webnotes.conn.sql("""
select sum((dnpi.qty/so_item.qty)*(so_item.qty - ifnull(so_item.delivered_qty, 0)))
select sum((dnpi_qty / so_item_qty) * (so_item_qty - so_item_delivered_qty))
from (select
qty as dnpi_qty,
(
select qty from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_qty,
(
select ifnull(delivered_qty, 0) from `tabSales Order Item`
where name = dnpi.parent_detail_docname
) as so_item_delivered_qty
from
(
select qty, parent_detail_docname
from `tabDelivery Note Packing Item` dnpi_in
where item_code = %s and warehouse = %s
and parenttype="Sales Order"
and exists (select * from `tabSales Order` so
where name = dnpi_in.parent and docstatus = 1 and status != 'Stopped')
) dnpi) tab""", (d[0], d[1]))
from `tabDelivery Note Packing Item` dnpi, `tabSales Order Item` so_item, `tabSales Order` so
where dnpi.item_code = %s
and dnpi.warehouse = %s
and dnpi.parent = so.name
and so_item.parent = so.name
and dnpi.parenttype = 'Sales Order'
and dnpi.parent_detail_docname = so_item.name
and dnpi.parent_item = so_item.item_code
and so.docstatus = 1
and so.status != 'Stopped'
""", (d[0], d[1]))
if flt(d[3]) != flt(reserved_qty[0][0]):
print d[3], reserved_qty[0][0]
webnotes.conn.sql("""
@ -51,9 +75,6 @@ def cleanup_wrong_sle():
def create_comment(dn):
from webnotes.model.doc import Document
cmt = Document('Comment')
for arg in ['comment', 'comment_by', 'comment_by_fullname', 'comment_doctype', \
'comment_docname']:
cmt.fields[arg] = args[arg]
cmt.comment = 'Cancelled by administrator due to wrong entry in packing list'
cmt.comment_by = 'Administrator'
cmt.comment_by_fullname = 'Administrator'
@ -68,8 +89,3 @@ def repost_bin(item, wh):
where item_code = %s and warehouse = %s", (item, wh))
get_obj('Bin', bin[0][0]).update_entries_after(posting_date = '2012-07-01', posting_time = '12:05')
def execute():
repost_reserved_qty()
cleanup_wrong_sle()

View File

@ -509,4 +509,8 @@ patch_list = [
'patch_module': 'patches.july_2012',
'patch_file': 'project_patch_repeat',
},
{
'patch_module': 'patches.july_2012',
'patch_file': 'repost_stock_due_to_wrong_packing_list',
},
]

View File

@ -66,7 +66,7 @@ class DocType:
if cstr(d.uom) == cstr(self.doc.stock_uom):
if flt(d.conversion_factor) != 1:
msgprint("Conversion Fator of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
msgprint("Conversion Factor of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
raise Exception
# else set uom_exist as true
uom_exist='true'

View File

@ -45,10 +45,6 @@ class DocType:
msgprint("Please Enter an Item.")
raise Exception
if not cstr(self.doc.current_stock_uom):
msgprint("There is no Current Stock UOM for Item Code" + cstr(self.doc.item_code))
raise Exception
if not cstr(self.doc.new_stock_uom):
msgprint("Please Enter New Stock UOM.")
raise Exception
@ -119,3 +115,5 @@ class DocType:
# update bin
self.update_bin()
get_obj("Item", self.doc.item_code).on_update()

View File

@ -3,9 +3,9 @@
# These values are common in all dictionaries
{
'creation': '2012-06-07 11:02:55',
'creation': '2012-06-26 11:58:13',
'docstatus': 0,
'modified': '2012-06-07 11:24:20',
'modified': '2012-08-03 16:10:35',
'modified_by': u'Administrator',
'owner': u'Administrator'
},
@ -15,6 +15,7 @@
'allow_attach': 1,
'description': u'Keep a track of all communications',
'doctype': 'DocType',
'document_type': u'Master',
'module': u'Support',
'name': '__common__',
'version': 1
@ -86,7 +87,7 @@
# DocPerm
{
'cancel': 0,
'cancel': 1,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
@ -99,16 +100,7 @@
'create': 1,
'doctype': u'DocPerm',
'permlevel': 0,
'role': u'Administrator'
},
# DocPerm
{
'cancel': 0,
'create': 0,
'doctype': u'DocPerm',
'permlevel': 1,
'role': u'Administrator'
'role': u'Support Manager'
},
# DocField