Merge remote-tracking branch 'webnotes/4.0.0-wip' into permissions

Conflicts:
	erpnext/accounts/page/accounts_browser/accounts_browser.css
	erpnext/controllers/buying_controller.py
	erpnext/manufacturing/doctype/production_order/production_order.py
	erpnext/patches/patch_list.py
	erpnext/selling/doctype/customer/customer.txt
	erpnext/selling/doctype/sales_order/sales_order.py
	erpnext/selling/doctype/sales_order/test_sales_order.py
	erpnext/setup/doctype/features_setup/features_setup.txt
	erpnext/stock/doctype/stock_entry/test_stock_entry.py
	erpnext/stock/doctype/stock_ledger_entry/stock_ledger_entry.py
	startup/query_handlers.py
This commit is contained in:
Anand Doshi 2013-12-26 18:30:39 +05:30
commit 8e332ffd16
1813 changed files with 12064 additions and 18858 deletions

2
.gitignore vendored
View File

@ -5,3 +5,5 @@ conf.py
locale
latest_updates.json
.wnf-lang-status
*.egg-info
dist/

30
.travis.yml Normal file
View File

@ -0,0 +1,30 @@
anguage: python
python:
- "2.7"
services:
- mysql
install:
- pip install https://github.com/webnotes/wnframework/archive/4.0.0-wip.tar.gz &&
- pip install --editable .
script:
cd ./test_sites/ &&
webnotes --reinstall -v test_site &&
webnotes --install_app erpnext -v test_site &&
webnotes --run_tests -v test_site --app erpnext
branches:
except:
- develop
- master
- 3.x.x
- slow
- webshop_refactor
before_script:
- mysql -e 'create database travis' &&
- echo "USE mysql;\nUPDATE user SET password=PASSWORD('travis') WHERE user='travis';\nFLUSH PRIVILEGES;\n" | mysql -u root

18
MANIFEST.in Normal file
View File

@ -0,0 +1,18 @@
include MANIFEST.in
include requirements.txt
include *.json
include *.md
include *.py
include *.txt
recursive-include erpnext *.css
recursive-include erpnext *.csv
recursive-include erpnext *.html
recursive-include erpnext *.ico
recursive-include erpnext *.js
recursive-include erpnext *.json
recursive-include erpnext *.md
recursive-include erpnext *.png
recursive-include erpnext *.py
recursive-include erpnext *.svg
recursive-include erpnext *.txt
recursive-exclude * *.pyc

View File

@ -1 +0,0 @@
{% extends "app/portal/templates/sales_transactions.html" %}

View File

@ -1,78 +0,0 @@
{
"app_name": "ERPNext",
"app_version": "3.3.7",
"base_template": "app/portal/templates/base.html",
"modules": {
"Accounts": {
"color": "#3498db",
"icon": "icon-money",
"link": "accounts-home",
"type": "module"
},
"Activity": {
"color": "#e67e22",
"icon": "icon-play",
"label": "Activity",
"link": "activity",
"type": "page"
},
"Buying": {
"color": "#c0392b",
"icon": "icon-shopping-cart",
"link": "buying-home",
"type": "module"
},
"HR": {
"color": "#2ecc71",
"icon": "icon-group",
"label": "Human Resources",
"link": "hr-home",
"type": "module"
},
"Manufacturing": {
"color": "#7f8c8d",
"icon": "icon-cogs",
"link": "manufacturing-home",
"type": "module"
},
"Notes": {
"color": "#95a5a6",
"doctype": "Note",
"icon": "icon-file-alt",
"label": "Notes",
"link": "List/Note",
"type": "list"
},
"Projects": {
"color": "#8e44ad",
"icon": "icon-puzzle-piece",
"link": "projects-home",
"type": "module"
},
"Selling": {
"color": "#1abc9c",
"icon": "icon-tag",
"link": "selling-home",
"type": "module"
},
"Setup": {
"color": "#bdc3c7",
"icon": "icon-wrench",
"link": "Setup",
"type": "setup"
},
"Stock": {
"color": "#f39c12",
"icon": "icon-truck",
"link": "stock-home",
"type": "module"
},
"Support": {
"color": "#2c3e50",
"icon": "icon-phone",
"link": "support-home",
"type": "module"
}
},
"requires_framework_version": "==3.3.2"
}

View File

@ -206,7 +206,7 @@ class DocType:
def before_rename(self, old, new, merge=False):
# Add company abbr if not provided
from setup.doctype.company.company import get_name_with_abbr
from erpnext.setup.doctype.company.company import get_name_with_abbr
new_account = get_name_with_abbr(new, self.doc.company)
# Validate properties before merging

View File

@ -5,8 +5,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import cint, cstr
from webnotes import msgprint, _
from webnotes import _
class DocType:
def __init__(self, d, dl):
@ -16,6 +15,11 @@ class DocType:
webnotes.conn.set_default("auto_accounting_for_stock", self.doc.auto_accounting_for_stock)
if self.doc.auto_accounting_for_stock:
for wh in webnotes.conn.sql("select name from `tabWarehouse`"):
wh_bean = webnotes.bean("Warehouse", wh[0])
warehouse_list = webnotes.conn.sql("select name, company from tabWarehouse", as_dict=1)
warehouse_with_no_company = [d.name for d in warehouse_list if not d.company]
if warehouse_with_no_company:
webnotes.throw(_("Company is missing in following warehouses") + ": \n" +
"\n".join(warehouse_with_no_company))
for wh in warehouse_list:
wh_bean = webnotes.bean("Warehouse", wh.name)
wh_bean.save()

