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

This commit is contained in:
Akhilesh Darjee
2014-01-08 19:36:26 +05:30
5 changed files with 57 additions and 72 deletions

View File

@@ -12,6 +12,7 @@ def execute(filters=None):
item_list = get_items(filters) item_list = get_items(filters)
aii_account_map = get_aii_accounts() aii_account_map = get_aii_accounts()
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns) item_tax, tax_accounts = get_tax_accounts(item_list, columns)
data = [] data = []

View File

@@ -11,6 +11,7 @@ def execute(filters=None):
last_col = len(columns) last_col = len(columns)
item_list = get_items(filters) item_list = get_items(filters)
if item_list:
item_tax, tax_accounts = get_tax_accounts(item_list, columns) item_tax, tax_accounts = get_tax_accounts(item_list, columns)
data = [] data = []
@@ -39,7 +40,6 @@ def get_columns():
"Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120" "Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120"
] ]
def get_conditions(filters): def get_conditions(filters):
conditions = "" conditions = ""

View File

@@ -1,6 +1,6 @@
{ {
"app_name": "ERPNext", "app_name": "ERPNext",
"app_version": "3.4.6", "app_version": "3.4.9",
"base_template": "app/portal/templates/base.html", "base_template": "app/portal/templates/base.html",
"modules": { "modules": {
"Accounts": { "Accounts": {
@@ -74,5 +74,5 @@
"type": "module" "type": "module"
} }
}, },
"requires_framework_version": "==3.4.3" "requires_framework_version": "==3.4.4"
} }

View File

