Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
commit
5c13163e84
@ -351,7 +351,7 @@ class DocType(SellingController):
|
|||||||
|
|
||||||
if ret.get("warehouse"):
|
if ret.get("warehouse"):
|
||||||
ret["actual_qty"] = flt(webnotes.conn.get_value("Bin",
|
ret["actual_qty"] = flt(webnotes.conn.get_value("Bin",
|
||||||
{"item_code": args.get("item_code"), "warehouse": args.get("warehouse")},
|
{"item_code": args.get("item_code"), "warehouse": ret.get("warehouse")},
|
||||||
"actual_qty"))
|
"actual_qty"))
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
@ -433,17 +433,6 @@ class DocType(SellingController):
|
|||||||
from accounts.utils import reconcile_against_document
|
from accounts.utils import reconcile_against_document
|
||||||
reconcile_against_document(lst)
|
reconcile_against_document(lst)
|
||||||
|
|
||||||
def validate_customer(self):
|
|
||||||
""" Validate customer name with SO and DN"""
|
|
||||||
for d in getlist(self.doclist,'entries'):
|
|
||||||
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
|
|
||||||
if dt:
|
|
||||||
dt_no = d.delivery_note or d.sales_order
|
|
||||||
cust = webnotes.conn.sql("select customer from `tab%s` where name = %s" % (dt, '%s'), dt_no)
|
|
||||||
if cust and cstr(cust[0][0]) != cstr(self.doc.customer):
|
|
||||||
msgprint("Customer %s does not match with customer of %s: %s." %(self.doc.customer, dt, dt_no), raise_exception=1)
|
|
||||||
|
|
||||||
|
|
||||||
def validate_customer_account(self):
|
def validate_customer_account(self):
|
||||||
"""Validates Debit To Account and Customer Matches"""
|
"""Validates Debit To Account and Customer Matches"""
|
||||||
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
|
||||||
@ -455,6 +444,19 @@ class DocType(SellingController):
|
|||||||
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
and Master Name in account master." %(self.doc.debit_to, self.doc.customer,self.doc.company), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
|
def validate_customer(self):
|
||||||
|
""" Validate customer name with SO and DN"""
|
||||||
|
if self.doc.customer:
|
||||||
|
for d in getlist(self.doclist,'entries'):
|
||||||
|
dt = d.delivery_note and 'Delivery Note' or d.sales_order and 'Sales Order' or ''
|
||||||
|
if dt:
|
||||||
|
dt_no = d.delivery_note or d.sales_order
|
||||||
|
cust = webnotes.conn.get_value(dt, dt_no, "customer")
|
||||||
|
if cust and cstr(cust) != cstr(self.doc.customer):
|
||||||
|
msgprint("Customer %s does not match with customer of %s: %s."
|
||||||
|
%(self.doc.customer, dt, dt_no), raise_exception=1)
|
||||||
|
|
||||||
|
|
||||||
def validate_debit_acc(self):
|
def validate_debit_acc(self):
|
||||||
acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
|
acc = webnotes.conn.sql("select debit_or_credit, is_pl_account from tabAccount where name = '%s' and docstatus != 2" % self.doc.debit_to)
|
||||||
if not acc:
|
if not acc:
|
||||||
|
0
accounts/report/customer_account_head/__init__.py
Normal file
0
accounts/report/customer_account_head/__init__.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# ERPNext - web based ERP (http://erpnext.com)
|
||||||
|
# Copyright (C) 2012 Web Notes Technologies Pvt Ltd
|
||||||
|
#
|
||||||
|
# This program is free software: you can redistribute it and/or modify
|
||||||
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation, either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
from __future__ import unicode_literals
|
||||||
|
import webnotes
|
||||||
|
|
||||||
|
def execute(filters=None):
|
||||||
|
account_map = get_account_map()
|
||||||
|
columns = get_columns(account_map)
|
||||||
|
data = []
|
||||||
|
customers = webnotes.conn.sql("select name from tabCustomer where docstatus < 2")
|
||||||
|
for cust in customers:
|
||||||
|
row = [cust[0]]
|
||||||
|
for company in sorted(account_map):
|
||||||
|
row.append(account_map[company].get(cust[0], ''))
|
||||||
|
data.append(row)
|
||||||
|
|
||||||
|
return columns, data
|
||||||
|
|
||||||
|
def get_account_map():
|
||||||
|
accounts = webnotes.conn.sql("""select name, company, master_name
|
||||||
|
from `tabAccount` where master_type = 'Customer'
|
||||||
|
and ifnull(master_name, '') != '' and docstatus < 2""", as_dict=1)
|
||||||
|
|
||||||
|
account_map = {}
|
||||||
|
for acc in accounts:
|
||||||
|
account_map.setdefault(acc.company, {}).setdefault(acc.master_name, {})
|
||||||
|
account_map[acc.company][acc.master_name] = acc.name
|
||||||
|
|
||||||
|
return account_map
|
||||||
|
|
||||||
|
def get_columns(account_map):
|
||||||
|
columns = ["Customer:Link/Customer:120"] + \
|
||||||
|
[(company + ":Link/Account:120") for company in sorted(account_map)]
|
||||||
|
|
||||||
|
return columns
|
@ -0,0 +1,21 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"creation": "2013-06-03 16:17:34",
|
||||||
|
"docstatus": 0,
|
||||||
|
"modified": "2013-06-03 16:17:34",
|
||||||
|
"modified_by": "Administrator",
|
||||||
|
"owner": "Administrator"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Report",
|
||||||
|
"is_standard": "Yes",
|
||||||
|
"name": "__common__",
|
||||||
|
"ref_doctype": "Account",
|
||||||
|
"report_name": "Customer Account Head",
|
||||||
|
"report_type": "Script Report"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"doctype": "Report",
|
||||||
|
"name": "Customer Account Head"
|
||||||
|
}
|
||||||
|
]
|
@ -273,36 +273,45 @@ def create_stock_in_hand_jv(reverse=False):
|
|||||||
jv = webnotes.bean([
|
jv = webnotes.bean([
|
||||||
{
|
{
|
||||||
"doctype": "Journal Voucher",
|
"doctype": "Journal Voucher",
|
||||||
"naming_series": "_PATCH-",
|
"naming_series": "JV-AUTO-",
|
||||||
"company": company,
|
"company": company,
|
||||||
"posting_date": today,
|
"posting_date": today,
|
||||||
"fiscal_year": fiscal_year,
|
"fiscal_year": fiscal_year,
|
||||||
"voucher_type": "Journal Entry",
|
"voucher_type": "Journal Entry",
|
||||||
"user_remark": "Accounting Entry for Stock: \
|
"user_remark": (_("Auto Inventory Accounting") + ": " +
|
||||||
Initial booking of stock received but not billed account"
|
(_("Disabled") if reverse else _("Enabled")) + ". " +
|
||||||
|
_("Journal Entry for inventory that is received but not yet invoiced"))
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Journal Voucher Detail",
|
"doctype": "Journal Voucher Detail",
|
||||||
"parentfield": "entries",
|
"parentfield": "entries",
|
||||||
"account": get_company_default(company, "stock_received_but_not_billed"),
|
"account": get_company_default(company, "stock_received_but_not_billed"),
|
||||||
(stock_rbnb_value > 0 and "credit" or "debit"): abs(stock_rbnb_value)
|
(stock_rbnb_value > 0 and "credit" or "debit"): abs(stock_rbnb_value)
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"doctype": "Journal Voucher Detail",
|
"doctype": "Journal Voucher Detail",
|
||||||
"parentfield": "entries",
|
"parentfield": "entries",
|
||||||
"account": get_company_default(company, "stock_adjustment_account"),
|
"account": get_company_default(company, "stock_adjustment_account"),
|
||||||
(stock_rbnb_value > 0 and "debit" or "credit"): abs(stock_rbnb_value),
|
(stock_rbnb_value > 0 and "debit" or "credit"): abs(stock_rbnb_value),
|
||||||
"cost_center": get_company_default(company, "stock_adjustment_cost_center")
|
"cost_center": get_company_default(company, "stock_adjustment_cost_center")
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
jv.insert()
|
jv.insert()
|
||||||
jv.submit()
|
|
||||||
|
|
||||||
jv_list.append(jv.doc.name)
|
jv_list.append(jv.doc.name)
|
||||||
|
|
||||||
if jv_list:
|
if jv_list:
|
||||||
webnotes.msgprint("""Folowing Journal Vouchers has been created automatically:
|
msgprint(_("Following Journal Vouchers have been created automatically") + \
|
||||||
%s""" % '\n'.join(jv_list))
|
":\n%s" % ("\n".join([("<a href=\"#Form/Journal Voucher/%s\">%s</a>" % (jv, jv)) for jv in jv_list]),))
|
||||||
|
|
||||||
|
msgprint(_("""These adjustment vouchers book the difference between \
|
||||||
|
the total value of received items and the total value of invoiced items, \
|
||||||
|
as a required step to use Auto Inventory Accounting.
|
||||||
|
This is an approximation to get you started.
|
||||||
|
You will need to submit these vouchers after checking if the values are correct.
|
||||||
|
For more details, read: \
|
||||||
|
<a href="http://erpnext.com/auto-inventory-accounting" target="_blank">\
|
||||||
|
Auto Inventory Accounting</a>"""))
|
||||||
|
|
||||||
webnotes.msgprint("""Please refresh the system to get effect of Auto Inventory Accounting""")
|
webnotes.msgprint("""Please refresh the system to get effect of Auto Inventory Accounting""")
|
||||||
|
|
||||||
|
@ -317,9 +317,9 @@ class DocType:
|
|||||||
|
|
||||||
items_to_be_requested = webnotes._dict()
|
items_to_be_requested = webnotes._dict()
|
||||||
for item in self.item_dict:
|
for item in self.item_dict:
|
||||||
if flt(self.item_dict[item][0]) > item_projected_qty[item]:
|
if flt(self.item_dict[item][0]) > item_projected_qty.get(item, 0):
|
||||||
# shortage
|
# shortage
|
||||||
requested_qty = flt(self.item_dict[item][0]) - item_projected_qty[item]
|
requested_qty = flt(self.item_dict[item][0]) - item_projected_qty.get(item, 0)
|
||||||
# comsider minimum order qty
|
# comsider minimum order qty
|
||||||
requested_qty = requested_qty > flt(self.item_dict[item][3]) and \
|
requested_qty = requested_qty > flt(self.item_dict[item][3]) and \
|
||||||
requested_qty or flt(self.item_dict[item][3])
|
requested_qty or flt(self.item_dict[item][3])
|
||||||
|
@ -2,6 +2,8 @@ import webnotes, os, webnotes.utils
|
|||||||
|
|
||||||
def execute():
|
def execute():
|
||||||
files_path = webnotes.utils.get_path("public", "files")
|
files_path = webnotes.utils.get_path("public", "files")
|
||||||
|
webnotes.conn.auto_commit_on_many_writes = 1
|
||||||
|
|
||||||
for f in webnotes.conn.sql("""select name, file_name from
|
for f in webnotes.conn.sql("""select name, file_name from
|
||||||
`tabFile Data`""", as_dict=True):
|
`tabFile Data`""", as_dict=True):
|
||||||
if f.file_name:
|
if f.file_name:
|
||||||
@ -9,4 +11,4 @@ def execute():
|
|||||||
if os.path.exists(filepath):
|
if os.path.exists(filepath):
|
||||||
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
|
webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
|
||||||
|
|
||||||
|
webnotes.conn.auto_commit_on_many_writes = 0
|
@ -2,6 +2,8 @@ import webnotes
|
|||||||
def execute():
|
def execute():
|
||||||
from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes
|
from patches.april_2013.p05_update_file_data import update_file_list, get_single_doctypes
|
||||||
|
|
||||||
|
webnotes.conn.auto_commit_on_many_writes = 1
|
||||||
|
|
||||||
singles = get_single_doctypes()
|
singles = get_single_doctypes()
|
||||||
for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns`
|
for doctype in webnotes.conn.sql_list("""select table_name from `information_schema`.`columns`
|
||||||
where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name):
|
where table_schema=%s and column_name='file_list'""", webnotes.conn.cur_db_name):
|
||||||
@ -14,3 +16,4 @@ def execute():
|
|||||||
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
|
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
|
||||||
and parent=%s""", doctype)
|
and parent=%s""", doctype)
|
||||||
|
|
||||||
|
webnotes.conn.auto_commit_on_many_writes = 0
|
@ -123,16 +123,9 @@ class DocType:
|
|||||||
|
|
||||||
def validate_series_name(self, n):
|
def validate_series_name(self, n):
|
||||||
import re
|
import re
|
||||||
if "." in n:
|
if not re.match("^[a-zA-Z0-9-/.#]*$", n):
|
||||||
parts = n.split(".")
|
msgprint('Special Characters except "-" and "/" not allowed in naming series',
|
||||||
if len(parts) > 2:
|
raise_exception=True)
|
||||||
msgprint("Only one dot (.) allowed in " + n, raise_exception=1)
|
|
||||||
if not re.match("#+$", parts[-1]):
|
|
||||||
msgprint("Numbering series must be in hashes (e.g. ####)", raise_exception=1)
|
|
||||||
n = n[0]
|
|
||||||
if not re.match("^[a-zA-Z0-9-/]*$", n):
|
|
||||||
msgprint('Special Characters except "-" and "/" not allowed in naming series')
|
|
||||||
raise Exception
|
|
||||||
|
|
||||||
def get_options(self, arg=''):
|
def get_options(self, arg=''):
|
||||||
sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series,
|
sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series,
|
||||||
|
@ -73,7 +73,7 @@ wn.module_page["Setup"] = [
|
|||||||
{
|
{
|
||||||
"route":"Form/Naming Series/Naming Series",
|
"route":"Form/Naming Series/Naming Series",
|
||||||
doctype: "Naming Series",
|
doctype: "Naming Series",
|
||||||
label: wn._("Manage numbering series"),
|
label: wn._("Manage Numbering Series"),
|
||||||
"description":wn._("Set multiple numbering series for transactions")
|
"description":wn._("Set multiple numbering series for transactions")
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user