View File

@ -76,7 +76,7 @@ class DocType:
}
def get_invoice_nos(doctype, txt, searchfield, start, page_len, filters):
from utilities import build_filter_conditions
from erpnext.utilities import build_filter_conditions
conditions, filter_values = build_filter_conditions(filters)
return webnotes.conn.sql("""select name from `tabSales Invoice` where docstatus = 1

View File

@ -75,7 +75,7 @@ class DocType(DocTypeNestedSet):
def before_rename(self, olddn, newdn, merge=False):
# Add company abbr if not provided
from setup.doctype.company.company import get_name_with_abbr
from erpnext.setup.doctype.company.company import get_name_with_abbr
new_cost_center = get_name_with_abbr(newdn, self.doc.company)
# Validate properties before merging

View File

@ -26,8 +26,7 @@ class DocType:
if year_start_end_dates:
if getdate(self.doc.year_start_date) != year_start_end_dates[0][0] or getdate(self.doc.year_end_date) != year_start_end_dates[0][1]:
webnotes.throw(_("Cannot change Year Start Date and Year End Date \
once the Fiscal Year is saved."))
webnotes.throw(_("Cannot change Year Start Date and Year End Date once the Fiscal Year is saved."))
def on_update(self):
# validate year start date and year end date
@ -43,5 +42,4 @@ class DocType:
for fiscal_year, ysd, yed in year_start_end_dates:
if (getdate(self.doc.year_start_date) == ysd and getdate(self.doc.year_end_date) == yed) \
and (not webnotes.flags.in_test):
webnotes.throw(_("Year Start Date and Year End Date are already \
set in Fiscal Year: ") + fiscal_year)
webnotes.throw(_("Year Start Date and Year End Date are already set in Fiscal Year: ") + fiscal_year)

View File

@ -50,7 +50,7 @@ class DocType:
self.doc.cost_center = None
def validate_posting_date(self):
from accounts.utils import validate_fiscal_year
from erpnext.accounts.utils import validate_fiscal_year
validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year, "Posting Date")
def check_pl_account(self):
@ -152,10 +152,7 @@ def validate_frozen_account(account, adv_adj):
frozen_accounts_modifier = webnotes.conn.get_value( 'Accounts Settings', None,
'frozen_accounts_modifier')
if not frozen_accounts_modifier:
webnotes.throw(account + _(" is a frozen account. \
Either make the account active or assign role in Accounts Settings \
who can create / modify entries against this account"))
webnotes.throw(account + _(" is a frozen account. Either make the account active or assign role in Accounts Settings who can create / modify entries against this account"))
elif frozen_accounts_modifier not in webnotes.user.get_roles():
webnotes.throw(account + _(" is a frozen account. ") +
_("To create / edit transactions against this account, you need role") + ": " +
frozen_accounts_modifier)
webnotes.throw(account + _(" is a frozen account. To create / edit transactions against this account, you need role") \
+ ": " + frozen_accounts_modifier)

View File

@ -166,7 +166,7 @@ cur_frm.cscript.account = function(doc,dt,dn) {
var d = locals[dt][dn];
if(d.account) {
return wn.call({
method: "accounts.utils.get_balance_on",
method: "erpnext.accounts.utils.get_balance_on",
args: {account: d.account, date: doc.posting_date},
callback: function(r) {
d.balance = r.message;
@ -209,7 +209,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
if(in_list(["Bank Voucher", "Cash Voucher"], doc.voucher_type)) {
return wn.call({
type: "GET",
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
args: {
"voucher_type": doc.voucher_type,
"company": doc.company
@ -223,7 +223,7 @@ cur_frm.cscript.voucher_type = function(doc, cdt, cdn) {
} else if(doc.voucher_type=="Opening Entry") {
return wn.call({
type:"GET",
method: "accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
method: "erpnext.accounts.doctype.journal_voucher.journal_voucher.get_opening_accounts",
args: {
"company": doc.company
},

View File

@ -8,9 +8,9 @@ from webnotes.utils import cint, cstr, flt, fmt_money, formatdate, getdate
from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
from webnotes import msgprint, _
from setup.utils import get_company_currency
from erpnext.setup.utils import get_company_currency
from controllers.accounts_controller import AccountsController
from erpnext.controllers.accounts_controller import AccountsController
class DocType(AccountsController):
def __init__(self,d,dl):
@ -47,7 +47,7 @@ class DocType(AccountsController):
self.check_credit_limit()
def on_cancel(self):
from accounts.utils import remove_against_link_from_jv
from erpnext.accounts.utils import remove_against_link_from_jv
remove_against_link_from_jv(self.doc.doctype, self.doc.name, "against_jv")
self.make_gl_entries(1)
@ -236,11 +236,10 @@ class DocType(AccountsController):
if d.against_voucher and webnotes.conn.get_value("Purchase Invoice",
d.against_voucher, "credit_to") != d.account:
webnotes.throw(_("Debited account (Supplier) is not matching with \
Purchase Invoice"))
webnotes.throw(_("Debited account (Supplier) is not matching with Purchase Invoice"))
def make_gl_entries(self, cancel=0, adv_adj=0):
from accounts.general_ledger import make_gl_entries
from erpnext.accounts.general_ledger import make_gl_entries
gl_map = []
for d in self.doclist.get({"parentfield": "entries"}):
if d.debit or d.credit:
@ -334,7 +333,7 @@ class DocType(AccountsController):
@webnotes.whitelist()
def get_default_bank_cash_account(company, voucher_type):
from accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on
account = webnotes.conn.get_value("Company", company,
voucher_type=="Bank Voucher" and "default_bank_account" or "default_cash_account")
if account:
@ -345,7 +344,7 @@ def get_default_bank_cash_account(company, voucher_type):
@webnotes.whitelist()
def get_payment_entry_from_sales_invoice(sales_invoice):
from accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on
si = webnotes.bean("Sales Invoice", sales_invoice)
jv = get_payment_entry(si.doc)
jv.doc.remark = 'Payment received against Sales Invoice %(name)s. %(remarks)s' % si.doc.fields
@ -363,7 +362,7 @@ def get_payment_entry_from_sales_invoice(sales_invoice):
@webnotes.whitelist()
def get_payment_entry_from_purchase_invoice(purchase_invoice):
from accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on
pi = webnotes.bean("Purchase Invoice", purchase_invoice)
jv = get_payment_entry(pi.doc)
jv.doc.remark = 'Payment against Purchase Invoice %(name)s. %(remarks)s' % pi.doc.fields
@ -407,7 +406,7 @@ def get_payment_entry(doc):
@webnotes.whitelist()
def get_opening_accounts(company):
"""get all balance sheet accounts for opening entry"""
from accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on
accounts = webnotes.conn.sql_list("""select name from tabAccount
where group_or_ledger='Ledger' and is_pl_account='No' and company=%s""", company)

View File

@ -34,14 +34,14 @@ class TestJournalVoucher(unittest.TestCase):
where against_jv=%s""", jv_invoice.doc.name))
def test_jv_against_stock_account(self):
from stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import set_perpetual_inventory
set_perpetual_inventory()
jv = webnotes.bean(copy=test_records[0])
jv.doclist[1].account = "_Test Warehouse - _TC"
jv.insert()
from accounts.general_ledger import StockAccountInvalidTransaction
from erpnext.accounts.general_ledger import StockAccountInvalidTransaction
self.assertRaises(StockAccountInvalidTransaction, jv.submit)
set_perpetual_inventory(0)
@ -61,7 +61,7 @@ class TestJournalVoucher(unittest.TestCase):
{"voucher_type": "Journal Voucher", "voucher_no": jv.doc.name}))
def test_monthly_budget_crossed_stop(self):
from accounts.utils import BudgetError
from erpnext.accounts.utils import BudgetError
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.clear_account_balance()
@ -77,7 +77,7 @@ class TestJournalVoucher(unittest.TestCase):
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Ignore")
def test_yearly_budget_crossed_stop(self):
from accounts.utils import BudgetError
from erpnext.accounts.utils import BudgetError
self.clear_account_balance()
self.test_monthly_budget_crossed_ignore()
@ -96,7 +96,7 @@ class TestJournalVoucher(unittest.TestCase):
webnotes.conn.set_value("Company", "_Test Company", "yearly_bgt_flag", "Ignore")
def test_monthly_budget_on_cancellation(self):
from accounts.utils import BudgetError
from erpnext.accounts.utils import BudgetError
webnotes.conn.set_value("Company", "_Test Company", "monthly_bgt_flag", "Stop")
self.clear_account_balance()

View File

@ -5,7 +5,7 @@ from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, get_first_day, get_last_day, has_common
import webnotes.defaults
from accounts.utils import get_balance_on
from erpnext.accounts.utils import get_balance_on
class DocType:
def __init__(self, doc, doclist):
@ -29,7 +29,7 @@ class DocType:
ret['period'] = ['Annual','Half Yearly','Quarterly','Monthly']
from accounts.page.accounts_browser.accounts_browser import get_companies
from erpnext.accounts.page.accounts_browser.accounts_browser import get_companies
ret['company'] = get_companies()
#--- to get fiscal year and start_date of that fiscal year -----

View File

@ -121,14 +121,14 @@ class DocType:
lst.append(args)
if lst:
from accounts.utils import reconcile_against_document
from erpnext.accounts.utils import reconcile_against_document
reconcile_against_document(lst)
msgprint("Successfully allocated.")
else:
msgprint("No amount allocated.", raise_exception=1)
def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
from controllers.queries import get_match_cond
from erpnext.controllers.queries import get_match_cond
return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date,
gle.%(account_type)s from `tabGL Entry` gle

Some files were not shown because too many files have changed in this diff Show More