@@ -387,16 +387,20 @@ class AccountsController(TransactionBase):
for item in self.doclist.get({"parentfield": "entries"}): for item in self.doclist.get({"parentfield": "entries"}):
if item.fields.get(item_ref_dn): if item.fields.get(item_ref_dn):
ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item",
item.fields[item_ref_dn], based_on), self.precision(based_on, item))
if not ref_amt:
webnotes.msgprint(_("As amount for item") + ": " + item.item_code + _(" in ") +
ref_dt + _(" is zero, system will not check for over-billed"))
else:
already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s` already_billed = webnotes.conn.sql("""select sum(%s) from `tab%s`
where %s=%s and docstatus=1""" % (based_on, self.tname, item_ref_dn, '%s'), where %s=%s and docstatus=1 and parent != %s""" %
item.fields[item_ref_dn])[0][0] (based_on, self.tname, item_ref_dn, '%s', '%s'),
(item.fields[item_ref_dn], self.doc.name))[0][0]
total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]), total_billed_amt = flt(flt(already_billed) + flt(item.fields[based_on]),
self.precision(based_on, item)) self.precision(based_on, item))
ref_amt = flt(webnotes.conn.get_value(ref_dt + " Item",
item.fields[item_ref_dn], based_on), self.precision(based_on, item))
tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code, tolerance, item_tolerance, global_tolerance = get_tolerance_for(item.item_code,
item_tolerance, global_tolerance) item_tolerance, global_tolerance)

View File

@@ -5,6 +5,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import os, sys import os, sys
import argparse import argparse
import subprocess
is_redhat = is_debian = None is_redhat = is_debian = None
root_password = None root_password = None
@@ -19,7 +20,7 @@ requirements = [
"jinja2", "jinja2",
"markdown2", "markdown2",
"markupsafe", "markupsafe",
"mysql-python", "mysql-python==1.2.4",
"pygeoip", "pygeoip",
"python-dateutil", "python-dateutil",
"python-memcached", "python-memcached",
@@ -80,7 +81,7 @@ def validate_install():
return is_redhat, is_debian return is_redhat, is_debian
def install_using_yum(): def install_using_yum():
packages = "python python-setuptools gcc python-devel MySQL-python git memcached ntp vim-enhanced screen" packages = "gcc MySQL-python git memcached ntp vim-enhanced screen"
print "-"*80 print "-"*80
print "Installing Packages: (This may take some time)" print "Installing Packages: (This may take some time)"
@@ -88,7 +89,10 @@ def install_using_yum():
print "-"*80 print "-"*80
exec_in_shell("yum install -y %s" % packages) exec_in_shell("yum install -y %s" % packages)
if not exec_in_shell("which mysql"):
try:
exec_in_shell("which mysql")
except subprocess.CalledProcessError:
packages = "mysql mysql-server mysql-devel" packages = "mysql mysql-server mysql-devel"
print "Installing Packages:", packages print "Installing Packages:", packages
exec_in_shell("yum install -y %s" % packages) exec_in_shell("yum install -y %s" % packages)
@@ -101,26 +105,19 @@ def install_using_yum():
exec_in_shell('mysqladmin -u root password "%s"' % (root_password,)) exec_in_shell('mysqladmin -u root password "%s"' % (root_password,))
print "Root password set as", root_password print "Root password set as", root_password
# install htop
if not exec_in_shell("which htop"):
try:
exec_in_shell("cd /tmp && rpm -i --force http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm && yum install -y htop")
except:
pass
update_config_for_redhat() update_config_for_redhat()
def update_config_for_redhat(): def update_config_for_redhat():
import re import re
# set to autostart on startup # set to autostart on startup
for service in ("mysqld", "memcached", "ntpd"): for service in ("mysqld", "memcached"):
exec_in_shell("chkconfig --level 2345 %s on" % service) exec_in_shell("chkconfig --level 2345 %s on" % service)
exec_in_shell("service %s restart" % service) exec_in_shell("service %s restart" % service)
def install_using_apt(): def install_using_apt():
exec_in_shell("apt-get update") exec_in_shell("apt-get update")
packages = "python python-setuptools python-dev build-essential python-pip python-mysqldb git memcached ntp vim screen htop" packages = "python python-setuptools python-dev build-essential python-mysqldb git memcached ntp vim screen htop"
print "-"*80 print "-"*80
print "Installing Packages: (This may take some time)" print "Installing Packages: (This may take some time)"
print packages print packages
@@ -132,7 +129,9 @@ def install_using_apt():
exec_in_shell("echo mysql-server mysql-server/root_password password %s | sudo debconf-set-selections" % root_password) exec_in_shell("echo mysql-server mysql-server/root_password password %s | sudo debconf-set-selections" % root_password)
exec_in_shell("echo mysql-server mysql-server/root_password_again password %s | sudo debconf-set-selections" % root_password) exec_in_shell("echo mysql-server mysql-server/root_password_again password %s | sudo debconf-set-selections" % root_password)
if not exec_in_shell("which mysql"): try:
exec_in_shell("which mysql")
except subprocess.CalledProcessError:
packages = "mysql-server libmysqlclient-dev" packages = "mysql-server libmysqlclient-dev"
print "Installing Packages:", packages print "Installing Packages:", packages
exec_in_shell("apt-get install -y %s" % packages) exec_in_shell("apt-get install -y %s" % packages)
@@ -140,7 +139,7 @@ def install_using_apt():
update_config_for_debian() update_config_for_debian()
def update_config_for_debian(): def update_config_for_debian():
for service in ("mysql", "ntpd"): for service in ("mysql",):
exec_in_shell("service %s restart" % service) exec_in_shell("service %s restart" % service)
def install_python_modules(): def install_python_modules():
@@ -148,13 +147,14 @@ def install_python_modules():
print "Installing Python Modules: (This may take some time)" print "Installing Python Modules: (This may take some time)"
print "-"*80 print "-"*80
if not exec_in_shell("which pip"): try:
exec_in_shell("easy_install pip") exec_in_shell("which pip2.7")
except subprocess.CalledProcessError:
exec_in_shell("easy_install-2.7 pip")
exec_in_shell("pip install --upgrade pip") exec_in_shell("pip2.7 install --upgrade setuptools --no-use-wheel")
exec_in_shell("pip install --upgrade setuptools") exec_in_shell("pip2.7 install --upgrade setuptools")
exec_in_shell("pip install --upgrade virtualenv") exec_in_shell("pip2.7 install {}".format(' '.join(requirements)))
exec_in_shell("pip install {}".format(' '.join(requirements)))
def install_erpnext(install_path): def install_erpnext(install_path):
print print
@@ -200,7 +200,7 @@ def setup_folders(install_path):
app = os.path.join(install_path, "app") app = os.path.join(install_path, "app")
if not os.path.exists(app): if not os.path.exists(app):
print "Cloning erpnext" print "Cloning erpnext"
exec_in_shell("cd %s && git clone https://github.com/webnotes/erpnext.git app" % install_path) exec_in_shell("cd %s && git clone --branch master https://github.com/webnotes/erpnext.git app" % install_path)
exec_in_shell("cd app && git config core.filemode false") exec_in_shell("cd app && git config core.filemode false")
if not os.path.exists(app): if not os.path.exists(app):
raise Exception, "Couldn't clone erpnext repository" raise Exception, "Couldn't clone erpnext repository"
@@ -208,7 +208,7 @@ def setup_folders(install_path):
lib = os.path.join(install_path, "lib") lib = os.path.join(install_path, "lib")
if not os.path.exists(lib): if not os.path.exists(lib):
print "Cloning wnframework" print "Cloning wnframework"
exec_in_shell("cd %s && git clone https://github.com/webnotes/wnframework.git lib" % install_path) exec_in_shell("cd %s && git clone --branch master https://github.com/webnotes/wnframework.git lib" % install_path)
exec_in_shell("cd lib && git config core.filemode false") exec_in_shell("cd lib && git config core.filemode false")
if not os.path.exists(lib): if not os.path.exists(lib):
raise Exception, "Couldn't clone wnframework repository" raise Exception, "Couldn't clone wnframework repository"
@@ -243,28 +243,8 @@ def post_install(install_path):
def exec_in_shell(cmd): def exec_in_shell(cmd):
# using Popen instead of os.system - as recommended by python docs # using Popen instead of os.system - as recommended by python docs
from subprocess import Popen import subprocess
import tempfile out = subprocess.check_output(cmd, shell=True)
with tempfile.TemporaryFile() as stdout:
with tempfile.TemporaryFile() as stderr:
p = Popen(cmd, shell=True, stdout=stdout, stderr=stderr)
p.wait()
stdout.seek(0)
out = stdout.read()
if out: out = out.decode('utf-8')
stderr.seek(0)
err = stderr.read()
if err: err = err.decode('utf-8')
if err and any((kw in err.lower() for kw in ["traceback", "error", "exception"])):
print out
raise Exception, err
else:
print "."
return out return out
def parse_args(): def parse_args():