Merge pull request #4069 from anandpdoshi/round-status-updater-percentages
Round status update percentages to 2 decimals
This commit is contained in:
commit
6534ad082d
@ -207,10 +207,10 @@ class StatusUpdater(Document):
|
||||
# update percent complete in the parent table
|
||||
if args.get('target_parent_field'):
|
||||
frappe.db.sql("""update `tab%(target_parent_dt)s`
|
||||
set %(target_parent_field)s = (select sum(if(%(target_ref_field)s >
|
||||
set %(target_parent_field)s = round((select sum(if(%(target_ref_field)s >
|
||||
ifnull(%(target_field)s, 0), %(target_field)s,
|
||||
%(target_ref_field)s))/sum(%(target_ref_field)s)*100
|
||||
from `tab%(target_dt)s` where parent="%(name)s") %(set_modified)s
|
||||
from `tab%(target_dt)s` where parent="%(name)s"), 2) %(set_modified)s
|
||||
where name='%(name)s'""" % args)
|
||||
|
||||
# update field
|
||||
|
@ -211,3 +211,4 @@ erpnext.patches.v6_2.remove_newsletter_duplicates
|
||||
erpnext.patches.v6_2.fix_missing_default_taxes_and_lead
|
||||
erpnext.patches.v5_8.tax_rule
|
||||
erpnext.patches.v6_3.convert_applicable_territory
|
||||
erpnext.patches.v6_4.round_status_updater_percentages
|
||||
|
1
erpnext/patches/v6_4/__init__.py
Normal file
1
erpnext/patches/v6_4/__init__.py
Normal file
@ -0,0 +1 @@
|
||||
from __future__ import unicode_literals
|
14
erpnext/patches/v6_4/round_status_updater_percentages.py
Normal file
14
erpnext/patches/v6_4/round_status_updater_percentages.py
Normal file
@ -0,0 +1,14 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
for doctype, fieldname in (
|
||||
("Sales Order", "per_billed"),
|
||||
("Sales Order", "per_delivered"),
|
||||
("Delivery Note", "per_installed"),
|
||||
("Purchase Order", "per_billed"),
|
||||
("Purchase Order", "per_received"),
|
||||
("Material Request", "per_ordered"),
|
||||
):
|
||||
frappe.db.sql("""update `tab{doctype}` set `{fieldname}`=round(`{fieldname}`, 2)""".format(
|
||||
doctype=doctype, fieldname=fieldname))
|
Loading…
Reference in New Issue
Block a user