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

This commit is contained in:
Ravi Dey
2011-06-28 19:01:32 +05:30
16 changed files with 1789 additions and 1547 deletions

View File

@@ -584,7 +584,7 @@ class StatusUpdater:
if overflow_percent - tolerance > 0.0001:
item['max_allowed'] = flt(item['qty'] * (100+tolerance)/100)
item['reduce_by'] = cint(item[args['compare_field']] - item['max_allowed'])
item['reduce_by'] = item[args['compare_field']] - item['max_allowed']
msgprint("""
Row #%(idx)s: Max qty allowed for <b>Item %(item_code)s</b> against <b>%(parenttype)s %(parent)s</b> is <b>%(max_allowed)s</b>.
@@ -707,7 +707,7 @@ class StatusUpdater:
set
%(target_field)s = (select sum(qty) from `tab%(source_dt)s` where `%(join_field)s`="%(detail_id)s" and (docstatus=1 %(cond)s))
where
name="%(detail_id)s"
name="%(detail_id)s"
""" % args)
# get unique transactions to update
@@ -716,33 +716,16 @@ class StatusUpdater:
args['name'] = name
# update percent complete in the parent table
if args.get('source_dt')!='Installed Item Details':
sql("""
update
`tab%(target_parent_dt)s`
set
%(target_parent_field)s = (
(select sum(amount) from `tab%(source_dt)s` where `%(percent_join_field)s`="%(name)s" and (docstatus=1 %(cond)s))
/ net_total
* 100
)
where
name="%(name)s"
""" % args)
else:
sql("""
update
`tab%(target_parent_dt)s`
set
%(target_parent_field)s = (
(select sum(qty) from `tab%(source_dt)s` where `%(percent_join_field)s`="%(name)s" and (docstatus=1 %(cond)s))
/ (select sum(qty) from `tab%(target_dt)s` where parent="%(name)s" and docstatus=1)
* 100
)
where
name="%(name)s"
""" % args)
sql("""
update
`tab%(target_parent_dt)s`
set
%(target_parent_field)s =
(select sum(if(qty > ifnull(%(target_field)s, 0), %(target_field)s, qty))/sum(qty)*100 from `tab%(target_dt)s` where parent="%(name)s"),
modified = now()
where
name="%(name)s"
""" % args)
# update field
if args['status_field']:
@@ -756,4 +739,3 @@ class StatusUpdater:
where
name="%(name)s"
""" % args)

File diff suppressed because it is too large Load Diff