Merge branch 'master' of github.com:webnotes/erpnext into slow
Conflicts:
stock/doctype/purchase_receipt/purchase_receipt.js
diff --git a/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt b/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt
index ce45824..031abd2 100644
--- a/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt
+++ b/accounts/DocType Mapper/Purchase Order-Purchase Invoice/Purchase Order-Purchase Invoice.txt
@@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2010-08-08 17:09:35",
"modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
+ "modified": "2013-07-04 12:49:50"
},
{
"name": "__common__",
@@ -120,4 +120,4 @@
"to_table": "Purchase Taxes and Charges",
"validation_logic": "docstatus =1"
}
-]
\ No newline at end of file
+]
diff --git a/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt b/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt
index f6c87e2..5ed4b2a 100644
--- a/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt
+++ b/accounts/DocType Mapper/Purchase Receipt-Purchase Invoice/Purchase Receipt-Purchase Invoice.txt
@@ -4,7 +4,7 @@
"docstatus": 0,
"creation": "2010-08-08 17:09:35",
"modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
+ "modified": "2013-07-04 12:49:50"
},
{
"name": "__common__",
@@ -141,4 +141,4 @@
"to_table": "Purchase Taxes and Charges",
"validation_logic": "docstatus=1"
}
-]
\ No newline at end of file
+]
diff --git a/accounts/doctype/account/account.py b/accounts/doctype/account/account.py
index eb65604..bdc26e4 100644
--- a/accounts/doctype/account/account.py
+++ b/accounts/doctype/account/account.py
@@ -187,7 +187,7 @@
sql("""delete from `tabGL Entry` where account = %s and
ifnull(is_cancelled, 'No') = 'Yes'""", self.doc.name)
- def on_rename(self, new, old):
+ def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
parts = new.split(" - ")
diff --git a/accounts/doctype/bank_reconciliation/bank_reconciliation.py b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
index 980af58..f19df48 100644
--- a/accounts/doctype/bank_reconciliation/bank_reconciliation.py
+++ b/accounts/doctype/bank_reconciliation/bank_reconciliation.py
@@ -66,6 +66,6 @@
vouchers.append(d.voucher_id)
if vouchers:
- msgprint("Clearance Date updated in %s" % vouchers)
+ msgprint("Clearance Date updated in %s" % ", ".join(vouchers))
else:
msgprint("Clearance Date not mentioned")
\ No newline at end of file
diff --git a/accounts/doctype/c_form/c_form.py b/accounts/doctype/c_form/c_form.py
index 9f89ad5..25a8c3b 100644
--- a/accounts/doctype/c_form/c_form.py
+++ b/accounts/doctype/c_form/c_form.py
@@ -17,16 +17,12 @@
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, getdate
-from webnotes.model.doc import make_autoname
from webnotes.model.bean import getlist
class DocType:
def __init__(self,d,dl):
self.doc, self.doclist = d,dl
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series + '.#####')
-
def validate(self):
"""Validate invoice that c-form is applicable
and no other c-form is received for that"""
diff --git a/accounts/doctype/c_form/c_form.txt b/accounts/doctype/c_form/c_form.txt
index 3a956e9..9243d36 100644
--- a/accounts/doctype/c_form/c_form.txt
+++ b/accounts/doctype/c_form/c_form.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-30 12:49:46",
+ "creation": "2013-03-07 14:48:29",
"docstatus": 0,
"modified": "2013-02-13 11:29:18",
"modified_by": "Administrator",
@@ -24,17 +24,13 @@
"permlevel": 0
},
{
- "create": 1,
"doctype": "DocPerm",
"name": "__common__",
"parent": "C-Form",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
"read": 1,
- "report": 1,
- "submit": 0,
- "write": 1
+ "submit": 0
},
{
"doctype": "DocType",
@@ -158,15 +154,6 @@
},
{
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "print_hide": 1,
- "read_only": 0
- },
- {
- "doctype": "DocField",
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
@@ -176,11 +163,28 @@
"read_only": 1
},
{
+ "create": 1,
"doctype": "DocPerm",
- "role": "Accounts User"
+ "permlevel": 0,
+ "report": 1,
+ "role": "Accounts User",
+ "write": 1
},
{
+ "create": 1,
"doctype": "DocPerm",
- "role": "Accounts Manager"
+ "permlevel": 0,
+ "report": 1,
+ "role": "Accounts Manager",
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "role": "All"
}
]
\ No newline at end of file
diff --git a/accounts/doctype/cost_center/cost_center.py b/accounts/doctype/cost_center/cost_center.py
index e57b6a3..4e9b7fd 100644
--- a/accounts/doctype/cost_center/cost_center.py
+++ b/accounts/doctype/cost_center/cost_center.py
@@ -29,7 +29,7 @@
def autoname(self):
company_abbr = webnotes.conn.sql("select abbr from tabCompany where name=%s",
self.doc.company_name)[0][0]
- self.doc.name = self.doc.cost_center_name + ' - ' + company_abbr
+ self.doc.name = self.doc.cost_center_name.strip() + ' - ' + company_abbr
def validate_mandatory(self):
if not self.doc.group_or_ledger:
@@ -81,13 +81,13 @@
"""
Cost Center name must be unique
"""
- if (self.doc.__islocal or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
+ if (self.doc.fields.get("__islocal") or not self.doc.name) and webnotes.conn.sql("select name from `tabCost Center` where cost_center_name = %s and company_name=%s", (self.doc.cost_center_name, self.doc.company_name)):
msgprint("Cost Center Name already exists, please rename", raise_exception=1)
self.validate_mandatory()
self.validate_budget_details()
- def on_rename(self, new, old):
+ def on_rename(self, new, old, merge=False):
company_abbr = webnotes.conn.get_value("Company", self.doc.company_name, "abbr")
parts = new.split(" - ")
diff --git a/accounts/doctype/gl_entry/gl_entry.py b/accounts/doctype/gl_entry/gl_entry.py
index 64d84b0..a2ef25a 100644
--- a/accounts/doctype/gl_entry/gl_entry.py
+++ b/accounts/doctype/gl_entry/gl_entry.py
@@ -42,9 +42,9 @@
self.check_negative_balance(adv_adj)
# Update outstanding amt on against voucher
- if self.doc.against_voucher and self.doc.against_voucher_type not in \
- ('Journal Voucher','POS') and update_outstanding == 'Yes':
- self.update_outstanding_amt()
+ if self.doc.against_voucher and self.doc.against_voucher_type != "POS" \
+ and update_outstanding == 'Yes':
+ self.update_outstanding_amt()
def check_mandatory(self):
mandatory = ['account','remarks','voucher_type','voucher_no','fiscal_year','company']
@@ -108,8 +108,8 @@
and not 'Accounts Manager' in webnotes.user.get_roles():
msgprint(_("Account") + ": " + self.doc.account + _(" has been freezed. \
Only Accounts Manager can do transaction against this account"), raise_exception=1)
-
- if ret and ret[0]["company"] != self.doc.company:
+
+ if self.doc.is_cancelled in ("No", None) and ret and ret[0]["company"] != self.doc.company:
msgprint(_("Account") + ": " + self.doc.account + _(" does not belong to the company") \
+ ": " + self.doc.company, raise_exception=1)
@@ -124,9 +124,10 @@
return self.cost_center_company[self.doc.cost_center]
- if self.doc.cost_center and _get_cost_center_company() != self.doc.company:
- msgprint(_("Cost Center") + ": " + self.doc.cost_center \
- + _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)
+ if self.doc.is_cancelled in ("No", None) and \
+ self.doc.cost_center and _get_cost_center_company() != self.doc.company:
+ msgprint(_("Cost Center") + ": " + self.doc.cost_center \
+ + _(" does not belong to the company") + ": " + self.doc.company, raise_exception=True)
def check_freezing_date(self, adv_adj):
"""
@@ -159,20 +160,29 @@
def update_outstanding_amt(self):
# get final outstanding amt
bal = flt(sql("""select sum(debit) - sum(credit) from `tabGL Entry`
- where against_voucher=%s and against_voucher_type=%s
- and ifnull(is_cancelled,'No') = 'No'""",
- (self.doc.against_voucher, self.doc.against_voucher_type))[0][0] or 0.0)
-
- if self.doc.against_voucher_type=='Purchase Invoice':
- # amount to debit
+ where against_voucher=%s and against_voucher_type=%s and account = %s
+ and ifnull(is_cancelled,'No') = 'No'""", (self.doc.against_voucher,
+ self.doc.against_voucher_type, self.doc.account))[0][0] or 0.0)
+
+ if self.doc.against_voucher_type == 'Purchase Invoice':
bal = -bal
+
+ elif self.doc.against_voucher_type == "Journal Voucher":
+ against_voucher_amount = flt(webnotes.conn.sql("""select sum(debit) - sum(credit)
+ from `tabGL Entry` where voucher_type = 'Journal Voucher' and voucher_no = %s
+ and account = %s""", (self.doc.against_voucher, self.doc.account))[0][0])
+
+ bal = against_voucher_amount + bal
+ if against_voucher_amount < 0:
+ bal = -bal
# Validation : Outstanding can not be negative
if bal < 0 and self.doc.is_cancelled == 'No':
msgprint(_("Outstanding for Voucher ") + self.doc.against_voucher +
- _(" will become ") + fmt_money(bal) + _("Outstanding cannot be less than zero. \
+ _(" will become ") + fmt_money(bal) + _(". Outstanding cannot be less than zero. \
Please match exact outstanding."), raise_exception=1)
# Update outstanding amt on against voucher
- sql("update `tab%s` set outstanding_amount=%s where name='%s'"%
- (self.doc.against_voucher_type, bal, self.doc.against_voucher))
\ No newline at end of file
+ if self.doc.against_voucher_type in ["Sales Invoice", "Purchase Invoice"]:
+ sql("update `tab%s` set outstanding_amount=%s where name='%s'"%
+ (self.doc.against_voucher_type, bal, self.doc.against_voucher))
\ No newline at end of file
diff --git a/accounts/doctype/journal_voucher/journal_voucher.py b/accounts/doctype/journal_voucher/journal_voucher.py
index 9b1ca7a..a5a4f10 100644
--- a/accounts/doctype/journal_voucher/journal_voucher.py
+++ b/accounts/doctype/journal_voucher/journal_voucher.py
@@ -34,15 +34,12 @@
self.credit_days_global = -1
self.is_approving_authority = -1
- def autoname(self):
- if not self.doc.naming_series:
- webnotes.msgprint("""Naming Series is mandatory""", raise_exception=1)
- self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
def validate(self):
if not self.doc.is_opening:
self.doc.is_opening='No'
+ self.doc.clearance_date = None
+
self.validate_debit_credit()
self.validate_cheque_info()
self.validate_entries_for_advance()
diff --git a/accounts/doctype/journal_voucher/test_journal_voucher.py b/accounts/doctype/journal_voucher/test_journal_voucher.py
index 7cfeb59..feb1e2c 100644
--- a/accounts/doctype/journal_voucher/test_journal_voucher.py
+++ b/accounts/doctype/journal_voucher/test_journal_voucher.py
@@ -122,119 +122,4 @@
"parentfield": "entries",
"cost_center": "_Test Cost Center - _TC"
}],
-]
-
-
-
-
-
-
-#
-#
-# import webnotes.model
-# from webnotes.utils import nowdate, flt, add_days
-# from accounts.utils import get_fiscal_year, get_balance_on
-#
-# company = webnotes.conn.get_default("company")
-# abbr = webnotes.conn.get_value("Company", company, "abbr")
-#
-# data = {
-# "expense_account": {
-# "doctype": "Account",
-# "account_name": "Test Expense",
-# "parent_account": "Direct Expenses - %s" % abbr,
-# "company": company,
-# "debit_or_credit": "Debit",
-# "is_pl_account": "Yes",
-# "group_or_ledger": "Ledger"
-# },
-# "supplier_account": {
-# "doctype": "Account",
-# "account_name": "Test Supplier",
-# "parent_account": "Accounts Payable - %s" % abbr,
-# "company": company,
-# "debit_or_credit": "Credit",
-# "is_pl_account": "No",
-# "group_or_ledger": "Ledger"
-# },
-# "test_cost_center": {
-# "doctype": "Cost Center",
-# "cost_center_name": "Test Cost Center",
-# "parent_cost_center": "Root - %s" % abbr,
-# "company_name": company,
-# "group_or_ledger": "Ledger",
-# "company_abbr": abbr
-# },
-# "journal_voucher": [
-# {
-# "doctype": "Journal Voucher",
-# "voucher_type": "Journal Entry",
-# "naming_series": "JV",
-# "posting_date": nowdate(),
-# "remark": "Test Journal Voucher",
-# "fiscal_year": get_fiscal_year(nowdate())[0],
-# "company": company
-# },
-# {
-# "doctype": "Journal Voucher Detail",
-# "parentfield": "entries",
-# "account": "Test Expense - %s" % abbr,
-# "debit": 5000,
-# "cost_center": "Test Cost Center - %s" % abbr,
-# },
-# {
-# "doctype": "Journal Voucher Detail",
-# "parentfield": "entries",
-# "account": "Test Supplier - %s" % abbr,
-# "credit": 5000,
-# },
-# ]
-# }
-#
-# def get_name(s):
-# return s + " - " + abbr
-#
-# class TestJournalVoucher(unittest.TestCase):
-# def setUp(self):
-# webnotes.conn.begin()
-#
-# # create a dummy account
-# webnotes.model.insert([data["expense_account"]])
-# webnotes.model.insert([data["supplier_account"]])
-# webnotes.model.insert([data["test_cost_center"]])
-#
-# def tearDown(self):
-# webnotes.conn.rollback()
-#
-# def test_save_journal_voucher(self):
-# expense_ac_balance = get_balance_on(get_name("Test Expense"), nowdate())
-# supplier_ac_balance = get_balance_on(get_name("Test Supplier"), nowdate())
-#
-# dl = webnotes.model.insert(data["journal_voucher"])
-# dl.submit()
-# dl.load_from_db()
-#
-# # test submitted jv
-# self.assertTrue(webnotes.conn.exists("Journal Voucher", dl.doclist[0].name))
-# for d in dl.doclist[1:]:
-# self.assertEquals(webnotes.conn.get_value("Journal Voucher Detail",
-# d.name, "parent"), dl.doclist[0].name)
-#
-# # test gl entry
-# gle = webnotes.conn.sql("""select account, debit, credit
-# from `tabGL Entry` where voucher_no = %s order by account""",
-# dl.doclist[0].name)
-#
-# self.assertEquals((gle[0][0], flt(gle[0][1]), flt(gle[0][2])),
-# ('Test Expense - %s' % abbr, 5000.0, 0.0))
-# self.assertEquals((gle[1][0], flt(gle[1][1]), flt(gle[1][2])),
-# ('Test Supplier - %s' % abbr, 0.0, 5000.0))
-#
-# # check balance as on today
-# self.assertEqual(get_balance_on(get_name("Test Expense"), nowdate()),
-# expense_ac_balance + 5000)
-# self.assertEqual(get_balance_on(get_name("Test Supplier"), nowdate()),
-# supplier_ac_balance + 5000)
-#
-# # check previous balance
-# self.assertEqual(get_balance_on(get_name("Test Expense"), add_days(nowdate(), -1)), 0)
\ No newline at end of file
+]
\ No newline at end of file
diff --git a/accounts/doctype/mode_of_payment/mode_of_payment.txt b/accounts/doctype/mode_of_payment/mode_of_payment.txt
index 2d01996..0841af0 100644
--- a/accounts/doctype/mode_of_payment/mode_of_payment.txt
+++ b/accounts/doctype/mode_of_payment/mode_of_payment.txt
@@ -1,68 +1,68 @@
[
{
- "owner": "harshada@webnotestech.com",
+ "creation": "2012-12-04 17:49:20",
"docstatus": 0,
- "creation": "2012-07-03 13:30:49",
+ "modified": "2013-04-19 10:59:05",
"modified_by": "Administrator",
- "modified": "2012-12-04 16:33:37"
+ "owner": "harshada@webnotestech.com"
},
{
- "name": "__common__",
+ "allow_rename": 1,
"autoname": "field:mode_of_payment",
- "module": "Accounts",
"doctype": "DocType",
- "document_type": "Master"
+ "document_type": "Master",
+ "module": "Accounts",
+ "name": "__common__"
},
{
+ "doctype": "DocField",
"name": "__common__",
"parent": "Mode of Payment",
- "doctype": "DocField",
+ "parentfield": "fields",
"parenttype": "DocType",
"permlevel": 0,
- "parentfield": "fields"
+ "read_only": 0
},
{
- "parent": "Mode of Payment",
- "read": 1,
- "doctype": "DocPerm",
- "cancel": 1,
- "name": "__common__",
- "amend": 0,
"create": 1,
- "submit": 0,
- "write": 1,
+ "doctype": "DocPerm",
+ "name": "__common__",
+ "parent": "Mode of Payment",
+ "parentfield": "permissions",
"parenttype": "DocType",
- "role": "Accounts Manager",
- "report": 1,
"permlevel": 0,
- "parentfield": "permissions"
+ "read": 1,
+ "report": 1,
+ "role": "Accounts Manager",
+ "submit": 0,
+ "write": 1
},
{
- "name": "Mode of Payment",
- "doctype": "DocType"
+ "doctype": "DocType",
+ "name": "Mode of Payment"
},
{
- "oldfieldtype": "Data",
"doctype": "DocField",
- "label": "Mode of Payment",
- "oldfieldname": "mode_of_payment",
"fieldname": "mode_of_payment",
"fieldtype": "Data",
+ "label": "Mode of Payment",
+ "oldfieldname": "mode_of_payment",
+ "oldfieldtype": "Data",
"reqd": 1
},
{
"doctype": "DocField",
- "label": "Company",
"fieldname": "company",
"fieldtype": "Link",
+ "label": "Company",
"options": "Company"
},
{
"description": "Default Bank / Cash account will be automatically updated in POS Invoice when this mode is selected.",
"doctype": "DocField",
- "label": "Default Account",
"fieldname": "default_account",
"fieldtype": "Link",
+ "label": "Default Account",
"options": "Account"
},
{
diff --git a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
index 8b35bc1..ac7d9d2 100644
--- a/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
+++ b/accounts/doctype/payment_to_invoice_matching_tool/payment_to_invoice_matching_tool.js
@@ -50,6 +50,7 @@
where against_voucher_type = '%(dt)s' \
and against_voucher = gle.voucher_no \
and voucher_no != gle.voucher_no \
+ and account = gle.account \
and ifnull(is_cancelled, 'No') = 'No') != \
abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \
ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50",
diff --git a/accounts/doctype/pos_setting/pos_setting.txt b/accounts/doctype/pos_setting/pos_setting.txt
index 4e30b57..788af9e 100755
--- a/accounts/doctype/pos_setting/pos_setting.txt
+++ b/accounts/doctype/pos_setting/pos_setting.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-26 11:03:07",
+ "creation": "2013-05-09 13:16:11",
"docstatus": 0,
- "modified": "2013-03-26 12:48:18",
+ "modified": "2013-05-23 12:52:09",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -40,6 +40,7 @@
"doctype": "DocField",
"fieldname": "user",
"fieldtype": "Link",
+ "in_list_view": 1,
"label": "User",
"oldfieldname": "user",
"oldfieldtype": "Link",
@@ -99,6 +100,7 @@
"doctype": "DocField",
"fieldname": "company",
"fieldtype": "Link",
+ "in_list_view": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
@@ -211,12 +213,14 @@
"options": "link:Print Heading"
},
{
+ "cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "System Manager",
"write": 1
},
{
+ "cancel": 1,
"create": 1,
"doctype": "DocPerm",
"role": "Accounts Manager",
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.py b/accounts/doctype/purchase_invoice/purchase_invoice.py
index 50d5d43..32a46cf 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.py
@@ -326,7 +326,7 @@
against_accounts.append(stock_not_billed_account)
elif not item.expense_head:
- msgprint(_("""Expense account is mandatory for item: """) + item.item_code,
+ msgprint(_("""Expense account is mandatory for item: """) + (item.item_code or item.item_name),
raise_exception=1)
elif item.expense_head not in against_accounts:
@@ -464,15 +464,16 @@
# if auto inventory accounting enabled and stock item,
# then do stock related gl entries
# expense will be booked in sales invoice
-
stock_item_and_auto_inventory_accounting = True
+ valuation_amt = (flt(item.amount) + flt(item.item_tax_amount) +
+ flt(item.rm_supp_cost))
+
gl_entries.append(
self.get_gl_dict({
"account": stock_account,
"against": self.doc.credit_to,
- "debit": flt(item.valuation_rate) * flt(item.conversion_factor) \
- * flt(item.qty),
+ "debit": valuation_amt,
"remarks": self.doc.remarks or "Accounting Entry for Stock"
})
)
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice.txt b/accounts/doctype/purchase_invoice/purchase_invoice.txt
index 4228264..283c612 100755
--- a/accounts/doctype/purchase_invoice/purchase_invoice.txt
+++ b/accounts/doctype/purchase_invoice/purchase_invoice.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-07 13:16:13",
+ "creation": "2013-05-07 13:50:30",
"docstatus": 0,
- "modified": "2013-03-22 18:17:14",
+ "modified": "2013-05-13 11:12:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -43,6 +43,7 @@
"fieldname": "column_break0",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -56,6 +57,7 @@
"oldfieldtype": "Select",
"options": "BILL\nBILLJ",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0,
"reqd": 1
},
@@ -70,6 +72,7 @@
"oldfieldtype": "Link",
"options": "Account",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -82,7 +85,8 @@
"oldfieldname": "supplier",
"oldfieldtype": "Link",
"options": "Supplier",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -133,6 +137,7 @@
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"reqd": 0,
"width": "50%"
},
@@ -148,6 +153,7 @@
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -161,6 +167,7 @@
"oldfieldname": "bill_no",
"oldfieldtype": "Data",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -173,6 +180,7 @@
"oldfieldname": "bill_date",
"oldfieldtype": "Date",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0,
"search_index": 1
},
@@ -181,7 +189,8 @@
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -191,25 +200,29 @@
"label": "Entries",
"oldfieldname": "entries",
"oldfieldtype": "Table",
- "options": "Purchase Invoice Item"
+ "options": "Purchase Invoice Item",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
- "fieldtype": "Section Break"
+ "fieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "recalculate",
"fieldtype": "Button",
"label": "Recalculate",
- "oldfieldtype": "Button"
+ "oldfieldtype": "Button",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_17",
"fieldtype": "Section Break",
- "options": "Simple"
+ "options": "Simple",
+ "read_only": 0
},
{
"description": "Select Items from Purchase Order",
@@ -220,7 +233,8 @@
"oldfieldname": "purchase_order_main",
"oldfieldtype": "Link",
"options": "Purchase Order",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "Select Items from Purchase Receipt",
@@ -231,7 +245,8 @@
"oldfieldname": "purchase_receipt_main",
"oldfieldtype": "Link",
"options": "Purchase Receipt",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -239,13 +254,15 @@
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
- "options": "pull_details"
+ "options": "pull_details",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "currency_price_list",
"fieldtype": "Section Break",
- "label": "Currency & Price List"
+ "label": "Currency & Price List",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -255,7 +272,8 @@
"oldfieldname": "currency",
"oldfieldtype": "Select",
"options": "Currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "1",
@@ -266,12 +284,14 @@
"label": "Exchange Rate",
"oldfieldname": "conversion_rate",
"oldfieldtype": "Currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"description": "Consider this Price List for fetching rate. (only which have \"For Buying\" as checked)",
@@ -280,7 +300,8 @@
"fieldtype": "Link",
"label": "Price List",
"options": "Price List",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "price_list_name",
@@ -289,7 +310,8 @@
"fieldtype": "Link",
"label": "Price List Currency",
"options": "Currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "price_list_name",
@@ -297,7 +319,8 @@
"fieldname": "plc_conversion_rate",
"fieldtype": "Float",
"label": "Price List Exchange Rate",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "Add / Edit Taxes and Charges",
@@ -305,7 +328,8 @@
"fieldname": "taxes",
"fieldtype": "Section Break",
"label": "Taxes",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -315,7 +339,8 @@
"oldfieldname": "purchase_other_charges",
"oldfieldtype": "Link",
"options": "Purchase Taxes and Charges Master",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -324,7 +349,8 @@
"label": "Get Tax Detail",
"oldfieldtype": "Button",
"options": "get_purchase_tax_details",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -333,7 +359,8 @@
"label": "Purchase Taxes and Charges",
"oldfieldname": "purchase_tax_details",
"oldfieldtype": "Table",
- "options": "Purchase Taxes and Charges"
+ "options": "Purchase Taxes and Charges",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -341,7 +368,8 @@
"fieldtype": "Button",
"label": "Calculate Tax",
"oldfieldtype": "Button",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -349,7 +377,8 @@
"fieldtype": "HTML",
"label": "Tax Calculation",
"oldfieldtype": "HTML",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -366,7 +395,8 @@
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
- "label": "Contact Info"
+ "label": "Contact Info",
+ "read_only": 0
},
{
"depends_on": "eval:doc.supplier",
@@ -374,12 +404,14 @@
"fieldname": "supplier_address",
"fieldtype": "Link",
"label": "Supplier Address",
- "options": "Address"
+ "options": "Address",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break23",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -389,14 +421,16 @@
"fieldtype": "Link",
"label": "Contact Person",
"options": "Contact",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "totals",
"fieldtype": "Section Break",
"label": "Totals",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -499,6 +533,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -564,7 +599,8 @@
"label": "Write Off Amount",
"no_copy": 1,
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:flt(doc.write_off_amount)!=0",
@@ -574,7 +610,8 @@
"label": "Write Off Account",
"no_copy": 1,
"options": "Account",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:flt(doc.write_off_amount)!=0",
@@ -583,8 +620,9 @@
"fieldtype": "Link",
"label": "Write Off Cost Center",
"no_copy": 1,
- "options": "Account",
- "print_hide": 1
+ "options": "Cost Center",
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -596,6 +634,7 @@
"oldfieldname": "against_expense_account",
"oldfieldtype": "Small Text",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0
},
{
@@ -604,7 +643,8 @@
"fieldtype": "Section Break",
"label": "Advances",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -613,7 +653,8 @@
"label": "Get Advances Paid",
"oldfieldtype": "Button",
"options": "get_advances",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -624,7 +665,8 @@
"oldfieldname": "advance_allocation_details",
"oldfieldtype": "Table",
"options": "Purchase Invoice Advance",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -632,7 +674,8 @@
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "No",
@@ -646,6 +689,7 @@
"oldfieldtype": "Select",
"options": "No\nYes",
"print_hide": 1,
+ "read_only": 0,
"search_index": 1
},
{
@@ -657,6 +701,7 @@
"oldfieldname": "aging_date",
"oldfieldtype": "Date",
"print_hide": 1,
+ "read_only": 0,
"search_index": 0
},
{
@@ -682,6 +727,7 @@
"oldfieldtype": "Link",
"options": "Print Heading",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
},
{
@@ -694,6 +740,7 @@
"oldfieldname": "due_date",
"oldfieldtype": "Date",
"print_hide": 0,
+ "read_only": 0,
"search_index": 1
},
{
@@ -703,12 +750,14 @@
"label": "Mode of Payment",
"oldfieldname": "mode_of_payment",
"oldfieldtype": "Select",
- "options": "link:Mode of Payment"
+ "options": "link:Mode of Payment",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break_63",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -720,6 +769,7 @@
"oldfieldtype": "Link",
"options": "Company",
"print_hide": 1,
+ "read_only": 0,
"search_index": 1
},
{
@@ -732,6 +782,7 @@
"oldfieldtype": "Select",
"options": "link:Fiscal Year",
"print_hide": 1,
+ "read_only": 0,
"search_index": 1
},
{
@@ -755,18 +806,10 @@
"oldfieldname": "remarks",
"oldfieldtype": "Text",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
@@ -776,8 +819,40 @@
"write": 1
},
{
+ "amend": 0,
+ "cancel": 0,
+ "create": 1,
+ "doctype": "DocPerm",
+ "role": "Purchase User",
+ "submit": 0,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
"doctype": "DocPerm",
"match": "supplier",
- "role": "Supplier"
+ "role": "Supplier",
+ "submit": 0,
+ "write": 0
+ },
+ {
+ "amend": 1,
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "role": "Accounts Manager",
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "role": "Auditor",
+ "submit": 0,
+ "write": 0
}
]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_invoice/purchase_invoice_list.js b/accounts/doctype/purchase_invoice/purchase_invoice_list.js
index a3f667f..7b410a3 100644
--- a/accounts/doctype/purchase_invoice/purchase_invoice_list.js
+++ b/accounts/doctype/purchase_invoice/purchase_invoice_list.js
@@ -1,9 +1,9 @@
// render
wn.listview_settings['Purchase Invoice'] = {
add_fields: ["`tabPurchase Invoice`.grand_total", "`tabPurchase Invoice`.outstanding_amount"],
- add_columns: [{"content":"outstanding_amount", width:"10%", type:"bar-graph", label: "Paid"}],
+ add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph", label: "Paid"}],
prepare_data: function(data) {
- data.outstanding_amount = ((flt(data.grand_total) -
- flt(data.outstanding_amount)) / flt(data.grand_total)) * 100;
+ data.paid_amount = flt(data.grand_total) ? (((flt(data.grand_total) -
+ flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0;
}
};
diff --git a/accounts/doctype/purchase_invoice/test_purchase_invoice.py b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
index 621604b..a70c932 100644
--- a/accounts/doctype/purchase_invoice/test_purchase_invoice.py
+++ b/accounts/doctype/purchase_invoice/test_purchase_invoice.py
@@ -72,7 +72,38 @@
["Stock Received But Not Billed - _TC", 750.0, 0],
["_Test Account Shipping Charges - _TC", 100.0, 0],
["_Test Account VAT - _TC", 120.0, 0],
- ["Expenses Included In Valuation - _TC", 0, 250.0]
+ ["Expenses Included In Valuation - _TC", 0, 250.0],
+ ])
+
+ for i, gle in enumerate(gl_entries):
+ self.assertEquals(expected_values[i][0], gle.account)
+ self.assertEquals(expected_values[i][1], gle.debit)
+ self.assertEquals(expected_values[i][2], gle.credit)
+
+ webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
+
+ def test_gl_entries_with_aia_for_non_stock_items(self):
+ webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
+ self.assertEqual(cint(webnotes.defaults.get_global_default("auto_inventory_accounting")), 1)
+
+ pi = webnotes.bean(copy=test_records[1])
+ pi.doclist[1].item_code = "_Test Non Stock Item"
+ pi.doclist[1].expense_head = "_Test Account Cost for Goods Sold - _TC"
+ pi.doclist.pop(2)
+ pi.doclist.pop(3)
+ pi.run_method("calculate_taxes_and_totals")
+ pi.insert()
+ pi.submit()
+
+ gl_entries = webnotes.conn.sql("""select account, debit, credit
+ from `tabGL Entry` where voucher_type='Purchase Invoice' and voucher_no=%s
+ order by account asc""", pi.doc.name, as_dict=1)
+ self.assertTrue(gl_entries)
+
+ expected_values = sorted([
+ ["_Test Supplier - _TC", 0, 620],
+ ["_Test Account Cost for Goods Sold - _TC", 500.0, 0],
+ ["_Test Account VAT - _TC", 120.0, 0],
])
for i, gle in enumerate(gl_entries):
@@ -106,7 +137,6 @@
self.assertEqual(tax.account_head, expected_values[i][0])
self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2])
- # print tax.account_head, tax.tax_amount, tax.item_wise_tax_detail
expected_values = [
["_Test Item Home Desktop 100", 90, 59],
@@ -142,7 +172,6 @@
self.assertEqual(tax.account_head, expected_values[i][0])
self.assertEqual(tax.tax_amount, expected_values[i][1])
self.assertEqual(tax.total, expected_values[i][2])
- # print tax.account_head, tax.tax_amount, tax.item_wise_tax_detail
expected_values = [
["_Test FG Item", 90, 7059],
diff --git a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
index e33ab7c..8df4306 100755
--- a/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
+++ b/accounts/doctype/purchase_invoice_item/purchase_invoice_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-04-10 08:35:38",
+ "creation": "2013-04-19 11:00:07",
"docstatus": 0,
- "modified": "2013-04-17 14:05:20",
+ "modified": "2013-05-22 12:01:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -224,6 +224,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Pur Order",
+ "no_copy": 1,
"oldfieldname": "purchase_order",
"oldfieldtype": "Link",
"options": "Purchase Order",
@@ -238,6 +239,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Purchase Order Item",
+ "no_copy": 1,
"oldfieldname": "po_detail",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -250,6 +252,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Pur Receipt",
+ "no_copy": 1,
"oldfieldname": "purchase_receipt",
"oldfieldtype": "Link",
"options": "Purchase Receipt",
@@ -264,6 +267,7 @@
"hidden": 1,
"in_filter": 1,
"label": "PR Detail",
+ "no_copy": 1,
"oldfieldname": "pr_detail",
"oldfieldtype": "Data",
"print_hide": 1,
diff --git a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt
index 5767307..619aed1 100644
--- a/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt
+++ b/accounts/doctype/purchase_taxes_and_charges/purchase_taxes_and_charges.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-26 06:51:12",
+ "creation": "2013-04-19 11:00:06",
"docstatus": 0,
- "modified": "2013-04-17 14:05:19",
+ "modified": "2013-05-07 11:23:56",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"oldfieldname": "category",
"oldfieldtype": "Select",
"options": "Valuation and Total\nValuation\nTotal",
+ "read_only": 0,
"reqd": 1
},
{
@@ -45,6 +46,7 @@
"oldfieldname": "charge_type",
"oldfieldtype": "Select",
"options": "\nActual\nOn Net Total\nOn Previous Row Amount\nOn Previous Row Total",
+ "read_only": 0,
"reqd": 1
},
{
@@ -55,6 +57,7 @@
"oldfieldname": "account_head",
"oldfieldtype": "Link",
"options": "Account",
+ "read_only": 0,
"reqd": 1
},
{
@@ -65,7 +68,8 @@
"label": "Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
- "options": "Cost Center"
+ "options": "Cost Center",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -75,17 +79,18 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"width": "300px"
},
{
"doctype": "DocField",
"fieldname": "rate",
- "fieldtype": "Currency",
+ "fieldtype": "Float",
"label": "Rate",
"oldfieldname": "rate",
"oldfieldtype": "Currency",
- "options": "Company:company:default_currency",
+ "read_only": 0,
"reqd": 0
},
{
@@ -96,6 +101,7 @@
"oldfieldname": "tax_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
+ "read_only": 0,
"reqd": 0
},
{
@@ -115,7 +121,8 @@
"hidden": 0,
"label": "Enter Row",
"oldfieldname": "row_id",
- "oldfieldtype": "Data"
+ "oldfieldtype": "Data",
+ "read_only": 0
},
{
"default": "Add",
@@ -126,6 +133,7 @@
"oldfieldname": "add_deduct_tax",
"oldfieldtype": "Select",
"options": "Add\nDeduct",
+ "read_only": 0,
"reqd": 1
},
{
@@ -149,6 +157,7 @@
"oldfieldname": "parenttype",
"oldfieldtype": "Data",
"print_hide": 1,
+ "read_only": 0,
"search_index": 0
},
{
@@ -163,6 +172,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
},
{
@@ -177,6 +187,7 @@
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
}
]
\ No newline at end of file
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
index 53588e0..f04f895 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js
@@ -147,7 +147,7 @@
d.account_head = '';
}
else if(d.account_head && d.charge_type) {
- arg = "{'charge_type' : '" + d.charge_type +"', 'account_head' : '" + d.account_head + "'}";
+ arg = "{'charge_type' : '" + d.charge_type + "', 'account_head' : '" + d.account_head + "'}";
get_server_fields('get_rate', arg, 'purchase_tax_details', doc, cdt, cdn, 1);
}
refresh_field('account_head',d.name,'purchase_tax_details');
diff --git a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
index 1250db5..995415e 100644
--- a/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
+++ b/accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.py
@@ -26,11 +26,11 @@
class DocType:
- def __init__(self, doc, doclist=[]):
- self.doc = doc
- self.doclist = doclist
+ def __init__(self, doc, doclist=[]):
+ self.doc = doc
+ self.doclist = doclist
- # Get Tax Rate if account type is Tax
- # ===================================================================
- def get_rate(self, arg):
- return get_obj('Purchase Common').get_rate(arg, self)
\ No newline at end of file
+ # Get Tax Rate if account type is Tax
+ # ===================================================================
+ def get_rate(self, arg):
+ return get_obj('Purchase Common').get_rate(arg, self)
\ No newline at end of file
diff --git a/accounts/doctype/sales_invoice/sales_invoice.js b/accounts/doctype/sales_invoice/sales_invoice.js
index 2d5abd7..f5301c1 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.js
+++ b/accounts/doctype/sales_invoice/sales_invoice.js
@@ -159,7 +159,6 @@
cur_frm.cscript.hide_fields(doc, dt, dn);
}
-
cur_frm.cscript.warehouse = function(doc, cdt , cdn) {
var d = locals[cdt][cdn];
if (!d.item_code) { msgprint("please enter item code first"); return };
diff --git a/accounts/doctype/sales_invoice/sales_invoice.py b/accounts/doctype/sales_invoice/sales_invoice.py
index f44a787..956867d 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.py
+++ b/accounts/doctype/sales_invoice/sales_invoice.py
@@ -30,7 +30,6 @@
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
-
from controllers.selling_controller import SellingController
class DocType(SellingController):
@@ -40,12 +39,9 @@
self.tname = 'Sales Invoice Item'
self.fname = 'entries'
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series+ '.#####')
-
def validate(self):
super(DocType, self).validate()
-
+ self.fetch_missing_values()
self.validate_posting_time()
self.so_dn_required()
self.validate_proj_cust()
@@ -78,9 +74,11 @@
self.set_aging_date()
self.set_against_income_account()
self.validate_c_form()
+ self.validate_rate_with_refdoc()
self.validate_time_logs_are_submitted()
self.validate_recurring_invoice()
+
def on_submit(self):
if cint(self.doc.is_pos) == 1:
if cint(self.doc.update_stock) == 1:
@@ -137,7 +135,27 @@
def on_update_after_submit(self):
self.validate_recurring_invoice()
self.convert_to_recurring()
-
+
+ def fetch_missing_values(self):
+ # fetch contact and address details for customer, if they are not mentioned
+ if not (self.doc.contact_person and self.doc.customer_address):
+ for fieldname, val in self.get_default_address_and_contact("customer").items():
+ if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname):
+ self.doc.fields[fieldname] = val
+
+ # fetch missing item values
+ for item in self.doclist.get({"parentfield": "entries"}):
+ if item.fields.get("item_code"):
+ ret = get_obj('Sales Common').get_item_details(item.fields, self)
+ for fieldname, value in ret.items():
+ if self.meta.get_field(fieldname, parentfield="entries") and \
+ item.fields.get(fieldname) is None:
+ item.fields[fieldname] = value
+
+ # fetch pos details, if they are not fetched
+ if cint(self.doc.is_pos):
+ self.set_pos_fields(for_validate=True)
+
def update_time_log_batch(self, sales_invoice):
for d in self.doclist.get({"doctype":"Sales Invoice Item"}):
if d.time_log_batch:
@@ -153,60 +171,42 @@
webnotes.msgprint(_("Time Log Batch status must be 'Submitted'") + ":" + d.time_log_batch,
raise_exception=True)
- def set_pos_fields(self):
+ def set_pos_fields(self, for_validate=False):
"""Set retail related fields from pos settings"""
- pos = self.pos_details
-
- if pos:
- val = webnotes.conn.sql("""select name from `tabAccount`
- where name = %s and docstatus != 2""",
- (cstr(self.doc.customer) + " - " + self.get_company_abbr()))
-
- val = val and val[0][0] or ''
- if not val: val = pos[0]['customer_account'] or ''
+ if cint(self.doc.is_pos) != 1:
+ return
+
+ if self.pos_settings:
+ pos = self.pos_settings[0]
+
+ self.doc.conversion_rate = flt(pos.conversion_rate)
if not self.doc.debit_to:
- webnotes.conn.set(self.doc,'debit_to',val)
-
- lst = ['territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
- 'price_list_name', 'company', 'select_print_heading', 'cash_bank_account']
+ self.doc.debit_to = self.doc.customer and webnotes.conn.get_value("Account", {
+ "name": self.doc.customer + " - " + self.get_company_abbr(),
+ "docstatus": ["!=", 2]
+ }) or pos.customer_account
- for i in lst:
- self.doc.fields[i] = pos[0][i] or ''
+ for fieldname in ('territory', 'naming_series', 'currency', 'charge', 'letter_head', 'tc_name',
+ 'price_list_name', 'company', 'select_print_heading', 'cash_bank_account'):
+ if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
+ self.doc.fields[fieldname] = pos.get(fieldname)
- self.set_pos_item_values()
-
- self.doc.conversion_rate = flt(pos[0]['conversion_rate']) or 0
+ # set pos values in items
+ for item in self.doclist.get({"parentfield": "entries"}):
+ if item.fields.get('item_code'):
+ for fieldname, val in self.apply_pos_settings(item.fields).items():
+ if (not for_validate) or (for_validate and not item.fields.get(fieldname)):
+ item.fields[fieldname] = val
- #fetch terms
- if self.doc.tc_name:
+ # fetch terms
+ if self.doc.tc_name and not self.doc.terms:
self.get_tc_details()
- #fetch charges
- if self.doc.charge:
+ # fetch charges
+ if self.doc.charge and not len(self.doclist.get({"parentfield": "other_charges"})):
self.get_other_charges()
-
- def set_pos_item_values(self):
- """Set default values related to pos for previously created sales invoice."""
- if cint(self.doc.is_pos) == 1:
- dtl = self.pos_details
-
- for d in getlist(self.doclist,'entries'):
- # overwrite if mentioned in item
- item = webnotes.conn.sql("""select default_income_account,
- default_sales_cost_center, default_warehouse, purchase_account
- from tabItem where name = %s""", (d.item_code,), as_dict=1)
-
- d.income_account = (item and item[0]['default_income_account']) \
- or (dtl and dtl[0]['income_account']) or d.income_account
- d.cost_center = (item and item[0]['default_sales_cost_center']) \
- or (dtl and dtl[0]['cost_center']) or d.cost_center
- d.warehouse = (item and item[0]['default_warehouse']) \
- or (dtl and dtl[0]['warehouse']) or d.warehouse
- d.expense_account = (item and item[0].purchase_account) \
- or (dtl and dtl[0].expense_account) or d.expense_account
-
def get_customer_account(self):
"""Get Account Head to which amount needs to be Debited based on Customer"""
if not self.doc.company:
@@ -215,8 +215,9 @@
if self.doc.customer:
acc_head = webnotes.conn.sql("""select name from `tabAccount`
where (name = %s or (master_name = %s and master_type = 'customer'))
- and docstatus != 2""",
- (cstr(self.doc.customer) + " - " + self.get_company_abbr(), self.doc.customer))
+ and docstatus != 2 and company = %s""",
+ (cstr(self.doc.customer) + " - " + self.get_company_abbr(),
+ self.doc.customer, self.doc.company))
if acc_head and acc_head[0][0]:
return acc_head[0][0]
@@ -299,60 +300,59 @@
args = args and json.loads(args) or {}
if args.get('item_code'):
ret = get_obj('Sales Common').get_item_details(args, self)
- return self.get_pos_details(args, ret)
- else:
- for doc in self.doclist:
+
+ if cint(self.doc.is_pos) == 1 and self.pos_settings:
+ ret = self.apply_pos_settings(args, ret)
+
+ return ret
+
+ elif cint(self.doc.is_pos) == 1 and self.pos_settings:
+ for doc in self.doclist.get({"parentfield": "entries"}):
if doc.fields.get('item_code'):
- arg = {
- 'item_code':doc.fields.get('item_code'),
- 'income_account':doc.fields.get('income_account'),
- 'cost_center': doc.fields.get('cost_center'),
- 'warehouse': doc.fields.get('warehouse'),
- 'expense_account': doc.fields.get('expense_account'),
- }
-
- ret = self.get_pos_details(arg)
+ ret = self.apply_pos_settings(doc.fields)
for r in ret:
if not doc.fields.get(r):
doc.fields[r] = ret[r]
@property
- def pos_details(self):
- if not hasattr(self, "_pos_details"):
+ def pos_settings(self):
+ if not hasattr(self, "_pos_settings"):
dtl = webnotes.conn.sql("""select * from `tabPOS Setting` where user = %s
and company = %s""", (webnotes.session['user'], self.doc.company), as_dict=1)
if not dtl:
dtl = webnotes.conn.sql("""select * from `tabPOS Setting`
where ifnull(user,'') = '' and company = %s""", self.doc.company, as_dict=1)
- self._pos_details = dtl
+ self._pos_settings = dtl
- return self._pos_details
+ return self._pos_settings
- def get_pos_details(self, args, ret = {}):
- if args['item_code'] and cint(self.doc.is_pos) == 1:
- dtl = self.pos_details
-
- item = webnotes.conn.sql("""select default_income_account, default_sales_cost_center,
- default_warehouse, purchase_account from tabItem where name = %s""",
- args['item_code'], as_dict=1)
-
- ret['income_account'] = item and item[0].get('default_income_account') \
- or (dtl and dtl[0].get('income_account') or args.get('income_account'))
-
- ret['cost_center'] = item and item[0].get('default_sales_cost_center') \
- or (dtl and dtl[0].get('cost_center') or args.get('cost_center'))
+ def apply_pos_settings(self, args, ret=None):
+ if not ret: ret = {}
+
+ pos = self.pos_settings[0]
+
+ item = webnotes.conn.sql("""select default_income_account, default_sales_cost_center,
+ default_warehouse, purchase_account from tabItem where name = %s""",
+ args.get('item_code'), as_dict=1)
+
+ if item:
+ item = item[0]
- ret['warehouse'] = item and item[0].get('default_warehouse') \
- or (dtl and dtl[0].get('warehouse') or args.get('warehouse'))
+ ret.update({
+ "income_account": item.get("default_income_account") \
+ or pos.get("income_account") or args.get("income_account"),
+ "cost_center": item.get("default_sales_cost_center") \
+ or pos.get("cost_center") or args.get("cost_center"),
+ "warehouse": item.get("default_warehouse") \
+ or pos.get("warehouse") or args.get("warehouse"),
+ "expense_account": item.get("purchase_account") \
+ or pos.get("expense_account") or args.get("expense_account")
+ })
- ret['expense_account'] = item and item[0].get('purchase_account') \
- or (dtl and dtl[0].get('expense_account') or args.get('expense_account'))
-
- if ret['warehouse']:
- actual_qty = webnotes.conn.sql("""select actual_qty from `tabBin`
- where item_code = %s and warehouse = %s""",
- (args['item_code'], ret['warehouse']))
- ret['actual_qty']= actual_qty and flt(actual_qty[0][0]) or 0
+ if ret.get("warehouse"):
+ ret["actual_qty"] = flt(webnotes.conn.get_value("Bin",
+ {"item_code": args.get("item_code"), "warehouse": ret.get("warehouse")},
+ "actual_qty"))
return ret
def get_barcode_details(self, barcode):
@@ -433,17 +433,6 @@
from accounts.utils import reconcile_against_document
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):
"""Validates Debit To Account and Customer Matches"""
if self.doc.customer and self.doc.debit_to and not cint(self.doc.is_pos):
@@ -453,6 +442,19 @@
(not acc_head and (self.doc.debit_to != cstr(self.doc.customer) + " - " + self.get_company_abbr())):
msgprint("Debit To: %s do not match with Customer: %s for Company: %s.\n If both correctly entered, please select Master Type \
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):
@@ -554,6 +556,21 @@
webnotes.conn.set(self.doc, 'c_form_no', '')
+ def validate_rate_with_refdoc(self):
+ """Validate values with reference document with previous document"""
+ for d in self.doclist.get({"parentfield": "entries"}):
+ if d.so_detail:
+ self.check_value("Sales Order", d.sales_order, d.so_detail,
+ d.export_rate, d.item_code)
+ if d.dn_detail:
+ self.check_value("Delivery Note", d.delivery_note, d.dn_detail,
+ d.export_rate, d.item_code)
+
+ def check_value(self, ref_dt, ref_dn, ref_item_dn, val, item_code):
+ ref_val = webnotes.conn.get_value(ref_dt + " Item", ref_item_dn, "export_rate")
+ if flt(ref_val, 2) != flt(val, 2):
+ msgprint(_("Rate is not matching with ") + ref_dt + ": " + ref_dn +
+ _(" for item: ") + item_code, raise_exception=True)
def update_current_stock(self):
for d in getlist(self.doclist, 'entries'):
diff --git a/accounts/doctype/sales_invoice/sales_invoice.txt b/accounts/doctype/sales_invoice/sales_invoice.txt
index cf6e994..a2c422f 100644
--- a/accounts/doctype/sales_invoice/sales_invoice.txt
+++ b/accounts/doctype/sales_invoice/sales_invoice.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-22 18:37:25",
+ "creation": "2013-04-19 11:00:14",
"docstatus": 0,
- "modified": "2013-03-22 18:38:13",
+ "modified": "2013-04-22 11:59:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -30,9 +30,7 @@
"parent": "Sales Invoice",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1
+ "read": 1
},
{
"doctype": "DocType",
@@ -44,7 +42,8 @@
"fieldtype": "Section Break",
"label": "Basic Info",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -52,6 +51,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 0,
+ "read_only": 0,
"width": "50%"
},
{
@@ -65,6 +65,7 @@
"oldfieldtype": "Select",
"options": "INV\nINV/10-11/",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -74,7 +75,8 @@
"label": "Is POS",
"oldfieldname": "is_pos",
"oldfieldtype": "Check",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_pos==1",
@@ -84,7 +86,8 @@
"label": "Update Stock",
"oldfieldname": "update_stock",
"oldfieldtype": "Check",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "The account to which you will pay (have paid) the money to.",
@@ -97,6 +100,7 @@
"oldfieldtype": "Link",
"options": "Account",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -110,7 +114,8 @@
"oldfieldname": "customer",
"oldfieldtype": "Link",
"options": "Customer",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -160,7 +165,8 @@
"doctype": "DocField",
"fieldname": "column_break1",
"fieldtype": "Column Break",
- "oldfieldtype": "Column Break"
+ "oldfieldtype": "Column Break",
+ "read_only": 0
},
{
"default": "Today",
@@ -174,6 +180,7 @@
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"print_hide": 0,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -188,6 +195,7 @@
"no_copy": 1,
"oldfieldname": "due_date",
"oldfieldtype": "Date",
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -198,14 +206,16 @@
"label": "Mode of Payment",
"oldfieldname": "mode_of_payment",
"oldfieldtype": "Select",
- "options": "link:Mode of Payment"
+ "options": "link:Mode of Payment",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "items",
"fieldtype": "Section Break",
"label": "Items",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -215,25 +225,29 @@
"label": "Entries",
"oldfieldname": "entries",
"oldfieldtype": "Table",
- "options": "Sales Invoice Item"
+ "options": "Sales Invoice Item",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "sales_bom_help",
"fieldtype": "HTML",
"label": "Sales BOM Help",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
- "options": "Simple"
+ "options": "Simple",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break26",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -255,12 +269,14 @@
"fieldtype": "Button",
"label": "Re-Calculate Values",
"oldfieldtype": "Button",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break25",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -272,7 +288,8 @@
"oldfieldname": "sales_order_main",
"oldfieldtype": "Link",
"options": "Sales Order",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "Select Items from Delivery Note",
@@ -283,7 +300,8 @@
"oldfieldname": "delivery_note_main",
"oldfieldtype": "Link",
"options": "Delivery Note",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -291,18 +309,21 @@
"fieldtype": "Button",
"label": "Get Items",
"oldfieldtype": "Button",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "currency_section",
"fieldtype": "Section Break",
- "label": "Price List and Currency"
+ "label": "Price List and Currency",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break27",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -314,6 +335,7 @@
"oldfieldtype": "Select",
"options": "link:Price List",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -324,6 +346,7 @@
"label": "Price List Currency",
"options": "Currency",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -333,12 +356,14 @@
"fieldtype": "Float",
"label": "Price List Currency Conversion Rate",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
"fieldname": "column_break2",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -350,6 +375,7 @@
"oldfieldtype": "Select",
"options": "Currency",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -362,6 +388,7 @@
"oldfieldname": "conversion_rate",
"oldfieldtype": "Currency",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -369,7 +396,8 @@
"fieldname": "taxes",
"fieldtype": "Section Break",
"label": "Taxes and Charges",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -379,7 +407,8 @@
"oldfieldname": "charge",
"oldfieldtype": "Link",
"options": "Sales Taxes and Charges Master",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -387,7 +416,8 @@
"fieldtype": "Button",
"label": "Get Taxes and Charges",
"oldfieldtype": "Button",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -397,7 +427,8 @@
"label": "Taxes and Charges1",
"oldfieldname": "other_charges",
"oldfieldtype": "Table",
- "options": "Sales Taxes and Charges"
+ "options": "Sales Taxes and Charges",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -405,7 +436,8 @@
"fieldtype": "Button",
"label": "Calculate Taxes and Charges",
"oldfieldtype": "Button",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -424,7 +456,8 @@
"fieldtype": "HTML",
"label": "Taxes and Charges Calculation",
"oldfieldtype": "HTML",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -432,7 +465,8 @@
"fieldtype": "Section Break",
"label": "Totals",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -440,6 +474,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -508,6 +543,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -569,12 +605,14 @@
"doctype": "DocField",
"fieldname": "payments_section",
"fieldtype": "Section Break",
- "label": "Payments"
+ "label": "Payments",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -585,7 +623,8 @@
"oldfieldname": "paid_amount",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -595,12 +634,14 @@
"oldfieldname": "cash_bank_account",
"oldfieldtype": "Link",
"options": "Account",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break4",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -608,7 +649,8 @@
"fieldname": "write_off_outstanding_amount_automatically",
"fieldtype": "Check",
"label": "Write Off Outstanding Amount",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -616,7 +658,8 @@
"fieldtype": "Currency",
"label": "Write Off Amount",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -624,7 +667,8 @@
"fieldtype": "Link",
"label": "Write Off Account",
"options": "Account",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -632,14 +676,16 @@
"fieldtype": "Link",
"label": "Write Off Cost Center",
"options": "Cost Center",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "terms_section_break",
"fieldtype": "Section Break",
"label": "Terms and Conditions",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -649,7 +695,8 @@
"oldfieldname": "tc_name",
"oldfieldtype": "Link",
"options": "Terms and Conditions",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -658,7 +705,8 @@
"label": "Get Terms and Conditions",
"oldfieldtype": "Button",
"options": "get_tc_details",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -667,7 +715,8 @@
"label": "Terms and Conditions HTML",
"oldfieldtype": "HTML",
"options": "You can add Terms and Notes that will be printed in the Transaction",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -675,18 +724,21 @@
"fieldtype": "Text Editor",
"label": "Terms and Conditions Details",
"oldfieldname": "terms",
- "oldfieldtype": "Text Editor"
+ "oldfieldtype": "Text Editor",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "contact_section",
"fieldtype": "Section Break",
- "label": "Contact Info"
+ "label": "Contact Info",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break23",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -695,7 +747,8 @@
"fieldtype": "Link",
"label": "Customer Address",
"options": "Address",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -703,12 +756,14 @@
"fieldtype": "Link",
"label": "Contact Person",
"options": "Contact",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "col_break24",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -719,6 +774,7 @@
"label": "Territory",
"options": "Territory",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -730,6 +786,7 @@
"label": "Customer Group",
"options": "Customer Group",
"print_hide": 1,
+ "read_only": 0,
"search_index": 0
},
{
@@ -738,7 +795,8 @@
"fieldtype": "Section Break",
"label": "More Info",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -746,6 +804,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -760,6 +819,7 @@
"oldfieldtype": "Select",
"options": "No\nYes",
"print_hide": 1,
+ "read_only": 0,
"search_index": 0
},
{
@@ -770,7 +830,8 @@
"label": "Aging Date",
"oldfieldname": "aging_date",
"oldfieldtype": "Date",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -780,7 +841,8 @@
"no_copy": 1,
"oldfieldname": "posting_time",
"oldfieldtype": "Time",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -791,7 +853,8 @@
"oldfieldname": "letter_head",
"oldfieldtype": "Select",
"options": "link:Letter Head",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -801,6 +864,7 @@
"no_copy": 1,
"options": "No\nYes",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0
},
{
@@ -822,7 +886,8 @@
"oldfieldname": "campaign",
"oldfieldtype": "Link",
"options": "Campaign",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "Track this Sales Invoice against any Project",
@@ -834,6 +899,7 @@
"oldfieldname": "project_name",
"oldfieldtype": "Link",
"options": "Project",
+ "read_only": 0,
"search_index": 1
},
{
@@ -847,6 +913,7 @@
"oldfieldtype": "Link",
"options": "Print Heading",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
},
{
@@ -854,7 +921,8 @@
"fieldname": "column_break8",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -864,7 +932,8 @@
"oldfieldname": "source",
"oldfieldtype": "Select",
"options": "\nExisting Customer\nReference\nAdvertisement\nCold Calling\nExhibition\nSupplier Reference\nMass Mailing\nCustomer's Vendor\nCampaign",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -876,6 +945,7 @@
"oldfieldtype": "Link",
"options": "Company",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -890,6 +960,7 @@
"oldfieldtype": "Select",
"options": "link:Fiscal Year",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -914,7 +985,8 @@
"no_copy": 1,
"oldfieldname": "amendment_date",
"oldfieldtype": "Date",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:!doc.__islocal",
@@ -936,6 +1008,7 @@
"oldfieldname": "remarks",
"oldfieldtype": "Text",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0
},
{
@@ -944,7 +1017,8 @@
"fieldtype": "Section Break",
"label": "Advances",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -953,7 +1027,8 @@
"label": "Get Advances Received",
"oldfieldtype": "Button",
"options": "get_advances",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -963,14 +1038,16 @@
"oldfieldname": "advance_adjustment_details",
"oldfieldtype": "Table",
"options": "Sales Invoice Advance",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "packing_list",
"fieldtype": "Section Break",
"label": "Packing List",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -978,7 +1055,8 @@
"fieldtype": "Table",
"label": "Packing Details",
"options": "Delivery Note Packing Item",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -986,7 +1064,8 @@
"fieldtype": "Section Break",
"label": "Sales Team",
"oldfieldtype": "Section Break",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -994,6 +1073,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -1005,7 +1085,8 @@
"oldfieldname": "sales_partner",
"oldfieldtype": "Link",
"options": "Sales Partner",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -1013,6 +1094,7 @@
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -1022,7 +1104,8 @@
"label": "Commission Rate (%)",
"oldfieldname": "commission_rate",
"oldfieldtype": "Currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -1032,14 +1115,16 @@
"oldfieldname": "total_commission",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break2",
"fieldtype": "Section Break",
"options": "Simple",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -1049,7 +1134,8 @@
"oldfieldname": "sales_team",
"oldfieldtype": "Table",
"options": "Sales Team",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:doc.docstatus<2",
@@ -1057,13 +1143,15 @@
"fieldname": "recurring_invoice",
"fieldtype": "Section Break",
"label": "Recurring Invoice",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break11",
"fieldtype": "Column Break",
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -1075,7 +1163,8 @@
"fieldtype": "Check",
"label": "Convert into Recurring Invoice",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -1087,7 +1176,8 @@
"label": "Recurring Type",
"no_copy": 1,
"options": "Monthly\nQuarterly\nHalf-yearly\nYearly",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -1098,7 +1188,8 @@
"fieldtype": "Int",
"label": "Repeat on Day of Month",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -1109,7 +1200,8 @@
"fieldtype": "Date",
"label": "Invoice Period From Date",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"allow_on_submit": 1,
@@ -1120,7 +1212,8 @@
"fieldtype": "Date",
"label": "Invoice Period To Date",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -1128,6 +1221,7 @@
"fieldtype": "Column Break",
"no_copy": 0,
"print_hide": 1,
+ "read_only": 0,
"width": "50%"
},
{
@@ -1139,7 +1233,8 @@
"fieldtype": "Small Text",
"label": "Notification Email Address",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"depends_on": "eval:doc.convert_into_recurring_invoice==1",
@@ -1172,7 +1267,8 @@
"fieldtype": "Date",
"label": "End Date",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -1184,22 +1280,16 @@
"oldfieldname": "against_income_account",
"oldfieldtype": "Small Text",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
"role": "Accounts User",
"submit": 1,
"write": 1
@@ -1207,6 +1297,8 @@
{
"doctype": "DocPerm",
"match": "customer",
+ "permlevel": 0,
+ "report": 1,
"role": "Customer"
- }
+ },
]
\ No newline at end of file
diff --git a/accounts/doctype/sales_invoice/sales_invoice_list.js b/accounts/doctype/sales_invoice/sales_invoice_list.js
index c1f8061..e83611a 100644
--- a/accounts/doctype/sales_invoice/sales_invoice_list.js
+++ b/accounts/doctype/sales_invoice/sales_invoice_list.js
@@ -1,9 +1,10 @@
// render
wn.listview_settings['Sales Invoice'] = {
add_fields: ["`tabSales Invoice`.grand_total", "`tabSales Invoice`.outstanding_amount"],
- add_columns: [{"content":"outstanding_amount", width:"10%", type:"bar-graph"}],
+ add_columns: [{"content":"paid_amount", width:"10%", type:"bar-graph",
+ label: "Payment Received"}],
prepare_data: function(data) {
- data.outstanding_amount = (flt(data.grand_total) -
- flt(data.outstanding_amount)) / flt(data.grand_total) * 100;
+ data.paid_amount = flt(data.grand_total) ? (((flt(data.grand_total) -
+ flt(data.outstanding_amount)) / flt(data.grand_total)) * 100) : 0;
}
};
diff --git a/accounts/doctype/sales_invoice/test_sales_invoice.py b/accounts/doctype/sales_invoice/test_sales_invoice.py
index fd8dc64..b46cdd1 100644
--- a/accounts/doctype/sales_invoice/test_sales_invoice.py
+++ b/accounts/doctype/sales_invoice/test_sales_invoice.py
@@ -90,6 +90,9 @@
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
+ old_default_company = webnotes.conn.get_default("company")
+ webnotes.conn.set_default("company", "_Test Company")
+
self._insert_purchase_receipt()
self._insert_pos_settings()
@@ -106,7 +109,8 @@
# check stock ledger entries
sle = webnotes.conn.sql("""select * from `tabStock Ledger Entry`
- where voucher_type = 'Sales Invoice' and voucher_no = %s""", si.doc.name, as_dict=1)[0]
+ where voucher_type = 'Sales Invoice' and voucher_no = %s""",
+ si.doc.name, as_dict=1)[0]
self.assertTrue(sle)
self.assertEquals([sle.item_code, sle.warehouse, sle.actual_qty],
["_Test Item", "_Test Warehouse", -5.0])
@@ -145,6 +149,7 @@
self.assertEquals(gl_count[0][0], 16)
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
+ webnotes.conn.set_default("company", old_default_company)
def test_sales_invoice_gl_entry_with_aii_no_item_code(self):
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
@@ -337,7 +342,7 @@
# change posting date but keep recuring day to be today
si7 = webnotes.bean(copy=base_si.doclist)
si7.doc.fields.update({
- "posting_date": add_to_date(today, days=-3)
+ "posting_date": add_to_date(today, days=-1)
})
si7.insert()
si7.submit()
@@ -345,7 +350,7 @@
# setting so that _test function works
si7.doc.posting_date = today
self._test_recurring_invoice(si7, True)
-
+
def _test_recurring_invoice(self, base_si, first_and_last_day):
from webnotes.utils import add_months, get_last_day, getdate
from accounts.doctype.sales_invoice.sales_invoice import manage_recurring_invoices
@@ -361,7 +366,8 @@
manage_recurring_invoices(next_date=next_date, commit=False)
recurred_invoices = webnotes.conn.sql("""select name from `tabSales Invoice`
- where recurring_id=%s and docstatus=1 order by name desc""", base_si.doc.recurring_id)
+ where recurring_id=%s and docstatus=1 order by name desc""",
+ base_si.doc.recurring_id)
self.assertEquals(i+2, len(recurred_invoices))
@@ -395,7 +401,7 @@
for i in xrange(count):
base_si = _test(i)
-test_dependencies = ["Journal Voucher", "POS Setting"]
+test_dependencies = ["Journal Voucher", "POS Setting", "Contact", "Address"]
test_records = [
[
diff --git a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
index 2a6384d..82ad3b1 100644
--- a/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
+++ b/accounts/doctype/sales_invoice_item/sales_invoice_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-04-10 08:35:44",
+ "creation": "2013-06-04 11:02:19",
"docstatus": 0,
- "modified": "2013-04-17 14:05:20",
+ "modified": "2013-06-26 14:33:21",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -243,7 +243,8 @@
"oldfieldname": "serial_no",
"oldfieldtype": "Small Text",
"print_hide": 0,
- "read_only": 0
+ "read_only": 0,
+ "reqd": 0
},
{
"doctype": "DocField",
@@ -305,6 +306,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Sales Order",
+ "no_copy": 1,
"oldfieldname": "sales_order",
"oldfieldtype": "Link",
"options": "Sales Order",
@@ -319,6 +321,7 @@
"hidden": 1,
"in_filter": 1,
"label": "SO Detail ",
+ "no_copy": 1,
"oldfieldname": "so_detail",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -331,6 +334,7 @@
"fieldtype": "Link",
"in_filter": 1,
"label": "Delivery Note",
+ "no_copy": 1,
"oldfieldname": "delivery_note",
"oldfieldtype": "Link",
"options": "Delivery Note",
@@ -345,6 +349,7 @@
"hidden": 1,
"in_filter": 1,
"label": "DN Detail",
+ "no_copy": 1,
"oldfieldname": "dn_detail",
"oldfieldtype": "Data",
"print_hide": 1,
diff --git a/accounts/page/accounts_browser/accounts_browser.js b/accounts/page/accounts_browser/accounts_browser.js
index 2e8cc82..3541fcb 100644
--- a/accounts/page/accounts_browser/accounts_browser.js
+++ b/accounts/page/accounts_browser/accounts_browser.js
@@ -131,7 +131,7 @@
if (wn.model.can_read(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.open();">Edit</a>');
}
- if (data.expandable) {
+ if (data.expandable && wn.boot.profile.in_create.indexOf(this.ctype) !== -1) {
node_links.push('<a onclick="erpnext.account_chart.new_node();">Add Child</a>');
} else if (this.ctype === 'Account' && wn.boot.profile.can_read.indexOf("GL Entry") !== -1) {
node_links.push('<a onclick="erpnext.account_chart.show_ledger();">View Ledger</a>');
diff --git a/accounts/page/accounts_home/accounts_home.js b/accounts/page/accounts_home/accounts_home.js
index 9981ee9..31660eb 100644
--- a/accounts/page/accounts_home/accounts_home.js
+++ b/accounts/page/accounts_home/accounts_home.js
@@ -139,6 +139,26 @@
"page":"Financial Statements",
"label": wn._("Financial Statements")
},
+ {
+ "label":wn._("Accounts Receivable"),
+ route: "query-report/Accounts Receivable",
+ doctype: "Sales Invoice"
+ },
+ {
+ "label":wn._("Accounts Payable"),
+ route: "query-report/Accounts Payable",
+ doctype: "Purchase Invoice"
+ },
+ {
+ "label":wn._("Sales Register"),
+ route: "query-report/Sales Register",
+ doctype: "Sales Invoice"
+ },
+ {
+ "label":wn._("Purchase Register"),
+ route: "query-report/Purchase Register",
+ doctype: "Purchase Invoice"
+ },
]
},
{
@@ -151,11 +171,6 @@
page: "financial-analytics"
},
{
- "label":wn._("Trend Analyzer"),
- route: "Report/Profile/Trend Analyzer",
- doctype: "Sales Invoice"
- },
- {
"label":wn._("Gross Profit"),
route: "query-report/Gross Profit",
doctype: "Sales Invoice"
@@ -168,15 +183,85 @@
icon: "icon-list",
items: [
{
+ "label":wn._("Bank Reconciliation Statement"),
+ route: "query-report/Bank Reconciliation Statement",
+ doctype: "Journal Voucher"
+ },
+ {
"label":wn._("Delivered Items To Be Billed"),
route: "query-report/Delivered Items To Be Billed",
doctype: "Sales Invoice"
},
{
+ "label":wn._("Received Items To Be Billed"),
+ route: "query-report/Received Items To Be Billed",
+ doctype: "Purchase Invoice"
+ },
+ {
"label":wn._("Ordered Items To Be Billed"),
route: "query-report/Ordered Items To Be Billed",
doctype: "Sales Invoice"
},
+ {
+ "label":wn._("Purchase Order Items To Be Billed"),
+ route: "query-report/Purchase Order Items To Be Billed",
+ doctype: "Purchase Invoice"
+ },
+ {
+ "label":wn._("Bank Clearance Summary"),
+ route: "query-report/Bank Clearance Summary",
+ doctype: "Journal Voucher"
+ },
+ {
+ "label":wn._("Payment Collection With Ageing"),
+ route: "query-report/Payment Collection With Ageing",
+ doctype: "Journal Voucher"
+ },
+ {
+ "label":wn._("Payment Made With Ageing"),
+ route: "query-report/Payment Made With Ageing",
+ doctype: "Journal Voucher"
+ },
+ {
+ "label":wn._("Sales Partners Commission"),
+ route: "query-report/Sales Partners Commission",
+ doctype: "Sales Invoice"
+ },
+ {
+ "label":wn._("Customer Account Head"),
+ route: "query-report/Customer Account Head",
+ doctype: "Account"
+ },
+ {
+ "label":wn._("Supplier Account Head"),
+ route: "query-report/Supplier Account Head",
+ doctype: "Account"
+ },
+ {
+ "label":wn._("Item-wise Sales Register"),
+ route: "query-report/Item-wise Sales Register",
+ doctype: "Sales Invoice"
+ },
+ {
+ "label":wn._("Item-wise Purchase Register"),
+ route: "query-report/Item-wise Purchase Register",
+ doctype: "Purchase Invoice"
+ },
+ {
+ "label":wn._("Budget Variance Report"),
+ route: "query-report/Budget Variance Report",
+ doctype: "Cost Center"
+ },
+ {
+ "label":wn._("Purchase Invoice Trends"),
+ route: "query-report/Purchase Invoice Trends",
+ doctype: "Purchase Invoice"
+ },
+ {
+ "label":wn._("Sales Invoice Trends"),
+ route: "query-report/Sales Invoice Trends",
+ doctype: "Sales Invoice"
+ },
]
}
]
diff --git a/accounts/page/general_ledger/general_ledger.js b/accounts/page/general_ledger/general_ledger.js
index 21be3a0..269ed5e 100644
--- a/accounts/page/general_ledger/general_ledger.js
+++ b/accounts/page/general_ledger/general_ledger.js
@@ -68,6 +68,7 @@
];
},
+
filters: [
{fieldtype:"Select", label: "Company", link:"Company", default_value: "Select Company...",
filter: function(val, item, opts) {
@@ -96,6 +97,7 @@
return dateutil.str_to_obj(val) >= dateutil.str_to_obj(item.posting_date);
}},
{fieldtype: "Check", label: "Group by Ledger"},
+ {fieldtype: "Check", label: "Group by Voucher"},
{fieldtype:"Button", label: "Refresh", icon:"icon-refresh icon-white", cssClass:"btn-info"},
{fieldtype:"Button", label: "Reset Filters"}
],
@@ -116,9 +118,14 @@
me.filter_inputs.group_by_ledger
.parent().toggle(!!(me.account_by_name[$(this).val()]
&& me.account_by_name[$(this).val()].group_or_ledger==="Group"));
+
+ me.filter_inputs.group_by_voucher
+ .parent().toggle(!!(me.account_by_name[$(this).val()]
+ && me.account_by_name[$(this).val()].group_or_ledger==="Ledger"));
});
this.trigger_refresh_on_change(["group_by_ledger"]);
+ this.trigger_refresh_on_change(["group_by_voucher"]);
},
setup_account_filter: function(company_filter) {
var me = this;
@@ -139,12 +146,14 @@
init_filter_values: function() {
this._super();
this.filter_inputs.group_by_ledger.parent().toggle(false);
+ this.filter_inputs.group_by_voucher.parent().toggle(false);
this.filter_inputs.company.change();
this.filter_inputs.account.change();
},
apply_filters_from_route: function() {
this._super();
this.filter_inputs.group_by_ledger.parent().toggle(false);
+ this.filter_inputs.group_by_voucher.parent().toggle(false);
this.filter_inputs.company.change();
this.filter_inputs.account.change();
},
@@ -186,7 +195,6 @@
var totals = this.make_summary_row("Totals", this.account);
var grouped_ledgers = {};
-
$.each(data, function(i, item) {
if((me.is_default("company") ? true : me.apply_filter(item, "company")) &&
(me.account ? me.is_child_account(me.account, item.account)
@@ -197,13 +205,21 @@
if(!grouped_ledgers[item.account]) {
grouped_ledgers[item.account] = {
entries: [],
+ entries_group_by_voucher: {},
opening: me.make_summary_row("Opening", item.account),
totals: me.make_summary_row("Totals", item.account),
closing: me.make_summary_row("Closing (Opening + Totals)",
item.account)
};
}
-
+
+ if(!grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]) {
+ grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no] = {
+ row: {},
+ totals: {"debit": 0, "credit": 0}
+ }
+ }
+
if(date < from_date || item.is_opening=="Yes") {
opening.debit += item.debit;
opening.credit += item.credit;
@@ -216,9 +232,12 @@
grouped_ledgers[item.account].totals.debit += item.debit;
grouped_ledgers[item.account].totals.credit += item.credit;
+ grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
+ .totals.debit += item.debit;
+ grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
+ .totals.credit += item.credit;
}
-
- if(me.account) {
+ if(item.account) {
item.against_account = me.voucher_accounts[item.voucher_type + ":"
+ item.voucher_no][(item.debit > 0 ? "credits" : "debits")].join(", ");
}
@@ -226,6 +245,11 @@
if(me.apply_filters(item) && item.is_opening=="No") {
out.push(item);
grouped_ledgers[item.account].entries.push(item);
+
+ if(grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no].row){
+ grouped_ledgers[item.account].entries_group_by_voucher[item.voucher_no]
+ .row = jQuery.extend({}, item);
+ }
}
}
});
@@ -243,6 +267,11 @@
out = this.group_data_by_ledger(grouped_ledgers);
}
+ if(this.account_by_name[this.account].group_or_ledger==="Ledger"
+ && this.group_by_voucher) {
+ out = this.group_data_by_voucher(grouped_ledgers);
+ }
+
opening = me.get_balance(me.account_by_name[me.account].debit_or_credit, opening)
closing = me.get_balance(me.account_by_name[me.account].debit_or_credit, closing)
@@ -285,6 +314,27 @@
return [{id: "_blank_first", _no_format: true, debit: "", credit: ""}].concat(out);
},
+ group_data_by_voucher: function(grouped_ledgers) {
+ var me = this;
+ var out = []
+ $.each(Object.keys(grouped_ledgers).sort(), function(i, account) {
+ if(grouped_ledgers[account].entries.length) {
+ $.each(Object.keys(grouped_ledgers[account].entries_group_by_voucher),
+ function(j, voucher) {
+ voucher_dict = grouped_ledgers[account].entries_group_by_voucher[voucher];
+ if(voucher_dict &&
+ (voucher_dict.totals.debit || voucher_dict.totals.credit)) {
+ voucher_dict.row.debit = voucher_dict.totals.debit;
+ voucher_dict.row.credit = voucher_dict.totals.credit;
+ voucher_dict.row.id = "entry_grouped_by_" + voucher
+ out = out.concat(voucher_dict.row);
+ }
+ });
+ }
+ });
+ return [{id: "_blank_first", _no_format: true, debit: "", credit: ""}].concat(out);
+ },
+
get_balance: function(debit_or_credit, balance) {
if(debit_or_credit == "Debit") {
balance.debit -= balance.credit; balance.credit = 0;
diff --git a/accounts/page/voucher_import_tool/voucher_import_tool.py b/accounts/page/voucher_import_tool/voucher_import_tool.py
index 6648ee6..a3790a8f 100644
--- a/accounts/page/voucher_import_tool/voucher_import_tool.py
+++ b/accounts/page/voucher_import_tool/voucher_import_tool.py
@@ -1,7 +1,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes import _
-from webnotes.utils import flt, comma_and
+from webnotes.utils import flt, comma_and, cstr
import webnotes.defaults
@webnotes.whitelist()
@@ -31,13 +31,12 @@
"3. Naming Series Options: %(naming_options)s"
"4. Voucher Type Options: %(voucher_type)s"%(extra_note)s
"-------Common Values-----------"
-"Company:","%(default_company)s"
+"Company:",
"--------Data----------"
%(columns)s
''' % {
"template_type": template_type,
"user_fmt": webnotes.defaults.get_global_default('date_format'),
- "default_company": webnotes.conn.get_default("company"),
"naming_options": naming_options.replace("\n", ", "),
"voucher_type": voucher_type.replace("\n", ", "),
"extra_note": extra_note,
@@ -49,14 +48,29 @@
@webnotes.whitelist()
def upload():
- from webnotes.utils.datautils import read_csv_content_from_uploaded_file
- rows = read_csv_content_from_uploaded_file()
-
- common_values = get_common_values(rows)
- company_abbr = webnotes.conn.get_value("Company", common_values.company, "abbr")
- data, start_idx = get_data(rows, company_abbr)
+ messages = []
+ try:
+ from webnotes.utils.datautils import read_csv_content_from_uploaded_file
+ rows = read_csv_content_from_uploaded_file()
+ common_values = get_common_values(rows)
+ company_abbr = webnotes.conn.get_value("Company", common_values.company, "abbr")
+
+ if not company_abbr:
+ webnotes.msgprint(_("Company is missing or entered incorrect value"), raise_exception=1)
+
+ data, start_idx = get_data(rows, company_abbr, rows[0][0])
+ except Exception, e:
+ err_msg = webnotes.message_log and "<br>".join(webnotes.message_log) or cstr(e)
+ messages.append("""<p style='color: red'>%s</p>""" % (err_msg or "No message"))
+ webnotes.errprint(webnotes.getTraceback())
+ webnotes.message_log = []
+ return messages
+
return import_vouchers(common_values, data, start_idx, rows[0][0])
+
+
+
def map_fields(field_list, source, target):
for f in field_list:
@@ -70,9 +84,8 @@
from webnotes.model.bean import Bean
from accounts.utils import get_fiscal_year
from webnotes.utils.dateutils import parse_date
-
messages = []
-
+
def get_account_details(account):
acc_details = webnotes.conn.sql("""select is_pl_account,
master_name from tabAccount where name=%s""", account, as_dict=1)
@@ -113,8 +126,9 @@
if d.ref_number:
if not d.ref_date:
- raise webnotes.ValidationError, \
- """Ref Date is Mandatory if Ref Number is specified"""
+ webnotes.msgprint(_("Ref Date is Mandatory if Ref Number is specified"),
+ raise_exception=1)
+
d.ref_date = parse_date(d.ref_date)
d.company = common_values.company
@@ -176,7 +190,7 @@
webnotes.conn.commit()
except Exception, e:
webnotes.conn.rollback()
- err_msg = webnotes.message_log and "<br>".join(webnotes.message_log) or unicode(e)
+ err_msg = webnotes.message_log and "<br>".join(webnotes.message_log) or cstr(e)
messages.append("""<p style='color: red'>[row #%s] %s failed: %s</p>"""
% ((start_idx + 1) + i, jv.name or "", err_msg or "No message"))
messages.append("<p style='color: red'>All transactions rolled back</p>")
@@ -199,10 +213,11 @@
return common_values
-def get_data(rows, company_abbr):
+def get_data(rows, company_abbr, import_type):
start_row = 0
data = []
start_row_idx = 0
+ accounts = None
for i in xrange(len(rows)):
r = rows[i]
if r[0]:
@@ -240,16 +255,22 @@
raise Exception, """Column No(s). %s %s empty. \
Please remove them and try again.""" % (comma_and(empty_columns),
len(empty_columns)==1 and "is" or "are")
-
+
columns = [c.replace(" ", "_").lower() for c in rows[i+1]
if not c.endswith(" - " + company_abbr)]
- accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
-
- if accounts and (len(columns) != rows[i+1].index(accounts[0])):
- raise Exception, _("""All account columns should be after \
- standard columns and on the right.
- If you entered it properly, next probable reason \
- could be wrong account name.
- Please rectify it in the file and try again.""")
+
+ if import_type == "Voucher Import: Multiple Accounts":
+ accounts = [c for c in rows[i+1] if c.endswith(" - " + company_abbr)]
+
+ if not accounts:
+ webnotes.msgprint(_("""No Account found in csv file,
+ May be company abbreviation is not correct"""), raise_exception=1)
+
+ if accounts and (len(columns) != rows[i+1].index(accounts[0])):
+ webnotes.msgprint(_("""All account columns should be after \
+ standard columns and on the right.
+ If you entered it properly, next probable reason \
+ could be wrong account name.
+ Please rectify it in the file and try again."""), raise_exception=1)
return data, start_row_idx
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/accounts_payable/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/accounts_payable/__init__.py
diff --git a/accounts/report/accounts_payable/accounts_payable.js b/accounts/report/accounts_payable/accounts_payable.js
new file mode 100644
index 0000000..7ee38f2
--- /dev/null
+++ b/accounts/report/accounts_payable/accounts_payable.js
@@ -0,0 +1,42 @@
+wn.query_reports["Accounts Payable"] = {
+ "filters": [
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ var company = wn.query_report.filters_by_name.company.get_value();
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Credit",
+ "company": company,
+ "master_type": "Supplier"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"report_date",
+ "label": "Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"ageing_based_on",
+ "label": "Ageing Based On",
+ "fieldtype": "Select",
+ "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "default": "Posting Date"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/accounts_payable/accounts_payable.py b/accounts/report/accounts_payable/accounts_payable.py
new file mode 100644
index 0000000..71aeb35
--- /dev/null
+++ b/accounts/report/accounts_payable/accounts_payable.py
@@ -0,0 +1,132 @@
+from __future__ import unicode_literals
+import webnotes
+from webnotes.utils import getdate, nowdate, flt, cstr
+from webnotes import msgprint, _
+from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
+
+def execute(filters=None):
+ if not filters: filters = {}
+ columns = get_columns()
+
+ entries = get_gl_entries(filters)
+
+ entries_after_report_date = [[gle.voucher_type, gle.voucher_no]
+ for gle in get_gl_entries(filters, before_report_date=False)]
+
+ account_supplier_type_map = get_account_supplier_type_map()
+ pi_map = get_pi_map()
+
+ # Age of the invoice on this date
+ age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
+ and nowdate() or filters.get("report_date")
+
+ data = []
+ for gle in entries:
+ if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
+ or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
+
+ if gle.voucher_type == "Purchase Invoice":
+ pi_info = pi_map.get(gle.voucher_no)
+ due_date = pi_info.get("due_date")
+ bill_no = pi_info.get("bill_no")
+ bill_date = pi_info.get("bill_date")
+ else:
+ due_date = bill_no = bill_date = ""
+
+ invoiced_amount = gle.credit > 0 and gle.credit or 0
+ paid_amount = get_paid_amount(gle, filters.get("report_date") or nowdate(),
+ entries_after_report_date)
+ outstanding_amount = invoiced_amount - paid_amount
+
+ if abs(flt(outstanding_amount)) > 0.01:
+ row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no,
+ gle.remarks, account_supplier_type_map.get(gle.account), due_date, bill_no,
+ bill_date, invoiced_amount, paid_amount, outstanding_amount]
+
+ # Ageing
+ if filters.get("ageing_based_on") == "Due Date":
+ ageing_based_on_date = due_date
+ else:
+ ageing_based_on_date = gle.posting_date
+
+ row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
+ data.append(row)
+
+ return columns, data
+
+def get_columns():
+ return [
+ "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110",
+ "Voucher No::120", "Remarks::150", "Supplier Type:Link/Supplier Type:120",
+ "Due Date:Date:80", "Bill No::80", "Bill Date:Date:80",
+ "Invoiced Amount:Currency:100", "Paid Amount:Currency:100",
+ "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100",
+ "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
+ ]
+
+def get_gl_entries(filters, before_report_date=True):
+ conditions, supplier_accounts = get_conditions(filters, before_report_date)
+ gl_entries = []
+ gl_entries = webnotes.conn.sql("""select * from `tabGL Entry`
+ where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" %
+ (conditions), tuple(supplier_accounts), as_dict=1)
+ return gl_entries
+
+def get_conditions(filters, before_report_date=True):
+ conditions = ""
+ if filters.get("company"):
+ conditions += " and company='%s'" % filters["company"]
+
+ supplier_accounts = []
+ if filters.get("account"):
+ supplier_accounts = [filters["account"]]
+ else:
+ supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
+ where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" %
+ conditions, filters)
+
+ if supplier_accounts:
+ conditions += " and account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
+ else:
+ msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \
+ 'Master Type' value in account record."), raise_exception=1)
+
+ if filters.get("report_date"):
+ if before_report_date:
+ conditions += " and posting_date<='%s'" % filters["report_date"]
+ else:
+ conditions += " and posting_date>'%s'" % filters["report_date"]
+
+ return conditions, supplier_accounts
+
+def get_account_supplier_type_map():
+ account_supplier_type_map = {}
+ for each in webnotes.conn.sql("""select t2.name, t1.supplier_type from `tabSupplier` t1,
+ `tabAccount` t2 where t1.name = t2.master_name group by t2.name"""):
+ account_supplier_type_map[each[0]] = each[1]
+
+ return account_supplier_type_map
+
+def get_pi_map():
+ """ get due_date from sales invoice """
+ pi_map = {}
+ for t in webnotes.conn.sql("""select name, due_date, bill_no, bill_date
+ from `tabPurchase Invoice`""", as_dict=1):
+ pi_map[t.name] = t
+
+ return pi_map
+
+def get_paid_amount(gle, report_date, entries_after_report_date):
+
+ paid_amount = 0
+ if flt(gle.debit) > 0 and (not gle.against_voucher or
+ [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date):
+ paid_amount = gle.debit
+ elif flt(gle.credit) > 0:
+ paid_amount = webnotes.conn.sql("""
+ select sum(ifnull(debit, 0)) - sum(ifnull(credit, 0)) from `tabGL Entry`
+ where account = %s and posting_date <= %s and against_voucher_type = %s
+ and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""",
+ (gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0]
+
+ return flt(paid_amount)
\ No newline at end of file
diff --git a/accounts/report/accounts_payable/accounts_payable.txt b/accounts/report/accounts_payable/accounts_payable.txt
new file mode 100644
index 0000000..6de97f6
--- /dev/null
+++ b/accounts/report/accounts_payable/accounts_payable.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-04-22 16:16:03",
+ "docstatus": 0,
+ "modified": "2013-04-30 17:55:54",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Accounts Payable",
+ "report_type": "Report Builder"
+ },
+ {
+ "doctype": "Report",
+ "name": "Accounts Payable"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/accounts_receivable/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/accounts_receivable/__init__.py
diff --git a/accounts/report/accounts_receivable/accounts_receivable.js b/accounts/report/accounts_receivable/accounts_receivable.js
new file mode 100644
index 0000000..68c8593
--- /dev/null
+++ b/accounts/report/accounts_receivable/accounts_receivable.js
@@ -0,0 +1,42 @@
+wn.query_reports["Accounts Receivable"] = {
+ "filters": [
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ var company = wn.query_report.filters_by_name.company.get_value();
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Debit",
+ "company": company,
+ "master_type": "Customer"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"report_date",
+ "label": "Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"ageing_based_on",
+ "label": "Ageing Based On",
+ "fieldtype": "Select",
+ "options": 'Posting Date' + NEWLINE + 'Due Date',
+ "default": "Posting Date"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/accounts_receivable/accounts_receivable.py b/accounts/report/accounts_receivable/accounts_receivable.py
new file mode 100644
index 0000000..d791fad
--- /dev/null
+++ b/accounts/report/accounts_receivable/accounts_receivable.py
@@ -0,0 +1,135 @@
+from __future__ import unicode_literals
+import webnotes
+from webnotes import msgprint, _
+from webnotes.utils import getdate, nowdate, flt, cstr
+
+def execute(filters=None):
+ if not filters: filters = {}
+ columns = get_columns()
+ entries = get_gl_entries(filters)
+
+ entries_after_report_date = [[gle.voucher_type, gle.voucher_no]
+ for gle in get_gl_entries(filters, upto_report_date=False)]
+
+ account_territory_map = get_account_territory_map()
+ si_due_date_map = get_si_due_date_map()
+
+ # Age of the invoice on this date
+ age_on = getdate(filters.get("report_date")) > getdate(nowdate()) \
+ and nowdate() or filters.get("report_date")
+
+ data = []
+ for gle in entries:
+ if cstr(gle.against_voucher) == gle.voucher_no or not gle.against_voucher \
+ or [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date:
+
+ due_date = (gle.voucher_type == "Sales Invoice") \
+ and si_due_date_map.get(gle.voucher_no) or ""
+
+ invoiced_amount = gle.debit > 0 and gle.debit or 0
+ payment_amount = get_payment_amount(gle, filters.get("report_date") or nowdate(),
+ entries_after_report_date)
+ outstanding_amount = invoiced_amount - payment_amount
+
+ if abs(flt(outstanding_amount)) > 0.01:
+ row = [gle.posting_date, gle.account, gle.voucher_type, gle.voucher_no,
+ gle.remarks, due_date, account_territory_map.get(gle.account),
+ invoiced_amount, payment_amount, outstanding_amount]
+ # Ageing
+ if filters.get("ageing_based_on") == "Due Date":
+ ageing_based_on_date = due_date
+ else:
+ ageing_based_on_date = gle.posting_date
+ row += get_ageing_data(ageing_based_on_date, age_on, outstanding_amount)
+
+ data.append(row)
+
+ return columns, data
+
+def get_columns():
+ return [
+ "Posting Date:Date:80", "Account:Link/Account:150", "Voucher Type::110",
+ "Voucher No::120", "Remarks::150", "Due Date:Date:80", "Territory:Link/Territory:80",
+ "Invoiced Amount:Currency:100", "Payment Received:Currency:100",
+ "Outstanding Amount:Currency:100", "Age:Int:50", "0-30:Currency:100",
+ "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
+ ]
+
+def get_gl_entries(filters, upto_report_date=True):
+ conditions, customer_accounts = get_conditions(filters, upto_report_date)
+ return webnotes.conn.sql("""select * from `tabGL Entry`
+ where ifnull(is_cancelled, 'No') = 'No' %s order by posting_date, account""" %
+ (conditions), tuple(customer_accounts), as_dict=1)
+
+def get_conditions(filters, upto_report_date=True):
+ conditions = ""
+ if filters.get("company"):
+ conditions += " and company='%s'" % filters["company"]
+
+ customer_accounts = []
+ if filters.get("account"):
+ customer_accounts = [filters["account"]]
+ else:
+ customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
+ where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" %
+ conditions, filters)
+
+ if customer_accounts:
+ conditions += " and account in (%s)" % (", ".join(['%s']*len(customer_accounts)))
+ else:
+ msgprint(_("No Customer Accounts found. Customer Accounts are identified based on \
+ 'Master Type' value in account record."), raise_exception=1)
+
+ if filters.get("report_date"):
+ if upto_report_date:
+ conditions += " and posting_date<='%s'" % filters["report_date"]
+ else:
+ conditions += " and posting_date>'%s'" % filters["report_date"]
+
+ return conditions, customer_accounts
+
+def get_account_territory_map():
+ account_territory_map = {}
+ for each in webnotes.conn.sql("""select t2.name, t1.territory from `tabCustomer` t1,
+ `tabAccount` t2 where t1.name = t2.master_name"""):
+ account_territory_map[each[0]] = each[1]
+
+ return account_territory_map
+
+def get_si_due_date_map():
+ """ get due_date from sales invoice """
+ si_due_date_map = {}
+ for t in webnotes.conn.sql("""select name, due_date from `tabSales Invoice`"""):
+ si_due_date_map[t[0]] = t[1]
+
+ return si_due_date_map
+
+def get_payment_amount(gle, report_date, entries_after_report_date):
+ payment_amount = 0
+ if flt(gle.credit) > 0 and (not gle.against_voucher or
+ [gle.against_voucher_type, gle.against_voucher] in entries_after_report_date):
+ payment_amount = gle.credit
+ elif flt(gle.debit) > 0:
+ payment_amount = webnotes.conn.sql("""
+ select sum(ifnull(credit, 0)) - sum(ifnull(debit, 0)) from `tabGL Entry`
+ where account = %s and posting_date <= %s and against_voucher_type = %s
+ and against_voucher = %s and name != %s and ifnull(is_cancelled, 'No') = 'No'""",
+ (gle.account, report_date, gle.voucher_type, gle.voucher_no, gle.name))[0][0]
+
+ return flt(payment_amount)
+
+def get_ageing_data(ageing_based_on_date, age_on, outstanding_amount):
+ val1 = val2 = val3 = val4 = diff = 0
+ diff = age_on and ageing_based_on_date \
+ and (getdate(age_on) - getdate(ageing_based_on_date)).days or 0
+
+ if diff <= 30:
+ val1 = outstanding_amount
+ elif 30 < diff <= 60:
+ val2 = outstanding_amount
+ elif 60 < diff <= 90:
+ val3 = outstanding_amount
+ elif diff > 90:
+ val4 = outstanding_amount
+
+ return [diff, val1, val2, val3, val4]
\ No newline at end of file
diff --git a/accounts/report/accounts_receivable/accounts_receivable.txt b/accounts/report/accounts_receivable/accounts_receivable.txt
new file mode 100644
index 0000000..d01bef2
--- /dev/null
+++ b/accounts/report/accounts_receivable/accounts_receivable.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-04-16 11:31:13",
+ "docstatus": 0,
+ "modified": "2013-05-24 12:02:52",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Accounts Receivable",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Accounts Receivable"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/bank_clearance_summary/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/bank_clearance_summary/__init__.py
diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.js b/accounts/report/bank_clearance_summary/bank_clearance_summary.js
new file mode 100644
index 0000000..76adfd3
--- /dev/null
+++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.js
@@ -0,0 +1,32 @@
+wn.query_reports["Bank Clearance Summary"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"account",
+ "label": "Bank Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "account_type": "Bank or Cash"
+ }
+ }
+ }
+ },
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.py b/accounts/report/bank_clearance_summary/bank_clearance_summary.py
new file mode 100644
index 0000000..49ac1a4
--- /dev/null
+++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.py
@@ -0,0 +1,54 @@
+# 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
+from webnotes import _, msgprint
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ data = get_entries(filters)
+
+ return columns, data
+
+def get_columns():
+ return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140",
+ "Posting Date:Date:100", "Clearance Date:Date:110", "Against Account:Link/Account:200",
+ "Debit:Currency:120", "Credit:Currency:120"
+ ]
+
+def get_conditions(filters):
+ conditions = ""
+ if not filters.get("account"):
+ msgprint(_("Please select Bank Account"), raise_exception=1)
+ else:
+ conditions += " and jvd.account = %(account)s"
+
+ if filters.get("from_date"): conditions += " and jv.posting_date>=%(from_date)s"
+ if filters.get("to_date"): conditions += " and jv.posting_date<=%(to_date)s"
+
+ return conditions
+
+def get_entries(filters):
+ conditions = get_conditions(filters)
+ entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date,
+ jv.clearance_date, jvd.against_account, jvd.debit, jvd.credit
+ from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
+ where jvd.parent = jv.name and jv.docstatus=1 %s
+ order by jv.name DESC""" % conditions, filters, as_list=1)
+ return entries
\ No newline at end of file
diff --git a/accounts/report/bank_clearance_summary/bank_clearance_summary.txt b/accounts/report/bank_clearance_summary/bank_clearance_summary.txt
new file mode 100644
index 0000000..3dd2079
--- /dev/null
+++ b/accounts/report/bank_clearance_summary/bank_clearance_summary.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-05-01 12:13:25",
+ "docstatus": 0,
+ "modified": "2013-05-01 12:13:25",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Journal Voucher",
+ "report_name": "Bank Clearance Summary",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Bank Clearance Summary"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/bank_reconciliation_statement/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/bank_reconciliation_statement/__init__.py
diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
new file mode 100644
index 0000000..28ac920
--- /dev/null
+++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.js
@@ -0,0 +1,25 @@
+wn.query_reports["Bank Reconciliation Statement"] = {
+ "filters": [
+ {
+ "fieldname":"account",
+ "label": "Bank Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "account_type": "Bank or Cash"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"report_date",
+ "label": "Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
new file mode 100644
index 0000000..1345cd8
--- /dev/null
+++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.py
@@ -0,0 +1,79 @@
+# 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
+from webnotes import _, msgprint
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ data = get_entries(filters)
+
+ from accounts.utils import get_balance_on
+ balance_as_per_company = get_balance_on(filters["account"], filters["report_date"])
+
+ total_debit, total_credit = 0,0
+ for d in data:
+ total_debit += flt(d[4])
+ total_credit += flt(d[5])
+
+ if webnotes.conn.get_value("Account", filters["account"], "debit_or_credit") == 'Debit':
+ bank_bal = flt(balance_as_per_company) - flt(total_debit) + flt(total_credit)
+ else:
+ bank_bal = flt(balance_as_per_company) + flt(total_debit) - flt(total_credit)
+
+ data += [
+ ["", "", "", "Balance as per company books", balance_as_per_company, ""],
+ ["", "", "", "Amounts not reflected in bank", total_debit, total_credit],
+ ["", "", "", "Balance as per bank", bank_bal, ""]
+ ]
+
+ return columns, data
+
+
+def get_columns():
+ return ["Journal Voucher:Link/Journal Voucher:140", "Posting Date:Date:100",
+ "Clearance Date:Date:110", "Against Account:Link/Account:200",
+ "Debit:Currency:120", "Credit:Currency:120"
+ ]
+
+def get_conditions(filters):
+ conditions = ""
+ if not filters.get("account"):
+ msgprint(_("Please select Bank Account"), raise_exception=1)
+ else:
+ conditions += " and jvd.account = %(account)s"
+
+ if not filters.get("report_date"):
+ msgprint(_("Please select Date on which you want to run the report"), raise_exception=1)
+ else:
+ conditions += """ and jv.posting_date <= %(report_date)s
+ and ifnull(jv.clearance_date, '4000-01-01') > %(report_date)s"""
+
+ return conditions
+
+def get_entries(filters):
+ conditions = get_conditions(filters)
+ entries = webnotes.conn.sql("""select jv.name, jv.posting_date, jv.clearance_date,
+ jvd.against_account, jvd.debit, jvd.credit
+ from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
+ where jvd.parent = jv.name and jv.docstatus=1 and ifnull(jv.cheque_no, '')!= '' %s
+ order by jv.name DESC""" % conditions, filters, as_list=1)
+
+ return entries
\ No newline at end of file
diff --git a/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt
new file mode 100644
index 0000000..9867c5d
--- /dev/null
+++ b/accounts/report/bank_reconciliation_statement/bank_reconciliation_statement.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-04-30 18:30:21",
+ "docstatus": 0,
+ "modified": "2013-05-01 10:53:12",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 0,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Journal Voucher",
+ "report_name": "Bank Reconciliation Statement",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Bank Reconciliation Statement"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/budget_variance_report/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/budget_variance_report/__init__.py
diff --git a/accounts/report/budget_variance_report/budget_variance_report.js b/accounts/report/budget_variance_report/budget_variance_report.js
new file mode 100644
index 0000000..a051605
--- /dev/null
+++ b/accounts/report/budget_variance_report/budget_variance_report.js
@@ -0,0 +1,25 @@
+wn.query_reports["Budget Variance Report"] = {
+ "filters": [
+ {
+ fieldname: "fiscal_year",
+ label: "Fiscal Year",
+ fieldtype: "Link",
+ options: "Fiscal Year",
+ default: sys_defaults.fiscal_year
+ },
+ {
+ fieldname: "period",
+ label: "Period",
+ fieldtype: "Select",
+ options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
+ default: "Monthly"
+ },
+ {
+ fieldname: "company",
+ label: "Company",
+ fieldtype: "Link",
+ options: "Company",
+ default: sys_defaults.company
+ },
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/budget_variance_report/budget_variance_report.py b/accounts/report/budget_variance_report/budget_variance_report.py
new file mode 100644
index 0000000..42bc663
--- /dev/null
+++ b/accounts/report/budget_variance_report/budget_variance_report.py
@@ -0,0 +1,130 @@
+# 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
+from webnotes import _, msgprint
+from webnotes.utils import flt
+import time
+from accounts.utils import get_fiscal_year
+from controllers.trends import get_period_date_ranges, get_period_month_ranges
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
+ cam_map = get_costcenter_account_month_map(filters)
+
+ precision = webnotes.conn.get_value("Global Defaults", None, "float_precision") or 2
+
+ data = []
+
+ for cost_center, cost_center_items in cam_map.items():
+ for account, monthwise_data in cost_center_items.items():
+ row = [cost_center, account]
+ totals = [0, 0, 0]
+ for relevant_months in period_month_ranges:
+ period_data = [0, 0, 0]
+ for month in relevant_months:
+ month_data = monthwise_data.get(month, {})
+ for i, fieldname in enumerate(["target", "actual", "variance"]):
+ value = flt(month_data.get(fieldname), precision)
+ period_data[i] += value
+ totals[i] += value
+ period_data[2] = period_data[0] - period_data[1]
+ row += period_data
+ totals[2] = totals[0] - totals[1]
+ row += totals
+ data.append(row)
+
+ return columns, sorted(data, key=lambda x: (x[0], x[1]))
+
+def get_columns(filters):
+ for fieldname in ["fiscal_year", "period", "company"]:
+ if not filters.get(fieldname):
+ label = (" ".join(fieldname.split("_"))).title()
+ msgprint(_("Please specify") + ": " + label,
+ raise_exception=True)
+
+ columns = ["Cost Center:Link/Cost Center:100", "Account:Link/Account:100"]
+
+ group_months = False if filters["period"] == "Monthly" else True
+
+ for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]):
+ for label in ["Target (%s)", "Actual (%s)", "Variance (%s)"]:
+ if group_months:
+ columns.append(label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")))
+ else:
+ columns.append(label % from_date.strftime("%b"))
+
+ return columns + ["Total Target::80", "Total Actual::80", "Total Variance::80"]
+
+#Get cost center & target details
+def get_costcenter_target_details(filters):
+ return webnotes.conn.sql("""select cc.name, cc.distribution_id,
+ cc.parent_cost_center, bd.account, bd.budget_allocated
+ from `tabCost Center` cc, `tabBudget Detail` bd
+ where bd.parent=cc.name and bd.fiscal_year=%s and
+ cc.company_name=%s and ifnull(cc.distribution_id, '')!=''
+ order by cc.name""" % ('%s', '%s'),
+ (filters.get("fiscal_year"), filters.get("company")), as_dict=1)
+
+#Get target distribution details of accounts of cost center
+def get_target_distribution_details(filters):
+ target_details = {}
+
+ for d in webnotes.conn.sql("""select bdd.month, bdd.percentage_allocation \
+ from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd, \
+ `tabCost Center` cc where bdd.parent=bd.name and cc.distribution_id=bd.name and \
+ bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
+ target_details.setdefault(d.month, d)
+
+ return target_details
+
+#Get actual details from gl entry
+def get_actual_details(filters):
+ return webnotes.conn.sql("""select gl.account, gl.debit, gl.credit,
+ gl.cost_center, MONTHNAME(gl.posting_date) as month_name
+ from `tabGL Entry` gl, `tabBudget Detail` bd
+ where gl.fiscal_year=%s and company=%s and is_cancelled='No'
+ and bd.account=gl.account""" % ('%s', '%s'),
+ (filters.get("fiscal_year"), filters.get("company")), as_dict=1)
+
+def get_costcenter_account_month_map(filters):
+ costcenter_target_details = get_costcenter_target_details(filters)
+ tdd = get_target_distribution_details(filters)
+ actual_details = get_actual_details(filters)
+
+ cam_map = {}
+
+ for ccd in costcenter_target_details:
+ for month in tdd:
+ cam_map.setdefault(ccd.name, {}).setdefault(ccd.account, {})\
+ .setdefault(month, webnotes._dict({
+ "target": 0.0, "actual": 0.0
+ }))
+
+ tav_dict = cam_map[ccd.name][ccd.account][month]
+ tav_dict.target = flt(ccd.budget_allocated) * \
+ (tdd[month]["percentage_allocation"]/100)
+
+ for ad in actual_details:
+ if ad.month_name == month and ad.account == ccd.account \
+ and ad.cost_center == ccd.name:
+ tav_dict.actual += ad.debit - ad.credit
+
+ return cam_map
\ No newline at end of file
diff --git a/accounts/report/budget_variance_report/budget_variance_report.txt b/accounts/report/budget_variance_report/budget_variance_report.txt
new file mode 100644
index 0000000..b89cb45
--- /dev/null
+++ b/accounts/report/budget_variance_report/budget_variance_report.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-18 12:56:36",
+ "docstatus": 0,
+ "modified": "2013-06-18 12:56:36",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Cost Center",
+ "report_name": "Budget Variance Report",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Budget Variance Report"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/customer_account_head/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/customer_account_head/__init__.py
diff --git a/accounts/report/customer_account_head/customer_account_head.py b/accounts/report/customer_account_head/customer_account_head.py
new file mode 100644
index 0000000..61f8cb2
--- /dev/null
+++ b/accounts/report/customer_account_head/customer_account_head.py
@@ -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
\ No newline at end of file
diff --git a/accounts/report/customer_account_head/customer_account_head.txt b/accounts/report/customer_account_head/customer_account_head.txt
new file mode 100644
index 0000000..d258fac
--- /dev/null
+++ b/accounts/report/customer_account_head/customer_account_head.txt
@@ -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"
+ }
+]
\ No newline at end of file
diff --git a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
index c84854f..a9a18e7 100644
--- a/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
+++ b/accounts/report/delivered_items_to_be_billed/delivered_items_to_be_billed.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 17:55:23",
+ "creation": "2013-05-02 15:20:25",
"docstatus": 0,
- "modified": "2013-02-23 14:35:28",
+ "modified": "2013-07-08 11:08:23",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
- "query": "select \n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n`tabDelivery Note`.`status` as \"Status\",\n `tabDelivery Note`.`posting_date` as \"Date:Date\",\n `tabDelivery Note`.`project_name` as \"Project\",\n `tabDelivery Note Item`.item_code as \"Item:Link/Item:120\",\n `tabDelivery Note Item`.amount as \"Amount:Currency:110\",\n (`tabDelivery Note Item`.billed_amt * ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabDelivery Note Item`.amount,0) - (ifnull(`tabDelivery Note Item`.billed_amt,0) * ifnull(`tabDelivery Note`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabDelivery Note Item`.item_name as \"Item Name::150\",\n `tabDelivery Note Item`.description as \"Description:Data:200\"\nfrom\n `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note Item`.`parent` = `tabDelivery Note`.`name`\n and `tabDelivery Note`.docstatus = 1\n and `tabDelivery Note`.status != \"Stopped\"\n and ifnull(`tabDelivery Note Item`.billed_amt,0) < ifnull(`tabDelivery Note Item`.export_amount,0)\norder by `tabDelivery Note`.posting_date asc",
+ "query": "select \n `tabDelivery Note`.`name` as \"Delivery Note:Link/Delivery Note:120\",\n`tabDelivery Note`.`customer` as \"Customer:Link/Customer:120\",\n`tabDelivery Note`.`status` as \"Status\",\n `tabDelivery Note`.`posting_date` as \"Date:Date\",\n `tabDelivery Note`.`project_name` as \"Project\",\n `tabDelivery Note Item`.item_code as \"Item:Link/Item:120\",\n `tabDelivery Note Item`.amount as \"Amount:Currency:110\",\n (`tabDelivery Note Item`.billed_amt * ifnull(`tabDelivery Note`.conversion_rate, 1)) as \"Billed Amount:Currency:110\",\n (ifnull(`tabDelivery Note Item`.amount,0) - (ifnull(`tabDelivery Note Item`.billed_amt,0) * ifnull(`tabDelivery Note`.conversion_rate, 1))) as \"Pending Amount:Currency:120\",\n `tabDelivery Note Item`.item_name as \"Item Name::150\",\n `tabDelivery Note Item`.description as \"Description:Data:200\",\n `tabDelivery Note Item`.prevdoc_docname as \"Sales Order:Link/Sales Order:120\",\n `tabDelivery Note Item`.prevdoc_date as \"SO Date:Date:100\",\n `tabDelivery Note`.address_display as \"Customer Address::150\"\nfrom\n `tabDelivery Note`, `tabDelivery Note Item`\nwhere\n `tabDelivery Note Item`.`parent` = `tabDelivery Note`.`name`\n and `tabDelivery Note`.docstatus = 1\n and `tabDelivery Note`.status != \"Stopped\"\n and ifnull(`tabDelivery Note Item`.billed_amt,0) < ifnull(`tabDelivery Note Item`.export_amount,0)\norder by `tabDelivery Note`.posting_date asc",
"ref_doctype": "Sales Invoice",
"report_name": "Delivered Items To Be Billed",
"report_type": "Query Report"
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/item_wise_purchase_register/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/item_wise_purchase_register/__init__.py
diff --git a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
new file mode 100644
index 0000000..8323a1a
--- /dev/null
+++ b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.js
@@ -0,0 +1,39 @@
+wn.query_reports["Item-wise Purchase Register"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname": "item_code",
+ "label": "Item",
+ "fieldtype": "Link",
+ "options": "Item",
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Credit",
+ "master_type": "Supplier"
+ }
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
new file mode 100644
index 0000000..9f5f071
--- /dev/null
+++ b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.py
@@ -0,0 +1,73 @@
+# 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):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ item_list = get_items(filters)
+ aii_account_map = get_aii_accounts()
+ data = []
+ for d in item_list:
+ expense_head = d.expense_head or aii_account_map.get(d.company)
+ data.append([d.item_code, d.item_name, d.item_group, d.name, d.posting_date,
+ d.supplier_name, d.credit_to, d.project_name, d.company, d.purchase_order,
+ d.purchase_receipt, expense_head, d.qty, d.rate, d.amount])
+
+ return columns, data
+
+
+def get_columns():
+ return ["Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100",
+ "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier:Link/Customer:120",
+ "Supplier Account:Link/Account:120", "Project:Link/Project:80", "Company:Link/Company:100",
+ "Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100",
+ "Expense Account:Link/Account:140", "Qty:Float:120", "Rate:Currency:120",
+ "Amount:Currency:120"]
+
+
+def get_conditions(filters):
+ conditions = ""
+
+ if filters.get("account"): conditions += " and pi.credit_to = %(account)s"
+
+ if filters.get("item_code"): conditions += " and pi_item.item_code = %(item_code)s"
+
+ if filters.get("from_date"): conditions += " and pi.posting_date>=%(from_date)s"
+ if filters.get("to_date"): conditions += " and pi.posting_date<=%(to_date)s"
+
+ return conditions
+
+def get_items(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select pi.name, pi.posting_date, pi.credit_to, pi.company,
+ pi.supplier, pi.remarks, pi_item.item_code, pi_item.item_name, pi_item.item_group,
+ pi_item.project_name, pi_item.purchase_order, pi_item.purchase_receipt,
+ pi_item.expense_head, pi_item.qty, pi_item.rate, pi_item.amount, pi.supplier_name
+ from `tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item
+ where pi.name = pi_item.parent and pi.docstatus = 1 %s
+ order by pi.posting_date desc, pi_item.item_code desc""" % conditions, filters, as_dict=1)
+
+def get_aii_accounts():
+ aii_account_map = {}
+ for d in webnotes.conn.sql("select name, stock_received_but_not_billed from tabCompany",
+ as_dict=1):
+ aii_account_map.setdefault(d.name, d.stock_received_but_not_billed)
+
+ return aii_account_map
\ No newline at end of file
diff --git a/accounts/report/item_wise_purchase_register/item_wise_purchase_register.txt b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.txt
new file mode 100644
index 0000000..7ded5ff
--- /dev/null
+++ b/accounts/report/item_wise_purchase_register/item_wise_purchase_register.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-06-05 15:37:30",
+ "docstatus": 0,
+ "modified": "2013-06-05 15:37:30",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Item-wise Purchase Register",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Item-wise Purchase Register"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/item_wise_sales_register/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/item_wise_sales_register/__init__.py
diff --git a/accounts/report/item_wise_sales_register/item_wise_sales_register.js b/accounts/report/item_wise_sales_register/item_wise_sales_register.js
new file mode 100644
index 0000000..b9ce959
--- /dev/null
+++ b/accounts/report/item_wise_sales_register/item_wise_sales_register.js
@@ -0,0 +1,39 @@
+wn.query_reports["Item-wise Sales Register"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname": "item_code",
+ "label": "Item",
+ "fieldtype": "Link",
+ "options": "Item",
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Debit",
+ "master_type": "Customer"
+ }
+ }
+ }
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/item_wise_sales_register/item_wise_sales_register.py b/accounts/report/item_wise_sales_register/item_wise_sales_register.py
new file mode 100644
index 0000000..4d099e0
--- /dev/null
+++ b/accounts/report/item_wise_sales_register/item_wise_sales_register.py
@@ -0,0 +1,66 @@
+# 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):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ item_list = get_items(filters)
+
+ data = []
+ for d in item_list:
+ data.append([d.item_code, d.item_name, d.item_group, d.name, d.posting_date,
+ d.customer_name, d.debit_to, d.territory, d.project_name, d.company, d.sales_order,
+ d.delivery_note, d.income_account, d.qty, d.basic_rate, d.amount])
+
+ return columns, data
+
+
+def get_columns():
+ return [
+ "Item Code:Link/Item:120", "Item Name::120", "Item Group:Link/Item Group:100",
+ "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer:Link/Customer:120",
+ "Customer Account:Link/Account:120", "Territory:Link/Territory:80",
+ "Project:Link/Project:80", "Company:Link/Company:100", "Sales Order:Link/Sales Order:100",
+ "Delivery Note:Link/Delivery Note:100", "Income Account:Link/Account:140",
+ "Qty:Float:120", "Rate:Currency:120", "Amount:Currency:120"
+ ]
+
+
+def get_conditions(filters):
+ conditions = ""
+
+ if filters.get("account"): conditions += " and si.debit_to = %(account)s"
+
+ if filters.get("item_code"): conditions += " and si_item.item_code = %(item_code)s"
+
+ if filters.get("from_date"): conditions += " and si.posting_date>=%(from_date)s"
+ if filters.get("to_date"): conditions += " and si.posting_date<=%(to_date)s"
+
+ return conditions
+
+def get_items(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select si.name, si.posting_date, si.debit_to, si.project_name,
+ si.customer, si.remarks, si.territory, si.company, si_item.item_code, si_item.item_name,
+ si_item.item_group, si_item.sales_order, si_item.delivery_note, si_item.income_account,
+ si_item.qty, si_item.basic_rate, si_item.amount, si.customer_name
+ from `tabSales Invoice` si, `tabSales Invoice Item` si_item
+ where si.name = si_item.parent and si.docstatus = 1 %s
+ order by si.posting_date desc, si_item.item_code desc""" % conditions, filters, as_dict=1)
\ No newline at end of file
diff --git a/accounts/report/item_wise_sales_register/item_wise_sales_register.txt b/accounts/report/item_wise_sales_register/item_wise_sales_register.txt
new file mode 100644
index 0000000..fb0555d
--- /dev/null
+++ b/accounts/report/item_wise_sales_register/item_wise_sales_register.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-13 17:50:55",
+ "docstatus": 0,
+ "modified": "2013-05-13 17:50:55",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Item-wise Sales Register",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Item-wise Sales Register"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/payment_collection_with_ageing/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/payment_collection_with_ageing/__init__.py
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js
new file mode 100644
index 0000000..d608fbd
--- /dev/null
+++ b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.js
@@ -0,0 +1,42 @@
+wn.query_reports["Payment Collection With Ageing"] = {
+ "filters": [
+ {
+ "fieldname": "from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"account",
+ "label": "Customer Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ var company = wn.query_report.filters_by_name.company.get_value();
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Debit",
+ "company": company,
+ "master_type": "Customer"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ },
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py
new file mode 100644
index 0000000..1268852
--- /dev/null
+++ b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.py
@@ -0,0 +1,90 @@
+# 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
+from webnotes import msgprint, _
+from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ entries = get_entries(filters)
+ si_posting_date_map = get_si_posting_date_map()
+
+ data = []
+ for d in entries:
+ against_invoice_date = d.against_invoice and si_posting_date_map[d.against_invoice] or ""
+
+ row = [d.name, d.account, d.posting_date, d.against_invoice, against_invoice_date,
+ d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
+
+ if d.against_invoice:
+ row += get_ageing_data(against_invoice_date, d.posting_date, d.credit or -1*d.debit)
+ else:
+ row += ["", "", "", "", ""]
+
+ data.append(row)
+
+ return columns, data
+
+def get_columns():
+ return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140",
+ "Posting Date:Date:100", "Against Invoice:Link/Sales Invoice:130",
+ "Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120",
+ "Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40",
+ "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
+ ]
+
+def get_conditions(filters):
+ conditions = ""
+
+ customer_accounts = []
+ if filters.get("account"):
+ customer_accounts = [filters["account"]]
+ else:
+ cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
+ customer_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
+ where ifnull(master_type, '') = 'Customer' and docstatus < 2 %s""" % cond)
+
+ if customer_accounts:
+ conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(customer_accounts)))
+ else:
+ msgprint(_("No Customer Accounts found. Customer Accounts are identified based on \
+ 'Master Type' value in account record."), raise_exception=1)
+
+ if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"]
+ if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"]
+
+ return conditions, customer_accounts
+
+def get_entries(filters):
+ conditions, customer_accounts = get_conditions(filters)
+ entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date,
+ jvd.against_invoice, jvd.debit, jvd.credit, jv.cheque_no, jv.cheque_date, jv.remark
+ from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
+ where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" %
+ (conditions), tuple(customer_accounts), as_dict=1)
+
+ return entries
+
+def get_si_posting_date_map():
+ si_posting_date_map = {}
+ for t in webnotes.conn.sql("""select name, posting_date from `tabSales Invoice`"""):
+ si_posting_date_map[t[0]] = t[1]
+
+ return si_posting_date_map
\ No newline at end of file
diff --git a/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt
new file mode 100644
index 0000000..3405d19
--- /dev/null
+++ b/accounts/report/payment_collection_with_ageing/payment_collection_with_ageing.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-02 12:09:51",
+ "docstatus": 0,
+ "modified": "2013-05-02 12:09:51",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Journal Voucher",
+ "report_name": "Payment Collection With Ageing",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Payment Collection With Ageing"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/payment_made_with_ageing/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/payment_made_with_ageing/__init__.py
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.js b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.js
new file mode 100644
index 0000000..533fe61
--- /dev/null
+++ b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.js
@@ -0,0 +1,40 @@
+wn.query_reports["Payment Made With Ageing"] = {
+ "filters": [
+ {
+ fieldname: "from_date",
+ label: "From Date",
+ fieldtype: "Date",
+ default: wn.defaults.get_user_default("year_start_date"),
+ },
+ {
+ fieldname:"to_date",
+ label: "To Date",
+ fieldtype: "Date",
+ default: get_today()
+ },
+ {
+ fieldname:"account",
+ label: "Supplier Account",
+ fieldtype: "Link",
+ options: "Account",
+ get_query: function() {
+ return {
+ query: "accounts.utils.get_account_list",
+ filters: {
+ is_pl_account: "No",
+ debit_or_credit: "Credit",
+ company: wn.query_report.filters_by_name.company.get_value(),
+ master_type: "Supplier"
+ }
+ }
+ }
+ },
+ {
+ fieldname:"company",
+ label: "Company",
+ fieldtype: "Link",
+ options: "Company",
+ default: sys_defaults.company
+ },
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py
new file mode 100644
index 0000000..e7f13ef
--- /dev/null
+++ b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.py
@@ -0,0 +1,89 @@
+# 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
+from webnotes import msgprint, _
+from accounts.report.accounts_receivable.accounts_receivable import get_ageing_data
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ entries = get_entries(filters)
+ pi_posting_date_map = get_pi_posting_date_map()
+
+ data = []
+ for d in entries:
+ against_voucher_date = d.against_voucher and pi_posting_date_map[d.against_voucher] or ""
+
+ row = [d.name, d.account, d.posting_date, d.against_voucher, against_voucher_date,
+ d.debit, d.credit, d.cheque_no, d.cheque_date, d.remark]
+
+ if d.against_voucher:
+ row += get_ageing_data(against_voucher_date, d.posting_date, d.debit or -1*d.credit)
+ else:
+ row += ["", "", "", "", ""]
+
+ data.append(row)
+
+ return columns, data
+
+def get_columns():
+ return ["Journal Voucher:Link/Journal Voucher:140", "Account:Link/Account:140",
+ "Posting Date:Date:100", "Against Invoice:Link/Purchase Invoice:130",
+ "Against Invoice Posting Date:Date:130", "Debit:Currency:120", "Credit:Currency:120",
+ "Reference No::100", "Reference Date:Date:100", "Remarks::150", "Age:Int:40",
+ "0-30:Currency:100", "30-60:Currency:100", "60-90:Currency:100", "90-Above:Currency:100"
+ ]
+
+def get_conditions(filters):
+ conditions = ""
+ supplier_accounts = []
+ if filters.get("account"):
+ supplier_accounts = [filters["account"]]
+ else:
+ cond = filters.get("company") and (" and company = '%s'" % filters["company"]) or ""
+ supplier_accounts = webnotes.conn.sql_list("""select name from `tabAccount`
+ where ifnull(master_type, '') = 'Supplier' and docstatus < 2 %s""" % cond)
+
+ if supplier_accounts:
+ conditions += " and jvd.account in (%s)" % (", ".join(['%s']*len(supplier_accounts)))
+ else:
+ msgprint(_("No Supplier Accounts found. Supplier Accounts are identified based on \
+ 'Master Type' value in account record."), raise_exception=1)
+
+ if filters.get("from_date"): conditions += " and jv.posting_date >= '%s'" % filters["from_date"]
+ if filters.get("to_date"): conditions += " and jv.posting_date <= '%s'" % filters["to_date"]
+
+ return conditions, supplier_accounts
+
+def get_entries(filters):
+ conditions, supplier_accounts = get_conditions(filters)
+ entries = webnotes.conn.sql("""select jv.name, jvd.account, jv.posting_date,
+ jvd.against_voucher, jvd.debit, jvd.credit, jv.cheque_no, jv.cheque_date, jv.remark
+ from `tabJournal Voucher Detail` jvd, `tabJournal Voucher` jv
+ where jvd.parent = jv.name and jv.docstatus=1 %s order by jv.name DESC""" %
+ (conditions), tuple(supplier_accounts), as_dict=1)
+
+ return entries
+
+def get_pi_posting_date_map():
+ pi_posting_date_map = {}
+ for t in webnotes.conn.sql("""select name, posting_date from `tabPurchase Invoice`"""):
+ pi_posting_date_map[t[0]] = t[1]
+
+ return pi_posting_date_map
\ No newline at end of file
diff --git a/accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt
new file mode 100644
index 0000000..c5c85da
--- /dev/null
+++ b/accounts/report/payment_made_with_ageing/payment_made_with_ageing.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-02 12:10:21",
+ "docstatus": 0,
+ "modified": "2013-05-02 12:10:21",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Journal Voucher",
+ "report_name": "Payment Made With Ageing",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Payment Made With Ageing"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/purchase_invoice_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/purchase_invoice_trends/__init__.py
diff --git a/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
new file mode 100644
index 0000000..bb18ce4
--- /dev/null
+++ b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/purchase_trends_filters.js");
+
+wn.query_reports["Purchase Invoice Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
similarity index 73%
copy from patches/september_2012/reload_gross_profit.py
copy to accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
index 0a3f9ef..659cb85 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns,get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Purchase Invoice")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/accounts/report/purchase_invoice_trends/purchase_invoice_trends.txt b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.txt
new file mode 100644
index 0000000..1d5c2d5
--- /dev/null
+++ b/accounts/report/purchase_invoice_trends/purchase_invoice_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:46:55",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:46:55",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Purchase Invoice Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase Invoice Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/purchase_order_items_to_be_billed/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/purchase_order_items_to_be_billed/__init__.py
diff --git a/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt b/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt
new file mode 100644
index 0000000..7a9ec36
--- /dev/null
+++ b/accounts/report/purchase_order_items_to_be_billed/purchase_order_items_to_be_billed.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-28 15:54:16",
+ "docstatus": 0,
+ "modified": "2013-05-28 16:02:57",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Order Item`.billed_qty as \"Billed Qty:Float:100\", \n\t(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.billed_qty, 0)) as \"Qty to Bill:Float:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.billed_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Purchase Order Items To Be Billed",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase Order Items To Be Billed"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/purchase_register/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/purchase_register/__init__.py
diff --git a/accounts/report/purchase_register/purchase_register.js b/accounts/report/purchase_register/purchase_register.js
new file mode 100644
index 0000000..21e0547
--- /dev/null
+++ b/accounts/report/purchase_register/purchase_register.js
@@ -0,0 +1,42 @@
+wn.query_reports["Purchase Register"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ var company = wn.query_report.filters_by_name.company.get_value();
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Credit",
+ "company": company,
+ "master_type": "Supplier"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/purchase_register/purchase_register.py b/accounts/report/purchase_register/purchase_register.py
new file mode 100644
index 0000000..705a654
--- /dev/null
+++ b/accounts/report/purchase_register/purchase_register.py
@@ -0,0 +1,179 @@
+# 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
+from webnotes.utils import flt
+from webnotes import msgprint, _
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ invoice_list = get_invoices(filters)
+ columns, expense_accounts, tax_accounts, renamed_columns = get_columns(invoice_list)
+
+
+ if not invoice_list:
+ msgprint(_("No record found"))
+ return columns, invoice_list
+
+ invoice_expense_map = get_invoice_expense_map(invoice_list)
+ invoice_tax_map = get_invoice_tax_map(invoice_list, renamed_columns)
+ invoice_po_pr_map = get_invoice_po_pr_map(invoice_list)
+ account_map = get_account_details(invoice_list)
+
+ data = []
+ for inv in invoice_list:
+ # invoice details
+ purchase_order = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_order", [])))
+ purchase_receipt = list(set(invoice_po_pr_map.get(inv.name, {}).get("purchase_receipt", [])))
+ project_name = list(set(invoice_po_pr_map.get(inv.name, {}).get("project_name", [])))
+
+ row = [inv.name, inv.posting_date, inv.supplier_name, inv.credit_to,
+ account_map.get(inv.credit_to), ", ".join(project_name), inv.bill_no, inv.bill_date,
+ inv.remarks, ", ".join(purchase_order), ", ".join(purchase_receipt)]
+
+ # map expense values
+ for expense_acc in expense_accounts:
+ row.append(invoice_expense_map.get(inv.name, {}).get(expense_acc))
+
+ # net total
+ row.append(inv.net_total)
+
+ # tax account
+ for tax_acc in tax_accounts:
+ row.append(invoice_tax_map.get(inv.name, {}).get(tax_acc))
+
+ # total tax, grand total, outstanding amount & rounded total
+ row += [inv.total_tax, inv.grand_total, flt(inv.grand_total, 2), \
+ inv.outstanding_amount]
+ data.append(row)
+
+ return columns, data
+
+
+def get_columns(invoice_list):
+ """return columns based on filters"""
+ columns = [
+ "Invoice:Link/Purchase Invoice:120", "Posting Date:Date:80", "Supplier::120",
+ "Supplier Account:Link/Account:120", "Account Group:LInk/Account:120",
+ "Project:Link/Project:80", "Bill No::120", "Bill Date:Date:80", "Remarks::150",
+ "Purchase Order:Link/Purchase Order:100", "Purchase Receipt:Link/Purchase Receipt:100"
+ ]
+ expense_accounts = tax_accounts = expense_columns = tax_columns = []
+ renamed_columns = {}
+
+ if invoice_list:
+ expense_accounts = webnotes.conn.sql_list("""select distinct expense_head
+ from `tabPurchase Invoice Item` where docstatus = 1 and ifnull(expense_head, '') != ''
+ and parent in (%s) order by expense_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
+
+ tax_accounts = webnotes.conn.sql_list("""select distinct account_head
+ from `tabPurchase Taxes and Charges` where parenttype = 'Purchase Invoice'
+ and docstatus = 1 and ifnull(account_head, '') != '' and parent in (%s)
+ order by account_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
+
+
+ expense_columns = [(account + ":Currency:120") for account in expense_accounts]
+ for account in tax_accounts:
+ if account in expense_accounts:
+ new_account = account + " (Tax)"
+ renamed_columns[account] = new_account
+ tax_columns.append(new_account + ":Currency:120")
+ else:
+ tax_columns.append(account + ":Currency:120")
+
+ columns = columns + expense_columns + \
+ ["Net Total:Currency:120"] + tax_columns + \
+ ["Total Tax:Currency:120"] + ["Grand Total:Currency:120"] + \
+ ["Rounded Total:Currency:120"] + ["Outstanding Amount:Currency:120"]
+
+ return columns, expense_accounts, tax_accounts, renamed_columns
+
+def get_conditions(filters):
+ conditions = ""
+
+ if filters.get("company"): conditions += " and company=%(company)s"
+ if filters.get("account"): conditions += " and credit_to = %(account)s"
+
+ if filters.get("from_date"): conditions += " and posting_date>=%(from_date)s"
+ if filters.get("to_date"): conditions += " and posting_date<=%(to_date)s"
+
+ return conditions
+
+def get_invoices(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select name, posting_date, credit_to, supplier, supplier_name,
+ bill_no, bill_date, remarks, net_total, total_tax, grand_total, outstanding_amount
+ from `tabPurchase Invoice` where docstatus = 1 %s
+ order by posting_date desc, name desc""" % conditions, filters, as_dict=1)
+
+
+def get_invoice_expense_map(invoice_list):
+ expense_details = webnotes.conn.sql("""select parent, expense_head, sum(amount) as amount
+ from `tabPurchase Invoice Item` where parent in (%s) group by parent, expense_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_expense_map = {}
+ for d in expense_details:
+ invoice_expense_map.setdefault(d.parent, webnotes._dict()).setdefault(d.expense_head, [])
+ invoice_expense_map[d.parent][d.expense_head] = flt(d.amount)
+
+ return invoice_expense_map
+
+def get_invoice_tax_map(invoice_list, renamed_columns):
+ tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
+ from `tabPurchase Taxes and Charges` where parent in (%s) group by parent, account_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_tax_map = {}
+ for d in tax_details:
+ account = renamed_columns.get(d.account_head) or d.account_head
+ invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(account, [])
+ invoice_tax_map[d.parent][account] = flt(d.tax_amount)
+
+ return invoice_tax_map
+
+def get_invoice_po_pr_map(invoice_list):
+ pi_items = webnotes.conn.sql("""select parent, purchase_order, purchase_receipt,
+ project_name from `tabPurchase Invoice Item` where parent in (%s)
+ and (ifnull(purchase_order, '') != '' or ifnull(purchase_receipt, '') != '')""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_po_pr_map = {}
+ for d in pi_items:
+ if d.purchase_order:
+ invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+ "purchase_order", []).append(d.purchase_order)
+ if d.purchase_receipt:
+ invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+ "purchase_receipt", []).append(d.purchase_receipt)
+ if d.project_name:
+ invoice_po_pr_map.setdefault(d.parent, webnotes._dict()).setdefault(
+ "project_name", []).append(d.project_name)
+
+ return invoice_po_pr_map
+
+def get_account_details(invoice_list):
+ account_map = {}
+ accounts = list(set([inv.credit_to for inv in invoice_list]))
+ for acc in webnotes.conn.sql("""select name, parent_account from tabAccount
+ where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1):
+ account_map[acc.name] = acc.parent_account
+
+ return account_map
diff --git a/accounts/report/purchase_register/purchase_register.txt b/accounts/report/purchase_register/purchase_register.txt
new file mode 100644
index 0000000..847f5f3
--- /dev/null
+++ b/accounts/report/purchase_register/purchase_register.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-04-29 16:13:11",
+ "docstatus": 0,
+ "modified": "2013-04-30 17:51:19",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Purchase Register",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase Register"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/received_items_to_be_billed/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/received_items_to_be_billed/__init__.py
diff --git a/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt b/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt
new file mode 100644
index 0000000..554e0f0
--- /dev/null
+++ b/accounts/report/received_items_to_be_billed/received_items_to_be_billed.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-28 15:57:59",
+ "docstatus": 0,
+ "modified": "2013-05-28 17:34:05",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select \n `tabPurchase Receipt`.`name` as \"Purchase Receipt:Link/Purchase Receipt:120\",\n `tabPurchase Receipt`.`posting_date` as \"Date:Date:100\",\n `tabPurchase Receipt`.`supplier` as \"Supplier:Link/Supplier:120\",\n `tabPurchase Receipt Item`.`project_name` as \"Project\",\n\t`tabPurchase Receipt Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Receipt Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Receipt Item`.billed_qty as \"Billed Qty:Float:100\", \n\t(`tabPurchase Receipt Item`.qty - ifnull(`tabPurchase Receipt Item`.billed_qty, 0)) as \"Qty to Bill:Float:100\",\n\t`tabPurchase Receipt Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Receipt Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Receipt`, `tabPurchase Receipt Item`\nwhere\n\t`tabPurchase Receipt Item`.`parent` = `tabPurchase Receipt`.`name`\n\tand `tabPurchase Receipt`.docstatus = 1\n\tand `tabPurchase Receipt`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Receipt Item`.billed_qty, 0) < ifnull(`tabPurchase Receipt Item`.qty, 0)\norder by `tabPurchase Receipt`.posting_date asc",
+ "ref_doctype": "Purchase Invoice",
+ "report_name": "Received Items To Be Billed",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Received Items To Be Billed"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/sales_invoice_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/sales_invoice_trends/__init__.py
diff --git a/accounts/report/sales_invoice_trends/sales_invoice_trends.js b/accounts/report/sales_invoice_trends/sales_invoice_trends.js
new file mode 100644
index 0000000..6f20015
--- /dev/null
+++ b/accounts/report/sales_invoice_trends/sales_invoice_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/sales_trends_filters.js");
+
+wn.query_reports["Sales Invoice Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/accounts/report/sales_invoice_trends/sales_invoice_trends.py
similarity index 74%
copy from patches/september_2012/reload_gross_profit.py
copy to accounts/report/sales_invoice_trends/sales_invoice_trends.py
index 0a3f9ef..9a5eaf2 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/accounts/report/sales_invoice_trends/sales_invoice_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns,get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Sales Invoice")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/accounts/report/sales_invoice_trends/sales_invoice_trends.txt b/accounts/report/sales_invoice_trends/sales_invoice_trends.txt
new file mode 100644
index 0000000..279ac12
--- /dev/null
+++ b/accounts/report/sales_invoice_trends/sales_invoice_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:44:21",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:44:21",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Sales Invoice Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Invoice Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/sales_partners_commission/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/sales_partners_commission/__init__.py
diff --git a/accounts/report/sales_partners_commission/sales_partners_commission.txt b/accounts/report/sales_partners_commission/sales_partners_commission.txt
new file mode 100644
index 0000000..52bbf3c
--- /dev/null
+++ b/accounts/report/sales_partners_commission/sales_partners_commission.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-06 12:28:23",
+ "docstatus": 0,
+ "modified": "2013-05-06 12:41:15",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "SELECT\n sales_partner as \"Sales Partner:Link/Sales Partner:150\",\n\tsum(net_total) as \"Invoiced Amount (Exculsive Tax):Currency:210\",\n\tsum(total_commission) as \"Total Commission:Currency:150\",\n\tsum(total_commission)*100/sum(net_total) as \"Average Commission Rate:Currency:170\"\nFROM\n\t`tabSales Invoice`\nWHERE\n\tdocstatus = 1 and ifnull(net_total, 0) > 0 and ifnull(total_commission, 0) > 0\nGROUP BY\n\tsales_partner\nORDER BY\n\t\"Total Commission:Currency:120\"",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Sales Partners Commission",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Partners Commission"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/sales_register/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/sales_register/__init__.py
diff --git a/accounts/report/sales_register/sales_register.js b/accounts/report/sales_register/sales_register.js
new file mode 100644
index 0000000..8224619
--- /dev/null
+++ b/accounts/report/sales_register/sales_register.js
@@ -0,0 +1,42 @@
+wn.query_reports["Sales Register"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": wn.defaults.get_user_default("year_start_date"),
+ "width": "80"
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ },
+ {
+ "fieldname":"account",
+ "label": "Account",
+ "fieldtype": "Link",
+ "options": "Account",
+ "get_query": function() {
+ var company = wn.query_report.filters_by_name.company.get_value();
+ return {
+ "query": "accounts.utils.get_account_list",
+ "filters": {
+ "is_pl_account": "No",
+ "debit_or_credit": "Debit",
+ "company": company,
+ "master_type": "Customer"
+ }
+ }
+ }
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ }
+ ]
+}
\ No newline at end of file
diff --git a/accounts/report/sales_register/sales_register.py b/accounts/report/sales_register/sales_register.py
new file mode 100644
index 0000000..2bc2850
--- /dev/null
+++ b/accounts/report/sales_register/sales_register.py
@@ -0,0 +1,184 @@
+# 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
+from webnotes.utils import flt
+from webnotes import msgprint, _
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ invoice_list = get_invoices(filters)
+ columns, income_accounts, tax_accounts, renamed_columns = get_columns(invoice_list)
+
+ if not invoice_list:
+ msgprint(_("No record found"))
+ return columns, invoice_list
+
+ invoice_income_map = get_invoice_income_map(invoice_list)
+ invoice_tax_map = get_invoice_tax_map(invoice_list, renamed_columns)
+
+ invoice_so_dn_map = get_invoice_so_dn_map(invoice_list)
+ customer_map = get_customer_deatils(invoice_list)
+ account_map = get_account_details(invoice_list)
+
+ data = []
+ for inv in invoice_list:
+ # invoice details
+ sales_order = list(set(invoice_so_dn_map.get(inv.name, {}).get("sales_order", [])))
+ delivery_note = list(set(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", [])))
+
+ row = [inv.name, inv.posting_date, inv.customer_name, inv.debit_to,
+ account_map.get(inv.debit_to), customer_map.get(inv.customer), inv.project_name,
+ inv.remarks, ", ".join(sales_order), ", ".join(delivery_note)]
+
+ # map income values
+ for income_acc in income_accounts:
+ row.append(invoice_income_map.get(inv.name, {}).get(income_acc))
+
+ # net total
+ row.append(inv.net_total)
+
+ # tax account
+ for tax_acc in tax_accounts:
+ row.append(invoice_tax_map.get(inv.name, {}).get(tax_acc))
+
+ # total tax, grand total, outstanding amount & rounded total
+ row += [inv.other_charges_total, inv.grand_total, inv.rounded_total, inv.outstanding_amount]
+
+ data.append(row)
+
+ return columns, data
+
+
+def get_columns(invoice_list):
+ """return columns based on filters"""
+ columns = [
+ "Invoice:Link/Sales Invoice:120", "Posting Date:Date:80", "Customer::120",
+ "Customer Account:Link/Account:120", "Account Group:LInk/Account:120",
+ "Territory:Link/Territory:80", "Project:Link/Project:80",
+ "Remarks::150", "Sales Order:Link/Sales Order:100", "Delivery Note:Link/Delivery Note:100"
+ ]
+
+ income_accounts = tax_accounts = income_columns = tax_columns = []
+ renamed_columns = {}
+
+ if invoice_list:
+ income_accounts = webnotes.conn.sql_list("""select distinct income_account
+ from `tabSales Invoice Item` where docstatus = 1 and parent in (%s)
+ order by income_account""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
+
+ tax_accounts = webnotes.conn.sql_list("""select distinct account_head
+ from `tabSales Taxes and Charges` where parenttype = 'Sales Invoice'
+ and docstatus = 1 and ifnull(tax_amount, 0) > 0
+ and parent in (%s) order by account_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]))
+
+ income_columns = [(account + ":Currency:120") for account in income_accounts]
+ for account in tax_accounts:
+ if account in income_accounts:
+ new_account = account + " (Tax)"
+ renamed_columns[account] = new_account
+ tax_columns.append(new_account + ":Currency:120")
+ else:
+ tax_columns.append(account + ":Currency:120")
+
+ columns = columns + income_columns + ["Net Total:Currency:120"] + tax_columns + \
+ ["Total Tax:Currency:120"] + ["Grand Total:Currency:120"] + \
+ ["Rounded Total:Currency:120"] + ["Outstanding Amount:Currency:120"]
+
+ return columns, income_accounts, tax_accounts, renamed_columns
+
+def get_conditions(filters):
+ conditions = ""
+
+ if filters.get("company"): conditions += " and company=%(company)s"
+ if filters.get("account"): conditions += " and debit_to = %(account)s"
+
+ if filters.get("from_date"): conditions += " and posting_date >= %(from_date)s"
+ if filters.get("to_date"): conditions += " and posting_date <= %(to_date)s"
+
+ return conditions
+
+def get_invoices(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select name, posting_date, debit_to, project_name, customer,
+ customer_name, remarks, net_total, other_charges_total, grand_total, rounded_total,
+ outstanding_amount from `tabSales Invoice`
+ where docstatus = 1 %s order by posting_date desc, name desc""" %
+ conditions, filters, as_dict=1)
+
+def get_invoice_income_map(invoice_list):
+ income_details = webnotes.conn.sql("""select parent, income_account, sum(amount) as amount
+ from `tabSales Invoice Item` where parent in (%s) group by parent, income_account""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_income_map = {}
+ for d in income_details:
+ invoice_income_map.setdefault(d.parent, webnotes._dict()).setdefault(d.income_account, [])
+ invoice_income_map[d.parent][d.income_account] = flt(d.amount)
+
+ return invoice_income_map
+
+def get_invoice_tax_map(invoice_list, renamed_columns):
+ tax_details = webnotes.conn.sql("""select parent, account_head, sum(tax_amount) as tax_amount
+ from `tabSales Taxes and Charges` where parent in (%s) group by parent, account_head""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_tax_map = {}
+ for d in tax_details:
+ account = renamed_columns.get(d.account_head) or d.account_head
+ invoice_tax_map.setdefault(d.parent, webnotes._dict()).setdefault(account, [])
+ invoice_tax_map[d.parent][account] = flt(d.tax_amount)
+
+ return invoice_tax_map
+
+def get_invoice_so_dn_map(invoice_list):
+ si_items = webnotes.conn.sql("""select parent, sales_order, delivery_note
+ from `tabSales Invoice Item` where parent in (%s)
+ and (ifnull(sales_order, '') != '' or ifnull(delivery_note, '') != '')""" %
+ ', '.join(['%s']*len(invoice_list)), tuple([inv.name for inv in invoice_list]), as_dict=1)
+
+ invoice_so_dn_map = {}
+ for d in si_items:
+ if d.sales_order:
+ invoice_so_dn_map.setdefault(d.parent, webnotes._dict()).setdefault(
+ "sales_order", []).append(d.sales_order)
+ if d.delivery_note:
+ invoice_so_dn_map.setdefault(d.parent, webnotes._dict()).setdefault(
+ "delivery_note", []).append(d.delivery_note)
+
+ return invoice_so_dn_map
+
+def get_customer_deatils(invoice_list):
+ customer_map = {}
+ customers = list(set([inv.customer for inv in invoice_list]))
+ for cust in webnotes.conn.sql("""select name, territory from `tabCustomer`
+ where name in (%s)""" % ", ".join(["%s"]*len(customers)), tuple(customers), as_dict=1):
+ customer_map[cust.name] = cust.territory
+
+ return customer_map
+
+def get_account_details(invoice_list):
+ account_map = {}
+ accounts = list(set([inv.debit_to for inv in invoice_list]))
+ for acc in webnotes.conn.sql("""select name, parent_account from tabAccount
+ where name in (%s)""" % ", ".join(["%s"]*len(accounts)), tuple(accounts), as_dict=1):
+ account_map[acc.name] = acc.parent_account
+
+ return account_map
\ No newline at end of file
diff --git a/accounts/report/sales_register/sales_register.txt b/accounts/report/sales_register/sales_register.txt
new file mode 100644
index 0000000..dbf41af
--- /dev/null
+++ b/accounts/report/sales_register/sales_register.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-04-23 18:15:29",
+ "docstatus": 0,
+ "modified": "2013-04-30 17:53:10",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Invoice",
+ "report_name": "Sales Register",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Register"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/accounts/report/supplier_account_head/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to accounts/report/supplier_account_head/__init__.py
diff --git a/accounts/report/supplier_account_head/supplier_account_head.py b/accounts/report/supplier_account_head/supplier_account_head.py
new file mode 100644
index 0000000..8b55067
--- /dev/null
+++ b/accounts/report/supplier_account_head/supplier_account_head.py
@@ -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 = []
+ suppliers = webnotes.conn.sql("select name from tabSupplier where docstatus < 2")
+ for supplier in suppliers:
+ row = [supplier[0]]
+ for company in sorted(account_map):
+ row.append(account_map[company].get(supplier[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 = 'Supplier'
+ 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 = ["Supplier:Link/Supplier:120"] + \
+ [(company + ":Link/Account:120") for company in sorted(account_map)]
+
+ return columns
\ No newline at end of file
diff --git a/accounts/report/supplier_account_head/supplier_account_head.txt b/accounts/report/supplier_account_head/supplier_account_head.txt
new file mode 100644
index 0000000..b0554e8
--- /dev/null
+++ b/accounts/report/supplier_account_head/supplier_account_head.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-04 12:56:17",
+ "docstatus": 0,
+ "modified": "2013-06-04 12:56:46",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Account",
+ "report_name": "Supplier Account Head",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Supplier Account Head"
+ }
+]
\ No newline at end of file
diff --git a/accounts/search_criteria/__init__.py b/accounts/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/accounts_payable/__init__.py b/accounts/search_criteria/accounts_payable/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/accounts_payable/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.js b/accounts/search_criteria/accounts_payable/accounts_payable.js
deleted file mode 100644
index 8d8f1ab..0000000
--- a/accounts/search_criteria/accounts_payable/accounts_payable.js
+++ /dev/null
@@ -1,37 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
-
- this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Purchase Invoice', report_default:'Aging Date'});
- this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:30});
- this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:45});
- this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:60});
- this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry', report_default:90});
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-
- this.dt.set_no_limit(1);
-}
-
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.py b/accounts/search_criteria/accounts_payable/accounts_payable.py
deleted file mode 100644
index 3a5b899..0000000
--- a/accounts/search_criteria/accounts_payable/accounts_payable.py
+++ /dev/null
@@ -1,183 +0,0 @@
-# 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/>.
-
-# Check mandatory filters
-# ------------------------------------------------------------------
-
-from __future__ import unicode_literals
-if not filter_values.get('posting_date1'):
- msgprint("Please select To Posting Date ")
- raise Exception
-else:
- to_date = filter_values.get('posting_date1')
-
-if not filter_values['range_1'] or not filter_values['range_2'] \
- or not filter_values['range_3'] or not filter_values['range_4']:
- msgprint("Please select aging ranges in no of days in 'More Filters' ")
- raise Exception
-
-# validate Range
-range_list = ['range_1','range_2','range_3','range_4']
-for r in range(len(range_list)-1):
- if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
- msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
- raise Exception
-
-
-# Add columns
-# ------------------------------------------------------------------
-data = [['Aging Date','Date','80px',''],
- ['Account','Data','120px',''],
- ['Against Voucher Type','Data','120px',''],
- ['Against Voucher','Data','120px',''],
- ['Voucher Type','Data','120px',''],
- ['Voucher No','Data','120px',''],
- ['Remarks','Data','160px',''],
- ['Supplier Type', 'Data', '80px', ''],
- ['Due Date', 'Data', '80px', ''],
- ['Bill No','Data','80px',''],
- ['Bill Date','Data','80px',''],
- ['Opening Amt','Currency','120px',''],
- ['Outstanding Amt','Currency','120px',''],
- ['Age (Days)', 'Currency', '150px', ''],
- ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
- [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
- [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
- [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
- [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
-
-
-for d in data:
- colnames.append(d[0])
- coltypes.append(d[1])
- colwidths.append(d[2])
- coloptions.append(d[3])
- col_idx[d[0]] = len(colnames)-1
-
-# ageing based on
-# ------------------------------------------------------------------
-aging_based_on = 'Aging Date'
-if filter_values.has_key('aging_based_on') and filter_values['aging_based_on']:
- aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
-
-if len(res) > 2000 and from_export == 0:
- msgprint("""This is a very large report and cannot be shown in the browser
- as it is likely to make your browser very slow.
- Please select Account or click on 'Export' to open in excel""", raise_exception=1)
-
-# get supplier type
-supp_type_dict = {}
-for each in sql("""select t2.name, t1.supplier_type from tabSupplier t1, tabAccount t2
- where t1.name = t2.account_name group by t2.name"""):
- supp_type_dict[each[0]] = each[1]
-
-# get due_date, bill_no, bill_date from PV
-pv_dict = {}
-for t in sql("""select name, due_date, bill_no, bill_date
- from `tabPurchase Invoice` group by name"""):
- pv_dict[t[0]] = [cstr(t[1]), t[2], cstr(t[3])]
-
-# pv after to-date
-pv_after_to_date = [d[0] for d in sql("""select distinct name from `tabPurchase Invoice`
- where posting_date > %s and docstatus = 1""", (to_date,))]
-
-
-from webnotes.utils import nowdate
-
-out = []
-total_booking_amt, total_outstanding_amt = 0,0
-
-for r in res:
- outstanding_amt, due_date, bill_no, bill_date, cond = 0, '','','', ''
- booking_amt = r.pop(7)
-
- # supplier type
- r.append(supp_type_dict.get(r[col_idx['Account']], ''))
-
- if r[col_idx['Voucher Type']] == 'Purchase Invoice':
- r += pv_dict.get(r[col_idx['Voucher No']], ['', '', ''])
- else:
- r += ['', '', '']
-
- # if entry against Purchase Invoice
- if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Purchase Invoice':
- cond = " and ifnull(against_voucher, '') = '%s'" % r[col_idx['Against Voucher']]
-
- # if entry against JV & and not adjusted within period
- elif r[col_idx['Against Voucher Type']] == 'Purchase Invoice' \
- and r[col_idx['Against Voucher']] in pv_after_to_date:
- booking_amt = 0
- cond = """ and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'""" \
- % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
-
- # if un-adjusted
- elif not r[col_idx['Against Voucher']]:
- booking_amt = 0
- cond = """ and ((voucher_no = '%s' and ifnull(against_voucher, '') = '')
- or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))""" \
- % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
-
- if cond:
- outstanding_amt = flt(sql("""select sum(ifnull(credit, 0))-sum(ifnull(debit, 0))
- from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'No'
- and posting_date <= %s %s"""
- % ('%s', '%s', cond), (r[col_idx['Account']], to_date,))[0][0] or 0)
-
- # add to total outstanding
- total_outstanding_amt += flt(outstanding_amt)
-
- # add to total booking amount
- if outstanding_amt and r[col_idx['Voucher Type']] == 'Purchase Invoice' \
- and r[col_idx['Against Voucher']]:
- total_booking_amt += flt(booking_amt)
-
- r += [booking_amt, outstanding_amt]
-
- # split into date ranges
- val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above= 0
- if r[col_idx[aging_based_on]]:
- if getdate(to_date) > getdate(nowdate()):
- to_date = nowdate()
- diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
- if diff < cint(filter_values['range_1']):
- val_l1 = outstanding_amt
- if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
- val_l2 = outstanding_amt
- if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
- val_l3 = outstanding_amt
- if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
- val_l4 = outstanding_amt
- if diff >= cint(filter_values['range_4']):
- val_l5_above = outstanding_amt
-
- r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
-
- # Only show that entry which has outstanding
- if abs(flt(outstanding_amt)) > 0.001:
- out.append(r)
-
-if len(out) > 300 and from_export == 0:
- msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
- raise Exception
-
-
-# Append Extra rows to RES
-# ------------------------------------------------------------------
-t_row = ['' for i in range(len(colnames))]
-t_row[col_idx['Voucher No']] = 'Total'
-t_row[col_idx['Opening Amt']] = total_booking_amt
-t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
-out.append(t_row)
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.sql b/accounts/search_criteria/accounts_payable/accounts_payable.sql
deleted file mode 100644
index 56ff4cf..0000000
--- a/accounts/search_criteria/accounts_payable/accounts_payable.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-SELECT DISTINCT
- `tabGL Entry`.`Aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`,
- `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`,
- `tabGL Entry`.`remarks`, `tabGL Entry`.`credit`
-FROM
- `tabGL Entry`,`tabAccount`
-WHERE
- `tabGL Entry`.`posting_date`<= '%(posting_date1)s'
- AND `tabGL Entry`.`account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND ((ifnull(`tabGL Entry`.`voucher_type`,'') = 'Purchase Invoice'
- AND `tabGL Entry`.`credit`>0) OR `tabGL Entry`.voucher_type = 'Journal Voucher')
- AND `tabGL Entry`.`is_cancelled` = 'No'
- AND `tabAccount`.master_type = 'Supplier'
- AND `tabAccount`.name = `tabGL Entry`.account
-ORDER BY `tabGL Entry`.`posting_date`
diff --git a/accounts/search_criteria/accounts_payable/accounts_payable.txt b/accounts/search_criteria/accounts_payable/accounts_payable.txt
deleted file mode 100644
index 7f9151c..0000000
--- a/accounts/search_criteria/accounts_payable/accounts_payable.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-05-14 18:05:41",
- "modified_by": "Administrator",
- "modified": "2012-10-17 10:51:41"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"GL Entry\\u0001Voucher Type\":[\"\"],\"GL Entry\\u0001Is Cancelled\":[\"\"],\"GL Entry\\u0001Is Opening\":[\"\"],\"GL Entry\\u0001Fiscal Year\":[\"\"],\"Purchase Invoice\\u0001Aging Based On\":[\"Aging Date\"],\"GL Entry\\u0001Range 1\":\"30\",\"GL Entry\\u0001Range 2\":\"45\",\"GL Entry\\u0001Range 3\":\"60\",\"GL Entry\\u0001Range 4\":\"90\"}",
- "doctype": "Search Criteria",
- "doc_type": "GL Entry",
- "name": "__common__",
- "sort_by": "`tabGL Entry`.`name`",
- "page_len": 50,
- "criteria_name": "Accounts Payable",
- "columns": "GL Entry\u0001Posting Date,GL Entry\u0001Account,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher No"
- },
- {
- "name": "accounts_payable",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_receivable/__init__.py b/accounts/search_criteria/accounts_receivable/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/accounts_receivable/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.js b/accounts/search_criteria/accounts_receivable/accounts_receivable.js
deleted file mode 100644
index e8ed3e3..0000000
--- a/accounts/search_criteria/accounts_receivable/accounts_receivable.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
-
- this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Aging Date'+NEWLINE+'Due Date',ignore : 1, parent:'Sales Invoice', report_default:'Aging Date'});
- this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default']=dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-
- this.dt.set_no_limit(1);
-}
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.py b/accounts/search_criteria/accounts_receivable/accounts_receivable.py
deleted file mode 100644
index 34aafe5..0000000
--- a/accounts/search_criteria/accounts_receivable/accounts_receivable.py
+++ /dev/null
@@ -1,168 +0,0 @@
-# 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/>.
-
-
-# Check mandatory filters
-#------------------------------
-from __future__ import unicode_literals
-if not filter_values.get('posting_date1'):
- msgprint("Please select To Posting Date", raise_exception=1)
-else:
- to_date = filter_values.get('posting_date1')
-
-if not filter_values['range_1'] or not filter_values['range_2'] or \
- not filter_values['range_3'] or not filter_values['range_4']:
- msgprint("Please select aging ranges in no of days in 'More Filters' section")
- raise Exception
-
-# validate Range
-range_list = ['range_1','range_2','range_3','range_4']
-for r in range(len(range_list)-1):
- if not cint(filter_values[range_list[r]]) < cint(filter_values[range_list[r + 1]]):
- msgprint("Range %s should be less than Range %s." % (cstr(r+1),cstr(r+2)))
- raise Exception
-
-
-# Add columns
-# -----------
-data = [['Aging Date','Date','80px',''],
- ['Account','Data','120px',''],
- ['Against Voucher Type','Data','120px',''],
- ['Against Voucher','Data','120px',''],
- ['Voucher Type','Data','120px',''],
- ['Voucher No','Data','120px',''],
- ['Remarks','Data','160px',''],
- ['Territory','Data','120px',''],
- ['Due Date', 'Date', '80px', ''],
- ['Opening Amt','Currency','120px',''],
- ['Outstanding Amt','Currency','120px',''],
- ['Age (Days)', 'Data', '60px', ''],
- ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
- [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
- [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
- [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
- [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
-
-
-for d in data:
- colnames.append(d[0])
- coltypes.append(d[1])
- colwidths.append(d[2])
- coloptions.append(d[3])
- col_idx[d[0]] = len(colnames)-1
-
-# ageing based on
-aging_based_on = filter_values.get('aging_based_on') and filter_values['aging_based_on'].split(NEWLINE)[-1] or 'Aging Date'
-
-if len(res) > 2000 and from_export == 0:
- msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
- raise Exception
-
-
-# get supplier type
-territory_dict = {}
-for each in sql("""select t2.name, t1.territory from `tabCustomer` t1, `tabAccount` t2
- where t1.name = t2.master_name group by t2.name"""):
- territory_dict[each[0]] = each[1]
-
-# get due_date from sales invoice
-si_dict = {}
-for t in sql("""select name, due_date from `tabSales Invoice` group by name"""):
- si_dict[t[0]] = t[1]
-
-# sales invoice after to-date
-si_after_to_date = [d[0] for d in sql("""select distinct name from `tabSales Invoice`
- where posting_date > %s and docstatus = 1""", (to_date,))]
-
-
-from webnotes.utils import nowdate
-out = []
-total_booking_amt, total_outstanding_amt = 0,0
-for r in res:
- outstanding_amt = 0
- cond = due_date = ''
- booking_amt = r.pop(7)
-
- # get customer territory
- r.append(territory_dict.get(r[col_idx['Account']], ''))
-
- # if entry against Sales Invoice
- if r[col_idx['Against Voucher']] and r[col_idx['Voucher Type']] == 'Sales Invoice':
- # get due date
- due_date = si_dict.get(r[col_idx['Voucher No']], '')
- cond = """ and ifnull(against_voucher, '') = '%s'""" % r[col_idx['Against Voucher']]
-
- # if entry against JV & and not adjusted within period
- elif r[col_idx['Against Voucher Type']] == 'Sales Invoice' \
- and r[col_idx['Against Voucher']] in si_after_to_date:
- booking_amt = 0
- cond = """ and voucher_no = '%s' and ifnull(against_voucher, '') = '%s'""" \
- % (r[col_idx['Voucher No']], r[col_idx['Against Voucher']])
- # if entry against JV and unadjusted
- elif not r[col_idx['Against Voucher']]:
- booking_amt = 0
- cond = """ and ((voucher_no = '%s' and ifnull(against_voucher, '') = '')
- or (ifnull(against_voucher, '') = '%s' and voucher_type = 'Journal Voucher'))""" \
- % (r[col_idx['Voucher No']], r[col_idx['Voucher No']])
-
- if cond:
- outstanding_amt = flt(sql("""select ifnull(sum(debit),0) - ifnull(sum(credit),0)
- from `tabGL Entry` where account = %s and ifnull(is_cancelled, 'No') = 'No'
- and posting_date <= %s %s"""
- % ('%s', '%s', cond), (r[col_idx['Account']], to_date,))[0][0] or 0)
-
- # add to total outstanding
- total_outstanding_amt += flt(outstanding_amt)
- # add to total booking amount
- if outstanding_amt and r[col_idx['Voucher Type']] == 'Sales Invoice' and r[col_idx['Against Voucher']]:
- total_booking_amt += flt(booking_amt)
-
- r += [due_date, booking_amt, outstanding_amt]
-
- #Ageing Outstanding
- val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = 0
- diff = 0
- if r[col_idx[aging_based_on]]:
- if getdate(to_date) > getdate(nowdate()):
- to_date = nowdate()
- diff = (getdate(to_date) - getdate(r[col_idx[aging_based_on]])).days
- if diff <= cint(filter_values['range_1']):
- val_l1 = outstanding_amt
- if diff > cint(filter_values['range_1']) and diff <= cint(filter_values['range_2']):
- val_l2 = outstanding_amt
- if diff > cint(filter_values['range_2']) and diff <= cint(filter_values['range_3']):
- val_l3 = outstanding_amt
- if diff > cint(filter_values['range_3']) and diff <= cint(filter_values['range_4']):
- val_l4 = outstanding_amt
- if diff > cint(filter_values['range_4']):
- val_l5_above = outstanding_amt
- r += [diff, val_l1, val_l2, val_l3, val_l4, val_l5_above]
-
- # Only show that entry which has outstanding
- if abs(flt(outstanding_amt)) > 0.001:
- out.append(r)
-
-if len(out) > 500 and from_export == 0:
- msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
- raise Exception
-
-# Append Extra rows to res
-if len(out) > 0:
- t_row = ['' for i in range(len(colnames))]
- t_row[col_idx['Voucher No']] = 'Total'
- t_row[col_idx['Opening Amt']] = total_booking_amt
- t_row[col_idx['Outstanding Amt']] = total_outstanding_amt
- out.append(t_row)
\ No newline at end of file
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.sql b/accounts/search_criteria/accounts_receivable/accounts_receivable.sql
deleted file mode 100644
index e9f3922..0000000
--- a/accounts/search_criteria/accounts_receivable/accounts_receivable.sql
+++ /dev/null
@@ -1,16 +0,0 @@
-SELECT
- `tabGL Entry`.`aging_date`,`tabGL Entry`.`account`, `tabGL Entry`.`against_voucher_type`,
- `tabGL Entry`.`against_voucher`,`tabGL Entry`.`voucher_type`,`tabGL Entry`.`voucher_no`,
- `tabGL Entry`.`remarks`, `tabGL Entry`.`debit`
-FROM
- `tabGL Entry`,`tabAccount`
-WHERE
- `tabGL Entry`.`posting_date`<= '%(posting_date1)s'
- AND `tabGL Entry`.`account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND ((`tabGL Entry`.`voucher_type` = 'Sales Invoice' and `tabGL Entry`.`debit`>0)
- OR `tabGL Entry`.`voucher_type` = 'Journal Voucher')
- AND `tabGL Entry`.`is_cancelled` = 'No'
- AND `tabAccount`.`master_type` = 'Customer'
- AND `tabAccount`.`name` = `tabGL Entry`.`account`
-ORDER BY `tabGL Entry`.`posting_date`
diff --git a/accounts/search_criteria/accounts_receivable/accounts_receivable.txt b/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
deleted file mode 100644
index cfa496e..0000000
--- a/accounts/search_criteria/accounts_receivable/accounts_receivable.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "ASC",
- "filters": "{'GL Entry\u0001Is Cancelled':'No','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':'','GL Entry\u0001Range 1':'30','GL Entry\u0001Range 2':'45','GL Entry\u0001Range 3':'60','GL Entry\u0001Range 4':'90'}",
- "doctype": "Search Criteria",
- "doc_type": "GL Entry",
- "name": "__common__",
- "sort_by": "`tabGL Entry`.`name`",
- "criteria_name": "Accounts Receivable",
- "columns": "GL Entry\u0001Posting Date,GL Entry\u0001Transaction Date,GL Entry\u0001Account,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher No"
- },
- {
- "name": "accounts_receivable",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_clearance_report/__init__.py b/accounts/search_criteria/bank_clearance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/bank_clearance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js
deleted file mode 100644
index b5f9ffd..0000000
--- a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.js
+++ /dev/null
@@ -1,50 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Voucher Type'].df.in_first_page = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Clearance Date'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'ID'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Saved'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Receivable'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Category'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Cost Center'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Against Payable'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Owner'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'TDS Applicable'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit >='].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Debit <='].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit >='].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Total Credit <='].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'User Remark'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Voucher Date'].df.filter_hide = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Voucher Date'].df.filter_hide = 1;
-}
-
-this.mytabs.items['More Filters'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt b/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
deleted file mode 100644
index 0038438..0000000
--- a/accounts/search_criteria/bank_clearance_report/bank_clearance_report.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "description": "Bank Clearance report",
- "parent_doc_type": "Journal Voucher",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Fiscal Year':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
- "dis_filters": "fiscal_year",
- "doc_type": "Journal Voucher Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "ID",
- "page_len": 50,
- "criteria_name": "Bank Clearance report",
- "columns": "Journal Voucher\u0001ID,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher\u0001Clearance Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Voucher Date,Journal Voucher\u0001Posting Date,Journal Voucher Detail\u0001Against Payable,Journal Voucher Detail\u0001Against Receivable"
- },
- {
- "name": "bank_clearance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_reconciliation_statement/__init__.py b/accounts/search_criteria/bank_reconciliation_statement/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/bank_reconciliation_statement/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js
deleted file mode 100644
index f6bec4b..0000000
--- a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.js
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
-
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Clearance Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-
- this.dt.set_no_limit(1);
-}
-
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py
deleted file mode 100644
index 1ab94a4..0000000
--- a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# 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/>.
-
-#get company
-from __future__ import unicode_literals
-
-import webnotes.defaults
-company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
-
-# To date
-if not filter_values.get('clearance_date1'):
- msgprint('Please enter To Clearance Date')
- raise Exception
-else:
- to_date = filter_values['clearance_date1']
-
-
-#Fiscal year and year start date
-#----------------------------------
-ysd, fiscal_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",to_date)[0]
-# Account
-if not filter_values.get('account'):
- msgprint('Please select Account in filter section')
- raise Exception
-else:
- acc_name = filter_values.get('account')
-
-
-if len(res) > 300 and from_export == 0:
- msgprint("This is a very large report and cannot be shown in the browser as it is likely to make your browser very slow.Please select Account or click on 'Export' to open in excel")
- raise Exception
-
-acc = sql("select debit_or_credit, is_pl_account, lft, rgt from tabAccount where name = '%s'" % acc_name)
-
-from accounts.utils import get_balance_on
-opening = get_balance_on(acc_name, to_date)
-
-total_debit, total_credit = 0,0
-out = []
-
-for r in res:
- total_debit = flt(total_debit) + flt(r[col_idx['Debit']])
- total_credit = flt(total_credit) + flt(r[col_idx['Credit']])
- out.append(r)
-
-if acc and acc[0][0] == 'Debit':
- bank_bal = flt(opening)-flt(total_debit)+flt(total_credit)
-else:
- bank_bal = flt(opening)+flt(total_debit)-flt(total_credit)
-
-out.append(['','','','<font color = "#000"><b>Balance as per Company Books: </b></font>', opening,'', ''])
-out.append(['','','','<font color = "#000"><b>Amounts not reflected in Bank: </b></font>', total_debit,total_credit,''])
-out.append(['','','','<font color = "#000"><b>Balance as per Bank: </b></font>', bank_bal,'',''])
diff --git a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt b/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
deleted file mode 100644
index 4d5d5fc..0000000
--- a/accounts/search_criteria/bank_reconciliation_statement/bank_reconciliation_statement.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "parent_doc_type": "Journal Voucher",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':''}",
- "dis_filters": "clearance_date\nfiscal_year",
- "doc_type": "Journal Voucher Detail",
- "name": "__common__",
- "add_cond": "(`tabJournal Voucher Detail`.credit >= 0 or `tabJournal Voucher Detail`.credit is null)\n(`tabJournal Voucher`.cheque_no is not null or `tabJournal Voucher`.cheque_no != '')\n(ifnull(`tabJournal Voucher`.clearance_date, '0000-00-00') >'%(clearance_date1)s' or `tabJournal Voucher`.clearance_date is null or `tabJournal Voucher`.clearance_date = '0000-00-00')\n(`tabJournal Voucher`.posting_date <= '%(clearance_date1)s')",
- "doctype": "Search Criteria",
- "sort_by": "`tabJournal Voucher`.`name`",
- "page_len": 50,
- "criteria_name": "Bank Reconciliation Statement",
- "columns": "Journal Voucher\u0001ID,Journal Voucher\u0001Posting Date,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher\u0001Clearance Date,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Debit,Journal Voucher Detail\u0001Credit,Journal Voucher Detail\u0001Against Account"
- },
- {
- "name": "bank_reconciliation_statement",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/budget_variance_report/__init__.py b/accounts/search_criteria/budget_variance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/budget_variance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.js b/accounts/search_criteria/budget_variance_report/budget_variance_report.js
deleted file mode 100644
index 5cc644c..0000000
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Budget Detail'});
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Budget Detail', in_first_page:1});
- this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
- this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Period'].df.in_first_page = 1;
-
- this.filter_fields_dict['Budget Detail'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
-
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{whiteSpace:'pre'});
-}
-
-this.mytabs.items['More Filters'].hide();
-this.mytabs.items['Select Columns'].hide();
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.py b/accounts/search_criteria/budget_variance_report/budget_variance_report.py
deleted file mode 100644
index 301c19a..0000000
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# 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/>.
-
-# validate Filters
-from __future__ import unicode_literals
-flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period'}
-for f in flt_dict:
- if not filter_values.get(f):
- msgprint("Please Select " + cstr(flt_dict[f]))
- raise Exception
-
-# Get Values from fliters
-fiscal_year = filter_values.get('fiscal_year')
-period = filter_values.get('period')
-under = "GL Entry"
-based_on = "Cost Center"
-
-#add distributed id field
-col = []
-col.append([based_on,'Date','150px',''])
-col.append(['Budget Allocated','Currency','150px',''])
-col.append(['Distribution Id','Date','150px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
-
- col_idx[c[0]] = len(colnames)-1
-
-def make_child_lst(based_on,name):
- rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
- ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
- chl ='('
- flag = 1
- for c in ch_name:
- if flag == 1:
- chl += "'%s'"%c[0]
- flag = 2
- else:
- chl +=",'%s'"%c[0]
-
- chl +=")"
- return chl
-
-
-
-for r in res:
-
- cond1 =" t1.fiscal_year ='%s' and t1.parent=t2.name and t1.parenttype = '%s' and t1.docstatus !=2"
-
- q = "select t1.name from `tabBudget Detail` t1, `tab%s` t2 where "+cond1+" and t2.name = '%s'"
- ch = sql(q%(based_on,fiscal_year,based_on,r[0].strip()))
- q1 = "select sum(t1.budget_allocated) from `tabBudget Detail` t1, `tab%s` t2, `tabAccount` t3 where "
- cond2 = " t3.is_pl_account = 'Yes' and t3.debit_or_credit = 'Debit' and t3.name = t1.account and t1.docstatus != 2 and "
- if ch:
- qur = q1+cond2+cond1+" and t2.name = '%s'"
- ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
-
-
- #----------------------------------------------------------------
- else:
- node_lst = make_child_lst(based_on,r[0].strip())
- qur = q1+cond1+' and '+cond2+" t2.name in %s"
-
- ret_amt = sql(qur%(based_on,fiscal_year,based_on,node_lst))
-
- #----------------------------------------------------------------
- ret_dis_id = sql("select distribution_id from `tab%s` where name = '%s'"%(based_on,r[0].strip()))
-
- target_amt = ret_amt and flt(ret_amt[0][0]) or 0
- dis_id = ret_dis_id and ret_dis_id[0][0] or ''
-
- r.append(target_amt)
- r.append(dis_id)
-
-
-
-# Set required field names
-based_on_fn = 'cost_center'
-
-date_fn = 'posting_date'
-
-mon_list = []
-
-data = {'start_date':0, 'end_date':1}
-
-def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
- count = 1
- if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
- for m in range(12):
- # get last date
- last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-
- # make mon_list for Monthly Period
- if period == 'Monthly' :
- mon_list.append([start_date, last_date])
- # add months as Column names
- month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
- append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
-
- # get start date
- start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
- # make mon_list for Quaterly Period
- if period == 'Quarterly' and count % 3 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column names
- append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Half Yearly Period
- if period == 'Half Yearly' and count % 6 == 0 :
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Annual Period
- if period == 'Annual' and count % 12 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
- count = count +1
-
-def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
- col = ['Target', 'Actual', 'Variance']
- for c in col:
- n = str(name) and ' (' + str(name) +')' or ''
- colnames.append(str(c) + n)
- coltypes.append('Currency')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[str(c) + n ] = len(colnames) - 1
-
-
-# get start date
-start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
-if not start_date:
- msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
- raise Exception
-start_date = start_date.strftime('%Y-%m-%d')
-
-# make month list and columns
-make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
-
-
-bc_obj = get_obj('Budget Control')
-for r in res:
- count = 0
-
- for idx in range(3, len(colnames), 3):
- cidx = 2
-
- # ================= Calculate Target ==========================================
- r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
-
- #================== Actual Amount =============================================
- actual = 0
-
- ch = make_child_lst(based_on,r[0].strip())
-
- actual = sql("select sum(ifnull(t1.debit,0))-sum(ifnull(t1.credit,0)) from `tabGL Entry` t1, `tabAccount` t2 where ifnull(t2.is_pl_account, 'No') = 'Yes' and ifnull(t1.is_cancelled, 'No') = 'No' and t1.cost_center in %s and t2.debit_or_credit = 'Debit' and t1.posting_date between '%s' and '%s' and t1.account = t2.name"%(ch, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- #----------------------------------------------------------
- actual = flt(actual[0][0])
- r.append(actual)
- # ================ Variance ===================================================
- r.append(r[idx] - r[idx + 1])
- count = count +1
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql b/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
deleted file mode 100644
index 575fbfb..0000000
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.sql
+++ /dev/null
@@ -1,10 +0,0 @@
-SELECT
- CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name
-FROM
- `tabCost Center` AS node,`tabCost Center` AS parent
-WHERE
- node.lft BETWEEN parent.lft AND parent.rgt
- AND node.docstatus !=2
- AND node.company_name like '%(company)s%%'
-GROUP BY node.name
-ORDER BY node.lft
diff --git a/accounts/search_criteria/budget_variance_report/budget_variance_report.txt b/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
deleted file mode 100644
index 2c079a0..0000000
--- a/accounts/search_criteria/budget_variance_report/budget_variance_report.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "parent_doc_type": "Cost Center",
- "module": "Accounts",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Budget Detail\u0001Fiscal Year':''}",
- "standard": "Yes",
- "doc_type": "Budget Detail",
- "name": "__common__",
- "sort_by": "`tabCost Center`.`lft`",
- "page_len": 50,
- "criteria_name": "Budget Variance Report"
- },
- {
- "name": "budget_variance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/business_associate_commission_report/__init__.py b/accounts/search_criteria/business_associate_commission_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/business_associate_commission_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
deleted file mode 100644
index 272327b..0000000
--- a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.in_first_page = 1;
-
-}
-
-
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py
deleted file mode 100644
index 6aa7529..0000000
--- a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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
-colwidths[col_idx['Business Associate']] = '200px'
-
-coltypes[col_idx['Average Commission Rate']] = 'Currency'
-colwidths[col_idx['Average Commission Rate']] = '200px'
-
-coltypes[col_idx['Net Total']] = 'Currency'
-colwidths[col_idx['Net Total']] = '150px'
-
-coltypes[col_idx['Total Commission']] = 'Currency'
-colwidths[col_idx['Total Commission']] = '150px'
\ No newline at end of file
diff --git a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt b/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
deleted file mode 100644
index ffc6422..0000000
--- a/accounts/search_criteria/business_associate_commission_report/business_associate_commission_report.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "saumil@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "add_col": "SUM(`tabSales Invoice`.`total_commission`) AS 'Total Commission'\nSUM(`tabSales Invoice`.`net_total`) AS 'Net Total'\n((SUM(`tabSales Invoice`.`total_commission`) / SUM(`tabSales Invoice`.`net_total`)) * 100) AS 'Average Commission Rate'",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Invoice\u0001Submitted':1}",
- "description": "Track total commission given to your Business Associate",
- "doc_type": "Sales Invoice",
- "name": "__common__",
- "add_cond": "`tabSales Invoice`.`net_total` > 0\n`tabSales Invoice`.`total_commission` > 0",
- "doctype": "Search Criteria",
- "group_by": "`tabSales Invoice`.sales_partner",
- "page_len": 50,
- "criteria_name": "Business Associate Commission Report",
- "columns": "Sales Invoice\u0001Business Associate"
- },
- {
- "name": "business_associate_commission_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/__init__.py b/accounts/search_criteria/collection_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/collection_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/collection_report/collection_report.js b/accounts/search_criteria/collection_report/collection_report.js
deleted file mode 100644
index dfa58a6..0000000
--- a/accounts/search_criteria/collection_report/collection_report.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Is Opening'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.filter_hide = 0;
-
- this.add_filter({fieldname:'range_1', label:'Range 1', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_2', label:'Range 2', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_3', label:'Range 3', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
- this.add_filter({fieldname:'range_4', label:'Range 4', fieldtype:'Data', ignore : 1, parent:'GL Entry'});
-
- this.add_filter({fieldname:'aging_based_on', label:'Aging Based On', fieldtype:'Select', options:NEWLINE+'Transaction Date'+NEWLINE+'Aging Date',ignore : 1, parent:'Sales Invoice', 'report_default': 'Aging Date'});
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['Journal Voucher Detail'+FILTER_SEP +'Account'].df.in_first_page = 1;
-
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Journal Voucher'+FILTER_SEP +'Company'].df['report_default']=sys_defaults.company;
-}
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/collection_report.py b/accounts/search_criteria/collection_report/collection_report.py
deleted file mode 100644
index bc40a69..0000000
--- a/accounts/search_criteria/collection_report/collection_report.py
+++ /dev/null
@@ -1,107 +0,0 @@
-# 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/>.
-
-#check mandatory
-from __future__ import unicode_literals
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
- msgprint("Please select From Posting Date and To Posting Date ")
- raise Exception
-else:
- from_date = filter_values.get('posting_date')
- to_date = filter_values.get('posting_date1')
-
-if not filter_values['range_1'] or not filter_values['range_2'] or not filter_values['range_3'] or not filter_values['range_4']:
- msgprint("Please select aging ranges in no of days in 'Set Filters' section")
- raise Exception
-
-# ageing based on
-aging_based_on = 'Aging Date'
-if filter_values.get('aging_based_on'):
- aging_based_on = filter_values['aging_based_on'].split(NEWLINE)[-1]
-
-
-# Add columns
-# -----------
-row_list = [['ID','Data','150px',''],
- ['Account','Data','150px',''],
- ['Credit','Data','150px',''],
- ['Debit','Data','150px',''],
- ['Against Receivable','Data','150px',''],
- ['Is Advance','Data','150px',''],
- ['Transaction Date','Date','150px',''],
- ['Aging Date','Date','150px',''],
- ['Company','Data','150px',''],
- ['Cheque No','Data','100px',''],
- ['Cheque Date','Date','150px',''],
- ['Territory','Data','150px',''],
- ['Remark','Data','250px',''],
- ['Advance','Data','250px',''],
- ['RV Transaction Date','Date','150px',''],
- ['RV Aging Date','Date','150px',''],
- ['Age (Days)','Data','50px',''],
- ['0-'+cstr(filter_values['range_1']),'Currency','100px',''],
- [cstr(cint(filter_values['range_1']) + 1)+ '-' +cstr(filter_values['range_2']),'Currency','100px',''],
- [cstr(cint(filter_values['range_2']) + 1)+ '-' +cstr(filter_values['range_3']),'Currency','100px',''],
- [cstr(cint(filter_values['range_3']) + 1)+ '-' +cstr(filter_values['range_4']),'Currency','100px',''],
- [cstr(filter_values['range_4']) + '-Above','Currency','100px','']]
-
-for r in row_list:
- colnames.append(r[0])
- coltypes.append(r[1])
- colwidths.append(r[2])
- coloptions.append(r[3])
- col_idx[r[0]] = len(colnames)-1
-
-for r in res:
- if r[col_idx['Against Receivable']]:
- dt=sql("select date(modified), Aging_date from `tabSales Invoice` where name='%s'"%r[col_idx['Against Receivable']])
- r.append('')
- r.append(dt and cstr(dt[0][0]) or '')
- r.append(dt and cstr(dt[0][1]) or '')
- else:
- r.append(r[col_idx['Credit']])
- r.append('')
- r.append('')
-
-
- # Aging Credit Amount
- val_l1 = val_l2 = val_l3 = val_l4 = val_l5_above = diff = 0
-
- if r[col_idx['Against Receivable']]:
- amt = flt(r[col_idx['Credit']]) or (-1)*flt(r[col_idx['Debit']])
-
- if aging_based_on == 'Transaction Date' and r[col_idx['RV Transaction Date']]:
- diff = (getdate(r[col_idx['Transaction Date']]) - getdate(r[col_idx['RV Transaction Date']])).days
- elif aging_based_on == 'Aging Date' and r[col_idx['RV Aging Date']]:
- diff = (getdate(r[col_idx['Aging Date']]) - getdate(r[col_idx['RV Aging Date']])).days
-
- if diff < cint(filter_values['range_1']):
- val_l1 = amt
- if diff >= cint(filter_values['range_1']) and diff < cint(filter_values['range_2']):
- val_l2 = amt
- if diff >= cint(filter_values['range_2']) and diff < cint(filter_values['range_3']):
- val_l3 = amt
- if diff >= cint(filter_values['range_3']) and diff < cint(filter_values['range_4']):
- val_l4 = amt
- if diff >= cint(filter_values['range_4']):
- val_l5_above = amt
-
- r.append(diff)
- r.append(val_l1)
- r.append(val_l2)
- r.append(val_l3)
- r.append(val_l4)
- r.append(val_l5_above)
diff --git a/accounts/search_criteria/collection_report/collection_report.sql b/accounts/search_criteria/collection_report/collection_report.sql
deleted file mode 100644
index 8743b88..0000000
--- a/accounts/search_criteria/collection_report/collection_report.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-SELECT `tabJournal Voucher`.`name`,`tabJournal Voucher Detail`.`account`,`tabJournal Voucher Detail`.`credit`,`tabJournal Voucher Detail`.`debit`,`tabJournal Voucher Detail`.`against_invoice`,`tabJournal Voucher Detail`.`is_advance`,`tabJournal Voucher`.`voucher_date`,`tabJournal Voucher`.`aging_date`,`tabJournal Voucher`.`company`,`tabJournal Voucher`.`cheque_no`,`tabJournal Voucher`.`cheque_date`,`tabCustomer`.`territory`, `tabJournal Voucher`.`remark`
- FROM `tabJournal Voucher Detail`,`tabJournal Voucher`,`tabAccount`,`tabCustomer`
- WHERE `tabJournal Voucher`.docstatus=1
- AND `tabJournal Voucher`.`posting_date`>='%(posting_date)s'
- AND `tabJournal Voucher`.`posting_date`<='%(posting_date1)s'
- AND `tabJournal Voucher`.`company` LIKE '%(company)s%%'
- AND `tabJournal Voucher`.`is_opening` LIKE '%(is_opening)s%%'
- AND `tabJournal Voucher Detail`.`account` LIKE '%(account)s%%'
- AND `tabAccount`.master_type = 'Customer'
- AND `tabAccount`.`account_name` = `tabCustomer`.`name`
- AND `tabJournal Voucher Detail`.`account` = `tabAccount`.`name`
- AND `tabJournal Voucher Detail`.`parent` = `tabJournal Voucher`.`name`
- ORDER BY `tabJournal Voucher`.`name`
\ No newline at end of file
diff --git a/accounts/search_criteria/collection_report/collection_report.txt b/accounts/search_criteria/collection_report/collection_report.txt
deleted file mode 100644
index 781e74c..0000000
--- a/accounts/search_criteria/collection_report/collection_report.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "parent_doc_type": "Journal Voucher",
- "module": "Accounts",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Journal Voucher\u0001Saved':1,'Journal Voucher\u0001Submitted':1,'Journal Voucher\u0001Voucher Type':'','Journal Voucher\u0001Is Opening':'','Journal Voucher\u0001Company':'','Journal Voucher\u0001TDS Applicable':'','Journal Voucher\u0001TDS Category':'','GL Entry\u0001Range 1':'30','GL Entry\u0001Range 2':'45','GL Entry\u0001Range 3':'60','GL Entry\u0001Range 4':'90'}",
- "standard": "Yes",
- "doc_type": "Journal Voucher Detail",
- "name": "__common__",
- "sort_by": "`tabJournal Voucher`.`name`",
- "criteria_name": "Collection Report",
- "columns": "Journal Voucher\u0001ID,Journal Voucher\u0001Posting Date,Journal Voucher\u0001Company,Journal Voucher\u0001Cheque No,Journal Voucher\u0001Cheque Date,Journal Voucher Detail\u0001Account,Journal Voucher Detail\u0001Credit,Journal Voucher Detail\u0001Against Receivable,Journal Voucher Detail\u0001Is Advance"
- },
- {
- "name": "collection_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/__init__.py b/accounts/search_criteria/cost_center_wise_expense/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/cost_center_wise_expense/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js
deleted file mode 100644
index d33a4e8..0000000
--- a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.filter_hide = 0;
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Cost Center'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-
-}
-this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py
deleted file mode 100644
index 1c73501..0000000
--- a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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/>.
-
-# Add columns
-# -----------
-from __future__ import unicode_literals
-row_list = [['Cost Center','Data','160px'],
- ['Account','Data','160px'],
- ['Debit','Currency','120px'],
- ['Credit','Currency','120px'],
- ['Expense','Currency','120px']]
-
-for r in row_list:
- colnames.append(r[0])
- coltypes.append(r[1])
- colwidths.append(r[2])
- col_idx[r[0]] = len(colnames)-1
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql
deleted file mode 100644
index b5fbb7c..0000000
--- a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.sql
+++ /dev/null
@@ -1,20 +0,0 @@
-SELECT
- `tabGL Entry`.`cost_center`,
- `tabAccount`.`parent_account`,
- sum(ifnull(`tabGL Entry`.`debit`, 0)),
- sum(ifnull(`tabGL Entry`.`credit`, 0)),
- sum(ifnull(`tabGL Entry`.`debit`,0))-sum(ifnull(`tabGL Entry`.`credit`, 0))
- FROM
- `tabGL Entry`,`tabAccount`
- WHERE
- `tabGL Entry`.`account`=`tabAccount`.`name`
- AND ifnull(`tabGL Entry`.`is_cancelled`,'No')='No'
- AND `tabAccount`.is_pl_account='Yes'
- AND `tabAccount`.debit_or_credit='Debit'
- AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
- AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND `tabAccount`.`parent_account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`cost_center` LIKE '%(cost_center)s%%'
- GROUP BY
- `tabGL Entry`.`cost_center` , `tabAccount`.`parent_account`
\ No newline at end of file
diff --git a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt b/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
deleted file mode 100644
index 98e3b08..0000000
--- a/accounts/search_criteria/cost_center_wise_expense/cost_center_wise_expense.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "swarnalata@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':''}",
- "doctype": "Search Criteria",
- "dis_filters": "fiscal_year",
- "doc_type": "GL Entry",
- "name": "__common__",
- "sort_by": "`tabGL Entry`.`name`",
- "page_len": 50,
- "criteria_name": "Cost Center wise Expense"
- },
- {
- "name": "cost_center_wise_expense",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/__init__.py b/accounts/search_criteria/creditors_ledger/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/creditors_ledger/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.js b/accounts/search_criteria/creditors_ledger/creditors_ledger.js
deleted file mode 100644
index b3f1a09..0000000
--- a/accounts/search_criteria/creditors_ledger/creditors_ledger.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- //to hide all filters
- this.hide_all_filters();
- field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
- for(var i=0;i<field_list.length;i++){
- this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
- }
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-}
-
-this.mytabs.tabs['Select Columns'].hide()
-
-report.aftertableprint = function(t) {
- $yt(t,'*',2,{whiteSpace:'pre'});
- $yt(t,'*',3,{whiteSpace:'pre'});
-}
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.py b/accounts/search_criteria/creditors_ledger/creditors_ledger.py
deleted file mode 100644
index cba3993..0000000
--- a/accounts/search_criteria/creditors_ledger/creditors_ledger.py
+++ /dev/null
@@ -1,134 +0,0 @@
-# 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/>.
-
-#get company
-from __future__ import unicode_literals
-
-import webnotes.defaults
-company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
-
-#get company letter head
-l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
-l_head = l_head and l_head[0][0] or ''
-
-# Posting date, fiscal year and year start date
-#-----------------------------------------------
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
- msgprint("Please enter From Date and To Date")
- raise Exception
-else:
- from_date = filter_values['posting_date']
- to_date = filter_values['posting_date1']
-
-ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
-
-
-# define columns
-#---------------
-col = []
-col.append(['Date','Date','80px',''])
-col.append(['Detail','Text','475px',''])
-col.append(['Debit','Currency','75px',''])
-col.append(['Credit','Currency','75px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)
-
-
-total_debit, total_credit, total_opening, total_diff = 0,0,0,0
-
-#total query
-q = query.split('WHERE')[1].split('LIMIT')
-if len(q) > 2:
- query_where_clause = 'LIMIT'.join(q[:-1])
-else:
- query_where_clause = q[0]
-
-tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
-
-for t in tot:
- total_debit += t and flt(t[0]) or 0
- total_credit += t and flt(t[1]) or 0
-
-total_diff = total_debit - total_credit
-
-# opening
-account = filter_values.get('account')
-if account:
- acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
- from accounts.utils import get_balance_on
- opening_bal = get_balance_on(account, add_days(from_date, -1))
-
- if acc_det[0][0] == 'Credit':
- opening_bal = -1*opening_bal
-
-
-out = []
-count = 0
-for r in res:
- count +=1
- det = r[1].split('~~~')
- if from_export == 1:
- a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
- else:
- a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
- r[1] = a
- out.append(r)
-
-if total_debit != 0 or total_credit != 0:
- # Total debit/credit
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total'
- t_row[col_idx['Debit']-1] = total_debit
- t_row[col_idx['Credit']-1] = total_credit
- out.append(t_row)
-
- # opening
- if account:
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Opening Balance on '+ from_date
- t_row[col_idx['Debit']-1] = opening_bal
- out.append(t_row)
-
- # diffrence (dr-cr)
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total(Dr-Cr)'
- t_row[col_idx['Debit']-1] = total_diff
- out.append(t_row)
-
- # closing
- if account:
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Closing Balance on ' + to_date
- t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
- out.append(t_row)
-
-# Print Format
-myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
-</tr>
-<tr> <td>
-<div><h3> %(acc)s </h3></div>
-<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
-
- """ % {'acc':account,
- 'fdt':from_date,
- 'tdt':to_date}
-
-page_template = myheader+"<div>%(table)s</div>"
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.sql b/accounts/search_criteria/creditors_ledger/creditors_ledger.sql
deleted file mode 100644
index 03784b9..0000000
--- a/accounts/search_criteria/creditors_ledger/creditors_ledger.sql
+++ /dev/null
@@ -1,15 +0,0 @@
-SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
- FROM `tabGL Entry`, `tabAccount`
- WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
- AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
- AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND `tabGL Entry`.`account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
- AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
- AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
- AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
- AND `tabGL Entry`.`account` = `tabAccount`.`name`
- AND `tabAccount`.`master_type` = 'Supplier'
- GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
- ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/creditors_ledger/creditors_ledger.txt b/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
deleted file mode 100644
index 7f44ab4c..0000000
--- a/accounts/search_criteria/creditors_ledger/creditors_ledger.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "nabin@erpnext.com",
- "docstatus": 0,
- "creation": "2012-05-14 18:05:41",
- "modified_by": "nabin@erpnext.com",
- "modified": "2012-12-06 11:36:10"
- },
- {
- "custom_query": null,
- "report_script": null,
- "page_len": 50,
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"GL Entry\\u0001Voucher Type\":[],\"GL Entry\\u0001Is Cancelled\":[\"No\"],\"GL Entry\\u0001Is Opening\":[\"\"],\"GL Entry\\u0001Fiscal Year\":[\"\"]}",
- "doc_type": "GL Entry",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabGL Entry`.`name`",
- "criteria_name": "Creditors Ledger"
- },
- {
- "name": "creditors_ledger",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/__init__.py b/accounts/search_criteria/debtors_ledger/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/debtors_ledger/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.js b/accounts/search_criteria/debtors_ledger/debtors_ledger.js
deleted file mode 100644
index b3f1a09..0000000
--- a/accounts/search_criteria/debtors_ledger/debtors_ledger.js
+++ /dev/null
@@ -1,40 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- //to hide all filters
- this.hide_all_filters();
- field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
- for(var i=0;i<field_list.length;i++){
- this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
- }
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-}
-
-this.mytabs.tabs['Select Columns'].hide()
-
-report.aftertableprint = function(t) {
- $yt(t,'*',2,{whiteSpace:'pre'});
- $yt(t,'*',3,{whiteSpace:'pre'});
-}
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.py b/accounts/search_criteria/debtors_ledger/debtors_ledger.py
deleted file mode 100644
index a2e3c36..0000000
--- a/accounts/search_criteria/debtors_ledger/debtors_ledger.py
+++ /dev/null
@@ -1,133 +0,0 @@
-# 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/>.
-
-#get company
-from __future__ import unicode_literals
-
-import webnotes.defaults
-company = filter_values.get('company') or webnotes.defaults.get_user_default('company')
-
-#get company letter head
-l_head = sql("select letter_head from `tabCompany` where name='%s'" % company)
-l_head = l_head and l_head[0][0] or ''
-
-# Posting date, fiscal year and year start date
-#-----------------------------------------------
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
- msgprint("Please enter From Date and To Date")
- raise Exception
-else:
- from_date = filter_values['posting_date']
- to_date = filter_values['posting_date1']
-
-ysd, from_date_year = sql("select year_start_date, name from `tabFiscal Year` where %s between year_start_date and date_add(year_start_date,interval 1 year)",from_date)[0]
-
-
-# define columns
-#---------------
-col = []
-col.append(['Date','Date','80px',''])
-col.append(['Detail','Text','475px',''])
-col.append(['Debit','Currency','75px',''])
-col.append(['Credit','Currency','75px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)
-
-
-total_debit, total_credit, total_opening, total_diff = 0,0,0,0
-
-#total query
-q = query.split('WHERE')[1].split('LIMIT')
-if len(q) > 2:
- query_where_clause = 'LIMIT'.join(q[:-1])
-else:
- query_where_clause = q[0]
-
-tot = sql('select sum(`tabGL Entry`.debit),sum(`tabGL Entry`.credit) from `tabGL Entry`, tabAccount where %s' % query_where_clause)
-
-for t in tot:
- total_debit += t and flt(t[0]) or 0
- total_credit += t and flt(t[1]) or 0
-
-total_diff = total_debit - total_credit
-
-# opening
-account = filter_values.get('account')
-if account:
- acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
- from accounts.utils import get_balance_on
- opening_bal = get_balance_on(account, add_days(from_date, -1))
- if acc_det[0][0] == 'Credit':
- opening_bal = -1*opening_bal
-
-
-out = []
-count = 0
-for r in res:
- count +=1
- det = r[1].split('~~~')
- if from_export == 1:
- a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
- else:
- a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
- r[1] = a
- out.append(r)
-
-if total_debit != 0 or total_credit != 0:
- # Total debit/credit
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total'
- t_row[col_idx['Debit']-1] = total_debit
- t_row[col_idx['Credit']-1] = total_credit
- out.append(t_row)
-
- # opening
- if account:
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Opening Balance on '+ from_date
- t_row[col_idx['Debit']-1] = opening_bal
- out.append(t_row)
-
- # diffrence (dr-cr)
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total(Dr-Cr)'
- t_row[col_idx['Debit']-1] = total_diff
- out.append(t_row)
-
- # closing
- if account:
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Closing Balance on ' + to_date
- t_row[col_idx['Debit']-1] = flt(opening_bal) + flt(total_diff )
- out.append(t_row)
-
-# Print Format
-myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
-</tr>
-<tr> <td>
-<div><h3> %(acc)s </h3></div>
-<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
-
- """ % {'acc':account,
- 'fdt':from_date,
- 'tdt':to_date}
-
-page_template = myheader+"<div>%(table)s</div>"
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.sql b/accounts/search_criteria/debtors_ledger/debtors_ledger.sql
deleted file mode 100644
index 59103fd..0000000
--- a/accounts/search_criteria/debtors_ledger/debtors_ledger.sql
+++ /dev/null
@@ -1,15 +0,0 @@
-SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
- FROM `tabGL Entry`, `tabAccount`
- WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
- AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
- AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND `tabGL Entry`.`account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
- AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
- AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
- AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
- AND `tabGL Entry`.`account` = `tabAccount`.`name`
- AND `tabAccount`.`master_type` = 'Customer'
- GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
- ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/debtors_ledger/debtors_ledger.txt b/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
deleted file mode 100644
index e04492f..0000000
--- a/accounts/search_criteria/debtors_ledger/debtors_ledger.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "nabin@erpnext.com",
- "docstatus": 0,
- "creation": "2012-05-14 18:05:42",
- "modified_by": "nabin@erpnext.com",
- "modified": "2012-12-06 11:37:16"
- },
- {
- "custom_query": null,
- "report_script": null,
- "page_len": 50,
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"GL Entry\\u0001Voucher Type\":[],\"GL Entry\\u0001Is Cancelled\":[\"No\"],\"GL Entry\\u0001Is Opening\":[],\"GL Entry\\u0001Fiscal Year\":[]}",
- "doc_type": "GL Entry",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabGL Entry`.`name`",
- "criteria_name": "Debtors Ledger"
- },
- {
- "name": "debtors_ledger",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/general_ledger/__init__.py b/accounts/search_criteria/general_ledger/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/general_ledger/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/general_ledger/general_ledger.js b/accounts/search_criteria/general_ledger/general_ledger.js
deleted file mode 100644
index 3d6505f..0000000
--- a/accounts/search_criteria/general_ledger/general_ledger.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.mytabs.tabs['Select Columns'].hide();
- //to hide all filters
- this.hide_all_filters();
- field_list=['Voucher Type', 'Voucher No', 'From Posting Date','To Posting Date','Account','Company', 'Remarks', 'Is Cancelled', 'Is Opening']
- for(var i=0;i<field_list.length;i++){
- this.filter_fields_dict['GL Entry'+FILTER_SEP +field_list[i]].df.filter_hide = 0;
- }
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Account'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['GL Entry'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-}
-
-
-report.aftertableprint = function(t) {
- $yt(t,'*',2,{whiteSpace:'pre'});
- $yt(t,'*',3,{whiteSpace:'pre'});
-}
diff --git a/accounts/search_criteria/general_ledger/general_ledger.py b/accounts/search_criteria/general_ledger/general_ledger.py
deleted file mode 100644
index 11ab7c3..0000000
--- a/accounts/search_criteria/general_ledger/general_ledger.py
+++ /dev/null
@@ -1,141 +0,0 @@
-# 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/>.
-
-#get company letter head
-#---------------------------------------------------------------------
-from __future__ import unicode_literals
-l_head = sql("select content from `tabLetter Head` where ifnull(is_default, 0) = 1 and ifnull(disabled, 0) = 0")
-l_head = l_head and l_head[0][0] or ''
-
-
-# Posting date, fiscal year and year start date
-#---------------------------------------------------------------------
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
- msgprint("Please enter From Date and To Date")
- raise Exception
-else:
- from_date = filter_values['posting_date']
- to_date = filter_values['posting_date1']
-
-# define columns
-#---------------------------------------------------------------------
-col = []
-col.append(['Date','Date','80px',''])
-col.append(['Detail','Text','475px',''])
-col.append(['Debit','Currency','75px',''])
-col.append(['Credit','Currency','75px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)
-
-
-#total query
-#---------------------------------------------------------------------
-total_debit, total_credit, total_opening, total_diff = 0,0,0,0
-q = query.split('WHERE')[1].split('LIMIT')
-if len(q) > 2:
- query_where_clause = 'LIMIT'.join(q[:-1])
-else:
- query_where_clause = q[0]
-
-tot = sql('select sum(debit),sum(credit) from `tabGL Entry` where %s' % query_where_clause)
-
-for t in tot:
- total_debit += t and flt(t[0]) or 0
- total_credit += t and flt(t[1]) or 0
-
-total_diff = total_debit - total_credit
-
-out = []
-
-
-# If account mentioned, show opening and closing
-#---------------------------------------------------------------------
-account = filter_values.get('account')
-
-if account and (total_debit != 0 or total_credit != 0):
- acc_det = sql("select debit_or_credit, is_pl_account, lft, rgt, group_or_ledger from tabAccount where name = '%s'" % account)
-
- from accounts.utils import get_balance_on
- opening_bal = get_balance_on(account, add_days(from_date, -1))
- closing_bal = get_balance_on(account, to_date)
-
- if acc_det[0][0] == 'Credit':
- closing_bal = -1*closing_bal
- opening_bal = -1*opening_bal
-
- # add opening row
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Opening as on '+formatdate(from_date)
- t_row[col_idx['Debit']-1] = opening_bal
- out.append(t_row)
-
-
-# table output
-#---------------------------------------------------------------------
-count = 0
-for r in res:
- count +=1
- det = r[1].split('~~~')
- if from_export == 1:
- a = "Account: " + det[0] + NEWLINE + det[1] + NEWLINE + "Against: " + det[2] + NEWLINE + "Voucher No: " + det[4]
- else:
- a = "Account: <b>" + det[0]+ "</b>" + NEWLINE + "<div class='comment'>" +det[1]+ "</div><div class = 'comment' style='padding-left:12px'>Against: <b>" + det[2] + "</b></div><div class = 'comment' style='padding-left:12px'>Voucher No: <span class='link_type' onclick='loaddoc(" + '"' + det[3] +'", ' + '"' + det[4] +'"' + ")'>" + det[4] + "</span></div>"
- r[1] = a
- out.append(r)
-
-
-# Total, Difference and closing balance
-#---------------------------------------------------------------------
-if total_debit != 0 or total_credit != 0:
- # Total debit/credit
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total'
- t_row[col_idx['Debit']-1] = total_debit
- t_row[col_idx['Credit']-1] = total_credit
- out.append(t_row)
-
- # diffrence (dr-cr)
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Total(Dr-Cr)'
- t_row[col_idx['Debit']-1] = total_diff
- out.append(t_row)
-
- # closing
- if account:
- t_row = ['' for i in range(len(colnames))]
- t_row[1] = 'Closing Balance on ' + formatdate(to_date)
- t_row[col_idx['Debit']-1] = flt(closing_bal)
- out.append(t_row)
-
-
-# Print Format
-#---------------------------------------------------------------------
-myheader = """<table width = '100%%'><tr><td>"""+l_head+"""</td>
-</tr>
-<tr> <td>
-<div><h3> %(acc)s </h3></div>
-<div>Ledger Between %(fdt)s and %(tdt)s </div></td></tr></table><br>
-
- """ % {'acc':account,
- 'fdt':from_date,
- 'tdt':to_date}
-
-page_template = myheader+"<div>%(table)s</div>"
diff --git a/accounts/search_criteria/general_ledger/general_ledger.sql b/accounts/search_criteria/general_ledger/general_ledger.sql
deleted file mode 100644
index 51123cd..0000000
--- a/accounts/search_criteria/general_ledger/general_ledger.sql
+++ /dev/null
@@ -1,13 +0,0 @@
-SELECT `tabGL Entry`.`posting_date`, CONCAT(`tabGL Entry`.`account`, "~~~", ifnull(`tabGL Entry`.`remarks`, ''), "~~~", ifnull(`tabGL Entry`.`against`,''), "~~~", ifnull(`tabGL Entry`.`voucher_type`, ''), "~~~", ifnull(`tabGL Entry`.`voucher_no`, '')), sum(`tabGL Entry`.`debit`), sum(`tabGL Entry`.`credit`)
- FROM `tabGL Entry`
- WHERE `tabGL Entry`.`is_cancelled` LIKE '%(is_cancelled)s%%'
- AND `tabGL Entry`.`posting_date`>='%(posting_date)s'
- AND `tabGL Entry`.`posting_date`<='%(posting_date1)s'
- AND `tabGL Entry`.`company` LIKE '%(company)s%%'
- AND `tabGL Entry`.`account` LIKE '%(account)s%%'
- AND `tabGL Entry`.`remarks` LIKE '%(remarks)s%%'
- AND `tabGL Entry`.`is_opening` LIKE '%(is_opening)s%%'
- AND `tabGL Entry`.`voucher_no` LIKE '%(voucher_no)s%%'
- AND `tabGL Entry`.`voucher_type` LIKE '%(voucher_type)s%%'
- GROUP BY `tabGL Entry`.`voucher_no`,`tabGL Entry`.`account`
- ORDER BY `tabGL Entry`.`posting_date` DESC
\ No newline at end of file
diff --git a/accounts/search_criteria/general_ledger/general_ledger.txt b/accounts/search_criteria/general_ledger/general_ledger.txt
deleted file mode 100644
index 939b8a3..0000000
--- a/accounts/search_criteria/general_ledger/general_ledger.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Accounts",
- "sort_order": "DESC",
- "filters": "{'GL Entry\u0001From Posting Date\u0001lower':'','GL Entry\u0001To Posting Date\u0001upper':'','GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'No','GL Entry\u0001Is Opening':'','GL Entry\u0001Fiscal Year':'','GL Entry\u0001Company':''}",
- "standard": "Yes",
- "doc_type": "GL Entry",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabGL Entry`.`name`",
- "page_len": 50,
- "criteria_name": "General Ledger"
- },
- {
- "name": "general_ledger",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/invoices_overdue/__init__.py b/accounts/search_criteria/invoices_overdue/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/invoices_overdue/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/invoices_overdue/invoices_overdue.txt b/accounts/search_criteria/invoices_overdue/invoices_overdue.txt
deleted file mode 100644
index 514afac..0000000
--- a/accounts/search_criteria/invoices_overdue/invoices_overdue.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Invoice\u0001Saved':1,'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001Is Opening':'','Sales Invoice\u0001Fiscal Year':''}",
- "doc_type": "Sales Invoice",
- "name": "__common__",
- "add_cond": "`tabSales Invoice`.due_date<now()\n`tabSales Invoice`.outstanding_amount!=0\n`tabSales Invoice`.docstatus=1",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Invoice`.`name`",
- "page_len": 50,
- "criteria_name": "Invoices-Overdue",
- "columns": "Sales Invoice\u0001ID,Sales Invoice\u0001Debit To,Sales Invoice\u0001Voucher Date,Sales Invoice\u0001Due Date,Sales Invoice\u0001Outstanding Amount"
- },
- {
- "name": "invoices-overdue",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/itemwise_purchase_register/__init__.py b/accounts/search_criteria/itemwise_purchase_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/itemwise_purchase_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
deleted file mode 100644
index 7f47fc3..0000000
--- a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- var me = this;
- var set_filter_property = function(dt, field, property, value) {
- if (me.filter_fields_dict[dt + FILTER_SEP + field])
- me.filter_fields_dict[dt + FILTER_SEP + field].df[property] = value;
- }
-
- this.hide_all_filters();
- filter_list = ['Credit To', 'Is Opening',
- 'From Posting Date', 'To Posting Date', "Company"]
-
- for(var i=0;i<filter_list.length;i++) {
- set_filter_property("Purchase Invoice", filter_list[i], "filter_hide", 0);
- }
- set_filter_property("Purchase Invoice Item", "Item", "filter_hide", 0);
-
- set_filter_property("Purchase Invoice", "From Posting Date", "in_first_page", 1);
- set_filter_property("Purchase Invoice", "To Posting Date", "in_first_page", 1);
- set_filter_property("Purchase Invoice Item", "Item", "in_first_page", 1);
-
- set_filter_property("Purchase Invoice", "From Posting Date",
- "report_default", sys_defaults.year_start_date);
- set_filter_property("Purchase Invoice", "To Posting Date",
- "report_default", dateutil.obj_to_str(new Date()));
- set_filter_property("Purchase Invoice", "Company",
- "report_default", sys_defaults.company);
-}
diff --git a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt b/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
deleted file mode 100644
index 93977f9..0000000
--- a/accounts/search_criteria/itemwise_purchase_register/itemwise_purchase_register.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "description": "Itemwise Purchase Register",
- "parent_doc_type": "Purchase Invoice",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Purchase Invoice\u0001Submitted':1,'Purchase Invoice\u0001Is Opening':'No','Purchase Invoice\u0001Company':'','Purchase Invoice\u0001Fiscal Year':''}",
- "dis_filters": "fiscal_year",
- "doc_type": "Purchase Invoice Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabPurchase Invoice`.`name`",
- "page_len": 50,
- "criteria_name": "Itemwise Purchase Register",
- "columns": "Purchase Invoice\u0001ID,Purchase Invoice\u0001Credit To,Purchase Invoice\u0001Company,Purchase Invoice Item\u0001Item,Purchase Invoice Item\u0001Item Name,Purchase Invoice Item\u0001Expense Head,Purchase Invoice Item\u0001Cost Center,Purchase Invoice Item\u0001Qty,Purchase Invoice Item\u0001Rate (Default Curr.),Purchase Invoice Item\u0001Amount (Default Curr.)"
- },
- {
- "name": "itemwise_purchase_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/itemwise_sales_register/__init__.py b/accounts/search_criteria/itemwise_sales_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/itemwise_sales_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js b/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js
deleted file mode 100755
index b52b472..0000000
--- a/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- var me = this;
- var set_filter_property = function(dt, field, property, value) {
- if (me.filter_fields_dict[dt + FILTER_SEP + field])
- me.filter_fields_dict[dt + FILTER_SEP + field].df[property] = value;
- }
-
- this.hide_all_filters();
- filter_list_main = ['Debit To', 'From Posting Date', 'To Posting Date', "Company"]
- for(var i=0;i<filter_list_main.length;i++) {
- set_filter_property("Sales Invoice", filter_list_main[i], "filter_hide", 0);
- }
- filter_list_item = ["Item", "Item Group", "Brand Name", "Cost Center"]
- for(var i=0;i<filter_list_item.length;i++) {
- set_filter_property("Sales Invoice Item", filter_list_item[i], "filter_hide", 0);
- }
- set_filter_property("Sales Invoice", "From Posting Date", "in_first_page", 1);
- set_filter_property("Sales Invoice", "To Posting Date", "in_first_page", 1);
- set_filter_property("Sales Invoice Item", "Item", "in_first_page", 1);
-
- set_filter_property("Sales Invoice", "From Posting Date",
- "report_default", sys_defaults.year_start_date);
- set_filter_property("Sales Invoice", "To Posting Date",
- "report_default", dateutil.obj_to_str(new Date()));
- set_filter_property("Sales Invoice", "Company",
- "report_default", sys_defaults.company);
-}
diff --git a/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt b/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
deleted file mode 100644
index 9819845..0000000
--- a/accounts/search_criteria/itemwise_sales_register/itemwise_sales_register.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "parent_doc_type": "Sales Invoice",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001From Posting Date\u0001lower':'','Sales Invoice\u0001To Posting Date\u0001upper':'','Sales Invoice\u0001Is Opening':'','Sales Invoice\u0001Company':'','Sales Invoice\u0001Fiscal Year':''}",
- "doc_type": "Sales Invoice Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Invoice Item`.`income_account`",
- "page_len": 50,
- "criteria_name": "Itemwise Sales Register",
- "columns": "Sales Invoice Item\u0001Item,Sales Invoice Item\u0001Item Name,Sales Invoice Item\u0001Item Group,Sales Invoice\u0001ID,Sales Invoice\u0001Voucher Date,Sales Invoice\u0001Posting Date,Sales Invoice\u0001Debit To,Sales Invoice Item\u0001Cost Center,Sales Invoice\u0001Territory,Sales Invoice Item\u0001Income Account,Sales Invoice Item\u0001Qty,Sales Invoice Item\u0001Basic Rate*,Sales Invoice Item\u0001Amount*"
- },
- {
- "name": "itemwise_sales_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_transaction_summary/__init__.py b/accounts/search_criteria/monthly_transaction_summary/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/monthly_transaction_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js b/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
deleted file mode 100644
index bc33d33..0000000
--- a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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/>.
-
-
-
-report.customize_filters = function() {
- this.mytabs.items['Select Columns'].hide()
- this.hide_all_filters();
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'DocType'});
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'DocType'});
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',ignore : 1, parent:'DocType'});
-}
-
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{NEWLINE:'<br>'});
-}
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py b/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
deleted file mode 100644
index 7660fe9..0000000
--- a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.py
+++ /dev/null
@@ -1,168 +0,0 @@
-# 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
-if filter_values.get('period'):
- period_values = filter_values.get('period').split(NEWLINE)
-
-if not filter_values.get('fiscal_year'):
- msgprint("Please Select Fiscal Year")
- raise Exception
-elif not filter_values.get('period'):
- msgprint("Please Select Period")
- raise Exception
-elif len(period_values) > 2:
- msgprint("You can view report only for one period. Please select only one value in period.")
- raise Exception
-else:
- fiscal_year = filter_values.get('fiscal_year')
- period = filter_values.get('period')
- company = filter_values.get('company')
-
-# get fiscal year start date and start month
-# ---------------------------------------------------------
-year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
-start_date = year_start_date and year_start_date[0][0] or ''
-start_month = year_start_date and year_start_date[0][1] or ''
-month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-
-# Add columns based on period
-# --------------------------------
-columns = []
-columns.append(['ID','Data','150px',''])
-columns.append(['Description','Data','150px',''])
-# ================ Annual ======================
-if period == 'Annual':
- columns.append([fiscal_year,'Currency','150px',''])
-
-# =========== Half Yearly ======================
-elif period == 'Half Yearly':
- columns.append([month_name[start_month-1]+' to '+month_name[start_month+4],'Currency','150px','']) # first half
- if start_month == 1: # this is case when fiscal year starts with JAN
- columns.append([month_name[start_month+5]+' to '+month_name[start_month+11],'Currency','150px',''])
- else: #this is case when fiscal year starts with other than JAN
- columns.append([month_name[start_month+5]+' to '+month_name[start_month-2],'Currency','150px',''])
- columns.append(['Total','Currency','150px',''])
-
-# ================ Quarterly ===================
-elif period == 'Quarterly':
- length_1 = (len(month_name) - start_month + 1) / 3 #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4
- q_no = 1
- for i in range(length_1):
- value = 3*i + val
- columns.append(['Q'+cstr(q_no)+' ('+month_name[value]+' to '+month_name[value+2]+')','Currency','150px',''])
- q_no += 1
- length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- columns.append(['Q'+cstr(q_no)+' ('+month_name[3*i]+' to '+month_name[3*i+2]+')','Currency','150px',''])
- q_no += 1;
- columns.append(['Total','Currency','150px',''])
-
-# =============== Monthly ======================
-elif period == 'Monthly':
- for i in range(start_month-1,len(month_name)):
- columns.append([month_name[i],'Currency','150px',''])
- for i in range(start_month-1):
- columns.append([month_name[i],'Currency','150px',''])
- columns.append(['Total','Currency','150px',''])
-
-for c in columns:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
-
-out = []
-if company:
- condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'" and company = "'+company+'"'
-else:
- condition = 'docstatus = 1 and fiscal_year = "'+fiscal_year+'"'
-
-for r in res:
- det = ''
- list_range = 0
- query = ''
- # ================= Annual Report ===============
- if period == 'Annual':
- # Main Query
- det = sql("SELECT count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s" %(r[col_idx['ID']],condition))
- list_range = 1
-
- # ============ Half Yearly Report ===============
- elif period == 'Half Yearly':
- # first half
- query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
- # second half
- query += 'COUNT(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
-
- # Main Query
- det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
- list_range = 3
-
- # =============== Quarterly Report ==============
- elif period == 'Quarterly':
- length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4;
- for i in range(length_1):
- value = 3*i + val;
- query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
- length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- query += 'COUNT(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN name ELSE NULL END),SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),MAX(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),AVG(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END),';
- # Main Query
- det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
- list_range = 5
-
- # ================ Monthly Report ===============
- elif period == 'Monthly':
- # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
- for i in range(start_month-1,len(month_name)):
- query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
- # the above query calculates total_no, total_amt, min_amt, max_amt, avg_amt of doctypes in monthwise
- for i in range(start_month-1):
- query += 'COUNT(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN name ELSE NULL END), SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),MIN(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), MAX(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END), AVG(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
-
- # Main Query
- det = sql("SELECT %s count(*), SUM(net_total), MIN(net_total), MAX(net_total), AVG(net_total) from `tab%s` where %s and transaction_date > CAST('%s' AS DATE)" %(query,r[col_idx['ID']],condition,start_date))
- list_range = 13
-
- # bifurcate all values and append them in list
- total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
-
- count = 0
- # append values to list
- for i in range(list_range):
- total_no.append(cstr(det and det[0][count] or 0))
- total_amt.append(cstr(det and det[0][count+1] or 0))
- min_amt.append(cstr(det and det[0][count+2] or 0))
- max_amt.append(cstr(det and det[0][count+3] or 0))
- avg_amt.append(cstr(det and det[0][count+4] or 0))
- count += 5
-
- for col in range(len(colnames)-1): # this would make all first row blank. just for look
- r.append('')
- out.append(r)
-
- d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
-
- for des in range(5):
- t_row = ['' for i in range(len(colnames))]
- t_row[col_idx['Description']] = d[des][0]
- for v in range(list_range):
- t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
- out.append(t_row)
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql b/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
deleted file mode 100644
index b05de58..0000000
--- a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
\ No newline at end of file
diff --git a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt b/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
deleted file mode 100644
index 1c6c60b..0000000
--- a/accounts/search_criteria/monthly_transaction_summary/monthly_transaction_summary.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'DocType\u0001Period':'Monthly'}",
- "doctype": "Search Criteria",
- "doc_type": "Profile",
- "name": "__common__",
- "sort_by": "`tabProfile`.`name`",
- "criteria_name": "Monthly Transaction Summary",
- "columns": "Profile\u0001ID"
- },
- {
- "name": "monthly_transaction_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_receipt_report/__init__.py b/accounts/search_criteria/payment_receipt_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/payment_receipt_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py
deleted file mode 100644
index 84cbbec..0000000
--- a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.py
+++ /dev/null
@@ -1,41 +0,0 @@
-# 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
-if not filter_values.get('posting_date'):
- msgprint("Enter From Posting Date.")
- raise Exception
-
-if not filter_values.get('posting_date1'):
- msgprint("Enter To Posting Date.")
- raise Exception
-
-if not filter_values.get('company'):
- msgprint("Select Company to proceed.")
- raise Exception
-
-
-
-col_list = [['Account', 'Link', '150px', 'Account']
- ,['Total', 'Currency', '150px', '']
- ]
-
-for c in col_list:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames) - 1
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql
deleted file mode 100644
index a4132b7..0000000
--- a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.sql
+++ /dev/null
@@ -1 +0,0 @@
-select t1.account, sum(if(t2.debit_or_credit = 'Debit', ifnull(t1.debit,0) - ifnull(t1.credit,0), ifnull(t1.credit,0) - ifnull(t1.debit,0))) from `tabGL Entry` t1, `tabAccount` t2 where t1.account = t2.name and t2.account_type != 'Bank or Cash' and t1.name in (select t1.name from `tabGL Entry` t1, `tabAccount` t2 where t1.against = t2.name and t2.account_type = 'Bank or Cash' and posting_date >= '%(posting_date)s' and posting_date <= '%(posting_date1)s') group by t1.account
\ No newline at end of file
diff --git a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt b/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
deleted file mode 100644
index 2e039e2..0000000
--- a/accounts/search_criteria/payment_receipt_report/payment_receipt_report.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "jai@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'GL Entry\u0001Voucher Type':'','GL Entry\u0001Is Cancelled':'','GL Entry\u0001Is Opening':'','GL Entry\u0001Fiscal Year':''}",
- "doctype": "Search Criteria",
- "doc_type": "GL Entry",
- "name": "__common__",
- "sort_by": "`tabGL Entry`.`name`",
- "page_len": 50,
- "criteria_name": "Payment Receipt Report",
- "columns": "GL Entry\u0001ID,GL Entry\u0001Owner,GL Entry\u0001Posting Date,GL Entry\u0001Account,GL Entry\u0001Cost Center,GL Entry\u0001Against Voucher,GL Entry\u0001Voucher Type,GL Entry\u0001Voucher No,GL Entry\u0001Remarks,GL Entry\u0001Is Cancelled,GL Entry\u0001Is Opening,GL Entry\u0001Fiscal Year,GL Entry\u0001Company"
- },
- {
- "name": "payment_receipt_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/purchase_register/__init__.py b/accounts/search_criteria/purchase_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/purchase_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/purchase_register/purchase_register.py b/accounts/search_criteria/purchase_register/purchase_register.py
deleted file mode 100644
index 82ab047..0000000
--- a/accounts/search_criteria/purchase_register/purchase_register.py
+++ /dev/null
@@ -1,97 +0,0 @@
-# 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/>.
-
-# add expense head columns
-from __future__ import unicode_literals
-from webnotes.utils import flt
-
-expense_acc = [c[0] for c in sql("""select distinct expense_head
- from `tabPurchase Invoice Item`
- where parenttype='Purchase Invoice'
- and docstatus=1
- order by expense_head asc""")]
-
-expense_acc.append('Net Total')
-
-for i in expense_acc:
- colnames.append(i)
- coltypes.append('Currency')
- colwidths.append('100px')
- coloptions.append('')
-
-# Add tax head columns
-tax_acc = [c[0] for c in sql("""select distinct account_head
- from `tabPurchase Taxes and Charges`
- where parenttype = 'Purchase Invoice'
- and add_deduct_tax = 'Add'
- and category in ('Total', 'Valuation and Total')
- and docstatus=1
- order by account_head asc""")]
-
-tax_acc.append('Total Tax')
-tax_acc.append('Grand Total')
-
-for c in tax_acc:
- if c:
- colnames.append(c)
- coltypes.append('Currency')
- colwidths.append('100px')
- coloptions.append('')
-
-# remove total columns from the list
-expense_acc = expense_acc[:-1]
-tax_acc = tax_acc[:-2]
-
-# add the values
-for r in res:
- #Get amounts for expense heads
- exp_head_amount = sql("""select expense_head, sum(amount)
- from `tabPurchase Invoice Item`
- where parent = %s and parenttype='Purchase Invoice'
- group by expense_head""", (r[col_idx['ID']]))
-
- #convert the result to dictionary for easy retrieval
- exp_head_amount_dict = {}
- for e in exp_head_amount:
- exp_head_amount_dict[e[0]] = e[1]
-
- net_total = 0
- # get expense amount
- for i in expense_acc:
- val = exp_head_amount_dict.get(i, 0)
- net_total += val
- r.append(val)
- r.append(net_total)
-
- #Get tax for account heads
- acc_head_tax = sql("""select account_head,
- sum(if(add_deduct_tax='Add', tax_amount, -tax_amount))
- from `tabPurchase Taxes and Charges` where parent = %s and parenttype = 'Purchase Invoice'
- and category in ('Total', 'Valuation and Total') group by account_head""", r[col_idx['ID']])
-
- #Convert the result to dictionary for easy retrieval
- acc_head_tax_dict = {}
- for a in acc_head_tax:
- acc_head_tax_dict[a[0]] = flt(a[1])
-
- # get tax amount
- total_tax = 0
- for c in tax_acc:
- val = acc_head_tax_dict.get(c, 0)
- total_tax += val
- r.append(val)
- r.append(total_tax)
- r.append(flt(total_tax)+ flt(net_total)) # grand total
\ No newline at end of file
diff --git a/accounts/search_criteria/purchase_register/purchase_register.txt b/accounts/search_criteria/purchase_register/purchase_register.txt
deleted file mode 100644
index f4fdb36..0000000
--- a/accounts/search_criteria/purchase_register/purchase_register.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "doc_type": "Purchase Invoice",
- "name": "__common__",
- "add_cond": "`tabPurchase Invoice`.is_opening != 'Yes'\n`tabPurchase Invoice`.name not like 'OP/%'",
- "module": "Accounts",
- "standard": "Yes",
- "filters": "{'Purchase Invoice\u0001Submitted':1}",
- "doctype": "Search Criteria",
- "criteria_name": "Purchase Register",
- "columns": "Purchase Invoice\u0001ID,Purchase Invoice\u0001Voucher Date,Purchase Invoice\u0001Posting Date,Purchase Invoice\u0001Credit To,Purchase Invoice\u0001Expense Head"
- },
- {
- "name": "purchase_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register/__init__.py b/accounts/search_criteria/sales_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/sales_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/sales_register/sales_register.js b/accounts/search_criteria/sales_register/sales_register.js
deleted file mode 100644
index 5a09713..0000000
--- a/accounts/search_criteria/sales_register/sales_register.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'ID'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Owner'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Saved'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Submitted'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Cancelled'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total >='].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Grand Total <='].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Sales Partner'].df.filter_hide = 1;
- this.filter_fields_dict['Sales Invoice'+FILTER_SEP +'Is Opening'].df.filter_hide = 1;
-}
diff --git a/accounts/search_criteria/sales_register/sales_register.py b/accounts/search_criteria/sales_register/sales_register.py
deleted file mode 100644
index f9cbc5d..0000000
--- a/accounts/search_criteria/sales_register/sales_register.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# 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/>.
-
-# add additional columns
-from __future__ import unicode_literals
-from webnotes.utils import flt
-
-cl = [c[0] for c in sql("""select distinct account_head
- from `tabSales Taxes and Charges`
- where parenttype='Sales Invoice'
- and docstatus=1
- order by account_head asc""")]
-
-income_acc = [c[0] for c in sql("""select distinct income_account
- from `tabSales Invoice Item`
- where parenttype='Sales Invoice'
- and docstatus=1
- order by income_account asc""")]
-
-income_acc.append('Net Total')
-
-for i in income_acc:
- colnames.append(i)
- coltypes.append('Currency')
- colwidths.append('100px')
- coloptions.append('')
-
-cl.append('Total Tax')
-cl.append('Grand Total')
-for c in cl:
- colnames.append(c)
- coltypes.append('Currency')
- colwidths.append('100px')
- coloptions.append('')
-
-income_acc = income_acc[:-1]
-cl = cl[:-2]
-
-
-# add the values
-for r in res:
-
- #Get amounts for income account
- income_acc_list = sql("""select income_account, sum(amount)
- from `tabSales Invoice Item`
- where parent = %s
- and parenttype='Sales Invoice'
- group by income_account""", (r[col_idx['ID']],))
-
- #convert the result to dictionary for easy retrieval
- income_acc_dict = {}
- for ia in income_acc_list:
- income_acc_dict[ia[0]] = flt(ia[1])
-
- net_total = 0
- for i in income_acc:
- val = income_acc_dict.get(i, 0)
- net_total += val
- r.append(val)
- r.append(net_total)
-
- #Get tax for account heads
- acc_head_tax = sql("""select account_head, sum(tax_amount)
- from `tabSales Taxes and Charges`
- where parent = '%s'
- and parenttype = 'Sales Invoice'
- group by account_head""" %(r[col_idx['ID']],))
-
- #Convert the result to dictionary for easy retrieval
- acc_head_tax_dict = {}
- for a in acc_head_tax:
- acc_head_tax_dict[a[0]] = flt(a[1])
-
- total_tax = 0
- for c in cl:
- val = acc_head_tax_dict.get(c, 0)
- total_tax += val
- r.append(val)
- r.append(total_tax)
- r.append(net_total+total_tax)
\ No newline at end of file
diff --git a/accounts/search_criteria/sales_register/sales_register.txt b/accounts/search_criteria/sales_register/sales_register.txt
deleted file mode 100644
index b7b63f0..0000000
--- a/accounts/search_criteria/sales_register/sales_register.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-11 17:36:48",
- "modified_by": "Administrator",
- "modified": "2012-04-18 17:41:46"
- },
- {
- "add_col": "`tabAccount`.`parent_account` AS 'Parent Account'\n`tabCustomer`.`territory` AS 'Territory'\n`tabCustomer`.`customer_details` AS 'Customer Details'",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "add_tab": "`tabAccount`\n`tabCustomer`",
- "dis_filters": "fiscal_year",
- "doc_type": "Sales Invoice",
- "name": "__common__",
- "filters": "{'Sales Invoice\u0001Submitted':1,'Sales Invoice\u0001Is Opening':''}",
- "add_cond": "ifnull(`tabSales Invoice`.`is_opening`, 'No') = 'No'\n`tabAccount`.name =`tabSales Invoice`.debit_to\n`tabCustomer`.`name` = `tabAccount`.`master_name`",
- "doctype": "Search Criteria",
- "sort_by": "`Parent Account`",
- "page_len": 50,
- "criteria_name": "Sales Register",
- "columns": "Sales Invoice\u0001ID,Sales Invoice\u0001Posting Date,Sales Invoice\u0001Debit To"
- },
- {
- "name": "sales_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/trend_analyzer/__init__.py b/accounts/search_criteria/trend_analyzer/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/trend_analyzer/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/trend_analyzer/trend_analyzer.js b/accounts/search_criteria/trend_analyzer/trend_analyzer.js
deleted file mode 100644
index 59d9483..0000000
--- a/accounts/search_criteria/trend_analyzer/trend_analyzer.js
+++ /dev/null
@@ -1,153 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.dt.set_no_limit(1);
-
- // hide transaction based on permissions
- var all_transactions = ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice",
- "Purchase Order", "Purchase Receipt", "Purchase Invoice"];
- var transaction_list = [];
- $.each(all_transactions, function(i, dt) {
- if(wn.boot.profile.can_read.indexOf(dt)!=-1) {
- transaction_list.push(dt);
- }
- });
-
- this.add_filter({fieldname:'transaction', label:'Transaction', fieldtype:'Select', options:transaction_list.join(NEWLINE),report_default:'Delivery Note',ignore : 1,parent:'Profile',in_first_page : 1,single_select : 1});
-
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Profile',in_first_page:1,single_select:1});
-
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Item'+NEWLINE+'Item Group'+NEWLINE+'Customer'+NEWLINE+'Customer Group'+NEWLINE+'Territory'+NEWLINE+'Supplier'+NEWLINE+'Supplier Type'+NEWLINE+'Project', ignore : 1, parent:'Profile', report_default:'Item', in_first_page : 1,single_select:1});
-
- this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item'+NEWLINE+'Customer'+NEWLINE+'Supplier', ignore : 1, parent:'Profile',single_select:1});
-
- this.add_filter({fieldname:'order_type', label:'Order Type', fieldtype:'Select', options:NEWLINE+'Sales'+NEWLINE+'Maintenance',ignore : 1, parent:'Profile',single_select:1});
-
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
-
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile', in_first_page:1});
-
-
- // Add Filters
- this.add_filter({fieldname:'item', label:'Item', fieldtype:'Link', options:'Item', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'customer', label:'Customer', fieldtype:'Link', options:'Customer', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'customer_group', label:'Customer Group', fieldtype:'Link', options:'Customer Group', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'supplier', label:'Supplier', fieldtype:'Link', options:'Supplier', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'supplier_type', label:'Supplier Type', fieldtype:'Link', options:'Supplier Type', ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'project', label:'Project', fieldtype:'Link', options:'Project', ignore : 1, parent:'Profile'});
-}
-
-
-this.mytabs.tabs['Select Columns'].hide();
-
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{whiteSpace:'pre'});
-}
-
-var validate_values = function(trans,based_on,order_type) {
- if(!fiscal_year){
- msgprint("Please select Fiscal Year");
- return 0;
- }
- if((in_list(['Quotation','Sales Order','Delivery Note','Sales Invoice'],trans) && in_list(['Supplier','Supplier Type'],based_on)) || (in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && in_list(['Customer','Customer Group','Territory'],based_on))){
- msgprint("Sorry! You cannot fetch "+trans+" trend based on "+based_on);
- return 0;
- }
- if(in_list(['Purchase Order','Purchase Receipt','Purchase Invoice'],trans) && order_type){
- msgprint("Please deselect Order Type for "+trans);
- return 0;
- }
- return 1;
-}
-
-
-report.get_query = function() {
- trans = this.get_filter('Profile', 'Transaction').get_value();
- order_type = this.get_filter('Profile', 'Order Type').get_value();
- based_on = this.get_filter('Profile', 'Based On').get_value();
- company = this.get_filter('Profile', 'Company').get_value();
- fiscal_year = this.get_filter('Profile', 'Fiscal Year').get_value();
-
- if(validate_values(trans,based_on,order_type)){
- col = '';
- add_cond = '';
- add_col = '';
- add_tables = '';
- sp_cond = '';
-
- trans_det = trans+' Item'
-
- if(order_type != '') add_code += ' AND t1.order_type = '+order_type;
-
- switch(based_on){
- case 'Item' : item = this.get_filter('Profile', 'Item').get_value();
- col = 'DISTINCT t2.item_code, t3.item_name';
- add_tables = ',tabItem t3';
- add_cond += ' AND t2.item_code = t3.name';
- if(item) add_cond += ' AND t2.item_code = "'+item+'"';
- break;
- case 'Customer' : cust = this.get_filter('Profile', 'Customer').get_value();
- col = 'DISTINCT t1.customer, t3.territory';
- add_tables = ',tabCustomer t3';
- add_cond += ' AND t1.customer = t3.name';
- if(cust) add_cond += ' AND t1.customer = "'+cust+'"';
- break;
- case 'Supplier' : supp = this.get_filter('Profile', 'Supplier').get_value();
- col = 'DISTINCT t1.supplier, t3.supplier_type';
- add_tables = ',tabSupplier t3';
- add_cond += ' AND t1.supplier = t3.name';
- if(supp) add_cond += ' AND t1.supplier = "'+supp+'"';
- break;
- case 'Supplier Type' : supp_type = this.get_filter('Profile', 'Supplier Type').get_value();
- col = 'DISTINCT t3.supplier_type';
- add_tables = ',tabSupplier t3';
- add_cond += ' AND t1.supplier = t3.name';
- if(supp_type) add_cond += ' AND t1.supplier_type = "'+supp_type+'"';
- break;
- case 'Project' : pro = this.get_filter('Profile', 'Project').get_value();
- if (inList(['Purchase Order', 'Purchase Receipt', 'Purchase Invoice'], trans)) {
- col = 'DISTINCT t2.project_name';
- if(pro) add_cond += ' AND t2.project_name = "'+pro+'"';
- } else {
- col = 'DISTINCT t1.project_name';
- if(pro) add_cond += ' AND t1.project_name = "'+pro+'"';
- }
- break;
- case 'Item Group' : ig = this.get_filter('Profile', 'Item Group').get_value();
- if(ig) sp_cond += ' AND parent.name = "'+ig+'"';
- break;
- case 'Customer Group' : cg = this.get_filter('Profile', 'Customer Group').get_value();
- if(cg) sp_cond += ' AND parent.name = "'+cg+'"';
- break;
- case 'Territory' : ter = this.get_filter('Profile', 'Territory').get_value();
- if(ter) sp_cond += ' AND parent.name = "'+ter+'"';
- break;
-
- }
-
-
- if(based_on == 'Item' || based_on == 'Customer' || based_on == 'Supplier' || based_on == 'Supplier Type' || based_on == 'Project')
- var q ='SELECT '+col+' FROM `tab'+trans+'` t1, `tab'+trans_det+'` t2 '+add_tables+' WHERE t1.fiscal_year = "'+fiscal_year+'" and t1.company = "'+company+'" and t2.parent = t1.name '+add_cond;
- else
- var q = 'SELECT CONCAT(REPEAT(" ", COUNT(parent.name) - 1), node.name) AS "Name" FROM `tab'+based_on+'` node,`tab'+based_on+'` parent WHERE node.lft BETWEEN parent.lft and parent.rgt and node.docstatus !=2 '+sp_cond+' GROUP BY node.name ORDER BY node.lft';
-
- return q;
- }
-}
diff --git a/accounts/search_criteria/trend_analyzer/trend_analyzer.py b/accounts/search_criteria/trend_analyzer/trend_analyzer.py
deleted file mode 100644
index 87e1e8e..0000000
--- a/accounts/search_criteria/trend_analyzer/trend_analyzer.py
+++ /dev/null
@@ -1,177 +0,0 @@
-# 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/>.
-
-# ********************************************* INITIALIZATION *******************************************
-from __future__ import unicode_literals
-out = []
-
-# Filter Values
-# =============================================
-based_on = filter_values.get('based_on')
-group_by = filter_values.get('group_by')
-trans = filter_values.get('transaction')
-period = filter_values.get('period')
-order_type = filter_values.get('order_type')
-company = filter_values.get('company')
-fiscal_year = filter_values.get('fiscal_year')
-item = filter_values.get('item')
-item_group = filter_values.get('item_group')
-customer = filter_values.get('customer')
-customer_group = filter_values.get('customer_group')
-territory = filter_values.get('territory')
-supplier = filter_values.get('supplier')
-supplier_type = filter_values.get('supplier_type')
-project = filter_values.get('project')
-
-
-# ********************************************* SET DEFAULTS **************************************************
-# Details Table
-# --------------
-
-trans_det = trans+' Item'
-
-col_names, query_val = get_obj('Trend Analyzer Control').get_single_year_query_value(fiscal_year, period, trans, trans_det)
-query_val += 'SUM(t2.qty), SUM(t2.amount)'
-
-col_names.append('Total (Qty)')
-col_names.append('Total (Amt)')
-
-
-# ********************************************* VALIDATIONS ***************************************************
-if (based_on in ['Customer','Customer Group','Territory'] and group_by == 'Supplier') or (based_on in ['Supplier','Supplier Type'] and group_by == 'Customer'):
- msgprint("Sorry! You cannot group Trend Analyzer based on %s by %s" % (based_on,group_by))
- raise Exception
-
-if based_on == group_by:
- msgprint("Based On and Group By value cannot be same for Trend Analyzer")
- raise Exception
-
-
-# ********************************************** ADD COLUMNS **********************************************
-cols = [[based_on, 'Data', '300px', '']]
-cr = 1
-if based_on == 'Item':
- cols.append(['Item Name','Data','200px',''])
- cr = 2
-elif based_on == 'Customer':
- cols.append(['Territory','Link','150px','Territory'])
- cr = 2
-elif based_on == 'Supplier':
- cols.append(['Supplier Type','Link','150px','Supplier Type'])
- cr = 2
-if group_by:
- cr += 1
-
-if group_by:
- cols.append([group_by,'Data','150px',''])
-
-for c in col_names:
- cols.append([c, ("Amt" in c) and 'Currency' or 'Float','150px',''])
-
-for c in cols:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
-
-
-# ******************************************* ADDITIONAL CONDITION ************************************************
-add_cond = ' t2.parent = t1.name AND t1.company = "%s" AND t1.fiscal_year = "%s" and t1.docstatus = 1' % (company, fiscal_year)
-add_tab = ' `tab'+trans+'` t1, `tab'+trans_det+'` t2'
-if order_type: add_cond += ' AND t1.order_type = "%s"' % order_type
-
-
-# Item
-if item or based_on == 'Item':
- add_cond += ' AND t2.item_code = "%s"' % (based_on != 'Item' and item or '%(value)s')
-
-# Item Group
-if item_group or based_on == 'Item Group':
- add_tab += ' ,`tabItem` t3, `tabItem Group` t4 '
- add_cond += ' AND t3.name = t2.item_code AND t3.item_group = t4.name and (t4.name = "%s" or t4.name IN (SELECT t5.name FROM `tabItem Group` t5,`tabItem Group` t6 WHERE t5.lft BETWEEN t6.lft and t6.rgt and t5.docstatus !=2 and t6.name = "%s"))' % (based_on != 'Item Group' and item_group or '%(value)s', based_on != 'Item Group' and item_group or '%(value)s')
-
-# Customer
-if customer or based_on == 'Customer':
- add_cond += ' AND t1.customer = "%s"' % (based_on != 'Customer' and customer or '%(value)s')
-
-# Customer Group
-if customer_group or based_on == 'Customer Group':
- add_tab += ' ,`tabCustomer` t7, `tabCustomer Group` t8 '
- add_cond += ' AND t7.name = t1.customer AND t7.customer_group = t8.name and (t8.name = "%s" or t8.name IN (SELECT t9.name FROM `tabCustomer Group` t9,`tabCustomer Group` t10 WHERE t9.lft BETWEEN t10.lft and t10.rgt and t9.docstatus !=2 and ifnull(t9.is_group,"No") = "No" and t10.name = "%s"))' % (based_on != 'Customer Group' and customer_group or '%(value)s', based_on != 'Customer Group' and customer_group or '%(value)s')
-
-# Territory
-if territory or based_on == 'Territory':
- add_tab += ' ,`tabTerritory` t11 '
- add_cond += ' AND t1.territory = t11.name and (t11.name = "%s" or t11.name IN (SELECT t12.name FROM `tabTerritory` t12,`tabTerritory` t13 WHERE t12.lft BETWEEN t13.lft and t13.rgt and t12.docstatus !=2 and ifnull(t12.is_group,"No") = "No" and t13.name = "%s"))' % (based_on != 'Territory' and territory or '%(value)s', based_on != 'Territory' and territory or '%(value)s')
-
-# Supplier
-if supplier or based_on == 'Supplier':
- add_cond += ' AND t1.supplier = "%s"' % (based_on != 'Supplier' and supplier or '%(value)s')
-
-# Supplier Type
-if supplier_type or based_on == 'Supplier Type':
- add_tab += ' ,`tabSupplier` t14, `tabSupplier Type` t15 '
- add_cond += ' AND t14.name = t1.supplier AND t14.supplier_type = t15.name and t15.name = "%s"' % (based_on != 'Supplier Type' and supplier_type or '%(value)s')
-
-# Project
-if project or based_on == 'Project':
- if trans in ['Purchase Order', 'Purchase Receipt', 'Purchase Invoice']:
- add_cond += ' AND t2.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
- else:
- add_cond += ' AND t1.project_name = "%s"' % (based_on != 'Project' and project or '%(value)s')
-
-# Column to be seleted for group by condition
-# ==============================================
-sel_col = ''
-if group_by == 'Item':
- sel_col = 't2.item_code'
-elif group_by == 'Customer':
- sel_col = 't1.customer'
-elif group_by == 'Supplier':
- sel_col = 't1.supplier'
-
-
-# ********************************************** Result Set ************************************************
-for r in res:
- main_det = sql("SELECT %s FROM %s WHERE %s" % (query_val, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
- if group_by:
- for col in range(cr,cr+1): # this would make all first row blank. just for look
- r.append('')
- if main_det[0][len(colnames) - cr - 1]:
- for d in range(len(colnames) - cr):
- r.append(flt(main_det[0][d]))
- out.append(r)
-
- if group_by:
- flag = 1
- # check for root nodes
- if based_on in ['Item Group','Customer Group','Territory']:
- is_grp = sql("select is_group from `tab%s` where name = '%s'" % (based_on, cstr(r[col_idx[based_on]]).strip()))
- is_grp = is_grp and cstr(is_grp[0][0]) or ''
- if is_grp != 'No':
- flag = 0
-
- if flag == 1:
- det = [x[0] for x in sql("SELECT DISTINCT %s FROM %s where %s" % (sel_col, add_tab, add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))]
-
- for des in range(len(det)):
- t_row = ['' for i in range(len(colnames))]
- t_row[col_idx[group_by]] = cstr(det[des])
- gr_det = sql("SELECT %s FROM %s WHERE %s = '%s' and %s" % (query_val, add_tab, sel_col, cstr(det[des]), add_cond % {'value':cstr(r[col_idx[based_on]]).strip()}))
- for d in range(len(col_names)):
- t_row[col_idx[col_names[d]]] = flt(gr_det[0][d])
- out.append(t_row)
diff --git a/accounts/search_criteria/trend_analyzer/trend_analyzer.txt b/accounts/search_criteria/trend_analyzer/trend_analyzer.txt
deleted file mode 100644
index ab15003..0000000
--- a/accounts/search_criteria/trend_analyzer/trend_analyzer.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "saumil@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-23 12:46:00",
- "modified_by": "Administrator",
- "modified": "2012-05-04 12:49:43"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{}",
- "doctype": "Search Criteria",
- "doc_type": "Profile",
- "name": "__common__",
- "sort_by": "`tabProfile`.`name`",
- "page_len": 50,
- "criteria_name": "Trend Analyzer",
- "columns": "Profile\u0001ID,Profile\u0001Owner"
- },
- {
- "name": "trend_analyzer",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/voucher_wise_tax_details/__init__.py b/accounts/search_criteria/voucher_wise_tax_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/voucher_wise_tax_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js b/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js
deleted file mode 100644
index 09a4498..0000000
--- a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- //Add filter
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Invoice', ignore : 1,parent:'Sales Taxes and Charges', single_select :1, in_first_page:1});
-
- this.add_filter({fieldname:'posting_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
-
- this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
-
- this.add_filter({fieldname:'tax_account', label:'Tax Account', fieldtype:'Link', options:'Account', ignore : 1,parent:'Sales Taxes and Charges', in_first_page:1});
-}
-
-
-// hide sections
-//--------------------------------------
-this.mytabs.items['More Filters'].hide();
-this.mytabs.items['Select Columns'].hide();
-
-// Get query
-//--------------------------------------
-report.get_query = function() {
- based_on = this.get_filter('Sales Taxes and Charges', 'Based On').get_value();
- from_date = this.get_filter('Sales Taxes and Charges', 'From Date').get_value();
- to_date = this.get_filter('Sales Taxes and Charges', 'To Date').get_value();
- vid = this.get_filter('Sales Taxes and Charges', 'Voucher Id').get_value();
- acc = this.get_filter('Sales Taxes and Charges', 'Tax Account').get_value();
-
- date_fld = 'transaction_date';
- if(based_on == 'Sales Invoice') {
- based_on = 'Sales Invoice';
- date_fld = 'posting_date';
- }
-
- sp_cond = '';
- if (from_date) sp_cond += repl(' AND t1.%(dt)s >= "%(from_date)s"', {dt:date_fld, from_date:from_date});
- if (to_date) sp_cond += repl(' AND t1.%(dt)s <= "%(to_date)s"', {dt:date_fld, to_date:to_date});
- if (vid) sp_cond += repl(' AND t1.name LIKE "%%(voucher)s%"', {voucher:vid});
- if (acc) sp_cond += repl(' AND t2.account_head = "%(acc)s"', {acc:acc});
-
- return repl('SELECT t1.`name`, t1.`%(dt)s`, t1.`customer_name`, t1.net_total, t2.account_head, t2.description, t2.rate, t2.tax_amount \
- FROM `tab%(parent)s` t1, `tabSales Taxes and Charges` t2 \
- WHERE t1.docstatus=1 AND t2.`parenttype` = "%(parent)s" \
- AND t2.`parent` = t1.`name` \
- %(cond)s ORDER BY t1.`name` DESC, t1.%(dt)s DESC', {parent:based_on, cond:sp_cond, dt:date_fld});
-}
-
diff --git a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py b/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py
deleted file mode 100644
index 0f99d0b..0000000
--- a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.py
+++ /dev/null
@@ -1,39 +0,0 @@
-# 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
-if filter_values.get('based_on') == 'Sales Invoice':
- based_on_dt = 'Sales Invoice'
-else:
- based_on_dt = filter_values.get('based_on')
-
-cols = [
- [filter_values.get('based_on'), 'Link','150px', based_on_dt],
- ['Transaction Date', 'Date', '120px', ''],
- ['Customer', 'Link','150px','Customer'],
- ['Net Total', 'Currency', '80px', ''],
- ['Tax Account', 'Link','150px','Account'],
- ['Description', 'Text','120px',''],
- ['Tax Rate', 'Currency', '80px', ''],
- ['Tax Amount', 'Currency', '80px', '']
-]
-
-for c in cols:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
diff --git a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt b/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt
deleted file mode 100644
index 7e8adf3..0000000
--- a/accounts/search_criteria/voucher_wise_tax_details/voucher_wise_tax_details.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Delivery Note",
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Delivery Note\u0001Submitted':1,'Delivery Note\u0001Status':'','Delivery Note\u0001Fiscal Year':''}",
- "doc_type": "Sales Taxes and Charges",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Taxes and Charges`.`parent`",
- "page_len": 50,
- "criteria_name": "Voucher wise tax details",
- "columns": "Sales Taxes and Charges\u0001Type,Sales Taxes and Charges\u0001Account Head,Sales Taxes and Charges\u0001Cost Center,Sales Taxes and Charges\u0001Description,Sales Taxes and Charges\u0001Rate,Sales Taxes and Charges\u0001Amount*,Sales Taxes and Charges\u0001Total*"
- },
- {
- "name": "voucher_wise_tax_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/search_criteria/yearly_transaction_summary/__init__.py b/accounts/search_criteria/yearly_transaction_summary/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/accounts/search_criteria/yearly_transaction_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js b/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
deleted file mode 100644
index febd6a3..0000000
--- a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.mytabs.items['Select Columns'].hide()
- this.hide_all_filters();
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company', report_default:sys_defaults.company, ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'from_fiscal_year', label:'From Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'to_fiscal_year', label:'To Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Profile'});
- this.add_filter({fieldname:'date', label:'Date', fieldtype:'Date', options:'',ignore : 1, parent:'Profile'});
-}
-
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{NEWLINE:'<br>'});
-}
\ No newline at end of file
diff --git a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py b/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
deleted file mode 100644
index 166d313..0000000
--- a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.py
+++ /dev/null
@@ -1,131 +0,0 @@
-# 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
-if not filter_values.get('from_fiscal_year'):
- msgprint("Please Select From Fiscal Year")
- raise Exception
-elif not filter_values.get('to_fiscal_year'):
- msgprint("Please Select To Fiscal Year")
- raise Exception
-else:
- from_fiscal_year = filter_values.get('from_fiscal_year')
- to_fiscal_year = filter_values.get('to_fiscal_year')
- company = filter_values.get('company')
- from_date = filter_values.get('date')
- to_date = filter_values.get('date1')
- if from_date != "" and to_date != "":
- get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date) # validate dates (i.e. dates should be between particular fiscal year)
-
-# Add columns based on from and to fiscal year---------
-columns = []
-columns.append(['ID','Data','150px',''])
-columns.append(['Description','Data','150px',''])
-columns.append([from_fiscal_year,'Data','150px','']) # append from fiscal year column
-
-# === get no. of fiscal years between from and to fiscal year and append columns accordingly ========
-start_year = from_fiscal_year.split('-')[1] # eg. from fiscal year 2008-2009 . this gives value 2009
-end_year = to_fiscal_year.split('-')[0] # eg. to fiscal year 2009-2010 . this gives value 2009
-diff = cint(end_year)-cint(start_year)
-if diff > 0:
- year = cint(start_year);
- next_year = 0
- f_year = ''
- for i in range(1,diff+1):
- next_year = cint(year)+1
- f_year = cstr(year)+'-'+cstr(next_year)
- columns.append([f_year,'Data','150px',''])
-# ====================================================================================================
-
-columns.append([to_fiscal_year,'Data','150px','']) # append to fiscal year column
-
-for c in columns:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
-
-out = []
-# =========================== condition for result ===================================================
-if company:
- condition = 'docstatus = 1 and company = "'+company+'"'
-else:
- condition = 'docstatus = 1'
-
-# ====================================================================================================
-
-for r in res:
- det = ''
- query = ''
- list_range = 0
- if from_date != "" and to_date != "":
- date_1 = cstr(get_obj('MIS Control').dates(from_fiscal_year,from_date,to_date))
- query += 'COUNT(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+from_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_1.split('~~~')[0]+'" AS DATE) AND CAST("'+date_1.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
- else:
- query += 'COUNT(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+from_fiscal_year+'" THEN net_total ELSE NULL END),'
- list_range += 1
-
- if diff > 0:
- year = cint(start_year);
- next_year = 0
- f_year = ''
- for i in range(1,diff+1):
- next_year = cint(year)+1;
- f_year = cstr(year)+'-'+cstr(next_year);
- if from_date != "" and to_date != "":
- date_2 = cstr(get_obj('MIS Control').dates(f_year,from_date,to_date))
- query += 'COUNT(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+f_year+'" and (transaction_date BETWEEN CAST("'+date_2.split('~~~')[0]+'" AS DATE) AND CAST("'+date_2.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),'
- else:
- query += 'COUNT(CASE WHEN fiscal_year = "'+f_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+f_year+'" THEN net_total ELSE NULL END),'
- year += 1
- list_range += 1
-
- if from_date != "" and to_date != "":
- date_3 = cstr(get_obj('MIS Control').dates(to_fiscal_year,from_date,to_date))
- query += 'COUNT(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN name ELSE NULL END),SUM(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MIN(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),MAX(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END),AVG(CASE WHEN (fiscal_year = "'+to_fiscal_year+'" and (transaction_date BETWEEN CAST("'+date_3.split('~~~')[0]+'" AS DATE) AND CAST("'+date_3.split('~~~')[1]+'" AS DATE))) THEN net_total ELSE NULL END)'
- else:
- query += 'COUNT(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN name ELSE NULL END),SUM(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MIN(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),MAX(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END),AVG(CASE WHEN fiscal_year = "'+to_fiscal_year+'" THEN net_total ELSE NULL END)'
- list_range += 1
-
- # Main Query
- det = sql("SELECT %s from `tab%s` where %s" %(query,r[col_idx['ID']],condition))
-
- # bifurcate all values and append them in list
- total_no,total_amt,min_amt,max_amt,avg_amt = [],[],[],[],[]
-
- count = 0
- # append values to list
- for i in range(list_range):
- total_no.append(cstr(det and det[0][count] or 0))
- total_amt.append(cstr(det and det[0][count+1] or 0))
- min_amt.append(cstr(det and det[0][count+2] or 0))
- max_amt.append(cstr(det and det[0][count+3] or 0))
- avg_amt.append(cstr(det and det[0][count+4] or 0))
- count += 5
-
- for col in range(len(colnames)-1): # this would make all first row blank. just for look
- r.append('')
- out.append(r)
-
- d = [['Total No',total_no],['Total Amount',total_amt],['Min Amount',min_amt],['Max Amount',max_amt],['Avg Amount',avg_amt]]
-
- for des in range(5):
- t_row = ['' for i in range(len(colnames))]
- t_row[col_idx['Description']] = d[des][0]
- for v in range(list_range):
- t_row[col_idx[colnames[v+2]]] = flt(d[des][1][v])
- out.append(t_row)
\ No newline at end of file
diff --git a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql b/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
deleted file mode 100644
index b05de58..0000000
--- a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT DISTINCT name FROM tabDocType WHERE document_type="Transaction" AND ifnull(istable,0) = 0
\ No newline at end of file
diff --git a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt b/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
deleted file mode 100644
index 9c6ad4b..0000000
--- a/accounts/search_criteria/yearly_transaction_summary/yearly_transaction_summary.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "module": "Accounts",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'DocType\u0001Fiscal Year':'2009-2010','DocType\u0001Company':'Alpha Company','DocType\u0001Period':'Monthly'}",
- "doctype": "Search Criteria",
- "doc_type": "Profile",
- "name": "__common__",
- "sort_by": "`tabProfile`.`name`",
- "criteria_name": "Yearly Transaction Summary",
- "columns": "Profile\u0001ID"
- },
- {
- "name": "yearly_transaction_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/accounts/utils.py b/accounts/utils.py
index 755546c..fa93cb0 100644
--- a/accounts/utils.py
+++ b/accounts/utils.py
@@ -26,17 +26,23 @@
class FiscalYearError(webnotes.ValidationError): pass
-def get_fiscal_year(date, verbose=1):
- return get_fiscal_years(date, verbose=1)[0]
+def get_fiscal_year(date=None, fiscal_year=None, verbose=1):
+ return get_fiscal_years(date, fiscal_year, verbose=1)[0]
-def get_fiscal_years(date, verbose=1):
+def get_fiscal_years(date=None, fiscal_year=None, verbose=1):
# if year start date is 2012-04-01, year end date should be 2013-03-31 (hence subdate)
+ cond = ""
+ if fiscal_year:
+ cond = "name = '%s'" % fiscal_year
+ else:
+ cond = "'%s' >= year_start_date and '%s' < adddate(year_start_date, interval 1 year)" % \
+ (date, date)
fy = webnotes.conn.sql("""select name, year_start_date,
subdate(adddate(year_start_date, interval 1 year), interval 1 day)
as year_end_date
from `tabFiscal Year`
- where %s >= year_start_date and %s < adddate(year_start_date, interval 1 year)
- order by year_start_date desc""", (date, date))
+ where %s
+ order by year_start_date desc""" % cond)
if not fy:
error_msg = """%s not in any Fiscal Year""" % formatdate(date)
@@ -125,7 +131,6 @@
ac.doc.doctype = "Account"
ac.doc.old_parent = ""
ac.doc.freeze_account = "No"
- ac.ignore_permissions = 1
ac.insert()
return ac.doc.name
@@ -138,7 +143,6 @@
cc = webnotes.bean(args)
cc.doc.doctype = "Cost Center"
cc.doc.old_parent = ""
- cc.ignore_permissions = 1
cc.insert()
return cc.doc.name
@@ -273,36 +277,45 @@
jv = webnotes.bean([
{
"doctype": "Journal Voucher",
- "naming_series": "_PATCH-",
+ "naming_series": "JV-AUTO-",
"company": company,
"posting_date": today,
"fiscal_year": fiscal_year,
"voucher_type": "Journal Entry",
- "user_remark": "Accounting Entry for Stock: \
- Initial booking of stock received but not billed account"
+ "user_remark": (_("Auto Inventory Accounting") + ": " +
+ (_("Disabled") if reverse else _("Enabled")) + ". " +
+ _("Journal Entry for inventory that is received but not yet invoiced"))
},
{
"doctype": "Journal Voucher Detail",
"parentfield": "entries",
"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",
"parentfield": "entries",
"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")
},
])
jv.insert()
- jv.submit()
jv_list.append(jv.doc.name)
if jv_list:
- webnotes.msgprint("""Folowing Journal Vouchers has been created automatically:
- %s""" % '\n'.join(jv_list))
+ msgprint(_("Following Journal Vouchers have been created automatically") + \
+ ":\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""")
@@ -322,3 +335,20 @@
and exists(select name from `tabPurchase Invoice`
where name = pi_item.parent and company = %s)""", company)
return flt(total_received_amount[0][0]) - flt(total_billed_amount[0][0])
+
+
+def fix_total_debit_credit():
+ vouchers = webnotes.conn.sql("""select voucher_type, voucher_no,
+ sum(debit) - sum(credit) as diff
+ from `tabGL Entry`
+ group by voucher_type, voucher_no
+ having sum(ifnull(debit, 0)) != sum(ifnull(credit, 0))""", as_dict=1)
+
+ for d in vouchers:
+ if abs(d.diff) > 0:
+ dr_or_cr = d.voucher_type == "Sales Invoice" and "credit" or "debit"
+
+ webnotes.conn.sql("""update `tabGL Entry` set %s = %s + %s
+ where voucher_type = %s and voucher_no = %s and %s > 0 limit 1""" %
+ (dr_or_cr, dr_or_cr, '%s', '%s', '%s', dr_or_cr),
+ (d.diff, d.voucher_type, d.voucher_no), debug=1)
\ No newline at end of file
diff --git a/buying/doctype/purchase_common/purchase_common.js b/buying/doctype/purchase_common/purchase_common.js
index dacee80..9e291f5 100644
--- a/buying/doctype/purchase_common/purchase_common.js
+++ b/buying/doctype/purchase_common/purchase_common.js
@@ -128,23 +128,27 @@
},
currency: function() {
- this.set_dynamic_labels();
+ if(this.frm.doc.currency === this.get_company_currency())
+ this.frm.set_value("conversion_rate", 1.0);
+
+ this.price_list_currency();
},
company: function() {
- this.set_dynamic_labels();
+ if(this.frm.fields_dict.currency)
+ this.set_dynamic_labels();
},
price_list_currency: function() {
this.frm.toggle_reqd("plc_conversion_rate",
!!(this.frm.doc.price_list_name && this.frm.doc.price_list_currency));
- this.set_dynamic_labels();
-
if(this.frm.doc.price_list_currency === this.get_company_currency())
this.frm.set_value("plc_conversion_rate", 1.0);
else if(this.frm.doc.price_list_currency === this.frm.doc.currency)
this.frm.set_value("plc_conversion_rate", this.frm.doc.conversion_rate || 1.0);
+
+ this.set_dynamic_labels();
},
set_dynamic_labels: function(doc, dt, dn) {
diff --git a/buying/doctype/purchase_common/purchase_common.py b/buying/doctype/purchase_common/purchase_common.py
index d5b563b..7cc5c22 100644
--- a/buying/doctype/purchase_common/purchase_common.py
+++ b/buying/doctype/purchase_common/purchase_common.py
@@ -185,21 +185,22 @@
if d.fields.has_key(x):
d.fields[x] = f_lst[x]
- item = sql("select is_stock_item, is_purchase_item, is_sub_contracted_item from tabItem where name=%s and (ifnull(end_of_life,'')='' or end_of_life = '0000-00-00' or end_of_life > now())", d.item_code)
+ item = sql("select is_stock_item, is_purchase_item, is_sub_contracted_item, end_of_life from tabItem where name=%s",
+ d.item_code)
if not item:
- msgprint("Item %s does not exist in Item Master." % cstr(d.item_code))
- raise Exception
+ msgprint("Item %s does not exist in Item Master." % cstr(d.item_code), raise_exception=True)
+
+ from stock.utils import validate_end_of_life
+ validate_end_of_life(d.item_code, item[0][3])
# validate stock item
if item[0][0]=='Yes' and d.qty and not d.warehouse:
- msgprint("Warehouse is mandatory for %s, since it is a stock item" %
- d.item_code, raise_exception=1)
+ msgprint("Warehouse is mandatory for %s, since it is a stock item" %
+ d.item_code, raise_exception=1)
# validate purchase item
if item[0][1] != 'Yes' and item[0][2] != 'Yes':
- msgprint("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code))
- raise Exception
-
+ msgprint("Item %s is not a purchase item or sub-contracted item. Please check" % (d.item_code), raise_exception=True)
if d.fields.has_key('prevdoc_docname') and d.prevdoc_docname:
# check warehouse, uom in previous doc and in current doc are same.
@@ -215,13 +216,13 @@
# Check if Warehouse has been modified.
if not cstr(data[0]['warehouse']) == cstr(d.warehouse):
- msgprint("Please check warehouse %s of Item %s which is not present in %s %s ." % (d.warehouse, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
- raise Exception
+ msgprint("Please check warehouse %s of Item %s which is not present in %s %s ." % \
+ (d.warehouse, d.item_code, d.prevdoc_doctype, d.prevdoc_docname), raise_exception=True)
# Check if UOM has been modified.
if not cstr(data[0]['uom']) == cstr(d.uom) and not cstr(d.prevdoc_doctype) == 'Material Request':
- msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname))
- raise Exception
+ msgprint("Please check UOM %s of Item %s which is not present in %s %s ." % \
+ (d.uom, d.item_code, d.prevdoc_doctype, d.prevdoc_docname), raise_exception=True)
# list criteria that should not repeat if item is stock item
e = [d.schedule_date, d.item_code, d.description, d.warehouse, d.uom, d.fields.has_key('prevdoc_docname') and d.prevdoc_docname or '', d.fields.has_key('prevdoc_detail_docname') and d.prevdoc_detail_docname or '', d.fields.has_key('batch_no') and d.batch_no or '']
@@ -432,6 +433,7 @@
d.account_head = other['account_head']
d.rate = flt(other['rate'])
d.tax_amount = flt(other['tax_amount'])
+ d.cost_center = other["cost_center"]
d.idx = idx
idx += 1
return obj.doclist
diff --git a/buying/doctype/purchase_order/purchase_order.txt b/buying/doctype/purchase_order/purchase_order.txt
index 101b0a9..8a56f26 100644
--- a/buying/doctype/purchase_order/purchase_order.txt
+++ b/buying/doctype/purchase_order/purchase_order.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-29 19:25:50",
+ "creation": "2013-03-25 16:01:24",
"docstatus": 0,
"modified": "2013-02-18 13:37:11",
"modified_by": "Administrator",
@@ -804,19 +804,11 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"report": 0,
"role": "Material User",
@@ -839,6 +831,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"report": 0,
"role": "Purchase Manager",
@@ -861,6 +854,7 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 0,
"report": 1,
"role": "Purchase User",
@@ -872,6 +866,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"role": "All",
"submit": 0
diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py
index bd27f07..be2e294 100644
--- a/buying/doctype/purchase_order/test_purchase_order.py
+++ b/buying/doctype/purchase_order/test_purchase_order.py
@@ -27,6 +27,12 @@
po.insert()
self.assertEquals(len(po.doclist.get({"parentfield": "po_raw_material_details"})), 2)
+ def test_warehouse_company_validation(self):
+ from controllers.buying_controller import WrongWarehouseCompany
+ po = webnotes.bean(copy=test_records[0])
+ po.doc.company = "_Test Company 1"
+ self.assertRaises(WrongWarehouseCompany, po.insert)
+
test_dependencies = ["BOM"]
diff --git a/buying/doctype/purchase_order_item/purchase_order_item.txt b/buying/doctype/purchase_order_item/purchase_order_item.txt
index cd00f87..01a144a 100755
--- a/buying/doctype/purchase_order_item/purchase_order_item.txt
+++ b/buying/doctype/purchase_order_item/purchase_order_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:27:42",
+ "creation": "2013-03-07 11:42:55",
"docstatus": 0,
- "modified": "2013-03-07 07:03:27",
+ "modified": "2013-05-22 11:59:52",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -36,6 +36,7 @@
"oldfieldname": "schedule_date",
"oldfieldtype": "Date",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -49,6 +50,7 @@
"oldfieldtype": "Link",
"options": "Item",
"print_hide": 0,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -72,6 +74,7 @@
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -83,6 +86,7 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"width": "300px"
},
@@ -95,6 +99,7 @@
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"print_width": "60px",
+ "read_only": 0,
"reqd": 1,
"width": "60px"
},
@@ -108,6 +113,7 @@
"options": "UOM",
"print_hide": 0,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -117,14 +123,16 @@
"fieldtype": "Currency",
"label": "Ref Rate ",
"options": "currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "discount_rate",
"fieldtype": "Float",
"label": "Discount %",
- "print_hide": 0
+ "print_hide": 0,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -135,7 +143,8 @@
"oldfieldname": "import_rate",
"oldfieldtype": "Currency",
"options": "currency",
- "print_hide": 0
+ "print_hide": 0,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -153,7 +162,8 @@
"fieldtype": "Currency",
"label": "Ref Rate*",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "0.00",
@@ -166,6 +176,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -192,6 +203,7 @@
"oldfieldtype": "Link",
"options": "Warehouse",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0
},
{
@@ -202,6 +214,7 @@
"label": "Project Name",
"options": "Project",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0
},
{
@@ -214,6 +227,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -237,7 +251,7 @@
"fieldtype": "Data",
"hidden": 1,
"label": "Prevdoc DocType",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -250,7 +264,7 @@
"hidden": 0,
"in_filter": 1,
"label": "Material Request No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Material Request",
@@ -267,6 +281,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Material Request Date",
+ "no_copy": 1,
"oldfieldname": "prevdoc_date",
"oldfieldtype": "Date",
"print_hide": 1,
@@ -280,7 +295,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Material Request Detail No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_detail_docname",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -294,6 +309,7 @@
"hidden": 1,
"in_filter": 0,
"label": "Supplier Quotation",
+ "no_copy": 1,
"options": "Supplier Quotation",
"read_only": 1,
"search_index": 0
@@ -304,6 +320,7 @@
"fieldtype": "Link",
"hidden": 1,
"label": "Supplier Quotation Item",
+ "no_copy": 1,
"options": "Supplier Quotation Item",
"read_only": 1
},
@@ -395,6 +412,7 @@
"no_copy": 1,
"oldfieldname": "page_break",
"oldfieldtype": "Check",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
}
]
\ No newline at end of file
diff --git a/buying/doctype/quality_inspection/quality_inspection.py b/buying/doctype/quality_inspection/quality_inspection.py
index 336aabe..48a9a7a 100644
--- a/buying/doctype/quality_inspection/quality_inspection.py
+++ b/buying/doctype/quality_inspection/quality_inspection.py
@@ -17,28 +17,16 @@
from __future__ import unicode_literals
import webnotes
-from webnotes.model import db_exists
-from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.bean import copy_doclist
-
-sql = webnotes.conn.sql
-
-
+from webnotes.model.doc import addchild
class DocType:
def __init__(self, doc, doclist=[]):
self.doc = doc
self.doclist = doclist
- # Autoname
- # ---------
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
-
def get_item_specification_details(self):
self.doclist = self.doc.clear_table(self.doclist, 'qa_specification_details')
- specification = sql("select specification, value from `tabItem Quality Inspection Parameter` \
+ specification = webnotes.conn.sql("select specification, value from `tabItem Quality Inspection Parameter` \
where parent = '%s' order by idx" % (self.doc.item_code))
for d in specification:
child = addchild(self.doc, 'qa_specification_details', 'Quality Inspection Reading', self.doclist)
@@ -48,13 +36,13 @@
def on_submit(self):
if self.doc.purchase_receipt_no:
- sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
+ webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '%s', t2.modified = '%s' \
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
% (self.doc.name, self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
def on_cancel(self):
if self.doc.purchase_receipt_no:
- sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
+ webnotes.conn.sql("update `tabPurchase Receipt Item` t1, `tabPurchase Receipt` t2 set t1.qa_no = '', t2.modified = '%s' \
where t1.parent = '%s' and t1.item_code = '%s' and t1.parent = t2.name" \
% (self.doc.modified, self.doc.purchase_receipt_no, self.doc.item_code))
diff --git a/buying/doctype/quality_inspection/quality_inspection.txt b/buying/doctype/quality_inspection/quality_inspection.txt
index e8650e0..60ede70 100644
--- a/buying/doctype/quality_inspection/quality_inspection.txt
+++ b/buying/doctype/quality_inspection/quality_inspection.txt
@@ -1,13 +1,13 @@
[
{
- "creation": "2013-01-10 16:34:11",
+ "creation": "2013-04-30 13:13:03",
"docstatus": 0,
- "modified": "2013-01-22 14:57:21",
+ "modified": "2013-05-09 14:34:10",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
- "autoname": "QAI/.######",
+ "autoname": "naming_series:",
"doctype": "DocType",
"is_submittable": 1,
"module": "Buying",
diff --git a/buying/doctype/supplier/supplier.js b/buying/doctype/supplier/supplier.js
index 3834bda..202be71 100644
--- a/buying/doctype/supplier/supplier.js
+++ b/buying/doctype/supplier/supplier.js
@@ -47,7 +47,7 @@
if(!cur_frm.address_list) {
cur_frm.address_list = new wn.ui.Listing({
parent: cur_frm.fields_dict['address_html'].wrapper,
- page_length: 2,
+ page_length: 5,
new_doctype: "Address",
custom_new_doc: function(doctype) {
var address = wn.model.make_new_doc_and_get_name('Address');
@@ -78,7 +78,7 @@
if(!cur_frm.contact_list) {
cur_frm.contact_list = new wn.ui.Listing({
parent: cur_frm.fields_dict['contact_html'].wrapper,
- page_length: 2,
+ page_length: 5,
new_doctype: "Contact",
custom_new_doc: function(doctype) {
var contact = wn.model.make_new_doc_and_get_name('Contact');
diff --git a/buying/doctype/supplier/supplier.py b/buying/doctype/supplier/supplier.py
index 0137504..f506439 100644
--- a/buying/doctype/supplier/supplier.py
+++ b/buying/doctype/supplier/supplier.py
@@ -24,7 +24,6 @@
sql = webnotes.conn.sql
-from accounts.utils import add_ac
from utilities.transaction_base import TransactionBase
class DocType(TransactionBase):
@@ -71,14 +70,16 @@
return g
def add_account(self, ac, par, abbr):
- ac = add_ac({
+ ac_bean = webnotes.bean({
+ "doctype": "Account",
'account_name':ac,
'parent_account':par,
'group_or_ledger':'Group',
'company':self.doc.company,
- 'account_type':'',
- 'tax_rate':'0'
+ "freeze_account": "No",
})
+ ac_bean.ignore_permissions = True
+ ac_bean.insert()
msgprint(_("Created Group ") + ac)
@@ -109,8 +110,8 @@
parent_account = self.get_parent_account(abbr)
if not sql("select name from tabAccount where name=%s", (self.doc.name + " - " + abbr)):
-
- ac = add_ac({
+ ac_bean = webnotes.bean({
+ "doctype": "Account",
'account_name': self.doc.name,
'parent_account': parent_account,
'group_or_ledger':'Ledger',
@@ -119,8 +120,12 @@
'tax_rate': '0',
'master_type': 'Supplier',
'master_name': self.doc.name,
+ "freeze_account": "No"
})
- msgprint(_("Created Account Head: ") + ac)
+ ac_bean.ignore_permissions = True
+ ac_bean.insert()
+
+ msgprint(_("Created Account Head: ") + ac_bean.doc.name)
else:
self.check_parent_account(parent_account, abbr)
else :
@@ -168,7 +173,7 @@
self.delete_supplier_communication()
self.delete_supplier_account()
- def on_rename(self, new, old):
+ def on_rename(self, new, old, merge=False):
#update supplier_name if not naming series
if webnotes.defaults.get_global_default('supp_master_name') == 'Supplier Name':
update_fields = [
@@ -186,7 +191,7 @@
for account in webnotes.conn.sql("""select name, account_name from
tabAccount where master_name=%s and master_type='Supplier'""", old, as_dict=1):
if account.account_name != new:
- webnotes.rename_doc("Account", account.name, new)
+ webnotes.rename_doc("Account", account.name, new, merge=merge)
#update master_name in doctype account
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.js b/buying/doctype/supplier_quotation/supplier_quotation.js
index 1e4f6cb..bac6e9f 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.js
+++ b/buying/doctype/supplier_quotation/supplier_quotation.js
@@ -87,7 +87,6 @@
get_server_fields('get_default_supplier_address',
JSON.stringify({ supplier: doc.supplier }), '', doc, dt, dn, 1,
function() { cur_frm.refresh(); });
- cur_frm.cscript.toggle_contact_section(doc);
}
}
diff --git a/buying/doctype/supplier_quotation/supplier_quotation.txt b/buying/doctype/supplier_quotation/supplier_quotation.txt
index d180651..dace56a 100644
--- a/buying/doctype/supplier_quotation/supplier_quotation.txt
+++ b/buying/doctype/supplier_quotation/supplier_quotation.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-29 19:25:54",
+ "creation": "2013-03-25 16:01:25",
"docstatus": 0,
"modified": "2013-02-18 13:40:17",
"modified_by": "Administrator",
@@ -664,15 +664,6 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
@@ -732,6 +723,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"report": 0,
"role": "All",
diff --git a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
index 53fa9f8..6b24d2f 100644
--- a/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
+++ b/buying/doctype/supplier_quotation_item/supplier_quotation_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:27:43",
+ "creation": "2013-03-07 11:42:56",
"docstatus": 0,
- "modified": "2013-03-07 07:03:32",
+ "modified": "2013-05-22 12:02:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"oldfieldtype": "Link",
"options": "Item",
"print_hide": 0,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -58,6 +59,7 @@
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -69,6 +71,7 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"width": "300px"
},
@@ -81,6 +84,7 @@
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"print_width": "60px",
+ "read_only": 0,
"reqd": 1,
"width": "60px"
},
@@ -94,6 +98,7 @@
"options": "UOM",
"print_hide": 0,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -103,14 +108,16 @@
"fieldtype": "Currency",
"label": "Ref Rate ",
"options": "currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "discount_rate",
"fieldtype": "Float",
"label": "Discount %",
- "print_hide": 0
+ "print_hide": 0,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -121,7 +128,8 @@
"oldfieldname": "import_rate",
"oldfieldtype": "Currency",
"options": "currency",
- "print_hide": 0
+ "print_hide": 0,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -139,7 +147,8 @@
"fieldtype": "Currency",
"label": "Ref Rate*",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "0.00",
@@ -152,6 +161,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -178,6 +188,7 @@
"oldfieldtype": "Link",
"options": "Warehouse",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0
},
{
@@ -188,6 +199,7 @@
"label": "Project Name",
"options": "Project",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0
},
{
@@ -196,7 +208,7 @@
"fieldtype": "Data",
"hidden": 1,
"label": "Prevdoc DocType",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -209,7 +221,7 @@
"hidden": 0,
"in_filter": 1,
"label": "Material Request No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Material Request",
@@ -226,6 +238,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Material Request Date",
+ "no_copy": 1,
"oldfieldname": "prevdoc_date",
"oldfieldtype": "Date",
"print_hide": 1,
@@ -239,7 +252,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Material Request Detail No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_detail_docname",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -295,6 +308,7 @@
"no_copy": 1,
"oldfieldname": "page_break",
"oldfieldtype": "Check",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
}
]
\ No newline at end of file
diff --git a/buying/page/buying_home/buying_home.js b/buying/page/buying_home/buying_home.js
index 2df5f6f..182b075 100644
--- a/buying/page/buying_home/buying_home.js
+++ b/buying/page/buying_home/buying_home.js
@@ -91,13 +91,36 @@
"label":wn._("Purchase Analytics"),
page: "purchase-analytics"
},
- {
- "label":wn._("Trend Analyzer"),
- route: "Report/Profile/Trend Analyzer",
- doctype: "Purchase Order"
- },
]
},
+ {
+ title: wn._("Reports"),
+ right: true,
+ icon: "icon-list",
+ items: [
+ {
+ "label":wn._("Item-wise Purchase History"),
+ route: "query-report/Item-wise Purchase History",
+ },
+ {
+ "label":wn._("Purchase In Transit"),
+ route: "query-report/Purchase In Transit",
+ },
+ {
+ "label":wn._("Requested Items To Be Ordered"),
+ route: "query-report/Requested Items To Be Ordered",
+ },
+ {
+ "label":wn._("Purchase Order Trends"),
+ route: "query-report/Purchase Order Trends",
+ doctype: "Purchase Order"
+ },
+ {
+ "label":wn._("Item-wise Last Purchase Rate"),
+ route: "query-report/Item-wise Last Purchase Rate",
+ }
+ ]
+ }
]
pscript['onload_buying-home'] = function(wrapper) {
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/buying/report/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to buying/report/__init__.py
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/buying/report/item_wise_purchase_history/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to buying/report/item_wise_purchase_history/__init__.py
diff --git a/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt b/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt
new file mode 100644
index 0000000..5d36d94
--- /dev/null
+++ b/buying/report/item_wise_purchase_history/item_wise_purchase_history.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-03 14:55:53",
+ "docstatus": 0,
+ "modified": "2013-05-07 11:20:09",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select\n po_item.item_code as \"Item Code:Link/Item:120\",\n\tpo_item.item_name as \"Item Name::120\",\n\tpo_item.description as \"Description::150\",\n\tpo_item.qty as \"Qty:Float:100\",\n\tpo_item.stock_uom as \"UOM:Link/UOM:80\",\n\tpo_item.purchase_rate as \"Rate:Currency:120\",\n\tpo_item.amount as \"Amount:Currency:120\",\n\tpo.name as \"Purchase Order:Link/Purchase Order:120\",\n\tpo.transaction_date as \"Transaction Date:Date:140\",\n\tpo.supplier as \"Supplier:Link/Supplier:130\",\n\tpo_item.project_name as \"Project:Link/Project:130\",\n\tifnull(po_item.received_qty, 0) as \"Received Qty:Float:120\",\n\tifnull(po_item.billed_qty, 0) as \"Billed Qty:Float:120\"\nfrom\n\t`tabPurchase Order` po, `tabPurchase Order Item` po_item\nwhere\n\tpo.name = po_item.parent and po.docstatus = 1\norder by po.name desc",
+ "ref_doctype": "Purchase Order",
+ "report_name": "Item-wise Purchase History",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Item-wise Purchase History"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/buying/report/purchase_order_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to buying/report/purchase_order_trends/__init__.py
diff --git a/buying/report/purchase_order_trends/purchase_order_trends.js b/buying/report/purchase_order_trends/purchase_order_trends.js
new file mode 100644
index 0000000..c6373db
--- /dev/null
+++ b/buying/report/purchase_order_trends/purchase_order_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/purchase_trends_filters.js");
+
+wn.query_reports["Purchase Order Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/hr/search_criteria/employee_information/employee_information.py b/buying/report/purchase_order_trends/purchase_order_trends.py
similarity index 74%
rename from hr/search_criteria/employee_information/employee_information.py
rename to buying/report/purchase_order_trends/purchase_order_trends.py
index 6e08872..9dc986e 100644
--- a/hr/search_criteria/employee_information/employee_information.py
+++ b/buying/report/purchase_order_trends/purchase_order_trends.py
@@ -15,9 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-for c in range(0,len(colnames)):
- l = (len(colnames[c])*9)
- if l < 150 : col_width = '150px'
- else: col_width = '%spx'%(l)
+import webnotes
+from controllers.trends import get_columns,get_data
- colwidths[c] = col_width
\ No newline at end of file
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Purchase Order")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/buying/report/purchase_order_trends/purchase_order_trends.txt b/buying/report/purchase_order_trends/purchase_order_trends.txt
new file mode 100644
index 0000000..658dd4a
--- /dev/null
+++ b/buying/report/purchase_order_trends/purchase_order_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:45:01",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:45:01",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Order",
+ "report_name": "Purchase Order Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase Order Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/buying/report/requested_items_to_be_ordered/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to buying/report/requested_items_to_be_ordered/__init__.py
diff --git a/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt
new file mode 100644
index 0000000..49c7478
--- /dev/null
+++ b/buying/report/requested_items_to_be_ordered/requested_items_to_be_ordered.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-13 16:10:02",
+ "docstatus": 0,
+ "modified": "2013-05-13 16:21:07",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Ordered Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Order:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Purchase\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc",
+ "ref_doctype": "Purchase Order",
+ "report_name": "Requested Items To Be Ordered",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Requested Items To Be Ordered"
+ }
+]
\ No newline at end of file
diff --git a/buying/search_criteria/__init__.py b/buying/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/buying/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/buying/search_criteria/itemwise_purchase_details/__init__.py b/buying/search_criteria/itemwise_purchase_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/buying/search_criteria/itemwise_purchase_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js b/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js
deleted file mode 100644
index 139d69e..0000000
--- a/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'From Purchase Order Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'To Purchase Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-
-}
\ No newline at end of file
diff --git a/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt b/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
deleted file mode 100644
index ac92b71..0000000
--- a/buying/search_criteria/itemwise_purchase_details/itemwise_purchase_details.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-11 13:16:55",
- "modified_by": "Administrator",
- "modified": "2012-04-13 11:15:06"
- },
- {
- "parent_doc_type": "Purchase Order",
- "module": "Buying",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"Purchase Order\\u0001Submitted\":1,\"Purchase Order\\u0001Status\":[],\"Purchase Order\\u0001Fiscal Year\":[]}",
- "doc_type": "Purchase Order Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabPurchase Order`.`transaction_date`",
- "page_len": 50,
- "criteria_name": "Itemwise Purchase Details",
- "columns": "Purchase Order\u0001ID,Purchase Order\u0001Purchase Order Date,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001Stock UOM,Purchase Order Item\u0001Rate ,Purchase Order Item\u0001Amount,Purchase Order\u0001Net Total*,Purchase Order\u0001Grand Total"
- },
- {
- "name": "itemwise_purchase_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/buying/search_criteria/pending_po_items_to_bill/__init__.py b/buying/search_criteria/pending_po_items_to_bill/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/buying/search_criteria/pending_po_items_to_bill/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js b/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js
deleted file mode 100644
index de2c037..0000000
--- a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt b/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
deleted file mode 100644
index 9cb44a5..0000000
--- a/buying/search_criteria/pending_po_items_to_bill/pending_po_items_to_bill.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "dhanalekshmi@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "add_col": "(CASE WHEN (`tabPurchase Order Item`.qty- ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0 ) THEN (`tabPurchase Order Item`.qty-ifnull(`tabPurchase Order Item`.billed_qty, 0) ) ELSE 0 END) AS \"Pending To Bill\"",
- "parent_doc_type": "Purchase Order",
- "module": "Buying",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Purchase Order\u0001Saved':1,'Purchase Order\u0001Submitted':1,'Purchase Order\u0001Status':'','Purchase Order\u0001Fiscal Year':''}",
- "description": "Pending PO Items To Bill",
- "doc_type": "Purchase Order Item",
- "name": "__common__",
- "add_cond": "(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) > 0 or `tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.billed_qty, 0) > 0)\n`tabPurchase Order`.status != \"Stopped\"",
- "doctype": "Search Criteria",
- "sort_by": "`tabPurchase Order`.`name`",
- "page_len": 50,
- "criteria_name": "Pending PO Items To Bill",
- "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Material Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty"
- },
- {
- "name": "pending_po_items_to_bill",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/buying/search_criteria/pending_po_items_to_receive/__init__.py b/buying/search_criteria/pending_po_items_to_receive/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/buying/search_criteria/pending_po_items_to_receive/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js
deleted file mode 100644
index de2c037..0000000
--- a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
deleted file mode 100644
index e7ada4f..0000000
--- a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# 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
-colwidths[col_idx['Pending Quantity To Receive']] = '200px'
-colwidths[col_idx['Pending Amount To Receive']] = '200px'
diff --git a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt b/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
deleted file mode 100644
index 51cf165..0000000
--- a/buying/search_criteria/pending_po_items_to_receive/pending_po_items_to_receive.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "dhanalekshmi@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "add_col": "`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) AS \"Pending Quantity To Receive\"\n(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) * `tabPurchase Order Item`.purchase_rate AS \"Pending Amount To Receive\"",
- "parent_doc_type": "Purchase Order",
- "module": "Buying",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Purchase Order\u0001Saved':1,'Purchase Order\u0001Submitted':1,'Purchase Order\u0001Status':'','Purchase Order\u0001Fiscal Year':''}",
- "description": "Pending PO Items To Receive",
- "doc_type": "Purchase Order Item",
- "name": "__common__",
- "add_cond": "`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0) > 0 \n`tabPurchase Order`.status != \"Stopped\"",
- "doctype": "Search Criteria",
- "sort_by": "`tabPurchase Order`.`name`",
- "page_len": 50,
- "criteria_name": "Pending PO Items To Receive",
- "columns": "Purchase Order\u0001ID,Purchase Order\u0001Supplier,Purchase Order\u0001Supplier Name,Purchase Order\u0001Status,Purchase Order\u0001PO Date,Purchase Order\u0001Fiscal Year,Purchase Order Item\u0001Material Request No,Purchase Order Item\u0001Item Code,Purchase Order Item\u0001Item Name,Purchase Order Item\u0001Description,Purchase Order Item\u0001Quantity,Purchase Order Item\u0001UOM,Purchase Order Item\u0001Received Qty"
- },
- {
- "name": "pending_po_items_to_receive",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/buying/search_criteria/purchase_in_transit/__init__.py b/buying/search_criteria/purchase_in_transit/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/buying/search_criteria/purchase_in_transit/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/buying/search_criteria/purchase_in_transit/purchase_in_transit.js b/buying/search_criteria/purchase_in_transit/purchase_in_transit.js
deleted file mode 100644
index a08b921..0000000
--- a/buying/search_criteria/purchase_in_transit/purchase_in_transit.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- this.hide_all_filters();
-
-
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Credit To'].df.filter_hide = 0;
-
-
- this.add_filter({fieldname:'pr_posting_date', label:'PR Posting Date', fieldtype:'Date', ignore : 1, parent:'Purchase Receipt'});
-
-
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Credit To'].df.in_first_page = 0;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df.in_first_page = 1;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df.in_first_page = 1;
-
-
- this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df.ignore = 1;
- this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df.ignore = 1;
-
-
- this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'From PR Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Purchase Receipt'+FILTER_SEP +'To PR Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Purchase Invoice'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-
-}
-
-this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/buying/search_criteria/purchase_in_transit/purchase_in_transit.py b/buying/search_criteria/purchase_in_transit/purchase_in_transit.py
deleted file mode 100644
index c8739bb..0000000
--- a/buying/search_criteria/purchase_in_transit/purchase_in_transit.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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/>.
-
-#check mendatory
-from __future__ import unicode_literals
-if not filter_values.get('posting_date') or not filter_values.get('posting_date1'):
- msgprint("Please select From Posting Date and To Posting Date in 'Set Filters' section")
- raise Exception
-else:
- from_date = filter_values.get('posting_date')
- to_date = filter_values.get('posting_date1')
\ No newline at end of file
diff --git a/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt b/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt
deleted file mode 100644
index 9fa5ccf..0000000
--- a/buying/search_criteria/purchase_in_transit/purchase_in_transit.txt
+++ /dev/null
@@ -1,32 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-11 13:16:55",
- "modified_by": "Administrator",
- "modified": "2012-04-13 12:06:15"
- },
- {
- "add_col": "`tabPurchase Receipt`.`posting_date` AS 'PR Posting Date'",
- "parent_doc_type": "Purchase Invoice",
- "module": "Buying",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"Purchase Invoice\\u0001Submitted\":1,\"Purchase Invoice\\u0001Is Opening\":[\"\"],\"Purchase Invoice\\u0001Fiscal Year\":[\"\"]}",
- "dis_filters": "`tabPurchase Receipt`.`pr_posting_date`",
- "description": "List of PR whose posting date is after PV posting date",
- "doc_type": "Purchase Invoice Item",
- "name": "__common__",
- "add_tab": "`tabPurchase Receipt`",
- "add_cond": "`tabPurchase Invoice Item`.`purchase_receipt` = `tabPurchase Receipt`.`name`\n`tabPurchase Receipt`.`posting_date` >= '%(pr_posting_date)s'\n`tabPurchase Receipt`.`posting_date` <= '%(pr_posting_date1)s'\n`tabPurchase Receipt`.`posting_date` > `tabPurchase Invoice`.`posting_date`",
- "doctype": "Search Criteria",
- "sort_by": "`tabPurchase Invoice`.`name`",
- "page_len": 50,
- "criteria_name": "Purchase in Transit",
- "columns": "Purchase Invoice\u0001ID,Purchase Invoice\u0001Posting Date,Purchase Invoice\u0001Credit To,Purchase Invoice Item\u0001Qty,Purchase Invoice Item\u0001Amount,Purchase Invoice Item\u0001Pur Order,Purchase Invoice Item\u0001Pur Receipt"
- },
- {
- "name": "purchase_in_transit",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/config.json b/config.json
index ff6f80f..cb1a831 100644
--- a/config.json
+++ b/config.json
@@ -114,7 +114,7 @@
"ticket": {
"no_cache": true,
"template": "app/website/templates/pages/ticket",
- "get_website_args": "support.doctype.support_ticket.support_ticket.get_website_args"
+ "args_method": "support.doctype.support_ticket.support_ticket.get_website_args"
},
"tickets": {
"template": "app/website/templates/pages/tickets"
@@ -122,6 +122,10 @@
"writers": {
"template": "app/website/templates/pages/writers",
"args_method": "website.helpers.blog.get_writers_args"
+ },
+ "profile": {
+ "no_cache": true,
+ "template": "app/website/templates/pages/profile"
}
},
"generators": {
diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py
index 0e7c108..04e4bbd 100644
--- a/controllers/accounts_controller.py
+++ b/controllers/accounts_controller.py
@@ -16,7 +16,6 @@
from __future__ import unicode_literals
import webnotes
-from webnotes import msgprint, _
from webnotes.utils import flt
from utilities.transaction_base import TransactionBase
@@ -83,10 +82,13 @@
@property
def stock_items(self):
if not hasattr(self, "_stock_items"):
- item_codes = list(set(item.item_code for item in self.doclist.get({"parentfield": self.fname})))
- self._stock_items = [r[0] for r in webnotes.conn.sql("""select name
- from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
- (", ".join((["%s"]*len(item_codes))),), item_codes)]
+ self._stock_items = []
+ item_codes = list(set(item.item_code for item in
+ self.doclist.get({"parentfield": self.fname})))
+ if item_codes:
+ self._stock_items = [r[0] for r in webnotes.conn.sql("""select name
+ from `tabItem` where name in (%s) and is_stock_item='Yes'""" % \
+ (", ".join((["%s"]*len(item_codes))),), item_codes)]
return self._stock_items
@@ -95,4 +97,4 @@
if not hasattr(self, "_abbr"):
self._abbr = webnotes.conn.get_value("Company", self.doc.company, "abbr")
- return self._abbr
+ return self._abbr
\ No newline at end of file
diff --git a/controllers/buying_controller.py b/controllers/buying_controller.py
index 560dec2..f02e848 100644
--- a/controllers/buying_controller.py
+++ b/controllers/buying_controller.py
@@ -26,9 +26,13 @@
from controllers.stock_controller import StockController
+class WrongWarehouseCompany(Exception): pass
+
class BuyingController(StockController):
def validate(self):
super(BuyingController, self).validate()
+ self.validate_stock_or_nonstock_items()
+ self.validate_warehouse_belongs_to_company()
if self.meta.get_field("currency"):
self.company_currency = get_company_currency(self.doc.company)
self.validate_conversion_rate("currency", "conversion_rate")
@@ -41,7 +45,23 @@
# set total in words
self.set_total_in_words()
-
+
+ def validate_warehouse_belongs_to_company(self):
+ for warehouse, company in webnotes.conn.get_values("Warehouse",
+ self.doclist.get_distinct_values("warehouse"), "company").items():
+ if company and company != self.doc.company:
+ webnotes.msgprint(_("Company mismatch for Warehouse") + (": %s" % (warehouse,)),
+ raise_exception=WrongWarehouseCompany)
+
+ def validate_stock_or_nonstock_items(self):
+ if not self.stock_items:
+ tax_for_valuation = [d.account_head for d in
+ self.doclist.get({"parentfield": "purchase_tax_details"})
+ if d.category in ["Valuation", "Valuation and Total"]]
+ if tax_for_valuation:
+ webnotes.msgprint(_("""Tax Category can not be 'Valuation' or 'Valuation and Total'
+ as all items are non-stock items"""), raise_exception=1)
+
def update_item_details(self):
for item in self.doclist.get({"parentfield": self.fname}):
ret = get_item_details({
@@ -338,9 +358,13 @@
if d.item_code and d.qty:
# if no item code, which is sometimes the case in purchase invoice,
# then it is not possible to track valuation against it
- d.valuation_rate = (flt(d.purchase_rate or d.rate)
- + (flt(d.item_tax_amount) + flt(d.rm_supp_cost)) / flt(d.qty)
- ) / flt(d.conversion_factor)
+ d.valuation_rate = flt(((flt(d.purchase_rate, self.precision.item.purchase_rate) or
+ flt(d.rate, self.precision.item.rate)) +
+ (flt(d.item_tax_amount, self.precision.item.item_tax_amount) +
+ flt(d.rm_supp_cost, self.precision.item.rm_supp_cost)) /
+ flt(d.qty, self.precision.item.qty)) /
+ flt(d.conversion_factor, self.precision.item.conversion_factor),
+ self.precision.item.valuation_rate)
else:
d.valuation_rate = 0.0
@@ -419,21 +443,25 @@
@property
def sub_contracted_items(self):
if not hasattr(self, "_sub_contracted_items"):
+ self._sub_contracted_items = []
item_codes = list(set(item.item_code for item in
self.doclist.get({"parentfield": self.fname})))
- self._sub_contracted_items = [r[0] for r in webnotes.conn.sql("""select name
- from `tabItem` where name in (%s) and is_sub_contracted_item='Yes'""" % \
- (", ".join((["%s"]*len(item_codes))),), item_codes)]
+ if item_codes:
+ self._sub_contracted_items = [r[0] for r in webnotes.conn.sql("""select name
+ from `tabItem` where name in (%s) and is_sub_contracted_item='Yes'""" % \
+ (", ".join((["%s"]*len(item_codes))),), item_codes)]
return self._sub_contracted_items
@property
def purchase_items(self):
if not hasattr(self, "_purchase_items"):
+ self._purchase_items = []
item_codes = list(set(item.item_code for item in
self.doclist.get({"parentfield": self.fname})))
- self._purchase_items = [r[0] for r in webnotes.conn.sql("""select name
- from `tabItem` where name in (%s) and is_purchase_item='Yes'""" % \
- (", ".join((["%s"]*len(item_codes))),), item_codes)]
+ if item_codes:
+ self._purchase_items = [r[0] for r in webnotes.conn.sql("""select name
+ from `tabItem` where name in (%s) and is_purchase_item='Yes'""" % \
+ (", ".join((["%s"]*len(item_codes))),), item_codes)]
return self._purchase_items
diff --git a/controllers/selling_controller.py b/controllers/selling_controller.py
index b22042d..80af337 100644
--- a/controllers/selling_controller.py
+++ b/controllers/selling_controller.py
@@ -59,7 +59,8 @@
buying_amount = get_buying_amount(item.item_code, item.warehouse, -1*item.qty,
self.doc.doctype, self.doc.name, item.name, stock_ledger_entries,
item_sales_bom)
- item.buying_amount = buying_amount > 0 and buying_amount or 0
+
+ item.buying_amount = buying_amount >= 0.01 and buying_amount or 0
webnotes.conn.set_value(item.doctype, item.name, "buying_amount",
item.buying_amount)
diff --git a/controllers/trends.py b/controllers/trends.py
new file mode 100644
index 0000000..eaaf4d1
--- /dev/null
+++ b/controllers/trends.py
@@ -0,0 +1,265 @@
+# 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
+from webnotes.utils import add_days, add_months, cstr, getdate
+from webnotes import _
+
+def get_columns(filters, trans):
+ validate_filters(filters)
+
+ # get conditions for based_on filter cond
+ based_on_details = based_wise_colums_query(filters.get("based_on"), trans)
+ # get conditions for periodic filter cond
+ period_cols, period_select = period_wise_colums_query(filters, trans)
+ # get conditions for grouping filter cond
+ group_by_cols = group_wise_column(filters.get("group_by"))
+
+ columns = based_on_details["based_on_cols"] + period_cols + ["Total(Qty):Float:120", "Total(Amt):Currency:120"]
+ if group_by_cols:
+ columns = based_on_details["based_on_cols"] + group_by_cols + period_cols + \
+ ["Total(Qty):Float:120", "Total(Amt):Currency:120"]
+
+ conditions = {"based_on_select": based_on_details["based_on_select"], "period_wise_select": period_select,
+ "columns": columns, "group_by": based_on_details["based_on_group_by"], "grbc": group_by_cols, "trans": trans,
+ "addl_tables": based_on_details["addl_tables"]}
+
+ return conditions
+
+def validate_filters(filters):
+ for f in ["Fiscal Year", "Based On", "Period", "Company"]:
+ if not filters.get(f.lower().replace(" ", "_")):
+ webnotes.msgprint(f + _(" is mandatory"), raise_exception=1)
+
+ if filters.get("based_on") == filters.get("group_by"):
+ webnotes.msgprint("'Based On' and 'Group By' can not be same", raise_exception=1)
+
+def get_data(filters, conditions):
+ data = []
+ inc, cond= '',''
+ query_details = conditions["based_on_select"] + conditions["period_wise_select"]
+
+ if conditions["based_on_select"] in ["t1.project_name,", "t2.project_name,"]:
+ cond = 'and '+ conditions["based_on_select"][:-1] +' IS Not NULL'
+
+ if filters.get("group_by"):
+ sel_col = ''
+ ind = conditions["columns"].index(conditions["grbc"][0])
+
+ if filters.get("group_by") == 'Item':
+ sel_col = 't2.item_code'
+ elif filters.get("group_by") == 'Customer':
+ sel_col = 't1.customer'
+ elif filters.get("group_by") == 'Supplier':
+ sel_col = 't1.supplier'
+
+ if filters.get('based_on') in ['Item','Customer','Supplier']:
+ inc = 2
+ else :
+ inc = 1
+ data1 = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
+ where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and
+ t1.docstatus = 1 %s
+ group by %s
+ """ % (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"], "%s",
+ "%s", cond, conditions["group_by"]), (filters.get("company"),
+ filters["fiscal_year"]),as_list=1)
+
+ for d in range(len(data1)):
+ #to add blanck column
+ dt = data1[d]
+ dt.insert(ind,'')
+ data.append(dt)
+
+ #to get distinct value of col specified by group_by in filter
+ row = webnotes.conn.sql("""select DISTINCT(%s) from `tab%s` t1, `tab%s Item` t2 %s
+ where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s
+ and t1.docstatus = 1 and %s = %s
+ """ %
+ (sel_col, conditions["trans"], conditions["trans"], conditions["addl_tables"],
+ "%s", "%s", conditions["group_by"], "%s"),
+ (filters.get("company"), filters.get("fiscal_year"), data1[d][0]), as_list=1)
+
+ for i in range(len(row)):
+ des = ['' for q in range(len(conditions["columns"]))]
+
+ #get data for group_by filter
+ row1 = webnotes.conn.sql(""" select %s , %s from `tab%s` t1, `tab%s Item` t2 %s
+ where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s
+ and t1.docstatus = 1 and %s = %s and %s = %s
+ """ %
+ (sel_col, conditions["period_wise_select"], conditions["trans"],
+ conditions["trans"], conditions["addl_tables"], "%s", "%s", sel_col,
+ "%s", conditions["group_by"], "%s"),
+ (filters.get("company"), filters.get("fiscal_year"), row[i][0],
+ data1[d][0]), as_list=1)
+
+ des[ind] = row[i]
+ for j in range(1,len(conditions["columns"])-inc):
+ des[j+inc] = row1[0][j]
+
+ data.append(des)
+ else:
+ data = webnotes.conn.sql(""" select %s from `tab%s` t1, `tab%s Item` t2 %s
+ where t2.parent = t1.name and t1.company = %s and t1.fiscal_year = %s and
+ t1.docstatus = 1 %s
+ group by %s
+ """ %
+ (query_details, conditions["trans"], conditions["trans"], conditions["addl_tables"],
+ "%s", "%s", cond,conditions["group_by"]),
+ (filters.get("company"), filters.get("fiscal_year")), as_list=1)
+
+ return data
+
+def get_mon(dt):
+ return getdate(dt).strftime("%b")
+
+def period_wise_colums_query(filters, trans):
+ query_details = ''
+ pwc = []
+ bet_dates = get_period_date_ranges(filters.get("period"), filters.get("fiscal_year"))
+
+ if trans in ['Purchase Receipt', 'Delivery Note', 'Purchase Invoice', 'Sales Invoice']:
+ trans_date = 'posting_date'
+ else:
+ trans_date = 'transaction_date'
+
+ if filters.get("period") != 'Yearly':
+ for dt in bet_dates:
+ get_period_wise_columns(dt, filters.get("period"), pwc)
+ query_details = get_period_wise_query(dt, trans_date, query_details)
+ else:
+ pwc = [filters.get("fiscal_year") + " (Qty):Float:120",
+ filters.get("fiscal_year") + " (Amt):Currency:120"]
+ query_details = " SUM(t2.qty), SUM(t1.grand_total),"
+
+ query_details += 'SUM(t2.qty), SUM(t1.grand_total)'
+ return pwc, query_details
+
+def get_period_wise_columns(bet_dates, period, pwc):
+ if period == 'Monthly':
+ pwc += [get_mon(bet_dates[0]) + " (Qty):Float:120",
+ get_mon(bet_dates[0]) + " (Amt):Currency:120"]
+ else:
+ pwc += [get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Qty):Float:120",
+ get_mon(bet_dates[0]) + "-" + get_mon(bet_dates[1]) + " (Amt):Currency:120"]
+
+def get_period_wise_query(bet_dates, trans_date, query_details):
+ query_details += """SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t2.qty, NULL)),
+ SUM(IF(t1.%(trans_date)s BETWEEN '%(sd)s' AND '%(ed)s', t1.grand_total, NULL)),
+ """ % {"trans_date": trans_date, "sd": bet_dates[0],"ed": bet_dates[1]}
+ return query_details
+
+def get_period_date_ranges(period, fiscal_year):
+ from dateutil.relativedelta import relativedelta
+
+ year_start_date = webnotes.conn.get_value("Fiscal Year", fiscal_year, "year_start_date")
+ increment = {
+ "Monthly": 1,
+ "Quarterly": 3,
+ "Half-Yearly": 6,
+ "Yearly": 12
+ }.get(period)
+
+ period_date_ranges = []
+ for i in xrange(1, 13, increment):
+ period_end_date = year_start_date + relativedelta(months=increment, days=-1)
+ period_date_ranges.append([year_start_date, period_end_date])
+ year_start_date = period_end_date + relativedelta(days=1)
+
+ return period_date_ranges
+
+def get_period_month_ranges(period, fiscal_year):
+ from dateutil.relativedelta import relativedelta
+ period_month_ranges = []
+
+ for start_date, end_date in get_period_date_ranges(period, fiscal_year):
+ months_in_this_period = []
+ while start_date <= end_date:
+ months_in_this_period.append(start_date.strftime("%B"))
+ start_date += relativedelta(months=1)
+ period_month_ranges.append(months_in_this_period)
+
+ return period_month_ranges
+
+def based_wise_colums_query(based_on, trans):
+ based_on_details = {}
+
+ # based_on_cols, based_on_select, based_on_group_by, addl_tables
+ if based_on == "Item":
+ based_on_details["based_on_cols"] = ["Item:Link/Item:120", "Item Name:Data:120"]
+ based_on_details["based_on_select"] = "t2.item_code, t2.item_name,"
+ based_on_details["based_on_group_by"] = 't2.item_code'
+ based_on_details["addl_tables"] = ''
+
+ elif based_on == "Item Group":
+ based_on_details["based_on_cols"] = ["Item Group:Link/Item Group:120"]
+ based_on_details["based_on_select"] = "t2.item_group,"
+ based_on_details["based_on_group_by"] = 't2.item_group'
+ based_on_details["addl_tables"] = ''
+
+ elif based_on == "Customer":
+ based_on_details["based_on_cols"] = ["Customer:Link/Customer:120", "Territory:Link/Territory:120"]
+ based_on_details["based_on_select"] = "t1.customer_name, t1.territory, "
+ based_on_details["based_on_group_by"] = 't1.customer_name'
+ based_on_details["addl_tables"] = ''
+
+ elif based_on == "Customer Group":
+ based_on_details["based_on_cols"] = ["Customer Group:Link/Customer Group"]
+ based_on_details["based_on_select"] = "t1.customer_group,"
+ based_on_details["based_on_group_by"] = 't1.customer_group'
+ based_on_details["addl_tables"] = ''
+
+ elif based_on == 'Supplier':
+ based_on_details["based_on_cols"] = ["Supplier:Link/Supplier:120", "Supplier Type:Link/Supplier Type:140"]
+ based_on_details["based_on_select"] = "t1.supplier, t3.supplier_type,"
+ based_on_details["based_on_group_by"] = 't1.supplier'
+ based_on_details["addl_tables"] = ',`tabSupplier` t3'
+
+ elif based_on == 'Supplier Type':
+ based_on_details["based_on_cols"] = ["Supplier Type:Link/Supplier Type:140"]
+ based_on_details["based_on_select"] = "t3.supplier_type,"
+ based_on_details["based_on_group_by"] = 't3.supplier_type'
+ based_on_details["addl_tables"] =',`tabSupplier` t3'
+
+ elif based_on == "Territory":
+ based_on_details["based_on_cols"] = ["Territory:Link/Territory:120"]
+ based_on_details["based_on_select"] = "t1.territory,"
+ based_on_details["based_on_group_by"] = 't1.territory'
+ based_on_details["addl_tables"] = ''
+
+ elif based_on == "Project":
+ if trans in ['Sales Invoice', 'Delivery Note', 'Sales Order']:
+ based_on_details["based_on_cols"] = ["Project:Link/Project:120"]
+ based_on_details["based_on_select"] = "t1.project_name,"
+ based_on_details["based_on_group_by"] = 't1.project_name'
+ based_on_details["addl_tables"] = ''
+ elif trans in ['Purchase Order', 'Purchase Invoice', 'Purchase Receipt']:
+ based_on_details["based_on_cols"] = ["Project:Link/Project:120"]
+ based_on_details["based_on_select"] = "t2.project_name,"
+ based_on_details["based_on_group_by"] = 't2.project_name'
+ based_on_details["addl_tables"] = ''
+ else:
+ webnotes.msgprint("Project-wise data is not available for Quotation", raise_exception=1)
+
+ return based_on_details
+
+def group_wise_column(group_by):
+ if group_by:
+ return [group_by+":Link/"+group_by+":120"]
+ else:
+ return []
\ No newline at end of file
diff --git a/home/page/attributions/attributions.html b/home/page/attributions/attributions.html
index 2d08c79..99deea4 100644
--- a/home/page/attributions/attributions.html
+++ b/home/page/attributions/attributions.html
@@ -41,6 +41,11 @@
<li>dateutil
<li>termcolor
<li>python-memcached
+ <li>requests
+ <li>chardet
+ <li>pygeoip
+ <li>dropbox
+ <li>google-api-python-client
</ul>
</td>
</tr>
@@ -100,7 +105,12 @@
<tr>
<td><a href="https://github.com/dcneiner/Downloadify">Downloadify - Flash Download Widget</a></td>
<td>A tiny javascript + Flash library that enables the creation and download of text files without server interaction.</td>
- </tr>
+ </tr>
+ <tr>
+ <td><a href="http://dev.maxmind.com/geoip/geolite">GeoLite data by MaxMind</a></td>
+ <td>GeoLite data created by MaxMind, available from
+ <a href="https://www.maxmind.com">https://www.maxmind.com</a></td>
+ </tr>
</tbody>
</table>
diff --git a/home/page/latest_updates/latest_updates.js b/home/page/latest_updates/latest_updates.js
index 949849d..910c1b1 100644
--- a/home/page/latest_updates/latest_updates.js
+++ b/home/page/latest_updates/latest_updates.js
@@ -1,5 +1,16 @@
erpnext.updates = [
+ ["17th May", ["Patch: Set Conversion Factor for purchase invoice item in all old records. And repost JV to book Stock Received But Not Billed account, if Auto Inventory Integration enabed."
+ ]],
+ ["2nd May", ["Buying: Warehouse must belong to same company as transaction",
+ "Price List: Added Currency Field. One price list can have only one currency",
+ "Item: Naming can now be by series or item code",
+ "Naming Series: Set number of digits in series (optionally)",
+ "Login: Disable Signup link in the login page"]],
+ ["30th April", ["Price List: Valid for all countries or only valid for specific countries"]],
+ ["18th April", ["Cost Center: Set a default Cost Center for a Company"]],
["12th April", ["Employee: List of Leave Approvers who can approve the Employee's Leave Applications"]],
+ ["10th April", ["Redesigned File Uploads and added File Manager in Setup"]],
+ ["3rd April", ["Update Manager: Open source users can update their ERPNext instance from Setup > Update Manager"]],
["27th March", ["Rename multiple items together. Go to Setup > Rename Tool"]],
["26th March", ["Added project to Stock Ledger and Balance",
"Added Default Cash Account in Company."]],
diff --git a/hr/doctype/attendance/attendance.py b/hr/doctype/attendance/attendance.py
index 67af429..ac41acf 100644
--- a/hr/doctype/attendance/attendance.py
+++ b/hr/doctype/attendance/attendance.py
@@ -18,7 +18,6 @@
import webnotes
from webnotes.utils import getdate, nowdate
-from webnotes.model.doc import make_autoname
from webnotes import msgprint, _
sql = webnotes.conn.sql
@@ -28,9 +27,6 @@
self.doc = doc
self.doclist = doclist
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
def get_emp_name(self):
return {
"employee_name": webnotes.conn.get_value("Employee",
diff --git a/hr/doctype/deduction_type/deduction_type.txt b/hr/doctype/deduction_type/deduction_type.txt
index 4c9ad7a..f346793 100644
--- a/hr/doctype/deduction_type/deduction_type.txt
+++ b/hr/doctype/deduction_type/deduction_type.txt
@@ -1,12 +1,13 @@
[
{
- "creation": "2013-01-10 16:34:13",
+ "creation": "2013-01-22 16:50:30",
"docstatus": 0,
- "modified": "2013-01-22 14:25:38",
+ "modified": "2013-05-02 11:22:59",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
+ "allow_rename": 1,
"autoname": "field:deduction_name",
"doctype": "DocType",
"document_type": "Master",
diff --git a/hr/doctype/earning_type/earning_type.txt b/hr/doctype/earning_type/earning_type.txt
index 18cac68..d69f486 100644
--- a/hr/doctype/earning_type/earning_type.txt
+++ b/hr/doctype/earning_type/earning_type.txt
@@ -1,12 +1,13 @@
[
{
- "creation": "2013-01-10 16:34:13",
+ "creation": "2013-01-24 11:03:32",
"docstatus": 0,
- "modified": "2013-01-23 16:32:07",
+ "modified": "2013-05-02 11:22:48",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
+ "allow_rename": 1,
"autoname": "field:earning_name",
"doctype": "DocType",
"document_type": "Master",
diff --git a/hr/doctype/employee/employee.py b/hr/doctype/employee/employee.py
index 59c8380..0369803 100644
--- a/hr/doctype/employee/employee.py
+++ b/hr/doctype/employee/employee.py
@@ -36,7 +36,7 @@
if ret[0][0]=='Naming Series':
self.doc.name = make_autoname(self.doc.naming_series + '.####')
elif ret[0][0]=='Employee Number':
- self.doc.name = make_autoname(self.doc.employee_number)
+ self.doc.name = self.doc.employee_number
self.doc.employee = self.doc.name
@@ -80,7 +80,7 @@
if not "Employee" in webnotes.conn.sql_list("""select role from tabUserRole
where parent=%s""", self.doc.user_id):
from webnotes.profile import add_role
- add_role(self.doc.user_id, "HR User")
+ add_role(self.doc.user_id, "Employee")
profile_wrapper = webnotes.bean("Profile", self.doc.user_id)
@@ -101,18 +101,19 @@
if self.doc.gender:
profile_wrapper.doc.gender = self.doc.gender
- if self.doc.image and self.doc.file_list:
- # add to file list and user_image
- for file_args in self.doc.file_list.split("\n"):
- fname, fid = file_args.split(",")
- if self.doc.image == fname:
- new_file_args = fname + "," + fid
- file_list = cstr(profile_wrapper.doc.file_list).split("\n")
- if new_file_args not in file_list:
- file_list += [new_file_args]
- profile_wrapper.doc.file_list = "\n".join(file_list)
- profile_wrapper.doc.user_image = fname
- break
+ if self.doc.image:
+ if not profile_wrapper.doc.user_image == self.doc.image:
+ profile_wrapper.doc.user_image = self.doc.image
+ try:
+ webnotes.doc({
+ "doctype": "File Data",
+ "file_name": self.doc.image,
+ "attached_to_doctype": "Profile",
+ "attached_to_name": self.doc.user_id
+ }).insert()
+ except webnotes.DuplicateEntryError, e:
+ # already exists
+ pass
profile_wrapper.save()
diff --git a/hr/doctype/employee/employee.txt b/hr/doctype/employee/employee.txt
index 997a1ef..705eaa7 100644
--- a/hr/doctype/employee/employee.txt
+++ b/hr/doctype/employee/employee.txt
@@ -30,9 +30,7 @@
"parent": "Employee",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
"read": 1,
- "report": 1,
"submit": 0
},
{
@@ -743,14 +741,6 @@
},
{
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "print_hide": 1
- },
- {
- "doctype": "DocField",
"fieldname": "trash_reason",
"fieldtype": "Small Text",
"label": "Trash Reason",
@@ -763,6 +753,18 @@
"create": 0,
"doctype": "DocPerm",
"match": "employee",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Employee",
+ "write": 0
+ },
+ {
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
"role": "Employee",
"write": 0
},
@@ -771,6 +773,8 @@
"create": 1,
"doctype": "DocPerm",
"match": "company",
+ "permlevel": 0,
+ "report": 1,
"role": "HR User",
"write": 1
},
@@ -778,7 +782,29 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
"role": "HR Manager",
"write": 1
+ },
+ {
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "HR User",
+ "write": 0
+ },
+ {
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "HR Manager",
+ "write": 0
}
]
\ No newline at end of file
diff --git a/hr/doctype/job_applicant/job_applicant.txt b/hr/doctype/job_applicant/job_applicant.txt
index 4500d9b..d2a2d77 100644
--- a/hr/doctype/job_applicant/job_applicant.txt
+++ b/hr/doctype/job_applicant/job_applicant.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-15 16:32:13",
+ "creation": "2013-01-29 19:25:37",
"docstatus": 0,
"modified": "2013-01-29 17:44:52",
"modified_by": "Administrator",
@@ -89,16 +89,6 @@
"label": "Thread HTML"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "in_list_view": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/hr/doctype/leave_application/leave_application.js b/hr/doctype/leave_application/leave_application.js
index 7f8948a..2715a6c 100755
--- a/hr/doctype/leave_application/leave_application.js
+++ b/hr/doctype/leave_application/leave_application.js
@@ -16,7 +16,6 @@
cur_frm.add_fetch('employee','employee_name','employee_name');
-
cur_frm.cscript.onload = function(doc, dt, dn) {
if(!doc.posting_date)
set_multiple(dt,dn,{posting_date:get_today()});
@@ -127,4 +126,8 @@
}
}
-cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
\ No newline at end of file
+cur_frm.fields_dict.employee.get_query = function() {
+ return {
+ query: "hr.doctype.leave_application.leave_application.query_for_permitted_employees"
+ };
+}
\ No newline at end of file
diff --git a/hr/doctype/leave_application/leave_application.py b/hr/doctype/leave_application/leave_application.py
index b9f9e5b..7c47d6a 100755
--- a/hr/doctype/leave_application/leave_application.py
+++ b/hr/doctype/leave_application/leave_application.py
@@ -330,3 +330,27 @@
"title": _("Holiday") + ": " + cstr(holiday.description),
"name": holiday.name
})
+
+@webnotes.whitelist()
+def query_for_permitted_employees(doctype, txt, searchfield, start, page_len, filters):
+ txt = "%" + cstr(txt) + "%"
+
+ if "Leave Approver" in webnotes.user.get_roles():
+ condition = """and (exists(select ela.name from `tabEmployee Leave Approver` ela
+ where ela.parent=`tabEmployee`.name and ela.leave_approver= "%s") or
+ not exists(select ela.name from `tabEmployee Leave Approver` ela
+ where ela.parent=`tabEmployee`.name)
+ or user_id = "%s")""" % (webnotes.session.user, webnotes.session.user)
+ else:
+ from webnotes.widgets.reportview import build_match_conditions
+ condition = build_match_conditions("Employee")
+ condition = ("and " + condition) if condition else ""
+
+ return webnotes.conn.sql("""select name, employee_name from `tabEmployee`
+ where status = 'Active' and docstatus < 2 and
+ (`%s` like %s or employee_name like %s) %s
+ order by
+ case when name like %s then 0 else 1 end,
+ case when employee_name like %s then 0 else 1 end,
+ name limit %s, %s""" % tuple([searchfield] + ["%s"]*2 + [condition] + ["%s"]*4),
+ (txt, txt, txt, txt, start, page_len))
diff --git a/hr/doctype/leave_application/leave_application.txt b/hr/doctype/leave_application/leave_application.txt
index f0f1560..0710a5c 100644
--- a/hr/doctype/leave_application/leave_application.txt
+++ b/hr/doctype/leave_application/leave_application.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-02-18 18:37:56",
+ "creation": "2013-02-20 11:18:11",
"docstatus": 0,
"modified": "2013-02-19 16:30:05",
"modified_by": "Administrator",
@@ -8,7 +8,6 @@
},
{
"allow_attach": 1,
- "allow_import": 1,
"autoname": "LAP/.#####",
"description": "Apply / Approve Leaves",
"doctype": "DocType",
@@ -228,16 +227,6 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "permlevel": 0,
- "print_hide": 1
- },
- {
"create": 1,
"doctype": "DocPerm",
"match": "employee",
@@ -251,6 +240,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"role": "All",
"submit": 0
@@ -260,7 +250,6 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "match": "company",
"permlevel": 0,
"report": 1,
"role": "HR User",
@@ -269,8 +258,8 @@
},
{
"amend": 1,
- "cancel": 1,
- "create": 1,
+ "cancel": 0,
+ "create": 0,
"doctype": "DocPerm",
"match": "leave_approver:user",
"permlevel": 0,
@@ -284,6 +273,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"report": 1,
"role": "HR User",
@@ -295,6 +285,7 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
+ "match": "",
"permlevel": 1,
"report": 1,
"role": "Leave Approver",
diff --git a/hr/doctype/salary_slip/salary_slip.py b/hr/doctype/salary_slip/salary_slip.py
index 3edf410..d1ce3cc 100644
--- a/hr/doctype/salary_slip/salary_slip.py
+++ b/hr/doctype/salary_slip/salary_slip.py
@@ -152,7 +152,7 @@
d.e_modified_amount = round(flt(d.e_amount)*flt(self.doc.payment_days)/cint(self.doc.total_days_in_month), 2)
elif not self.doc.payment_days:
d.e_modified_amount = 0
- self.doc.gross_pay += d.e_modified_amount
+ self.doc.gross_pay += flt(d.e_modified_amount)
def calculate_ded_total(self):
"""
@@ -165,7 +165,7 @@
elif not self.doc.payment_days:
d.d_modified_amount = 0
- self.doc.total_deduction += d.d_modified_amount
+ self.doc.total_deduction += flt(d.d_modified_amount)
def calculate_net_pay(self):
"""
diff --git a/hr/doctype/salary_structure/salary_structure.py b/hr/doctype/salary_structure/salary_structure.py
index 22789e3..018aab7 100644
--- a/hr/doctype/salary_structure/salary_structure.py
+++ b/hr/doctype/salary_structure/salary_structure.py
@@ -18,31 +18,25 @@
import webnotes
from webnotes.utils import cstr, flt
-from webnotes.model import db_exists
from webnotes.model.doc import addchild, make_autoname
-from webnotes.model.bean import copy_doclist
-from webnotes import msgprint
+from webnotes import msgprint, _
sql = webnotes.conn.sql
class DocType:
- #init function
def __init__(self,doc,doclist=[]):
self.doc = doc
self.doclist = doclist
-
- #autoname function
- #---------------------------------------------------------
+
def autoname(self):
self.doc.name = make_autoname(self.doc.employee + '/.SST' + '/.#####')
-
- #get employee details
- #---------------------------------------------------------
+
def get_employee_details(self):
ret = {}
- det = sql("select employee_name, branch, designation, department, grade from `tabEmployee` where name = '%s'" %self.doc.employee)
+ det = sql("""select employee_name, branch, designation, department, grade
+ from `tabEmployee` where name = %s""", self.doc.employee)
if det:
ret = {
'employee_name': cstr(det[0][0]),
@@ -53,20 +47,16 @@
'backup_employee': cstr(self.doc.employee)
}
return ret
-
- # Set Salary structure field values
- #---------------------------------------------------------
def get_ss_values(self,employee):
- basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % employee)
+ basic_info = sql("""select bank_name, bank_ac_no, esic_card_no, pf_number
+ from `tabEmployee` where name =%s""", employee)
ret = {'bank_name': basic_info and basic_info[0][0] or '',
'bank_ac_no': basic_info and basic_info[0][1] or '',
'esic_no': basic_info and basic_info[0][2] or '',
'pf_no': basic_info and basic_info[0][3] or ''}
return ret
-
- # Make earning and deduction table
- #---------------------------------------------------------
+
def make_table(self, doct_name, tab_fname, tab_name):
list1 = sql("select name from `tab%s` where docstatus != 2" % doct_name)
for li in list1:
@@ -77,37 +67,31 @@
elif(tab_fname == 'deduction_details'):
child.d_type = cstr(li[0])
child.d_modified_amt = 0
-
- # add earning & deduction types to table
- #---------------------------------------------------------
+
def make_earn_ded_table(self):
- #Earning List
self.make_table('Earning Type','earning_details','Salary Structure Earning')
-
- #Deduction List
- self.make_table('Deduction Type','deduction_details',
- 'Salary Structure Deduction')
-
+ self.make_table('Deduction Type','deduction_details', 'Salary Structure Deduction')
- # Check if another active ss exists
- #---------------------------------------------------------
def check_existing(self):
- ret = sql("select name from `tabSalary Structure` where is_active = 'Yes' and employee = '%s' and name!='%s'" %(self.doc.employee,self.doc.name))
+ ret = sql("""select name from `tabSalary Structure` where is_active = 'Yes'
+ and employee = %s and name!=%s""", (self.doc.employee,self.doc.name))
if ret and self.doc.is_active=='Yes':
- msgprint("Another Salary Structure '%s' is active for employee '%s'. Please make its status 'Inactive' to proceed."%(cstr(ret), self.doc.employee))
- raise Exception
+ msgprint(_("""Another Salary Structure '%s' is active for employee '%s'.
+ Please make its status 'Inactive' to proceed.""") %
+ (cstr(ret), self.doc.employee), raise_exception=1)
- # Validate net pay
- #---------------------------------------------------------
- def validate_net_pay(self):
+ def validate_amount(self):
+ if flt(self.doc.ctc) < 12*flt(self.doc.total_earning):
+ msgprint(_("Annual Cost To Company can not be less than 12 months of Total Earning"),
+ raise_exception=1)
+
if flt(self.doc.net_pay) < 0:
- msgprint("Net pay can not be negative")
- raise Exception
- elif flt(self.doc.net_pay) > flt(self.doc.ctc):
- msgprint("Net pay can not be greater than CTC")
- raise Exception
+ msgprint(_("Net pay can not be negative"), raise_exception=1)
+ elif flt(self.doc.net_pay)*12 > flt(self.doc.ctc):
+ msgprint(_("Net pay can not be greater than 1/12th of Annual Cost To Company"),
+ raise_exception=1)
+
def validate(self):
self.check_existing()
- self.validate_net_pay()
-
+ self.validate_amount()
\ No newline at end of file
diff --git a/hr/doctype/salary_structure/salary_structure.txt b/hr/doctype/salary_structure/salary_structure.txt
index c2efac6..43b3662 100644
--- a/hr/doctype/salary_structure/salary_structure.txt
+++ b/hr/doctype/salary_structure/salary_structure.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-23 19:57:18",
+ "creation": "2013-03-07 18:50:29",
"docstatus": 0,
- "modified": "2013-01-29 17:35:34",
+ "modified": "2013-04-22 14:09:04",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -41,6 +41,7 @@
"doctype": "DocField",
"fieldname": "column_break0",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -52,6 +53,7 @@
"oldfieldname": "employee",
"oldfieldtype": "Link",
"options": "Employee",
+ "read_only": 0,
"reqd": 1
},
{
@@ -116,6 +118,7 @@
"doctype": "DocField",
"fieldname": "column_break1",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -129,6 +132,7 @@
"oldfieldname": "is_active",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -139,6 +143,7 @@
"label": "From Date",
"oldfieldname": "from_date",
"oldfieldtype": "Date",
+ "read_only": 0,
"reqd": 1
},
{
@@ -148,7 +153,8 @@
"in_list_view": 1,
"label": "To Date",
"oldfieldname": "to_date",
- "oldfieldtype": "Date"
+ "oldfieldtype": "Date",
+ "read_only": 0
},
{
"description": "Cost to Company",
@@ -156,10 +162,11 @@
"fieldname": "ctc",
"fieldtype": "Currency",
"in_filter": 1,
- "label": "CTC",
+ "label": "Annual Cost To Company",
"oldfieldname": "ctc",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
+ "read_only": 0,
"reqd": 1
},
{
@@ -169,6 +176,7 @@
"in_filter": 1,
"label": "Company",
"options": "link:Company",
+ "read_only": 0,
"reqd": 1
},
{
@@ -178,7 +186,8 @@
"fieldtype": "Section Break",
"label": "Earning & Deduction",
"oldfieldname": "earning_deduction",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -188,6 +197,7 @@
"label": "Earning",
"oldfieldname": "col_brk2",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -198,7 +208,8 @@
"label": "Earning1",
"oldfieldname": "earning_details",
"oldfieldtype": "Table",
- "options": "Salary Structure Earning"
+ "options": "Salary Structure Earning",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -208,6 +219,7 @@
"label": "Deduction",
"oldfieldname": "col_brk3",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -218,18 +230,21 @@
"label": "Deduction1",
"oldfieldname": "deduction_details",
"oldfieldtype": "Table",
- "options": "Salary Structure Deduction"
+ "options": "Salary Structure Deduction",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break0",
"fieldtype": "Section Break",
- "options": "Simple"
+ "options": "Simple",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -256,6 +271,7 @@
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
diff --git a/hr/doctype/upload_attendance/upload_attendance.js b/hr/doctype/upload_attendance/upload_attendance.js
index 35a00ed..4e5b47f 100644
--- a/hr/doctype/upload_attendance/upload_attendance.js
+++ b/hr/doctype/upload_attendance/upload_attendance.js
@@ -75,7 +75,6 @@
r.messages = ["<h4 style='color:green'>Import Successful!</h4>"].
concat(r.messages)
}
- console.log(r.messages);
$.each(r.messages, function(i, v) {
var $p = $('<p>').html(v).appendTo($log_wrapper);
diff --git a/hr/doctype/upload_attendance/upload_attendance.py b/hr/doctype/upload_attendance/upload_attendance.py
index e48cbef..ee4234a 100644
--- a/hr/doctype/upload_attendance/upload_attendance.py
+++ b/hr/doctype/upload_attendance/upload_attendance.py
@@ -100,7 +100,6 @@
def upload():
from webnotes.utils.datautils import read_csv_content_from_uploaded_file
from webnotes.modules import scrub
- from core.page.data_import_tool.data_import_tool import check_record, import_doc
rows = read_csv_content_from_uploaded_file()
if not rows:
@@ -112,6 +111,9 @@
ret = []
error = False
+ from webnotes.utils.datautils import check_record, import_doc
+ doctype_dl = webnotes.get_doctype("Attendance")
+
for i, row in enumerate(rows[5:]):
if not row: continue
row_idx = i + 5
@@ -121,7 +123,7 @@
d["docstatus"] = webnotes.conn.get_value("Attendance", d.name, "docstatus")
try:
- check_record(d)
+ check_record(d, doctype_dl=doctype_dl)
ret.append(import_doc(d, "Attendance", 1, row_idx, submit=True))
except Exception, e:
error = True
diff --git a/hr/page/hr_home/hr_home.js b/hr/page/hr_home/hr_home.js
index df32645..e35a808 100644
--- a/hr/page/hr_home/hr_home.js
+++ b/hr/page/hr_home/hr_home.js
@@ -169,6 +169,22 @@
"label":wn._("Employee Leave Balance"),
route: "query-report/Employee Leave Balance"
},
+ {
+ "label":wn._("Employee Birthday"),
+ route: "query-report/Employee Birthday"
+ },
+ {
+ "label":wn._("Employee Information"),
+ route: "Report2/Employee/Employee Information"
+ },
+ {
+ "label":wn._("Monthly Salary Register"),
+ route: "query-report/Monthly Salary Register"
+ },
+ {
+ "label":wn._("Monthly Attendance Sheet"),
+ route: "query-report/Monthly Attendance Sheet"
+ },
]
}
];
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/hr/report/employee_birthday/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to hr/report/employee_birthday/__init__.py
diff --git a/hr/report/employee_birthday/employee_birthday.js b/hr/report/employee_birthday/employee_birthday.js
new file mode 100644
index 0000000..f2bc9cb
--- /dev/null
+++ b/hr/report/employee_birthday/employee_birthday.js
@@ -0,0 +1,19 @@
+wn.query_reports["Employee Birthday"] = {
+ "filters": [
+ {
+ "fieldname":"month",
+ "label": "Month",
+ "fieldtype": "Select",
+ "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
+ "default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": wn.defaults.get_user_default("company")
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hr/report/employee_birthday/employee_birthday.py b/hr/report/employee_birthday/employee_birthday.py
new file mode 100644
index 0000000..7268055
--- /dev/null
+++ b/hr/report/employee_birthday/employee_birthday.py
@@ -0,0 +1,50 @@
+# 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
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ data = get_employees(filters)
+
+ return columns, data
+
+def get_columns():
+ return [
+ "Employee:Link/Employee:120", "Date of Birth:Date:100", "Branch:Link/Branch:120",
+ "Department:Link/Department:120", "Designation:Link/Designation:120", "Gender::60",
+ "Company:Link/Company:120"
+ ]
+
+def get_employees(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select name, date_of_birth, branch, department, designation,
+ gender, company from tabEmployee where status = 'Active' %s""" % conditions, as_list=1)
+
+def get_conditions(filters):
+ conditions = ""
+ if filters.get("month"):
+ month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"].index(filters["month"]) + 1
+ conditions += " and month(date_of_birth) = '%s'" % month
+
+ if filters.get("company"): conditions += " and company = '%s'" % filters["company"]
+
+ return conditions
\ No newline at end of file
diff --git a/hr/report/employee_birthday/employee_birthday.txt b/hr/report/employee_birthday/employee_birthday.txt
new file mode 100644
index 0000000..575ae73
--- /dev/null
+++ b/hr/report/employee_birthday/employee_birthday.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-05-06 17:56:03",
+ "docstatus": 0,
+ "modified": "2013-05-06 17:56:03",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Employee",
+ "report_name": "Employee Birthday",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Employee Birthday"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/hr/report/employee_information/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to hr/report/employee_information/__init__.py
diff --git a/hr/report/employee_information/employee_information.txt b/hr/report/employee_information/employee_information.txt
new file mode 100644
index 0000000..b9d190b
--- /dev/null
+++ b/hr/report/employee_information/employee_information.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-06 18:43:53",
+ "docstatus": 0,
+ "modified": "2013-05-06 18:47:43",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "json": "{\"filters\":[],\"columns\":[[\"name\",\"Employee\"],[\"employee_number\",\"Employee\"],[\"date_of_joining\",\"Employee\"],[\"branch\",\"Employee\"],[\"department\",\"Employee\"],[\"designation\",\"Employee\"],[\"gender\",\"Employee\"],[\"status\",\"Employee\"],[\"company\",\"Employee\"],[\"employment_type\",\"Employee\"],[\"grade\",\"Employee\"],[\"reports_to\",\"Employee\"],[\"company_email\",\"Employee\"]],\"sort_by\":\"Employee.bank_ac_no\",\"sort_order\":\"desc\",\"sort_by_next\":\"\",\"sort_order_next\":\"desc\"}",
+ "name": "__common__",
+ "ref_doctype": "Employee",
+ "report_name": "Employee Information",
+ "report_type": "Report Builder"
+ },
+ {
+ "doctype": "Report",
+ "name": "Employee Information"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/hr/report/monthly_attendance_sheet/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to hr/report/monthly_attendance_sheet/__init__.py
diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
new file mode 100644
index 0000000..6dc8d78
--- /dev/null
+++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.js
@@ -0,0 +1,32 @@
+wn.query_reports["Monthly Attendance Sheet"] = {
+ "filters": [
+ {
+ "fieldname":"month",
+ "label": "Month",
+ "fieldtype": "Select",
+ "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
+ "default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+ },
+ {
+ "fieldname":"fiscal_year",
+ "label": "Fiscal Year",
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": sys_defaults.fiscal_year,
+ },
+ {
+ "fieldname":"employee",
+ "label": "Employee",
+ "fieldtype": "Link",
+ "options": "Employee"
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
new file mode 100644
index 0000000..42a9770
--- /dev/null
+++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
@@ -0,0 +1,107 @@
+# 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
+from webnotes.utils import cstr, cint
+from webnotes import msgprint, _
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ conditions, filters = get_conditions(filters)
+ columns = get_columns(filters)
+ att_map = get_attendance_list(conditions, filters)
+ emp_map = get_employee_details()
+
+ data = []
+ for emp in sorted(att_map):
+ emp_det = emp_map.get(emp)
+ row = [emp, emp_det.employee_name, emp_det.branch, emp_det.department, emp_det.designation,
+ emp_det.company]
+
+ total_p = total_a = 0.0
+ for day in range(filters["total_days_in_month"]):
+ status = att_map.get(emp).get(day + 1, "Absent")
+ status_map = {"Present": "P", "Absent": "A", "Half Day": "HD"}
+ row.append(status_map[status])
+
+ if status == "Present":
+ total_p += 1
+ elif status == "Absent":
+ total_a += 1
+ elif status == "Half Day":
+ total_p += 0.5
+ total_a += 0.5
+
+ row += [total_p, total_a]
+
+ data.append(row)
+
+ return columns, data
+
+def get_columns(filters):
+ columns = [
+ "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120",
+ "Department:Link/Department:120", "Designation:Link/Designation:120",
+ "Company:Link/Company:120"
+ ]
+
+ for day in range(filters["total_days_in_month"]):
+ columns.append(cstr(day+1) +"::20")
+
+ columns += ["Total Present:Float:80", "Total Absent:Float:80"]
+ return columns
+
+def get_attendance_list(conditions, filters):
+ attendance_list = webnotes.conn.sql("""select employee, day(att_date) as day_of_month,
+ status from tabAttendance where docstatus = 1 %s order by employee, att_date""" %
+ conditions, filters, as_dict=1)
+
+ att_map = {}
+ for d in attendance_list:
+ att_map.setdefault(d.employee, webnotes._dict()).setdefault(d.day_of_month, "")
+ att_map[d.employee][d.day_of_month] = d.status
+
+ return att_map
+
+def get_conditions(filters):
+ if not (filters.get("month") and filters.get("fiscal_year")):
+ msgprint(_("Please select month and year"), raise_exception=1)
+
+ filters["month"] = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"].index(filters["month"]) + 1
+
+ from calendar import monthrange
+ filters["total_days_in_month"] = monthrange(cint(filters["fiscal_year"].split("-")[-1]),
+ filters["month"])[1]
+
+ conditions = " and month(att_date) = %(month)s and fiscal_year = %(fiscal_year)s"
+
+ if filters.get("company"): conditions += " and company = %(company)s"
+ if filters.get("employee"): conditions += " and employee = %(employee)s"
+
+ return conditions, filters
+
+def get_employee_details():
+ employee = webnotes.conn.sql("""select name, employee_name, designation, department,
+ branch, company from tabEmployee where docstatus < 2 and status = 'Active'""", as_dict=1)
+
+ emp_map = {}
+ for emp in employee:
+ emp_map[emp.name] = emp
+
+ return emp_map
\ No newline at end of file
diff --git a/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt
new file mode 100644
index 0000000..3c53aae
--- /dev/null
+++ b/hr/report/monthly_attendance_sheet/monthly_attendance_sheet.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-13 14:04:03",
+ "docstatus": 0,
+ "modified": "2013-05-13 14:32:42",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 0,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Attendance",
+ "report_name": "Monthly Attendance Sheet",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Monthly Attendance Sheet"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/hr/report/monthly_salary_register/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to hr/report/monthly_salary_register/__init__.py
diff --git a/hr/report/monthly_salary_register/monthly_salary_register.js b/hr/report/monthly_salary_register/monthly_salary_register.js
new file mode 100644
index 0000000..da88137
--- /dev/null
+++ b/hr/report/monthly_salary_register/monthly_salary_register.js
@@ -0,0 +1,32 @@
+wn.query_reports["Monthly Salary Register"] = {
+ "filters": [
+ {
+ "fieldname":"month",
+ "label": "Month",
+ "fieldtype": "Select",
+ "options": "Jan\nFeb\nMar\nApr\nMay\nJun\nJul\nAug\nSep\nOct\nNov\nDec",
+ "default": ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"][wn.datetime.str_to_obj(wn.datetime.get_today()).getMonth()],
+ },
+ {
+ "fieldname":"fiscal_year",
+ "label": "Fiscal Year",
+ "fieldtype": "Link",
+ "options": "Fiscal Year",
+ "default": sys_defaults.fiscal_year,
+ },
+ {
+ "fieldname":"employee",
+ "label": "Employee",
+ "fieldtype": "Link",
+ "options": "Employee"
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ }
+ ]
+}
\ No newline at end of file
diff --git a/hr/report/monthly_salary_register/monthly_salary_register.py b/hr/report/monthly_salary_register/monthly_salary_register.py
new file mode 100644
index 0000000..cc25dc3
--- /dev/null
+++ b/hr/report/monthly_salary_register/monthly_salary_register.py
@@ -0,0 +1,119 @@
+# 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
+from webnotes.utils import flt, cstr
+from webnotes import msgprint, _
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ salary_slips = get_salary_slips(filters)
+ columns, earning_types, ded_types = get_columns(salary_slips)
+ ss_earning_map = get_ss_earning_map(salary_slips)
+ ss_ded_map = get_ss_ded_map(salary_slips)
+
+ data = []
+ for ss in salary_slips:
+ row = [ss.employee, ss.employee_name, ss.branch, ss.department, ss.designation,
+ ss.company, ss.month, ss.leave_withut_pay, ss.payment_days]
+
+ for e in earning_types:
+ row.append(ss_earning_map.get(ss.name, {}).get(e))
+
+ row += [ss.arrear_amount, ss.leave_encashment_amount, ss.gross_pay]
+
+ for d in ded_types:
+ row.append(ss_ded_map.get(ss.name, {}).get(d))
+
+ row += [ss.total_deduction, ss.net_pay]
+
+ data.append(row)
+
+ return columns, data
+
+def get_columns(salary_slips):
+ columns = [
+ "Employee:Link/Employee:120", "Employee Name::140", "Branch:Link/Branch:120",
+ "Department:Link/Department:120", "Designation:Link/Designation:120",
+ "Company:Link/Company:120", "Month::80", "Leave Without pay:Float:130",
+ "Payment Days:Float:120"
+ ]
+
+ earning_types = webnotes.conn.sql_list("""select distinct e_type from `tabSalary Slip Earning`
+ where ifnull(e_modified_amount, 0) != 0 and parent in (%s)""" %
+ (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
+
+ ded_types = webnotes.conn.sql_list("""select distinct d_type from `tabSalary Slip Deduction`
+ where ifnull(d_modified_amount, 0) != 0 and parent in (%s)""" %
+ (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]))
+
+ columns = columns + [(e + ":Link/Earning Type:120") for e in earning_types] + \
+ ["Arrear Amount:Currency:120", "Leave Encashment Amount:Currency:150",
+ "Gross Pay:Currency:120"] + [(d + ":Link/Deduction Type:120") for d in ded_types] + \
+ ["Total Deduction:Currency:120", "Net Pay:Currency:120"]
+
+ return columns, earning_types, ded_types
+
+def get_salary_slips(filters):
+ conditions, filters = get_conditions(filters)
+ salary_slips = webnotes.conn.sql("""select * from `tabSalary Slip` where docstatus = 1 %s""" %
+ conditions, filters, as_dict=1)
+
+ if not salary_slips:
+ msgprint(_("No salary slip found for month: ") + cstr(filters.get("month")) +
+ _(" and year: ") + cstr(filters.get("fiscal_year")), raise_exception=1)
+
+ return salary_slips
+
+def get_conditions(filters):
+ conditions = ""
+ if filters.get("month"):
+ month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov",
+ "Dec"].index(filters["month"]) + 1
+ filters["month"] = month
+ conditions += " and month = %(month)s"
+
+ if filters.get("fiscal_year"): conditions += " and fiscal_year = %(fiscal_year)s"
+ if filters.get("company"): conditions += " and company = %(company)s"
+ if filters.get("employee"): conditions += " and employee = %(employee)s"
+
+ return conditions, filters
+
+def get_ss_earning_map(salary_slips):
+ ss_earnings = webnotes.conn.sql("""select parent, e_type, e_modified_amount
+ from `tabSalary Slip Earning` where parent in (%s)""" %
+ (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1)
+
+ ss_earning_map = {}
+ for d in ss_earnings:
+ ss_earning_map.setdefault(d.parent, webnotes._dict()).setdefault(d.e_type, [])
+ ss_earning_map[d.parent][d.e_type] = flt(d.e_modified_amount)
+
+ return ss_earning_map
+
+def get_ss_ded_map(salary_slips):
+ ss_deductions = webnotes.conn.sql("""select parent, d_type, d_modified_amount
+ from `tabSalary Slip Deduction` where parent in (%s)""" %
+ (', '.join(['%s']*len(salary_slips))), tuple([d.name for d in salary_slips]), as_dict=1)
+
+ ss_ded_map = {}
+ for d in ss_deductions:
+ ss_ded_map.setdefault(d.parent, webnotes._dict()).setdefault(d.d_type, [])
+ ss_ded_map[d.parent][d.e_type] = flt(d.d_modified_amount)
+
+ return ss_ded_map
\ No newline at end of file
diff --git a/hr/report/monthly_salary_register/monthly_salary_register.txt b/hr/report/monthly_salary_register/monthly_salary_register.txt
new file mode 100644
index 0000000..b0d5880
--- /dev/null
+++ b/hr/report/monthly_salary_register/monthly_salary_register.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-07 18:09:42",
+ "docstatus": 0,
+ "modified": "2013-05-07 18:09:42",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Salary Slip",
+ "report_name": "Monthly Salary Register",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Monthly Salary Register"
+ }
+]
\ No newline at end of file
diff --git a/hr/search_criteria/__init__.py b/hr/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/employee_appraisals/__init__.py b/hr/search_criteria/employee_appraisals/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/employee_appraisals/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/employee_appraisals/employee_appraisals.txt b/hr/search_criteria/employee_appraisals/employee_appraisals.txt
deleted file mode 100644
index ce12a0e..0000000
--- a/hr/search_criteria/employee_appraisals/employee_appraisals.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Appraisal\u0001Saved':1,'Appraisal\u0001Submitted':1,'Appraisal\u0001Status':'','Appraisal\u0001Fiscal Year':''}",
- "doctype": "Search Criteria",
- "doc_type": "Appraisal",
- "name": "__common__",
- "sort_by": "`tabAppraisal`.`name`",
- "page_len": 50,
- "criteria_name": "Employee Appraisals",
- "columns": "Appraisal\u0001ID,Appraisal\u0001Status,Appraisal\u0001Employee,Appraisal\u0001Employee Name,Appraisal\u0001Start Date,Appraisal\u0001End Date,Appraisal\u0001Approver,Appraisal\u0001Total Score"
- },
- {
- "name": "employee_appraisals",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/employee_information/__init__.py b/hr/search_criteria/employee_information/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/employee_information/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/employee_information/employee_information.txt b/hr/search_criteria/employee_information/employee_information.txt
deleted file mode 100644
index d054613..0000000
--- a/hr/search_criteria/employee_information/employee_information.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Employee\u0001Saved':1,'Employee\u0001Submitted':1,'Employee\u0001Gender':'','Employee\u0001Month of Birth':'','Employee\u0001Status':''}",
- "doctype": "Search Criteria",
- "doc_type": "Employee",
- "name": "__common__",
- "sort_by": "`tabEmployee`.`name`",
- "page_len": 50,
- "criteria_name": "Employee Information",
- "columns": "Employee\u0001ID,Employee\u0001Employee Name,Employee\u0001Employee Number,Employee\u0001Date of Joining,Employee\u0001Gender,Employee\u0001Date of Birth,Employee\u0001Employment Type,Employee\u0001Scheduled Confirmation Date,Employee\u0001Contract End Date,Employee\u0001Status,Employee\u0001Branch,Employee\u0001Department,Employee\u0001Designation,Employee\u0001Grade,Employee\u0001Reports to,Employee\u0001Email (By company),Employee\u0001Bank Name,Employee\u0001Relieving Date"
- },
- {
- "name": "employee_information",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/employees_birthday/__init__.py b/hr/search_criteria/employees_birthday/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/employees_birthday/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/employees_birthday/employees_birthday.txt b/hr/search_criteria/employees_birthday/employees_birthday.txt
deleted file mode 100644
index a96b869..0000000
--- a/hr/search_criteria/employees_birthday/employees_birthday.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Employee\u0001Saved':1,'Employee\u0001Gender':'','Employee\u0001Month of Birth':'May','Employee\u0001Status':''}",
- "doctype": "Search Criteria",
- "doc_type": "Employee",
- "name": "__common__",
- "sort_by": "`tabEmployee`.`name`",
- "page_len": 50,
- "criteria_name": "Employee's Birthday",
- "columns": "Employee\u0001ID,Employee\u0001Employee Name,Employee\u0001Department,Employee\u0001Gender,Employee\u0001Date of Birth,Employee\u0001Month of Birth"
- },
- {
- "name": "employees_birthday",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/expense_claims/__init__.py b/hr/search_criteria/expense_claims/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/expense_claims/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/expense_claims/expense_claims.txt b/hr/search_criteria/expense_claims/expense_claims.txt
deleted file mode 100644
index f1324d2..0000000
--- a/hr/search_criteria/expense_claims/expense_claims.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-03-30 13:33:32",
- "modified_by": "Administrator",
- "modified": "2012-03-30 13:33:32"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Expense Claim\u0001Saved':1,'Expense Claim\u0001Submitted':1,'Expense Claim\u0001Approval Status':'','Expense Claim\u0001Fiscal Year':''}",
- "doctype": "Search Criteria",
- "doc_type": "Expense Claim",
- "name": "__common__",
- "sort_by": "`tabExpense Claim`.`name`",
- "page_len": 50,
- "criteria_name": "Expense Claims",
- "columns": "Expense Claim\u0001ID,Expense Claim\u0001Approval Status,Expense Claim\u0001From Employee,Expense Claim\u0001Employee Name,Expense Claim\u0001Approver,Expense Claim\u0001Posting Date,Expense Claim\u0001Total Claimed Amount,Expense Claim\u0001Total Sanctioned Amount"
- },
- {
- "name": "expense_claims",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/monthly_attendance_details/__init__.py b/hr/search_criteria/monthly_attendance_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/monthly_attendance_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.js b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.js
deleted file mode 100644
index e922a2f..0000000
--- a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// 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/>.
-
-var get_month = function(){
-
- var dict = {0:'Jan', 1:'Feb',2:'Mar',3:'Apr',4:'May',5:'June',6:'July',7:'Aug',8:'Sept',9:'Oct',10:'Nov',11:'Dec'}
- var d = new Date();
- return dict[d.getMonth()]
-
-}
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.add_filter({fieldname:'month', label:'Month', fieldtype:'Select', options:'Jan'+NEWLINE+'Feb'+NEWLINE+'Mar'+NEWLINE+'Apr'+NEWLINE+'May'+NEWLINE+'June'+NEWLINE+'July'+NEWLINE+'Aug'+NEWLINE+'Sept'+NEWLINE+'Oct'+NEWLINE+'Nov'+NEWLINE+'Dec',ignore : 1,parent:'Attendance', single_select:1});
-
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.filter_hide = 0;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.filter_hide = 0;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.filter_hide = 0;
-
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Employee'].df.in_first_page = 1;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df.in_first_page = 1;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df.in_first_page = 1;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df.in_first_page = 1;
-
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Month'].df['report_default'] = get_month();
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Attendance'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
- this.get_filter('Attendance', 'Fiscal Year').set_as_single();
-}
-this.mytabs.items['More Filters'].hide();
-this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py
deleted file mode 100644
index dff95df..0000000
--- a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.py
+++ /dev/null
@@ -1,93 +0,0 @@
-# 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/>.
-
-#add column employee, employee name
-#--------------------------------------------------------------------------------------
-from __future__ import unicode_literals
-col =[['Employee','Link','155px','Employee'],['Employee Name','Data','150px','']]
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
-
- col_idx[c[0]] = len(colnames)-1
-
-
-#get feb months last day
-#--------------------------------------------------------------------------------------
-fy = filter_values.get('fiscal_year')
-month = filter_values.get('month')
-mdict = {'Jan':'01', 'Feb':'02','Mar':'03','Apr':'04','May':'05','June':'06','July':'07','Aug':'08','Sept':'09','Oct':'10','Nov':'11','Dec':'12'}
-
-import webnotes.utils
-from dateutil.relativedelta import relativedelta
-
-ysd = sql("select year_start_date from `tabFiscal Year` where name = '%s' and docstatus !=2"%fy)[0][0]
-
-last_date = webnotes.utils.get_last_day(ysd + relativedelta(months = (cint(ysd.strftime('%m'))>cint(mdict[month]) and (12-cint(ysd.strftime('%m'))+cint(mdict[month])) or (cint(mdict[month]) - cint(ysd.strftime('%m'))))))
-feb = last_date.strftime('%d')
-
-
-
-#get last day and add columns
-#--------------------------------------------------------------------------------------
-dict = {'Jan': 31,'Feb':cint(feb), 'Mar':31,'Apr':30,'May':31,'June':30,'July':31,'Aug':31,'Sept':30,'Oct':31,'Nov':30,'Dec':31}
-
-for i in range(0,dict[month]):
- colnames.append(i+1)
- coltypes.append('Data')
- colwidths.append('25px')
-
- col_idx[c[0]] = len(colnames)-1
-
-#add total present, absent days
-#--------------------------------------------------------------------------------------
-tot_col =[['Total Present Days','Data','120px'],['Total Absent Days','Data','120px']]
-
-for c in tot_col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
-
- col_idx[c[0]] = len(colnames)-1
-
-#get data
-#--------------------------------------------------------------------------------------
-
-
-year = last_date.strftime('%Y')
-out = []
-for r in res:
- p_cnt = a_cnt = 0
-
- for i in range(0,dict[month]):
- new_date = str(year)+'-'+mdict[month]+'-'+((i>=9) and str(i+1) or ('0'+str(i+1)))
-
- chk = sql("select status from `tabAttendance` where employee='%s' and att_date = '%s' and docstatus=1"%(r[0],new_date))
- chk = chk and chk[0][0][0] or '-'
- if chk=='P':
- p_cnt +=1
- elif chk=='A':
- a_cnt +=1
- r.append(chk)
-
- r.append(p_cnt)
- r.append(a_cnt)
-
- if p_cnt or a_cnt:
- out.append(r)
diff --git a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql
deleted file mode 100644
index 762a94f..0000000
--- a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT DISTINCT `tabAttendance`.employee, `tabEmployee`.employee_name FROM `tabAttendance`, `tabEmployee` WHERE `tabEmployee`.name = `tabAttendance`.employee and `tabAttendance`.fiscal_year like '%(fiscal_year)s%%' AND `tabAttendance`.company like '%(company)s%%' AND `tabAttendance`.employee like '%(employee)s%%'
\ No newline at end of file
diff --git a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt b/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
deleted file mode 100644
index abbacae..0000000
--- a/hr/search_criteria/monthly_attendance_details/monthly_attendance_details.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Attendance\u0001Status':'','Attendance\u0001Fiscal Year':''}",
- "doctype": "Search Criteria",
- "doc_type": "Attendance",
- "name": "__common__",
- "sort_by": "`tabAttendance`.`employee`",
- "page_len": 50,
- "criteria_name": "Monthly Attendance Details",
- "columns": "Attendance\u0001Employee"
- },
- {
- "name": "monthly_attendance_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/monthly_salary_register/__init__.py b/hr/search_criteria/monthly_salary_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/monthly_salary_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/monthly_salary_register/monthly_salary_register.py b/hr/search_criteria/monthly_salary_register/monthly_salary_register.py
deleted file mode 100644
index 2291b66..0000000
--- a/hr/search_criteria/monthly_salary_register/monthly_salary_register.py
+++ /dev/null
@@ -1,99 +0,0 @@
-from __future__ import unicode_literals
-colwidths[col_idx['Employee Name']]="120px"
-colwidths[col_idx['Leave Without Pay']] = '120px'
-
-sum_net = total_earning = total_deduction = total_lwp = total_arr = 0
-total = ['Total Net Pay','','']
-
-
-earn_type_lst = sql("select name from `tabEarning Type`")
-
-ded_type_lst = sql("select name from `tabDeduction Type`")
-li=[]
-for lst in earn_type_lst:
-
- li.append(lst[0])
-
-
-
-li.append('Total Earning')
-for lst in ded_type_lst:
-
- li.append(lst[0])
-
-
-li.append('Total Deduction')
-li.append('Net Pay')
-
-
-
-for d in li:
- colnames.append(d)
- colwidths.append("150px")
- coltypes.append("Currency")
- coloptions.append("")
- col_idx[d] = len(colnames)-1
- for r in res:
- r.append("0")
-
-for r in res:
-
- total_lwp += flt(r[col_idx['Leave Without Pay']])
- total_arr += flt(r[col_idx['Arrear Amount']])
-
- for d1 in li:
- d2 = '%s'%d1
-
- earn_ret=webnotes.conn.convert_to_lists(sql("select e_type,e_amount from `tabSalary Slip Earning` where parent = '%s'"%r[col_idx['ID']]))
- ded_ret=webnotes.conn.convert_to_lists(sql("select d_type,d_amount from `tabSalary Slip Deduction` where parent = '%s'"%r[col_idx['ID']]))
-
-
- for e in earn_ret:
- e0 = '%s'%e[0]
- r[col_idx[e0]]=flt(e[1]) or 0.00
-
-
- for d in ded_ret:
- d0 = '%s'%d[0]
- r[col_idx[d0]]=flt(d[1]) or 0.00
-
-
- tot_earn_ded_net_ret = sql("select gross_pay, total_deduction,net_pay from `tabSalary Slip` where name = '%s'"%r[col_idx['ID']])
- if d2 == 'Total Earning':
- r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][0]) or 0
- total_earning += flt(tot_earn_ded_net_ret[0][0]) or 0
- elif d2 == 'Total Deduction':
- r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][1]) or 0
- total_deduction += flt(tot_earn_ded_net_ret[0][1]) or 0
- elif d2 == 'Net Pay':
- r[col_idx[d2]] = flt(tot_earn_ded_net_ret[0][2]) or 0
- sum_net += flt(tot_earn_ded_net_ret[0][2]) or 0
-
-
-total.append(total_lwp)
-total.append(total_arr)
-
-for lst in earn_type_lst:
-
- total_ear = 0
- for r in res:
-
- lst0 = '%s'%lst[0]
- total_ear += flt(r[col_idx[lst0]])
-
- total.append(total_ear)
-
-total.append(total_earning)
-for lst in ded_type_lst:
- total_ded = 0
- for r in res:
- lst0 = '%s'%lst[0]
- total_ded += flt(r[col_idx[lst0]])
-
- total.append(total_ded)
-
-
-total.append(total_deduction)
-total.append(sum_net)
-
-res.append(total)
diff --git a/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt b/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt
deleted file mode 100644
index 2e1db8c..0000000
--- a/hr/search_criteria/monthly_salary_register/monthly_salary_register.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-03-30 14:50:44",
- "modified_by": "Administrator",
- "modified": "2012-04-05 17:23:13"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"Salary Slip\\u0001Submitted\":1,\"Salary Slip\\u0001Company\":[\"\"],\"Salary Slip\\u0001Month\":[\"\"]}",
- "doctype": "Search Criteria",
- "doc_type": "Salary Slip",
- "name": "__common__",
- "sort_by": "`tabSalary Slip`.`name`",
- "page_len": 50,
- "criteria_name": "Monthly Salary Register",
- "columns": "Salary Slip\u0001ID,Salary Slip\u0001Employee,Salary Slip\u0001Employee Name,Salary Slip\u0001Leave Without Pay,Salary Slip\u0001Arrear Amount"
- },
- {
- "name": "monthly_salary_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py b/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/new_or_left_employees_for_a_month/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js b/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js
deleted file mode 100644
index e6dc267..0000000
--- a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.js
+++ /dev/null
@@ -1,66 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- var d = new Date();
-
- var month=["January","February","March","April","May","June","July","August","September","October","November","December"]
-
- this.add_filter({fieldname:'month', label:'Month',fieldtype:'Select', options:"January"+NEWLINE+"February"+NEWLINE+"March"+NEWLINE+"April"+NEWLINE+"May"+NEWLINE+"June"+NEWLINE+"July"+NEWLINE+"August"+NEWLINE+"September"+NEWLINE+"October"+NEWLINE+"November"+NEWLINE+"December",report_default : month[d.getMonth()],ignore : 1, parent:'Employee'});
-
- this.filter_fields_dict['Employee'+FILTER_SEP +'Month'].df.in_first_page = 1;
- this.filter_fields_dict['Employee'+FILTER_SEP +'Status'].df.in_first_page = 1;
- this.filter_fields_dict['Employee'+FILTER_SEP +'Status'].df.report_default = 'Active';
-
- this.add_filter({fieldname:'year', label:'Year',fieldtype:'Select', options:"2000"+NEWLINE+"2001"+NEWLINE+"2002"+NEWLINE+"2003"+NEWLINE+"2004"+NEWLINE+"2005"+NEWLINE+"2006"+NEWLINE+"2007"+NEWLINE+"2008"+NEWLINE+"2009"+NEWLINE+"2010"+NEWLINE+"2011",report_default : d.getFullYear(),ignore : 1, parent:'Employee'});
-
- this.filter_fields_dict['Employee'+FILTER_SEP +'Year'].df.in_first_page = 1;
-}
-
-report.get_query = function() {
-
- emp_month = this.filter_fields_dict['Employee'+FILTER_SEP+'Month'].get_value();
- emp_year = this.filter_fields_dict['Employee'+FILTER_SEP+'Year'].get_value();
- emp_status = this.filter_fields_dict['Employee'+FILTER_SEP+'Status'].get_value();
-
- // month and year mandatory
- if ((emp_month == '') || (emp_year == '')) {
- alert("Please enter Month and Year");
- return;
- }
-
- month={"January":"1", "February":"2", "March":"3", "April":"4","May":"5", "June":"6", "July":"7","August":"8", "September":"9", "October":"10", "November":"11", "December":"12"}
-
- mnt = ''
- for(m=0; m<emp_month.length;m++){
- if(mnt== '') mnt = "("+month[emp_month[m]];
- else mnt +=", "+month[emp_month[m]];
- }
- mnt +=")"
- c1 = '(MONTH(t1.date_of_joining) in '+mnt+' AND YEAR(t1.date_of_joining) = "'+emp_year+'")';
- c2 = '(MONTH(t1.relieving_date) in '+mnt+' AND YEAR(t1.relieving_date) = "'+emp_year+'")';
-
- if(emp_status == 'Active')
- cond = c1;
- else if (emp_status == 'Left')
- cond = c2;
- else
- cond = c1 + ' OR '+c2;
-
- var q = 'SELECT t1.name AS "ID", t1.employee_name AS "Employee Name", t1.employee_number AS "Employee Number" FROM `tabEmployee` t1 WHERE '+cond;
-
- return q;
-}
diff --git a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py b/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py
deleted file mode 100644
index 7d5feca..0000000
--- a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.py
+++ /dev/null
@@ -1,60 +0,0 @@
-# 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
-status = filter_values.get('status')
-month = filter_values.get('month')
-
-
-if status == 'Active' and not status == 'Left':
- col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Employment Type','Link','Employment Type'],['Scheduled Confirmation Date','Data',''],['Final Confirmation Date','Data',''],['Contract End Date','Data',''],['Branch','Link','Branch'],['Department','Link','Department'],['Designation','Link','Designation'],['Reports to','Link','Employee'],['Grade','Link','Grade']]
-
-elif status == 'Left' and not status == 'Active':
- col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Resignation Letter Date','Data',''],['Relieving Date','Data',''],['Notice - Number of Days','Data',''],['Reason for Leaving','Data',''],['Leave Encashed?','Data',''],['Encashment Date','Data',''],['Reason for Resignation','Data','']]
-
-else:
- col = [['Employee', 'Link', 'Employee'], ['Employee Name', 'Data', ''], ['Employee Number', 'Data', ''], ['Employment Type','Link','Employment Type'],['Scheduled Confirmation Date','Data',''],['Final Confirmation Date','Data',''],['Contract End Date','Data',''],['Branch','Link','Branch'],['Department','Link','Department'],['Designation','Link','Designation'],['Reports to','Link','Employee'],['Grade','Link','Grade'],['Resignation Letter Date','Data',''],['Relieving Date','Data',''],['Notice - Number of Days','Data',''],['Reason for Leaving','Data',''],['Leave Encashed?','Data',''],['Encashment Date','Data',''],['Reason for Resignation','Data','']]
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append('150px')
- coloptions.append(c[2])
-
- col_idx[c[0]] = len(colnames)-1
-
-
-for c in range(0,len(colnames)):
- l = (len(colnames[c])*9)
- if l < 150 : col_width = '150px'
- else: col_width = '%spx'%(l)
-
- colwidths[c] = col_width
-
-for r in res:
-
- if status == 'Active':
- ret = sql("select employment_type,scheduled_confirmation_date,final_confirmation_date,contract_end_date,branch,department,designation,reports_to,grade from `tabEmployee` where name = %s",r[0])
-
- elif status == 'Left':
- ret = sql("select resignation_letter_date,relieving_date,notice_number_of_days,reason_for_leaving,leave_encashed,encashment_date,reason_for_resignation from `tabEmployee` where name =%s",r[0])
-
- else:
- ret = sql("select employment_type,scheduled_confirmation_date,final_confirmation_date,contract_end_date,branch,department,designation,reports_to,grade,resignation_letter_date,relieving_date,notice_number_of_days,reason_for_leaving,leave_encashed,encashment_date,reason_for_resignation from `tabEmployee` where name = %s",r[0])
-
- ret = ret and ret[0] or []
- for t in ret:
- r.append(cstr(t))
diff --git a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt b/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
deleted file mode 100644
index 86d09b5..0000000
--- a/hr/search_criteria/new_or_left_employees_for_a_month/new_or_left_employees_for_a_month.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Employee\u0001Saved':1,'Employee\u0001Submitted':1,'Employee\u0001Gender':'','Employee\u0001Month of Birth':'','Employee\u0001Status':''}",
- "doctype": "Search Criteria",
- "doc_type": "Employee",
- "name": "__common__",
- "sort_by": "`tabEmployee`.`name`",
- "page_len": 50,
- "criteria_name": "New or left employees for a month",
- "columns": "Employee\u0001ID"
- },
- {
- "name": "new_or_left_employees_for_a_month",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/salary_register/__init__.py b/hr/search_criteria/salary_register/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/salary_register/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/salary_register/salary_register.js b/hr/search_criteria/salary_register/salary_register.js
deleted file mode 100644
index c451b27..0000000
--- a/hr/search_criteria/salary_register/salary_register.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- fld_lst = ['ID','Employee']
-
- for(var i = 0; i<fld_lst.length; i++){
- this.filter_fields_dict['Salary Slip'+FILTER_SEP +fld_lst[i]].df.in_first_page = 1;
- }
-
-}
-this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/hr/search_criteria/salary_register/salary_register.py b/hr/search_criteria/salary_register/salary_register.py
deleted file mode 100644
index d1d3e99..0000000
--- a/hr/search_criteria/salary_register/salary_register.py
+++ /dev/null
@@ -1,77 +0,0 @@
-# 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
-sal_slips_ids = ''
-for r in res:
- if not sal_slips_ids == '': sal_slips_ids +=","
- sal_slips_ids+="'%s'"%r[col_idx['ID']]
-
-earn_heads, ded_heads = [], []
-if res:
- earn_heads =[i[0] for i in sql("select distinct e_type from `tabSalary Slip Earning` where parent in (%s)"%sal_slips_ids)]
- ded_heads =[i[0] for i in sql("select distinct d_type from `tabSalary Slip Deduction` where parent in (%s)"%sal_slips_ids)]
-
-col=[]
-for e in earn_heads:
- l = (len(cstr(e))*9)
- if l < 150 :
- col_width = '150px'
- else:
- col_width = '%spx'%(l)
- col.append([e,'Currency',col_width,''])
-
-col.append(['Arrear Amount','Currency','150px',''])
-col.append(['Encashment Amount','Currency','170px',''])
-col.append(['Gross Pay','Currency','150px',''])
-for d in ded_heads:
- l = (len(cstr(d))*9)
- if l < 150 : col_width = '150px'
- else: col_width = '%spx'%(l)
- col.append([d,'Currency',col_width,''])
-
-col.append(['Total Deduction','Currency','150px',''])
-col.append(['Net Pay','Currency','150px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)
-
-grand_tot = 0
-for r in res:
- for i in range(6,len(colnames)):
- if colnames[i] not in ('Arrear Amount','Encashment Amount','Net Pay','Gross Pay','Total Deduction'):
- amt = sql("select e_modified_amount from `tabSalary Slip Earning` where e_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
- if not amt:
- amt = sql("select d_modified_amount from `tabSalary Slip Deduction` where d_type = '%s' and parent = '%s'"%(colnames[i],r[0]))
- amt = amt and amt[0][0] or 0
- r.append(flt(amt))
-
- else:
- fld_nm = cstr(colnames[i]).lower().replace(' ','_')
- tot = sql("select %s from `tabSalary Slip` where name ='%s'"%(fld_nm,r[0]))
- tot = tot and flt(tot[0][0]) or 0
- if colnames[i] == 'Net Pay':
- grand_tot += tot
- r.append(tot)
-
-gt_row = ['' for i in range(len(colnames))]
-gt_row[col_idx['Employee Name']] = '<b>Grand Totals</b>'
-gt_row[col_idx['Net Pay']-1] = grand_tot
-res.append(gt_row)
\ No newline at end of file
diff --git a/hr/search_criteria/salary_register/salary_register.txt b/hr/search_criteria/salary_register/salary_register.txt
deleted file mode 100644
index aab7f25..0000000
--- a/hr/search_criteria/salary_register/salary_register.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Salary Slip\u0001Submitted':1,'Salary Slip\u0001Month':''}",
- "doctype": "Search Criteria",
- "doc_type": "Salary Slip",
- "name": "__common__",
- "sort_by": "`tabSalary Slip`.`name`",
- "page_len": 50,
- "criteria_name": "Salary Register",
- "columns": "Salary Slip\u0001ID,Salary Slip\u0001Employee,Salary Slip\u0001Employee Name,Salary Slip\u0001Year,Salary Slip\u0001Month,Salary Slip\u0001Total days in month,Salary Slip\u0001Payment days"
- },
- {
- "name": "salary_register",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/salary_slips/__init__.py b/hr/search_criteria/salary_slips/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/salary_slips/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/salary_slips/salary_slips.txt b/hr/search_criteria/salary_slips/salary_slips.txt
deleted file mode 100644
index e1bcccf..0000000
--- a/hr/search_criteria/salary_slips/salary_slips.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Salary Slip\u0001Saved':1,'Salary Slip\u0001Submitted':1}",
- "doctype": "Search Criteria",
- "doc_type": "Salary Slip",
- "name": "__common__",
- "sort_by": "`tabSalary Slip`.`name`",
- "page_len": 50,
- "criteria_name": "Salary Slips",
- "columns": "Salary Slip\u0001ID,Salary Slip\u0001Fiscal Year,Salary Slip\u0001Month,Salary Slip\u0001Employee,Salary Slip\u0001Employee Name,Salary Slip\u0001Department,Salary Slip\u0001Designation,Salary Slip\u0001Branch,Salary Slip\u0001Grade,Salary Slip\u0001PF No.,Salary Slip\u0001ESIC No.,Salary Slip\u0001Leave Without Pay,Salary Slip\u0001Bank Name,Salary Slip\u0001Bank Account No.,Salary Slip\u0001Payment days,Salary Slip\u0001Arrear Amount,Salary Slip\u0001Encashment Amount,Salary Slip\u0001Gross Pay,Salary Slip\u0001Total Deduction,Salary Slip\u0001Net Pay"
- },
- {
- "name": "salary_slips",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/hr/search_criteria/salary_structure_details/__init__.py b/hr/search_criteria/salary_structure_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/hr/search_criteria/salary_structure_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/hr/search_criteria/salary_structure_details/salary_structure_details.txt b/hr/search_criteria/salary_structure_details/salary_structure_details.txt
deleted file mode 100644
index c1ed01b..0000000
--- a/hr/search_criteria/salary_structure_details/salary_structure_details.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "HR",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Salary Structure\u0001Branch':'','Salary Structure\u0001Designation':'','Salary Structure\u0001Department':'','Salary Structure\u0001Grade':'','Salary Structure\u0001Is Active':''}",
- "doctype": "Search Criteria",
- "doc_type": "Salary Structure",
- "name": "__common__",
- "sort_by": "`tabSalary Structure`.`name`",
- "page_len": 50,
- "criteria_name": "Salary Structure Details",
- "columns": "Salary Structure\u0001ID,Salary Structure\u0001Employee,Salary Structure\u0001From Date,Salary Structure\u0001To Date,Salary Structure\u0001Fiscal Year,Salary Structure\u0001Branch,Salary Structure\u0001Designation,Salary Structure\u0001Department,Salary Structure\u0001Grade,Salary Structure\u0001Is Active,Salary Structure\u0001Total Earning,Salary Structure\u0001Total Deduction,Salary Structure\u0001CTC,Salary Structure\u0001Total"
- },
- {
- "name": "salary_structure_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom/bom.js b/manufacturing/doctype/bom/bom.js
index 4e8fbc9..b1f43f7 100644
--- a/manufacturing/doctype/bom/bom.js
+++ b/manufacturing/doctype/bom/bom.js
@@ -59,27 +59,22 @@
set_operation_no(doc);
}
-cur_frm.cscript.item = function(doc, dt, dn) {
- if (doc.item) {
- get_server_fields('get_item_details', doc.item, '', doc, dt, dn, 1);
- }
-}
+cur_frm.add_fetch("item", "description", "description");
+cur_frm.add_fetch("item", "stock_uom", "uom");
cur_frm.cscript.workstation = function(doc,dt,dn) {
var d = locals[dt][dn];
- if (d.workstation) {
- var callback = function(r, rt) {
- calculate_op_cost(doc, dt, dn);
- calculate_total(doc);
- }
- get_server_fields('get_workstation_details', d.workstation,
- 'bom_operations', doc, dt, dn, 1, callback);
- }
+ wn.model.with_doc("Workstation", d.workstation, function(i, r) {
+ d.hour_rate = r.docs[0].hour_rate;
+ refresh_field("hour_rate", dn, "bom_operations");
+ calculate_op_cost(doc);
+ calculate_total(doc);
+ });
}
cur_frm.cscript.hour_rate = function(doc, dt, dn) {
- calculate_op_cost(doc, dt, dn);
+ calculate_op_cost(doc);
calculate_total(doc);
}
@@ -114,7 +109,7 @@
$.extend(d, r.message);
refresh_field("bom_materials");
doc = locals[doc.doctype][doc.name];
- calculate_rm_cost(doc, cdt, cdn);
+ calculate_rm_cost(doc);
calculate_total(doc);
},
freeze: true
@@ -124,7 +119,7 @@
cur_frm.cscript.qty = function(doc, cdt, cdn) {
- calculate_rm_cost(doc, cdt, cdn);
+ calculate_rm_cost(doc);
calculate_total(doc);
}
@@ -134,12 +129,12 @@
msgprint("You can not change rate if BOM mentioned agianst any item");
get_bom_material_detail(doc, cdt, cdn);
} else {
- calculate_rm_cost(doc, cdt, cdn);
+ calculate_rm_cost(doc);
calculate_total(doc);
}
}
-var calculate_op_cost = function(doc, dt, dn) {
+var calculate_op_cost = function(doc) {
var op = getchildren('BOM Operation', doc.name, 'bom_operations');
total_op_cost = 0;
for(var i=0;i<op.length;i++) {
@@ -151,7 +146,7 @@
refresh_field('operating_cost');
}
-var calculate_rm_cost = function(doc, dt, dn) {
+var calculate_rm_cost = function(doc) {
var rm = getchildren('BOM Item', doc.name, 'bom_materials');
total_rm_cost = 0;
for(var i=0;i<rm.length;i++) {
@@ -201,7 +196,7 @@
}
cur_frm.cscript.validate = function(doc, dt, dn) {
- calculate_op_cost(doc, dt, dn);
- calculate_rm_cost(doc, dt, dn);
+ calculate_op_cost(doc);
+ calculate_rm_cost(doc);
calculate_total(doc);
}
diff --git a/manufacturing/doctype/bom/bom.py b/manufacturing/doctype/bom/bom.py
index 75bf305..5f64148 100644
--- a/manufacturing/doctype/bom/bom.py
+++ b/manufacturing/doctype/bom/bom.py
@@ -32,9 +32,10 @@
def autoname(self):
last_name = sql("""select max(name) from `tabBOM`
- where name like 'BOM/%s/%%'""" % self.doc.item)
+ where name like "BOM/%s/%%" """ % cstr(self.doc.item).replace('"', '\\"'))
if last_name:
- idx = cint(cstr(last_name[0][0]).split('/')[-1]) + 1
+ idx = cint(cstr(last_name[0][0]).split('/')[-1].split('-')[0]) + 1
+
else:
idx = 1
self.doc.name = 'BOM/' + self.doc.item + ('/%.3i' % idx)
@@ -44,10 +45,11 @@
self.validate_main_item()
self.validate_operations()
self.validate_materials()
+ self.set_bom_material_details()
+ self.calculate_cost()
def on_update(self):
self.check_recursion()
- self.calculate_cost()
self.update_exploded_items()
self.doc.save()
@@ -67,21 +69,13 @@
self.manage_default_bom()
def get_item_det(self, item_code):
- item = sql("""select name, is_asset_item, is_purchase_item, docstatus, description,
- is_sub_contracted_item, stock_uom, default_bom,
+ item = webnotes.conn.sql("""select name, is_asset_item, is_purchase_item,
+ docstatus, description, is_sub_contracted_item, stock_uom, default_bom,
last_purchase_rate, standard_rate, is_manufactured_item
- from `tabItem` where item_code = %s""", item_code, as_dict = 1)
+ from `tabItem` where name=%s""", item_code, as_dict = 1)
return item
-
- def get_item_details(self, item_code):
- res = sql("""select description, stock_uom as uom
- from `tabItem` where item_code = %s""", item_code, as_dict = 1)
- return res and res[0] or {}
-
- def get_workstation_details(self,workstation):
- return {'hour_rate': webnotes.conn.get_value("Workstation", workstation, "hour_rate")}
-
+
def validate_rm_item(self, item):
if item[0]['name'] == self.doc.item:
msgprint("Item_code: %s in materials tab cannot be same as FG Item",
@@ -89,32 +83,42 @@
if not item or item[0]['docstatus'] == 2:
msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
-
- def get_bom_material_detail(self):
+
+ def set_bom_material_details(self):
+ for item in self.doclist.get({"parentfield": "bom_materials"}):
+ ret = self.get_bom_material_detail({ "item_code": item.item_code, "bom_no": item.bom_no,
+ "qty": item.qty })
+
+ for r in ret:
+ if not item.fields.get(r):
+ item.fields[r] = ret[r]
+
+ def get_bom_material_detail(self, args=None):
""" Get raw material details like uom, desc and rate"""
- arg = webnotes.form_dict.get('args')
- import json
- arg = json.loads(arg)
-
- item = self.get_item_det(arg['item_code'])
+ if not args:
+ args = webnotes.form_dict.get('args')
+ import json
+ args = json.loads(args)
+
+ item = self.get_item_det(args['item_code'])
self.validate_rm_item(item)
- arg['bom_no'] = arg['bom_no'] or item and cstr(item[0]['default_bom']) or ''
- arg.update(item[0])
+ args['bom_no'] = args['bom_no'] or item and cstr(item[0]['default_bom']) or ''
+ args.update(item[0])
- rate = self.get_rm_rate(arg)
+ rate = self.get_rm_rate(args)
ret_item = {
- 'description' : item and arg['description'] or '',
- 'stock_uom' : item and arg['stock_uom'] or '',
- 'bom_no' : arg['bom_no'],
+ 'description' : item and args['description'] or '',
+ 'stock_uom' : item and args['stock_uom'] or '',
+ 'bom_no' : args['bom_no'],
'rate' : rate
}
return ret_item
def get_rm_rate(self, arg):
""" Get raw material rate as per selected method, if bom exists takes bom cost """
-
+ rate = 0
if arg['bom_no']:
rate = self.get_bom_unitcost(arg['bom_no'])
elif arg and (arg['is_purchase_item'] == 'Yes' or arg['is_sub_contracted_item'] == 'Yes'):
@@ -183,11 +187,14 @@
if not item:
msgprint("Item %s does not exists in the system or expired." %
self.doc.item, raise_exception = 1)
-
elif item[0]['is_manufactured_item'] != 'Yes' \
and item[0]['is_sub_contracted_item'] != 'Yes':
msgprint("""As Item: %s is not a manufactured / sub-contracted item, \
you can not make BOM for it""" % self.doc.item, raise_exception = 1)
+ else:
+ ret = webnotes.conn.get_value("Item", self.doc.item, ["description", "stock_uom"])
+ self.doc.description = ret[0]
+ self.doc.uom = ret[1]
def validate_operations(self):
""" Check duplicate operation no"""
@@ -209,7 +216,7 @@
msgprint("""Operation no: %s against item: %s at row no: %s \
is not present at Operations table""" %
(m.operation_no, m.item_code, m.idx), raise_exception = 1)
-
+
item = self.get_item_det(m.item_code)
if item[0]['is_manufactured_item'] == 'Yes':
if not m.bom_no:
@@ -259,22 +266,27 @@
for b in boms:
if b[0] == self.doc.name:
msgprint("""Recursion Occured => '%s' cannot be '%s' of '%s'.
- """ % (cstr(b), cstr(d[2]), self.doc.name), raise_exception = 1)
+ """ % (cstr(b[0]), cstr(d[2]), self.doc.name), raise_exception = 1)
if b[0]:
bom_list.append(b[0])
- def update_cost_and_exploded_items(self):
- bom_list = self.traverse_tree()
+ def update_cost_and_exploded_items(self, bom_list=[]):
+ bom_list = self.traverse_tree(bom_list)
for bom in bom_list:
bom_obj = get_obj("BOM", bom, with_children=1)
bom_obj.on_update()
- def traverse_tree(self):
+ return bom_list
+
+ def traverse_tree(self, bom_list=[]):
def _get_children(bom_no):
return [cstr(d[0]) for d in webnotes.conn.sql("""select bom_no from `tabBOM Item`
where parent = %s and ifnull(bom_no, '') != ''""", bom_no)]
- bom_list, count = [self.doc.name], 0
+ count = 0
+ if self.doc.name not in bom_list:
+ bom_list.append(self.doc.name)
+
while(count < len(bom_list)):
for child_bom in _get_children(bom_list[count]):
if child_bom not in bom_list:
@@ -293,9 +305,10 @@
"""Update workstation rate and calculates totals"""
total_op_cost = 0
for d in getlist(self.doclist, 'bom_operations'):
+ if d.workstation and not d.hour_rate:
+ d.hour_rate = webnotes.conn.get_value("Workstation", d.workstation, "hour_rate")
if d.hour_rate and d.time_in_mins:
d.operating_cost = flt(d.hour_rate) * flt(d.time_in_mins) / 60.0
- d.save()
total_op_cost += flt(d.operating_cost)
self.doc.operating_cost = total_op_cost
@@ -307,7 +320,6 @@
d.rate = self.get_bom_unitcost(d.bom_no)
d.amount = flt(d.rate) * flt(d.qty)
d.qty_consumed_per_unit = flt(d.qty) / flt(self.doc.quantity)
- d.save()
total_rm_cost += d.amount
self.doc.raw_material_cost = total_rm_cost
@@ -318,52 +330,50 @@
def get_exploded_items(self):
""" Get all raw materials including items from child bom"""
- self.cur_exploded_items = []
+ self.cur_exploded_items = {}
for d in getlist(self.doclist, 'bom_materials'):
if d.bom_no:
self.get_child_exploded_items(d.bom_no, d.qty)
else:
- self.cur_exploded_items.append({
+ self.add_to_cur_exploded_items(webnotes._dict({
'item_code' : d.item_code,
'description' : d.description,
'stock_uom' : d.stock_uom,
'qty' : flt(d.qty),
- 'rate' : flt(d.rate),
- 'amount' : flt(d.amount),
- 'parent_bom' : d.parent,
- 'mat_detail_no' : d.name,
- 'qty_consumed_per_unit' : flt(d.qty_consumed_per_unit)
- })
+ 'rate' : flt(d.rate),
+ }))
+
+ def add_to_cur_exploded_items(self, args):
+ if self.cur_exploded_items.get(args.item_code):
+ self.cur_exploded_items[args.item_code]["qty"] += args.qty
+ else:
+ self.cur_exploded_items[args.item_code] = args
def get_child_exploded_items(self, bom_no, qty):
""" Add all items from Flat BOM of child BOM"""
child_fb_items = sql("""select item_code, description, stock_uom, qty, rate,
- amount, parent_bom, mat_detail_no, qty_consumed_per_unit
- from `tabBOM Explosion Item` where parent = '%s' and docstatus = 1""" %
- bom_no, as_dict = 1)
+ qty_consumed_per_unit from `tabBOM Explosion Item`
+ where parent = %s and docstatus = 1""", bom_no, as_dict = 1)
+
for d in child_fb_items:
- self.cur_exploded_items.append({
+ self.add_to_cur_exploded_items(webnotes._dict({
'item_code' : d['item_code'],
'description' : d['description'],
'stock_uom' : d['stock_uom'],
'qty' : flt(d['qty_consumed_per_unit'])*qty,
- 'rate' : flt(d['rate']),
- 'amount' : flt(d['amount']),
- 'parent_bom' : d['parent_bom'],
- 'mat_detail_no' : d['mat_detail_no'],
- 'qty_consumed_per_unit' : flt(d['qty_consumed_per_unit'])*qty/flt(self.doc.quantity)
-
- })
+ 'rate' : flt(d['rate']),
+ }))
def add_exploded_items(self):
"Add items to Flat BOM table"
self.doclist = self.doc.clear_table(self.doclist, 'flat_bom_details', 1)
for d in self.cur_exploded_items:
- ch = addchild(self.doc, 'flat_bom_details', 'BOM Explosion Item',
- self.doclist)
- for i in d.keys():
- ch.fields[i] = d[i]
+ ch = addchild(self.doc, 'flat_bom_details', 'BOM Explosion Item', self.doclist)
+ for i in self.cur_exploded_items[d].keys():
+ ch.fields[i] = self.cur_exploded_items[d][i]
+ ch.amount = flt(ch.qty) * flt(ch.rate)
+ ch.qty_consumed_per_unit = flt(ch.qty) / flt(self.doc.quantity)
ch.docstatus = self.doc.docstatus
ch.save(1)
diff --git a/manufacturing/doctype/bom/test_bom.py b/manufacturing/doctype/bom/test_bom.py
index e742c0c..cb91e78 100644
--- a/manufacturing/doctype/bom/test_bom.py
+++ b/manufacturing/doctype/bom/test_bom.py
@@ -48,134 +48,4 @@
"stock_uom": "No."
}
]
-]
-
-
-
-# import webnotes.model
-# from webnotes.utils import nowdate, flt
-# from accounts.utils import get_fiscal_year
-# from webnotes.model.doclist import DocList
-# import copy
-#
-# company = webnotes.conn.get_default("company")
-#
-#
-# def load_data():
-#
-# # create default warehouse
-# if not webnotes.conn.exists("Warehouse", "Default Warehouse"):
-# webnotes.insert({"doctype": "Warehouse",
-# "warehouse_name": "Default Warehouse",
-# "warehouse_type": "Stores"})
-#
-# # create UOM: Nos.
-# if not webnotes.conn.exists("UOM", "Nos"):
-# webnotes.insert({"doctype": "UOM", "uom_name": "Nos"})
-#
-# from webnotes.tests import insert_test_data
-# # create item groups and items
-# insert_test_data("Item Group",
-# sort_fn=lambda ig: (ig[0].get('parent_item_group'), ig[0].get('name')))
-# insert_test_data("Item")
-#
-# base_bom_fg = [
-# {"doctype": "BOM", "item": "Android Jack D", "quantity": 1,
-# "is_active": "Yes", "is_default": 1, "uom": "Nos"},
-# {"doctype": "BOM Operation", "operation_no": 1, "parentfield": "bom_operations",
-# "opn_description": "Development", "hour_rate": 10, "time_in_mins": 90},
-# {"doctype": "BOM Item", "item_code": "Home Desktop 300", "operation_no": 1,
-# "qty": 2, "rate": 20, "stock_uom": "Nos", "parentfield": "bom_materials"},
-# {"doctype": "BOM Item", "item_code": "Home Desktop 100", "operation_no": 1,
-# "qty": 1, "rate": 300, "stock_uom": "Nos", "parentfield": "bom_materials"},
-# {"doctype": "BOM Item", "item_code": "Nebula 7", "operation_no": 1,
-# "qty": 5, "stock_uom": "Nos", "parentfield": "bom_materials"},
-# ]
-#
-# base_bom_child = [
-# {"doctype": "BOM", "item": "Nebula 7", "quantity": 5,
-# "is_active": "Yes", "is_default": 1, "uom": "Nos"},
-# {"doctype": "BOM Operation", "operation_no": 1, "parentfield": "bom_operations",
-# "opn_description": "Development"},
-# {"doctype": "BOM Item", "item_code": "Android Jack S", "operation_no": 1,
-# "qty": 10, "stock_uom": "Nos", "parentfield": "bom_materials"}
-# ]
-#
-# base_bom_grandchild = [
-# {"doctype": "BOM", "item": "Android Jack S", "quantity": 1,
-# "is_active": "Yes", "is_default": 1, "uom": "Nos"},
-# {"doctype": "BOM Operation", "operation_no": 1, "parentfield": "bom_operations",
-# "opn_description": "Development"},
-# {"doctype": "BOM Item", "item_code": "Home Desktop 300", "operation_no": 1,
-# "qty": 3, "rate": 10, "stock_uom": "Nos", "parentfield": "bom_materials"}
-# ]
-#
-#
-# class TestPurchaseReceipt(unittest.TestCase):
-# def setUp(self):
-# webnotes.conn.begin()
-# load_data()
-#
-# def test_bom_validation(self):
-# # show throw error bacause bom no missing for sub-assembly item
-# bom_fg = copy.deepcopy(base_bom_fg)
-# self.assertRaises(webnotes.ValidationError, webnotes.insert, DocList(bom_fg))
-#
-# # main item is not a manufacturing item
-# bom_fg = copy.deepcopy(base_bom_fg)
-# bom_fg[0]["item"] = "Home Desktop 200"
-# bom_fg.pop(4)
-# self.assertRaises(webnotes.ValidationError, webnotes.insert, DocList(bom_fg))
-#
-# # operation no mentioed in material table not matching with operation table
-# bom_fg = copy.deepcopy(base_bom_fg)
-# bom_fg.pop(4)
-# bom_fg[2]["operation_no"] = 2
-# self.assertRaises(webnotes.ValidationError, webnotes.insert, DocList(bom_fg))
-#
-#
-# def test_bom(self):
-# gc_wrapper = webnotes.insert(DocList(base_bom_grandchild))
-# gc_wrapper.submit()
-#
-# bom_child = copy.deepcopy(base_bom_child)
-# bom_child[2]["bom_no"] = gc_wrapper.doc.name
-# child_wrapper = webnotes.insert(DocList(bom_child))
-# child_wrapper.submit()
-#
-# bom_fg = copy.deepcopy(base_bom_fg)
-# bom_fg[4]["bom_no"] = child_wrapper.doc.name
-# fg_wrapper = webnotes.insert(DocList(bom_fg))
-# fg_wrapper.load_from_db()
-#
-# self.check_bom_cost(fg_wrapper)
-#
-# self.check_flat_bom(fg_wrapper, child_wrapper, gc_wrapper)
-#
-# def check_bom_cost(self, fg_wrapper):
-# expected_values = {
-# "operating_cost": 15,
-# "raw_material_cost": 640,
-# "total_cost": 655
-# }
-#
-# for key in expected_values:
-# self.assertEqual(flt(expected_values[key]), flt(fg_wrapper.doc.fields.get(key)))
-#
-# def check_flat_bom(self, fg_wrapper, child_wrapper, gc_wrapper):
-# expected_flat_bom_items = {
-# ("Home Desktop 300", fg_wrapper.doc.name): (2, 20),
-# ("Home Desktop 100", fg_wrapper.doc.name): (1, 300),
-# ("Home Desktop 300", gc_wrapper.doc.name): (30, 10)
-# }
-#
-# self.assertEqual(len(fg_wrapper.doclist.get({"parentfield": "flat_bom_details"})), 3)
-#
-# for key, val in expected_flat_bom_items.items():
-# flat_bom = fg_wrapper.doclist.get({"parentfield": "flat_bom_details",
-# "item_code": key[0], "parent_bom": key[1]})[0]
-# self.assertEqual(val, (flat_bom.qty, flat_bom.rate))
-#
-#
-# def tearDown(self):
-# webnotes.conn.rollback()
\ No newline at end of file
+]
\ No newline at end of file
diff --git a/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt b/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt
index 07aad7d..3808cdf 100644
--- a/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt
+++ b/manufacturing/doctype/bom_explosion_item/bom_explosion_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:27:48",
+ "creation": "2013-03-07 11:42:57",
"docstatus": 0,
- "modified": "2013-03-07 07:03:18",
+ "modified": "2013-06-04 13:13:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -82,25 +82,6 @@
},
{
"doctype": "DocField",
- "fieldname": "parent_bom",
- "fieldtype": "Link",
- "hidden": 0,
- "label": "Parent BOM",
- "oldfieldname": "parent_bom",
- "oldfieldtype": "Link",
- "options": "BOM",
- "print_width": "250px",
- "width": "250px"
- },
- {
- "doctype": "DocField",
- "fieldname": "mat_detail_no",
- "fieldtype": "Data",
- "hidden": 1,
- "label": "Mat Detail No"
- },
- {
- "doctype": "DocField",
"fieldname": "qty_consumed_per_unit",
"fieldtype": "Float",
"hidden": 0,
diff --git a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
index 177adcd..e69c487 100644
--- a/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
+++ b/manufacturing/doctype/bom_replace_tool/bom_replace_tool.py
@@ -29,9 +29,10 @@
self.validate_bom()
self.update_new_bom()
bom_list = self.get_parent_boms()
+ updated_bom = []
for bom in bom_list:
bom_obj = get_obj("BOM", bom, with_children=1)
- bom_obj.update_cost_and_exploded_items()
+ updated_bom = bom_obj.update_cost_and_exploded_items(updated_bom)
webnotes.msgprint(_("BOM replaced"))
@@ -46,11 +47,7 @@
webnotes.conn.sql("""update `tabBOM Item` set bom_no=%s,
rate=%s, amount=qty*%s where bom_no = %s and docstatus < 2""",
(self.doc.new_bom, current_bom_unitcost, current_bom_unitcost, self.doc.current_bom))
-
- def get_parent_boms(bom_no):
- return [d[0] for d in webnotes.conn.sql("""select distinct parent from
- `tabBOM Item` where ifnull(bom_no, '')=%s and docstatus < 2""", bom_no)]
-
+
def get_parent_boms(self):
return [d[0] for d in webnotes.conn.sql("""select distinct parent
from `tabBOM Item` where ifnull(bom_no, '') = %s and docstatus < 2""",
diff --git a/manufacturing/doctype/production_order/production_order.py b/manufacturing/doctype/production_order/production_order.py
index a0498e0..c76a87f 100644
--- a/manufacturing/doctype/production_order/production_order.py
+++ b/manufacturing/doctype/production_order/production_order.py
@@ -18,9 +18,6 @@
import webnotes
from webnotes.utils import cstr, flt, now, nowdate
-from webnotes.model import db_exists
-from webnotes.model.doc import make_autoname
-from webnotes.model.bean import copy_doclist
from webnotes.model.code import get_obj
from webnotes import msgprint
diff --git a/manufacturing/doctype/production_planning_tool/production_planning_tool.py b/manufacturing/doctype/production_planning_tool/production_planning_tool.py
index 1686478..ed7f7bf 100644
--- a/manufacturing/doctype/production_planning_tool/production_planning_tool.py
+++ b/manufacturing/doctype/production_planning_tool/production_planning_tool.py
@@ -241,40 +241,30 @@
def get_raw_materials(self, bom_dict):
""" Get raw materials considering sub-assembly items
{
- "item_code": [qty_required, description, stock_uom]
+ "item_code": [qty_required, description, stock_uom, min_order_qty]
}
"""
for bom in bom_dict:
if self.doc.use_multi_level_bom:
# get all raw materials with sub assembly childs
- fl_bom_items = sql("""
- select
- item_code,ifnull(sum(qty_consumed_per_unit),0)*%s as qty,
- description, stock_uom, min_order_qty
- from
- (
- select distinct fb.name, fb.description, fb.item_code,
- fb.qty_consumed_per_unit, fb.stock_uom, it.min_order_qty
- from `tabBOM Explosion Item` fb,`tabItem` it
- where it.name = fb.item_code
- and ifnull(it.is_pro_applicable, 'No') = 'No'
- and ifnull(it.is_sub_contracted_item, 'No') = 'No'
- and fb.docstatus<2 and fb.parent=%s
- ) a
- group by item_code,stock_uom
- """ , (flt(bom_dict[bom]), bom))
+ fl_bom_items = sql("""select fb.item_code,
+ ifnull(sum(fb.qty_consumed_per_unit), 0)*%s as qty,
+ fb.description, fb.stock_uom, it.min_order_qty
+ from `tabBOM Explosion Item` fb,`tabItem` it
+ where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No'
+ and ifnull(it.is_sub_contracted_item, 'No') = 'No'
+ and fb.docstatus<2 and fb.parent=%s
+ group by item_code, stock_uom""", (flt(bom_dict[bom]), bom))
else:
# Get all raw materials considering SA items as raw materials,
# so no childs of SA items
- fl_bom_items = sql("""
- select bom_item.item_code,
+ fl_bom_items = sql("""select bom_item.item_code,
ifnull(sum(bom_item.qty_consumed_per_unit), 0) * %s,
bom_item.description, bom_item.stock_uom, item.min_order_qty
from `tabBOM Item` bom_item, tabItem item
where bom_item.parent = %s and bom_item.docstatus < 2
- and bom_item.item_code = item.name
- group by item_code
- """, (flt(bom_dict[bom]), bom))
+ and bom_item.item_code = item.name
+ group by item_code""", (flt(bom_dict[bom]), bom))
self.make_items_dict(fl_bom_items)
def make_items_dict(self, item_list):
@@ -317,9 +307,9 @@
items_to_be_requested = webnotes._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
- 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
requested_qty = requested_qty > flt(self.item_dict[item][3]) and \
requested_qty or flt(self.item_dict[item][3])
@@ -379,4 +369,4 @@
webnotes.msgprint("Following Material Request created successfully: \n%s" %
"\n".join(pur_req))
else:
- webnotes.msgprint("Nothing to request")
\ No newline at end of file
+ webnotes.msgprint("Nothing to request")
diff --git a/manufacturing/page/manufacturing_home/manufacturing_home.js b/manufacturing/page/manufacturing_home/manufacturing_home.js
index b7f28ed..d4841df 100644
--- a/manufacturing/page/manufacturing_home/manufacturing_home.js
+++ b/manufacturing/page/manufacturing_home/manufacturing_home.js
@@ -58,6 +58,17 @@
},
]
},
+ {
+ title: wn._("Reports"),
+ right: true,
+ icon: "icon-list",
+ items: [
+ {
+ "label":wn._("Issued Items Against Production Order"),
+ route: "query-report/Issued Items Against Production Order",
+ },
+ ]
+ }
]
pscript['onload_manufacturing-home'] = function(wrapper) {
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/manufacturing/report/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to manufacturing/report/__init__.py
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/manufacturing/report/issued_items_against_production_order/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to manufacturing/report/issued_items_against_production_order/__init__.py
diff --git a/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.txt b/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.txt
new file mode 100644
index 0000000..a5a03bfa
--- /dev/null
+++ b/manufacturing/report/issued_items_against_production_order/issued_items_against_production_order.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-03 17:48:46",
+ "docstatus": 0,
+ "modified": "2013-05-07 11:49:56",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 0,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select\n ste.production_order as \"Production Order:Link/Production Order:120\",\n ste.posting_date as \"Issue Date:Date:140\",\n ste_item.item_code as \"Item Code:Link/Item:120\",\n\tste_item.description as \"Description::150\",\n\tste_item.transfer_qty as \"Qty:Float:100\",\n\tste_item.stock_uom as \"UOM:Link/UOM:80\",\n\tste_item.amount as \"Amount:Currency:120\",\n\tste_item.serial_no as \"Serial No:Link/Serial No:80\",\n\tste_item.s_warehouse as \"Source Warehouse:Link/Warehouse:120\",\n\tste_item.t_warehouse as \"Target Warehouse:Link/Warehouse:120\",\n\tpro.production_item as \"Finished Goods:Link/Item:120\", \n\tste.name as \"Stock Entry:Link/Stock Entry:120\"\nfrom\n\t`tabStock Entry` ste, `tabStock Entry Detail` ste_item, `tabProduction Order` pro\nwhere\n\tifnull(ste.production_order, '') != '' and ste.name = ste_item.parent \n\tand ste.production_order = pro.name and ste.docstatus = 1 \n\tand ste.purpose = 'Manufacture/Repack'\norder by ste.posting_date, ste.production_order, ste_item.item_code",
+ "ref_doctype": "Production Order",
+ "report_name": "Issued Items Against Production Order",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Issued Items Against Production Order"
+ }
+]
\ No newline at end of file
diff --git a/manufacturing/search_criteria/__init__.py b/manufacturing/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/manufacturing/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/manufacturing/search_criteria/consumption_against_production/__init__.py b/manufacturing/search_criteria/consumption_against_production/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/manufacturing/search_criteria/consumption_against_production/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/manufacturing/search_criteria/consumption_against_production/consumption_against_production.txt b/manufacturing/search_criteria/consumption_against_production/consumption_against_production.txt
deleted file mode 100644
index 70620ff..0000000
--- a/manufacturing/search_criteria/consumption_against_production/consumption_against_production.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "jai@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-12-10 18:30:00"
- },
- {
- "add_col": "`tabProduction Order`.consider_sa_items",
- "parent_doc_type": "Stock Entry",
- "module": "Manufacturing",
- "standard": "Yes",
- "sort_order": "DESC",
- "add_tab": "`tabProduction Order`",
- "doc_type": "Stock Entry Detail",
- "name": "__common__",
- "filters": "{'Stock Entry\u0001Submitted':1,'Stock Entry\u0001Purpose':'Production Order','Stock Entry\u0001Process':''}",
- "add_cond": "`tabProduction Order`.name = `tabStock Entry`.production_order",
- "doctype": "Search Criteria",
- "sort_by": "`tabStock Entry`.`name`",
- "page_len": 50,
- "criteria_name": "Consumption Against Production",
- "columns": "Stock Entry\u0001ID,Stock Entry\u0001Production Order,Stock Entry\u0001Process,Stock Entry\u0001Posting Date,Stock Entry\u0001Company,Stock Entry Detail\u0001Source Warehouse,Stock Entry Detail\u0001Target Warehouse,Stock Entry Detail\u0001FG Item,Stock Entry Detail\u0001Item Code,Stock Entry Detail\u0001Description,Stock Entry Detail\u0001Reqd Qty,Stock Entry Detail\u0001Transfer Quantity"
- },
- {
- "name": "consumption_against_production",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/manufacturing/search_criteria/itemwise_production_report/__init__.py b/manufacturing/search_criteria/itemwise_production_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/manufacturing/search_criteria/itemwise_production_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.js b/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.js
deleted file mode 100644
index 4998fad..0000000
--- a/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- //to hide all filters
- this.hide_all_filters();
-
- // to unhide required filters
- this.filter_fields_dict['Stock Entry'+FILTER_SEP +'ID'].df.filter_hide = 0;
- this.filter_fields_dict['Stock Entry'+FILTER_SEP +'Production Order'].df.filter_hide = 0;
-
- this.filter_fields_dict['Stock Entry'+FILTER_SEP +'From Posting Date'].df.filter_hide = 0;
- this.filter_fields_dict['Stock Entry'+FILTER_SEP +'To Posting Date'].df.filter_hide = 0;
-
- this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Target Warehouse'].df.filter_hide = 0;
-
- this.filter_fields_dict['Stock Entry Detail'+FILTER_SEP +'Item Code'].df.filter_hide = 0;
-}
\ No newline at end of file
diff --git a/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.txt b/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.txt
deleted file mode 100644
index 7814fec..0000000
--- a/manufacturing/search_criteria/itemwise_production_report/itemwise_production_report.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "jai@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-12-10 18:30:00"
- },
- {
- "parent_doc_type": "Stock Entry",
- "module": "Manufacturing",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Stock Entry\u0001Saved':1,'Stock Entry\u0001Submitted':1,'Stock Entry\u0001Purpose':'Production Order','Stock Entry\u0001Process':'Backflush','Stock Entry Detail\u0001FG Item':1}",
- "doc_type": "Stock Entry Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabStock Entry`.`name`",
- "page_len": 50,
- "criteria_name": "Itemwise Production Report",
- "columns": "Stock Entry\u0001ID,Stock Entry\u0001Posting Date,Stock Entry\u0001Production Order,Stock Entry\u0001Process,Stock Entry\u0001Company,Stock Entry Detail\u0001Target Warehouse,Stock Entry Detail\u0001Item Code,Stock Entry Detail\u0001Description,Stock Entry Detail\u0001Stock UOM,Stock Entry Detail\u0001Transfer Quantity"
- },
- {
- "name": "itemwise_production_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/manufacturing/search_criteria/production_orders_in_process/__init__.py b/manufacturing/search_criteria/production_orders_in_process/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/manufacturing/search_criteria/production_orders_in_process/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/manufacturing/search_criteria/production_orders_in_process/production_orders_in_process.txt b/manufacturing/search_criteria/production_orders_in_process/production_orders_in_process.txt
deleted file mode 100644
index 3a8c8c9..0000000
--- a/manufacturing/search_criteria/production_orders_in_process/production_orders_in_process.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "jai@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-12-10 18:30:00"
- },
- {
- "module": "Manufacturing",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Production Order\u0001Submitted':1,'Production Order\u0001Origin':'','Production Order\u0001Status':'','Production Order\u0001Consider SA Items':'','Production Order\u0001Fiscal Year':''}",
- "doc_type": "Production Order",
- "name": "__common__",
- "add_cond": "`tabProduction Order`.qty > `tabProduction Order`.produced_qty",
- "doctype": "Search Criteria",
- "sort_by": "`tabProduction Order`.`name`",
- "page_len": 50,
- "criteria_name": "Production Orders In Process",
- "columns": "Production Order\u0001ID,Production Order\u0001Origin,Production Order\u0001Status,Production Order\u0001Posting Date,Production Order\u0001Production Item,Production Order\u0001BOM No,Production Order\u0001Description,Production Order\u0001Stock UOM,Production Order\u0001Qty,Production Order\u0001Produced Qty,Production Order\u0001FG Warehouse,Production Order\u0001WIP Warehouse,Production Order\u0001Consider SA Items,Production Order\u0001Fiscal Year,Production Order\u0001Company"
- },
- {
- "name": "production_orders_in_process",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/master.sql.gz b/master.sql.gz
index f331784..030ee05 100644
--- a/master.sql.gz
+++ b/master.sql.gz
Binary files differ
diff --git a/patches/april_2013/p05_update_file_data.py b/patches/april_2013/p05_update_file_data.py
new file mode 100644
index 0000000..39449a6
--- /dev/null
+++ b/patches/april_2013/p05_update_file_data.py
@@ -0,0 +1,74 @@
+import webnotes, webnotes.utils, os
+from webnotes.modules.export_file import export_to_files
+
+def execute():
+ webnotes.reload_doc("core", "doctype", "file_data")
+ webnotes.reset_perms("File Data")
+
+ singles = get_single_doctypes()
+
+ for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
+ fieldname='file_list'"""):
+ # the other scenario is handled in p07_update_file_data_2
+ if doctype in singles:
+ update_file_list(doctype, singles)
+
+ # export_to_files([["DocType", doctype]])
+
+def get_single_doctypes():
+ return webnotes.conn.sql_list("""select name from tabDocType
+ where ifnull(issingle,0)=1""")
+
+def update_file_list(doctype, singles):
+ if doctype in singles:
+ doc = webnotes.doc(doctype, doctype)
+ if doc.file_list:
+ update_for_doc(doctype, doc)
+ webnotes.conn.set_value(doctype, None, "file_list", None)
+ else:
+ try:
+ for doc in webnotes.conn.sql("""select name, file_list from `tab%s` where
+ ifnull(file_list, '')!=''""" % doctype, as_dict=True):
+ update_for_doc(doctype, doc)
+ webnotes.conn.commit()
+ webnotes.conn.sql("""alter table `tab%s` drop column `file_list`""" % doctype)
+ except Exception, e:
+ print webnotes.getTraceback()
+ if (e.args and e.args[0]!=1054) or not e.args:
+ raise e
+
+def update_for_doc(doctype, doc):
+ for filedata in doc.file_list.split("\n"):
+ if not filedata:
+ continue
+
+ filedata = filedata.split(",")
+ if len(filedata)==2:
+ filename, fileid = filedata[0], filedata[1]
+ else:
+ continue
+
+ exists = True
+ if not (filename.startswith("http://") or filename.startswith("https://")):
+ if not os.path.exists(webnotes.utils.get_path("public", "files", filename)):
+ exists = False
+
+ if exists:
+ if webnotes.conn.exists("File Data", fileid):
+ try:
+ fd = webnotes.bean("File Data", fileid)
+ if not (fd.doc.attached_to_doctype and fd.doc.attached_to_name):
+ fd.doc.attached_to_doctype = doctype
+ fd.doc.attached_to_name = doc.name
+ fd.save()
+ else:
+ fd = webnotes.bean("File Data", copy=fd.doclist)
+ fd.doc.attached_to_doctype = doctype
+ fd.doc.attached_to_name = doc.name
+ fd.doc.name = None
+ fd.insert()
+ except webnotes.DuplicateEntryError:
+ pass
+ else:
+ webnotes.conn.sql("""delete from `tabFile Data` where name=%s""",
+ fileid)
\ No newline at end of file
diff --git a/patches/april_2013/p06_update_file_size.py b/patches/april_2013/p06_update_file_size.py
new file mode 100644
index 0000000..760c3cb
--- /dev/null
+++ b/patches/april_2013/p06_update_file_size.py
@@ -0,0 +1,14 @@
+import webnotes, os, webnotes.utils
+
+def execute():
+ 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
+ `tabFile Data`""", as_dict=True):
+ if f.file_name:
+ filepath = os.path.join(files_path, f.file_name)
+ if os.path.exists(filepath):
+ webnotes.conn.set_value("File Data", f.name, "file_size", os.stat(filepath).st_size)
+
+ webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/patches/april_2013/p07_update_file_data_2.py b/patches/april_2013/p07_update_file_data_2.py
new file mode 100644
index 0000000..548ba6c
--- /dev/null
+++ b/patches/april_2013/p07_update_file_data_2.py
@@ -0,0 +1,19 @@
+import webnotes
+def execute():
+ 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()
+ 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):
+ doctype = doctype[3:]
+
+ if not webnotes.conn.exists("DocType", doctype): continue
+
+ update_file_list(doctype, singles)
+
+ webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
+ and parent=%s""", doctype)
+
+ webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
diff --git a/patches/april_2013/p08_price_list_country.py b/patches/april_2013/p08_price_list_country.py
new file mode 100644
index 0000000..65643cc
--- /dev/null
+++ b/patches/april_2013/p08_price_list_country.py
@@ -0,0 +1,5 @@
+import webnotes
+
+def execute():
+ webnotes.reload_doc("Setup", "DocType", "Price List")
+ webnotes.conn.sql("""update `tabPrice List` set valid_for_all_countries=1""")
\ No newline at end of file
diff --git a/patches/april_2013/rebuild_sales_browser.py b/patches/april_2013/rebuild_sales_browser.py
new file mode 100644
index 0000000..917ae68
--- /dev/null
+++ b/patches/april_2013/rebuild_sales_browser.py
@@ -0,0 +1,4 @@
+import webnotes
+def execute():
+ from patches.january_2013 import rebuild_tree
+ rebuild_tree.execute()
\ No newline at end of file
diff --git a/patches/august_2012/change_profile_permission.py b/patches/august_2012/change_profile_permission.py
index 27169d8..7e945d5 100644
--- a/patches/august_2012/change_profile_permission.py
+++ b/patches/august_2012/change_profile_permission.py
@@ -31,5 +31,4 @@
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'profile')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'profile')
\ No newline at end of file
diff --git a/patches/august_2012/changed_blog_date_format.py b/patches/august_2012/changed_blog_date_format.py
deleted file mode 100644
index df51977..0000000
--- a/patches/august_2012/changed_blog_date_format.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- from webnotes.model.bean import Bean
- Bean("Website Settings", "Website Settings").save()
\ No newline at end of file
diff --git a/patches/august_2012/remove_cash_flow_statement.py b/patches/august_2012/remove_cash_flow_statement.py
deleted file mode 100644
index 739a4f2..0000000
--- a/patches/august_2012/remove_cash_flow_statement.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- webnotes.conn.sql("delete from `tabSearch Criteria` where name = 'cash_flow_statement'")
\ No newline at end of file
diff --git a/patches/august_2012/report_supplier_quotations.py b/patches/august_2012/report_supplier_quotations.py
deleted file mode 100644
index 8eaf707..0000000
--- a/patches/august_2012/report_supplier_quotations.py
+++ /dev/null
@@ -1,4 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- from webnotes.modules import reload_doc
- reload_doc("buying", "report", "supplier_quotations")
diff --git a/patches/december_2012/deprecate_tds.py b/patches/december_2012/deprecate_tds.py
index e351fd9..f3daeb0 100644
--- a/patches/december_2012/deprecate_tds.py
+++ b/patches/december_2012/deprecate_tds.py
@@ -15,7 +15,6 @@
webnotes.conn.sql("drop table if exists `tab%s`" % dt)
webnotes.conn.begin()
- delete_doc("Search Criteria", "tds_return")
# Add tds entry in tax table for purchase invoice
pi_list = webnotes.conn.sql("""select name from `tabPurchase Invoice`
diff --git a/patches/december_2012/reload_debtors_creditors_ledger.py b/patches/december_2012/reload_debtors_creditors_ledger.py
deleted file mode 100644
index 7f88a6f..0000000
--- a/patches/december_2012/reload_debtors_creditors_ledger.py
+++ /dev/null
@@ -1,5 +0,0 @@
-def execute():
- import webnotes
- from webnotes.modules import reload_doc
- reload_doc("accounts", "search_criteria", "debtors_ledger")
- reload_doc("accounts", "search_criteria", "creditors_ledger")
\ No newline at end of file
diff --git a/patches/february_2013/p03_material_request.py b/patches/february_2013/p03_material_request.py
index 66b2bf6..d85710d 100644
--- a/patches/february_2013/p03_material_request.py
+++ b/patches/february_2013/p03_material_request.py
@@ -8,8 +8,6 @@
webnotes.rename_doc("DocType", "Purchase Request Item", "Material Request Item", force=True)
if not "tabMaterial Request" in tables:
webnotes.rename_doc("DocType", "Purchase Request", "Material Request", force=True)
- webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_bill")
- webnotes.reload_doc("buying", "search_criteria", "pending_po_items_to_receive")
webnotes.reload_doc("stock", "doctype", "material_request")
webnotes.reload_doc("stock", "doctype", "material_request_item")
@@ -23,3 +21,7 @@
os.system("rm -rf app/hr/doctype/holiday_block_list_allow")
os.system("rm -rf app/hr/doctype/holiday_block_list_date")
+ for dt in ("Purchase Request", "Purchase Request Item"):
+ if webnotes.conn.exists("DocType", dt):
+ webnotes.delete_doc("DocType", dt)
+
\ No newline at end of file
diff --git a/patches/february_2013/remove_sales_order_pending_items.py b/patches/february_2013/remove_sales_order_pending_items.py
deleted file mode 100644
index bde6a7b..0000000
--- a/patches/february_2013/remove_sales_order_pending_items.py
+++ /dev/null
@@ -1,3 +0,0 @@
-def execute():
- import webnotes
- webnotes.delete_doc("Search Criteria", "sales_order_pending_items")
\ No newline at end of file
diff --git a/patches/january_2013/deprecate_stock_search_criteria.py b/patches/january_2013/deprecate_stock_search_criteria.py
deleted file mode 100644
index d51aadb..0000000
--- a/patches/january_2013/deprecate_stock_search_criteria.py
+++ /dev/null
@@ -1,9 +0,0 @@
-import webnotes
-
-def execute():
- for sc in ["itemwise_price_list", "itemwise_receipt_details",
- "shortage_to_purchase_request", "stock_aging_report",
- "stock_ledger", "stock_level", "stock_report",
- "custom_test2", "custom_test3", "custom_test4",
- "test_so2", "test_so3"]:
- webnotes.delete_doc("Search Criteria", sc)
\ No newline at end of file
diff --git a/patches/january_2013/remove_support_search_criteria.py b/patches/january_2013/remove_support_search_criteria.py
deleted file mode 100644
index 0443afe..0000000
--- a/patches/january_2013/remove_support_search_criteria.py
+++ /dev/null
@@ -1,4 +0,0 @@
-import webnotes
-def execute():
- for sc in ["warranty-amc_expiry_details", "warranty-amc_summary"]:
- webnotes.delete_doc("Search Criteria", sc)
\ No newline at end of file
diff --git a/patches/july_2012/address_contact_perms.py b/patches/july_2012/address_contact_perms.py
index 5b79f22..882cf72 100644
--- a/patches/july_2012/address_contact_perms.py
+++ b/patches/july_2012/address_contact_perms.py
@@ -6,7 +6,6 @@
where parent in ('Address', 'Contact')""")
webnotes.conn.commit()
- import webnotes.model.sync
- webnotes.model.sync.sync('utilities', 'address')
- webnotes.model.sync.sync('utilities', 'contact')
+ webnotes.reload_doc('utilities', 'doctype', 'address')
+ webnotes.reload_doc('utilities', 'doctype', 'contact')
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/july_2012/blog_guest_permission.py b/patches/july_2012/blog_guest_permission.py
deleted file mode 100644
index bc42a9d..0000000
--- a/patches/july_2012/blog_guest_permission.py
+++ /dev/null
@@ -1,12 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- """allocate read write permission to guest for doctype 'Blog'"""
- import webnotes
- webnotes.conn.sql("""delete from `tabDocPerm` where parent = 'Blog'""")
-
- webnotes.conn.commit()
-
- import webnotes.model.sync
- webnotes.model.sync.sync('website', 'blog', 1)
-
- webnotes.conn.begin()
diff --git a/patches/july_2012/project_patch_repeat.py b/patches/july_2012/project_patch_repeat.py
index bd52522..b138661 100644
--- a/patches/july_2012/project_patch_repeat.py
+++ b/patches/july_2012/project_patch_repeat.py
@@ -12,8 +12,6 @@
and ifnull(t1.project_name, '') = ''""")
webnotes.conn.commit()
- from webnotes.model.sync import sync
- sync("buying", "purchase_order")
- sync("buying", "purchase_request")
- sync("accounts", "purchase_invoice")
+ webnotes.reload_doc("buying", "doctype", "purchase_order")
+ webnotes.reload_doc("accounts", "doctype", "purchase_invoice")
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/july_2012/supplier_quotation.py b/patches/july_2012/supplier_quotation.py
index 49fa14d..0a1ab35 100644
--- a/patches/july_2012/supplier_quotation.py
+++ b/patches/july_2012/supplier_quotation.py
@@ -1,13 +1,12 @@
from __future__ import unicode_literals
+import webnotes
+
def execute():
"""sync supplier quotatoin and create supplier quotation mappers"""
- from webnotes.model.sync import sync
- sync('buying', 'supplier_quotation')
- sync('buying', 'supplier_quotation_item')
- sync('buying', 'purchase_request')
- sync('buying', 'purchase_request_item')
- sync('buying', 'purchase_order')
- sync('buying', 'purchase_order_item')
+ webnotes.reload_doc('buying', 'doctype', 'supplier_quotation')
+ webnotes.reload_doc('buying', 'doctype', 'supplier_quotation_item')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
from webnotes.modules import reload_doc
reload_doc('buying', 'DocType Mapper', 'Material Request-Supplier Quotation')
diff --git a/patches/july_2012/sync_trial_balance.py b/patches/july_2012/sync_trial_balance.py
deleted file mode 100644
index 3755ed4..0000000
--- a/patches/july_2012/sync_trial_balance.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- from webnotes.modules import reload_doc
- reload_doc('accounts', 'search_criteria', 'trial_balance')
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/patches/july_2013/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to patches/july_2013/__init__.py
diff --git a/patches/july_2013/restore_tree_roots.py b/patches/july_2013/restore_tree_roots.py
new file mode 100644
index 0000000..ea3a991
--- /dev/null
+++ b/patches/july_2013/restore_tree_roots.py
@@ -0,0 +1,3 @@
+def execute():
+ from startup.install import import_defaults
+ import_defaults()
\ No newline at end of file
diff --git a/patches/june_2012/cms2.py b/patches/june_2012/cms2.py
index 414af73..17b7d23 100644
--- a/patches/june_2012/cms2.py
+++ b/patches/june_2012/cms2.py
@@ -1,14 +1,11 @@
from __future__ import unicode_literals
def execute():
import webnotes
- import webnotes.model.sync
# sync doctypes required for the patch
- webnotes.model.sync.sync('website', 'web_cache')
- webnotes.model.sync.sync('website', 'web_page')
- webnotes.model.sync.sync('website', 'blog')
- webnotes.model.sync.sync('website', 'website_settings')
- webnotes.model.sync.sync('stock', 'item')
+ webnotes.reload_doc('website', 'doctype', 'web_page')
+ webnotes.reload_doc('website', 'doctype', 'website_settings')
+ webnotes.reload_doc('stock', 'doctype', 'item')
cleanup()
diff --git a/patches/june_2012/copy_uom_for_pur_inv_item.py b/patches/june_2012/copy_uom_for_pur_inv_item.py
index b374249..a22146c 100644
--- a/patches/june_2012/copy_uom_for_pur_inv_item.py
+++ b/patches/june_2012/copy_uom_for_pur_inv_item.py
@@ -2,11 +2,9 @@
def execute():
import webnotes
- # perform sync
- import webnotes.model.sync
- webnotes.model.sync.sync('buying', 'purchase_order_item')
- webnotes.model.sync.sync('accounts', 'purchase_invoice_item')
- webnotes.model.sync.sync('stock', 'purchase_receipt_item')
+ webnotes.reload_doc('buying', 'doctype', 'purchase_order_item')
+ webnotes.reload_doc('accounts', 'doctype', 'purchase_invoice_item')
+ webnotes.reload_doc('stock', 'doctype', 'purchase_receipt_item')
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Order Item` t2 set t1.uom = t2.uom where ifnull(t1.po_detail, '') != '' and t1.po_detail = t2.name")
webnotes.conn.sql("update `tabPurchase Invoice Item` t1, `tabPurchase Receipt Item` t2 set t1.uom = t2.uom where ifnull(t1.pr_detail, '') != '' and t1.pr_detail = t2.name")
\ No newline at end of file
diff --git a/patches/june_2012/reports_list_permission.py b/patches/june_2012/reports_list_permission.py
index a02f4fa..e88e8fb 100644
--- a/patches/june_2012/reports_list_permission.py
+++ b/patches/june_2012/reports_list_permission.py
@@ -8,8 +8,6 @@
webnotes.conn.commit()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'search_criteria')
- webnotes.model.sync.sync('core', 'report')
+ webnotes.reload_doc('core', 'doctype', 'report')
webnotes.conn.begin()
\ No newline at end of file
diff --git a/patches/june_2012/set_recurring_type.py b/patches/june_2012/set_recurring_type.py
index 79dd286..7fb416e 100644
--- a/patches/june_2012/set_recurring_type.py
+++ b/patches/june_2012/set_recurring_type.py
@@ -1,7 +1,6 @@
from __future__ import unicode_literals
def execute():
import webnotes
- from webnotes.model.sync import sync
- sync('accounts', 'sales_invoice')
+ webnotes.reload_doc('accounts', 'doctype', 'sales_invoice')
webnotes.conn.sql("update `tabSales Invoice` set recurring_type = 'Monthly' where ifnull(convert_into_recurring_invoice, 0) = 1")
\ No newline at end of file
diff --git a/patches/june_2012/support_ticket_autoreply.py b/patches/june_2012/support_ticket_autoreply.py
index 9fb0534..32e0956 100644
--- a/patches/june_2012/support_ticket_autoreply.py
+++ b/patches/june_2012/support_ticket_autoreply.py
@@ -4,9 +4,8 @@
import webnotes
import webnotes.utils
- import webnotes.model.sync
webnotes.conn.commit()
- webnotes.model.sync.sync('setup', 'email_settings')
+ webnotes.reload_doc('setup', 'doctype', 'email_settings')
webnotes.conn.begin()
sync_support_mails = webnotes.utils.cint(webnotes.conn.get_value('Email Settings',
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/patches/june_2013/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to patches/june_2013/__init__.py
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/june_2013/p01_update_bom_exploded_items.py
similarity index 70%
copy from patches/september_2012/reload_gross_profit.py
copy to patches/june_2013/p01_update_bom_exploded_items.py
index 0a3f9ef..f53eb5b 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/june_2013/p01_update_bom_exploded_items.py
@@ -15,7 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
+import webnotes
+
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ updated_bom = []
+ for bom in webnotes.conn.sql("select name from tabBOM where docstatus < 2"):
+ if bom[0] not in updated_bom:
+ try:
+ bom_obj = webnotes.get_obj("BOM", bom[0], with_children=1)
+ updated_bom += bom_obj.update_cost_and_exploded_items(bom[0])
+ webnotes.conn.commit()
+ except:
+ pass
\ No newline at end of file
diff --git a/patches/june_2013/p04_fix_event_for_lead_oppty_project.py b/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
new file mode 100644
index 0000000..971e4c7
--- /dev/null
+++ b/patches/june_2013/p04_fix_event_for_lead_oppty_project.py
@@ -0,0 +1,20 @@
+import webnotes
+
+def execute():
+ from utilities.transaction_base import delete_events
+
+ # delete orphaned Event User
+ webnotes.conn.sql("""delete from `tabEvent User`
+ where not exists(select name from `tabEvent` where `tabEvent`.name = `tabEvent User`.parent)""")
+
+ for dt in ["Lead", "Opportunity", "Project"]:
+ for ref_name in webnotes.conn.sql_list("""select ref_name
+ from `tabEvent` where ref_type=%s and ifnull(starts_on, '')='' """, dt):
+ if webnotes.conn.exists(dt, ref_name):
+ if dt in ["Lead", "Opportunity"]:
+ webnotes.get_obj(dt, ref_name).add_calendar_event(force=True)
+ else:
+ webnotes.get_obj(dt, ref_name).add_calendar_event()
+ else:
+ # remove events where ref doc doesn't exist
+ delete_events(dt, ref_name)
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/june_2013/p05_remove_search_criteria_reports.py
similarity index 85%
rename from patches/september_2012/reload_gross_profit.py
rename to patches/june_2013/p05_remove_search_criteria_reports.py
index 0a3f9ef..78963db 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/june_2013/p05_remove_search_criteria_reports.py
@@ -15,7 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
+import webnotes
+
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ webnotes.conn.sql("""delete from `tabSearch Criteria` where ifnull(standard, 'No') = 'Yes'""")
\ No newline at end of file
diff --git a/patches/mar_2012/clean_property_setter.py b/patches/mar_2012/clean_property_setter.py
index 08a0a94..a9c7b81 100644
--- a/patches/mar_2012/clean_property_setter.py
+++ b/patches/mar_2012/clean_property_setter.py
@@ -12,8 +12,7 @@
clean_docfield_properties()
def change_property_setter_fieldnames():
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'property_setter')
+ webnotes.reload_doc('core', 'doctype', 'property_setter')
docfield_list = webnotes.conn.sql("""\
SELECT name, fieldname FROM `tabDocField`""", as_list=1)
custom_field_list = webnotes.conn.sql("""\
diff --git a/patches/mar_2012/create_custom_fields.py b/patches/mar_2012/create_custom_fields.py
index d4c1a13..a91c765 100644
--- a/patches/mar_2012/create_custom_fields.py
+++ b/patches/mar_2012/create_custom_fields.py
@@ -94,8 +94,7 @@
from webnotes.model.doc import Document
def execute():
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'custom_field')
+ webnotes.reload_doc('core', 'doctype', 'custom_field')
for f in field_list:
res = webnotes.conn.sql("""SELECT name FROM `tabCustom Field`
WHERE dt=%s AND fieldname=%s""", (f[0], f[1]))
diff --git a/patches/may_2012/cleanup_notification_control.py b/patches/may_2012/cleanup_notification_control.py
index 25a704e..1a7730b 100644
--- a/patches/may_2012/cleanup_notification_control.py
+++ b/patches/may_2012/cleanup_notification_control.py
@@ -25,5 +25,4 @@
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('setup', 'notification_control')
\ No newline at end of file
+ webnotes.reload_doc('setup', 'doctype', 'notification_control')
\ No newline at end of file
diff --git a/patches/may_2012/cs_server_readonly.py b/patches/may_2012/cs_server_readonly.py
index b680606..51a9b76 100644
--- a/patches/may_2012/cs_server_readonly.py
+++ b/patches/may_2012/cs_server_readonly.py
@@ -27,5 +27,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'custom_script')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'custom_script')
\ No newline at end of file
diff --git a/patches/may_2012/profile_perm_patch.py b/patches/may_2012/profile_perm_patch.py
index 4423fdb..29fa9c0 100644
--- a/patches/may_2012/profile_perm_patch.py
+++ b/patches/may_2012/profile_perm_patch.py
@@ -19,5 +19,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'profile')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'profile')
\ No newline at end of file
diff --git a/patches/may_2012/reload_customer_address_contact.py b/patches/may_2012/reload_customer_address_contact.py
deleted file mode 100644
index 4aec19d..0000000
--- a/patches/may_2012/reload_customer_address_contact.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- import webnotes.modules
- webnotes.modules.reload_doc('selling', 'search_criteria', 'customer_address_contact')
\ No newline at end of file
diff --git a/patches/may_2012/reload_reports.py b/patches/may_2012/reload_reports.py
deleted file mode 100644
index 1cee3a0..0000000
--- a/patches/may_2012/reload_reports.py
+++ /dev/null
@@ -1,7 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'itemwise_sales_details')
- reload_doc('selling', 'search_criteria', 'itemwise_delivery_details')
-
diff --git a/patches/may_2012/reload_so_pending_items.py b/patches/may_2012/reload_so_pending_items.py
deleted file mode 100644
index 999004e..0000000
--- a/patches/may_2012/reload_so_pending_items.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from __future__ import unicode_literals
-def execute():
- import webnotes
- from webnotes.model import delete_doc
- delete_doc("Search Criteria", "sales_order_pending_items1")
-
- webnotes.conn.sql("update `tabSearch Criteria` set module = 'Selling' where module = 'CRM'")
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'sales_order_pending_items')
\ No newline at end of file
diff --git a/patches/may_2012/remove_communication_log.py b/patches/may_2012/remove_communication_log.py
index e44e673..b6e7e7d 100644
--- a/patches/may_2012/remove_communication_log.py
+++ b/patches/may_2012/remove_communication_log.py
@@ -1,8 +1,7 @@
from __future__ import unicode_literals
def execute():
import webnotes
- import webnotes.model.sync
- webnotes.model.sync.sync('support', 'communication')
+ webnotes.reload_doc('support', 'doctype', 'communication')
webnotes.conn.commit()
webnotes.conn.begin()
diff --git a/patches/may_2012/std_pf_readonly.py b/patches/may_2012/std_pf_readonly.py
index 83b5813..9fbbfe9 100644
--- a/patches/may_2012/std_pf_readonly.py
+++ b/patches/may_2012/std_pf_readonly.py
@@ -27,5 +27,4 @@
doc.save()
webnotes.conn.commit()
webnotes.conn.begin()
- import webnotes.model.sync
- webnotes.model.sync.sync('core', 'print_format')
\ No newline at end of file
+ webnotes.reload_doc('core', 'doctype', 'print_format')
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/patches/may_2013/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to patches/may_2013/__init__.py
diff --git a/patches/may_2013/p01_conversion_factor_and_aii.py b/patches/may_2013/p01_conversion_factor_and_aii.py
new file mode 100644
index 0000000..2fd0d36
--- /dev/null
+++ b/patches/may_2013/p01_conversion_factor_and_aii.py
@@ -0,0 +1,26 @@
+import webnotes
+from webnotes.utils import cint
+from accounts.utils import create_stock_in_hand_jv
+
+def execute():
+ webnotes.conn.auto_commit_on_many_writes = True
+
+ aii_enabled = cint(webnotes.conn.get_value("Global Defaults", None,
+ "auto_inventory_accounting"))
+
+ if aii_enabled:
+ create_stock_in_hand_jv(reverse = True)
+
+ webnotes.conn.sql("""update `tabPurchase Invoice Item` pi_item
+ set conversion_factor = (select ifnull(if(conversion_factor=0, 1, conversion_factor), 1)
+ from `tabUOM Conversion Detail`
+ where parent = pi_item.item_code and uom = pi_item.uom limit 1
+ )
+ where ifnull(conversion_factor, 0)=0""")
+
+ if aii_enabled:
+ create_stock_in_hand_jv()
+
+ webnotes.conn.auto_commit_on_many_writes = False
+
+
\ No newline at end of file
diff --git a/patches/may_2013/p02_update_valuation_rate.py b/patches/may_2013/p02_update_valuation_rate.py
new file mode 100644
index 0000000..280473c
--- /dev/null
+++ b/patches/may_2013/p02_update_valuation_rate.py
@@ -0,0 +1,47 @@
+# 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():
+ from stock.stock_ledger import update_entries_after
+ item_warehouse = []
+ # update valuation_rate in transaction
+ doctypes = {"Purchase Receipt": "purchase_receipt_details", "Purchase Invoice": "entries"}
+
+ for dt in doctypes:
+ for d in webnotes.conn.sql("""select name from `tab%s`
+ where modified >= '2013-05-09' and docstatus=1""" % dt):
+ rec = webnotes.get_obj(dt, d[0])
+ rec.update_valuation_rate(doctypes[dt])
+
+ for item in rec.doclist.get({"parentfield": doctypes[dt]}):
+ webnotes.conn.sql("""update `tab%s Item` set valuation_rate = %s
+ where name = %s"""% (dt, '%s', '%s'), tuple([item.valuation_rate, item.name]))
+
+ if dt == "Purchase Receipt":
+ webnotes.conn.sql("""update `tabStock Ledger Entry` set incoming_rate = %s
+ where voucher_detail_no = %s""", (item.valuation_rate, item.name))
+ if [item.item_code, item.warehouse] not in item_warehouse:
+ item_warehouse.append([item.item_code, item.warehouse])
+
+ for d in item_warehouse:
+ try:
+ update_entries_after({"item_code": d[0], "warehouse": d[1],
+ "posting_date": "2013-01-01", "posting_time": "00:05:00"})
+ webnotes.conn.commit()
+ except:
+ pass
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/may_2013/p03_update_support_ticket.py
similarity index 60%
copy from patches/september_2012/reload_gross_profit.py
copy to patches/may_2013/p03_update_support_ticket.py
index 0a3f9ef..7dc5854 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/may_2013/p03_update_support_ticket.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
+import webnotes
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ webnotes.reload_doc("support", "doctype", "support_ticket")
+ webnotes.reload_doc("core", "doctype", "communication")
+ for d in webnotes.conn.sql("""select name, raised_by from `tabSupport Ticket`
+ where docstatus < 2""", as_dict=True):
+ tic = webnotes.get_obj("Support Ticket", d.name)
+ tic.set_lead_contact(d.raised_by)
+ webnotes.conn.sql("""update `tabSupport Ticket` set lead = %s, contact = %s, company = %s
+ where name = %s""", (tic.doc.lead, tic.doc.contact, tic.doc.company, d.name))
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/may_2013/p04_reorder_level.py
similarity index 77%
copy from patches/september_2012/reload_gross_profit.py
copy to patches/may_2013/p04_reorder_level.py
index 0a3f9ef..8f4d669 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/may_2013/p04_reorder_level.py
@@ -15,7 +15,9 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
+import webnotes
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ webnotes.reload_doc("Setup", "DocType", "Global Defaults")
+
+ if webnotes.conn.exists({"doctype": "Item", "email_notify": 1}):
+ webnotes.conn.set_value("Global Defaults", None, "reorder_email_notify", 1)
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/may_2013/p05_update_cancelled_gl_entries.py
similarity index 66%
copy from patches/september_2012/reload_gross_profit.py
copy to patches/may_2013/p05_update_cancelled_gl_entries.py
index 0a3f9ef..59eed7e 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/may_2013/p05_update_cancelled_gl_entries.py
@@ -15,7 +15,15 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
+import webnotes
+from webnotes.utils import cint
+
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ aii_enabled = cint(webnotes.conn.get_value("Global Defaults", None,
+ "auto_inventory_accounting"))
+
+ if aii_enabled:
+ webnotes.conn.sql("""update `tabGL Entry` gle set is_cancelled = 'Yes'
+ where voucher_type = 'Delivery Note'
+ and exists(select name from `tabDelivery Note`
+ where name = gle.voucher_no and docstatus = 2)""")
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/patches/may_2013/repost_stock_for_no_posting_time.py
similarity index 63%
copy from patches/september_2012/reload_gross_profit.py
copy to patches/may_2013/repost_stock_for_no_posting_time.py
index 0a3f9ef..489511c 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/patches/may_2013/repost_stock_for_no_posting_time.py
@@ -16,6 +16,19 @@
from __future__ import unicode_literals
def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+ import webnotes
+ from stock.stock_ledger import update_entries_after
+
+ res = webnotes.conn.sql("""select distinct item_code, warehouse from `tabStock Ledger Entry`
+ where posting_time = '00:00'""")
+
+ i=0
+ for d in res:
+ try:
+ update_entries_after({ "item_code": d[0], "warehouse": d[1] })
+ except:
+ pass
+ i += 1
+ if i%20 == 0:
+ webnotes.conn.sql("commit")
+ webnotes.conn.sql("start transaction")
\ No newline at end of file
diff --git a/patches/october_2012/update_account_property.py b/patches/october_2012/update_account_property.py
index efe0649..a9d365f 100644
--- a/patches/october_2012/update_account_property.py
+++ b/patches/october_2012/update_account_property.py
@@ -11,4 +11,4 @@
for acc in roots:
webnotes.conn.sql("""update tabAccount set debit_or_credit = %(debit_or_credit)s,
is_pl_account = %(is_pl_account)s, company = %(company)s
- where lft > %(lft)s and rgt < %(rgt)s""", acc, debug=1)
\ No newline at end of file
+ where lft > %(lft)s and rgt < %(rgt)s""", acc)
\ No newline at end of file
diff --git a/patches/patch_list.py b/patches/patch_list.py
index f6a5996..812f641 100644
--- a/patches/patch_list.py
+++ b/patches/patch_list.py
@@ -38,19 +38,15 @@
"patches.may_2012.cleanup_property_setter",
"patches.may_2012.rename_prev_doctype",
"patches.may_2012.cleanup_notification_control",
- "patches.may_2012.renamedt_in_custom_search_criteria",
"patches.may_2012.stock_reco_patch",
- "patches.may_2012.reload_reports",
"patches.may_2012.page_role_series_fix",
"patches.may_2012.reload_sales_invoice_pf",
"patches.may_2012.std_pf_readonly",
- "patches.may_2012.reload_so_pending_items",
"patches.may_2012.customize_form_cleanup",
"patches.may_2012.cs_server_readonly",
"patches.may_2012.clear_session_cache",
"patches.may_2012.same_purchase_rate_patch",
"patches.may_2012.create_report_manager_role",
- "patches.may_2012.reload_customer_address_contact",
"patches.may_2012.profile_perm_patch",
"patches.may_2012.remove_euro_currency",
"patches.may_2012.remove_communication_log",
@@ -74,17 +70,13 @@
"patches.july_2012.auth_table",
"patches.july_2012.remove_event_role_owner_match",
"patches.july_2012.deprecate_bulk_rename",
- "patches.july_2012.blog_guest_permission",
"patches.july_2012.bin_permission",
"patches.july_2012.project_patch_repeat",
"patches.july_2012.repost_stock_due_to_wrong_packing_list",
"patches.july_2012.supplier_quotation",
- "patches.august_2012.report_supplier_quotations",
"patches.august_2012.task_allocated_to_assigned",
"patches.august_2012.change_profile_permission",
- "patches.august_2012.changed_blog_date_format",
"patches.august_2012.repost_billed_amt",
- "patches.august_2012.remove_cash_flow_statement",
"patches.september_2012.stock_report_permissions_for_accounts",
"patches.september_2012.communication_delete_permission",
"patches.september_2012.all_permissions_patch",
@@ -93,7 +85,6 @@
"patches.september_2012.plot_patch",
"patches.september_2012.event_permission",
"patches.september_2012.repost_stock",
- "patches.september_2012.reload_gross_profit",
"patches.september_2012.rebuild_trees",
"patches.september_2012.deprecate_account_balance",
"patches.september_2012.profile_delete_permission",
@@ -127,7 +118,6 @@
"patches.december_2012.expense_leave_reload",
"patches.december_2012.repost_ordered_qty",
"patches.december_2012.repost_projected_qty",
- "patches.december_2012.reload_debtors_creditors_ledger",
"patches.december_2012.website_cache_refactor",
"patches.december_2012.production_cleanup",
"patches.december_2012.fix_default_print_format",
@@ -142,8 +132,6 @@
"patches.december_2012.remove_project_mapper",
"patches.december_2012.update_print_width",
"patches.january_2013.remove_bad_permissions",
- "patches.january_2013.deprecate_stock_search_criteria",
- "patches.january_2013.remove_support_search_criteria",
"patches.january_2013.holiday_list_patch",
"patches.january_2013.stock_reconciliation_patch",
"patches.january_2013.report_permission",
@@ -154,12 +142,12 @@
"patches.january_2013.remove_tds_entry_from_gl_mapper",
"patches.january_2013.update_number_format",
"patches.january_2013.purchase_price_list",
+ "execute:webnotes.reload_doc('core', 'doctype', 'print_format') #2013-01",
"execute:webnotes.reload_doc('accounts','Print Format','Payment Receipt Voucher')",
"patches.january_2013.update_fraction_for_usd",
"patches.january_2013.enable_currencies",
"patches.january_2013.remove_unwanted_permission",
"patches.january_2013.remove_landed_cost_master",
- "execute:webnotes.reload_doc('core', 'doctype', 'print_format')",
"patches.january_2013.reload_print_format",
"patches.january_2013.rebuild_tree",
"execute:webnotes.reload_doc('core','doctype','docfield') #2013-01-28",
@@ -167,7 +155,6 @@
"patches.february_2013.remove_gl_mapper",
"patches.february_2013.reload_bom_replace_tool_permission",
"patches.february_2013.payment_reconciliation_reset_values",
- "patches.february_2013.remove_sales_order_pending_items",
"patches.february_2013.account_negative_balance",
"patches.february_2013.remove_account_utils_folder",
"patches.february_2013.update_company_in_leave_application",
@@ -191,14 +178,11 @@
"execute:webnotes.delete_doc('DocType', 'Service Quotation Detail')",
"patches.february_2013.p06_material_request_mappers",
"execute:webnotes.delete_doc('Page', 'Query Report')",
- "execute:webnotes.delete_doc('Search Criteria', 'employeewise_balance_leave_report')",
- "execute:webnotes.delete_doc('Search Criteria', 'employee_leave_balance_report')",
"patches.february_2013.repost_reserved_qty",
"execute:webnotes.reload_doc('core', 'doctype', 'report') # 2013-02-25",
"execute:webnotes.conn.sql(\"update `tabReport` set report_type=if(ifnull(query, '')='', 'Report Builder', 'Query Report') where is_standard='No'\")",
"execute:webnotes.conn.sql(\"update `tabReport` set report_name=name where ifnull(report_name,'')='' and is_standard='No'\")",
"patches.february_2013.p08_todo_query_report",
- "execute:webnotes.delete_doc('Search Criteria', 'gross_profit') # 2013-02-26",
'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Classic") # 2013-02-26',
'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Modern") # 2013-02-26',
'execute:webnotes.reload_doc("accounts", "Print Format", "Sales Invoice Spartan") # 2013-02-26',
@@ -212,7 +196,6 @@
"execute:webnotes.delete_doc('DocType', 'Attendance Control Panel')",
"patches.march_2013.p02_get_global_default",
"patches.march_2013.p03_rename_blog_to_blog_post",
- "execute:webnotes.reload_doc('hr', 'search_criteria', 'monthly_attendance_details')",
"patches.march_2013.p04_pos_update_stock_check",
"patches.march_2013.p05_payment_reconciliation",
"patches.march_2013.p06_remove_sales_purchase_return_tool",
@@ -238,9 +221,29 @@
'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Modern") # 2013-04-02',
'execute:webnotes.reload_doc("selling", "Print Format", "Quotation Spartan") # 2013-04-02',
"patches.april_2013.p04_reverse_modules_list",
- "execute:webnotes.delete_doc('Search Criteria', 'time_log_summary')",
"patches.april_2013.p04_update_role_in_pages",
+ "patches.april_2013.p05_update_file_data",
+ "patches.april_2013.p06_update_file_size",
"patches.april_2013.p05_fixes_in_reverse_modules",
"execute:webnotes.delete_doc('DocType Mapper', 'Delivery Note-Packing Slip')",
+ "execute:webnotes.reload_doc('Stock', 'DocType', 'Delivery Note Item')",
"patches.april_2013.p06_default_cost_center",
-]
\ No newline at end of file
+ "execute:webnotes.reset_perms('File Data')",
+ "patches.april_2013.p07_update_file_data_2",
+ "patches.april_2013.rebuild_sales_browser",
+ "patches.april_2013.p08_price_list_country",
+ "patches.may_2013.repost_stock_for_no_posting_time",
+ "patches.may_2013.p01_conversion_factor_and_aii",
+ "patches.may_2013.p02_update_valuation_rate",
+ "patches.may_2013.p03_update_support_ticket",
+ "patches.may_2013.p04_reorder_level",
+ "patches.may_2013.p05_update_cancelled_gl_entries",
+ "patches.june_2013.p01_update_bom_exploded_items",
+ "execute:webnotes.delete_doc('DocType', 'System Console')",
+ "patches.june_2013.p04_fix_event_for_lead_oppty_project",
+ "patches.june_2013.p05_remove_search_criteria_reports",
+ "execute:webnotes.delete_doc('DocType', 'Update Delivery Date')",
+ "execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Order-Purchase Invoice') # 2013-07-04 3:00",
+ "execute:webnotes.reload_doc('accounts', 'DocType Mapper', 'Purchase Receipt-Purchase Invoice') # 2013-07-04 3:00",
+ "execute:webnotes.delete_doc('Report', 'Sales Orders Pending To Be Delivered')",
+]
diff --git a/patches/september_2012/repost_stock.py b/patches/september_2012/repost_stock.py
index 9720701..deb2186 100644
--- a/patches/september_2012/repost_stock.py
+++ b/patches/september_2012/repost_stock.py
@@ -22,7 +22,7 @@
i=0
for d in res:
try:
- update_entries_after({ "item_code": d[0], "warehouse": d[1] })
+ update_entries_after({ "item_code": d[0], "warehouse": d[1]})
except:
pass
i += 1
diff --git a/projects/doctype/project/project.py b/projects/doctype/project/project.py
index 1de551c..84a216c 100644
--- a/projects/doctype/project/project.py
+++ b/projects/doctype/project/project.py
@@ -18,24 +18,18 @@
import webnotes
from webnotes.utils import flt, getdate
-from webnotes.model import db_exists
-from webnotes.model.doc import Document
-from webnotes.model.bean import copy_doclist
from webnotes import msgprint
-
-sql = webnotes.conn.sql
-
-
+from utilities.transaction_base import delete_events
class DocType:
- def __init__(self, doc, doclist=[]):
+ def __init__(self, doc, doclist=None):
self.doc = doc
self.doclist = doclist
# Get Customer Details along with its primary contact details
# ==============================================================
def get_customer_details(self):
- details =sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1)
+ details =webnotes.conn.sql("select address, territory, customer_group,customer_name from `tabCustomer` where name=%s and docstatus!=2",(self.doc.customer),as_dict=1)
if details:
ret = {
'customer_address' : details and details[0]['address'] or '',
@@ -44,7 +38,7 @@
'customer_name' : details and details[0]['customer_name'] or ''
}
#get primary contact details(this is done separately coz. , if join query used & no primary contact thn it would not be able to fetch customer details)
- contact_det = sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1)
+ contact_det = webnotes.conn.sql("select contact_name, phone, email_id from `tabContact` where customer_name='%s' and is_customer=1 and is_primary_contact=1 and docstatus!=2" %(self.doc.customer), as_dict = 1)
ret['contact_person'] = contact_det and contact_det[0]['contact_name'] or ''
ret['contact_no'] = contact_det and contact_det[0]['phone'] or ''
ret['email_id'] = contact_det and contact_det[0]['email_id'] or ''
@@ -52,21 +46,7 @@
else:
msgprint("Customer : %s does not exist in system." % (self.doc.customer))
raise Exception
-
- # Get customer's contact person details
- # ==============================================================
- def get_contact_details(self):
- contact = sql("select contact_no, email_id from `tabContact` where contact_name = '%s' and customer_name = '%s' and docstatus != 2" %(self.doc,contact_person,self.doc.customer), as_dict=1)
- if contact:
- ret = {
- 'contact_no' : contact and contact[0]['contact_no'] or '',
- 'email_id' : contact and contact[0]['email_id'] or ''
- }
- return ret
- else:
- msgprint("Contact Person : %s does not exist in the system." % (self.doc,contact_person))
- raise Exception
-
+
#calculate gross profit
#=============================================
def get_gross_profit(self):
@@ -86,20 +66,26 @@
raise Exception
def on_update(self):
- # update milestones
- webnotes.conn.sql("""delete from tabEvent where ref_type='Project' and ref_name=%s""",
- self.doc.name)
- for d in self.doclist:
- if d.doctype=='Project Milestone' and d.docstatus!=2:
- self.add_calendar_event(d.milestone, d.milestone_date)
+ self.add_calendar_event()
- def add_calendar_event(self, milestone, date):
- """ Add calendar event for task in calendar of Allocated person"""
- event = Document('Event')
- event.description = milestone + ' for ' + self.doc.name
- event.event_date = date
- event.event_hour = '10:00'
- event.event_type = 'Public'
- event.ref_type = 'Project'
- event.ref_name = self.doc.name
- event.save(1)
+ def add_calendar_event(self):
+ # delete any earlier event for this project
+ delete_events(self.doc.doctype, self.doc.name)
+
+ # add events
+ for milestone in self.doclist.get({"parentfield": "project_milestones"}):
+ if milestone.milestone_date:
+ description = (milestone.milestone or "Milestone") + " for " + self.doc.name
+ webnotes.bean({
+ "doctype": "Event",
+ "owner": self.doc.owner,
+ "subject": description,
+ "description": description,
+ "starts_on": milestone.milestone_date + " 10:00:00",
+ "event_type": "Private",
+ "ref_type": self.doc.doctype,
+ "ref_name": self.doc.name
+ }).insert()
+
+ def on_trash(self):
+ delete_events(self.doc.doctype, self.doc.name)
\ No newline at end of file
diff --git a/projects/doctype/task/task.txt b/projects/doctype/task/task.txt
index f0e0f23..85d6aaa 100644
--- a/projects/doctype/task/task.txt
+++ b/projects/doctype/task/task.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-10 16:34:17",
+ "creation": "2013-01-29 19:25:50",
"docstatus": 0,
"modified": "2013-01-29 16:27:52",
"modified_by": "Administrator",
@@ -250,15 +250,6 @@
"options": "Company"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/projects/doctype/time_log/time_log.js b/projects/doctype/time_log/time_log.js
index a602332..22f9610 100644
--- a/projects/doctype/time_log/time_log.js
+++ b/projects/doctype/time_log/time_log.js
@@ -1,5 +1,9 @@
-$.extend(cur_frm.cscript, {
- refresh: function(doc) {
-
+wn.provide("erpnext.projects");
+
+erpnext.projects.TimeLog = wn.ui.form.Controller.extend({
+ setup: function() {
+ this.frm.set_query("task", erpnext.queries.task);
}
-});
\ No newline at end of file
+});
+
+cur_frm.cscript = new erpnext.projects.TimeLog({frm: cur_frm});
\ No newline at end of file
diff --git a/projects/doctype/time_log/time_log.txt b/projects/doctype/time_log/time_log.txt
index 09c04c5..897d6be 100644
--- a/projects/doctype/time_log/time_log.txt
+++ b/projects/doctype/time_log/time_log.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-03-06 14:08:07",
+ "creation": "2013-04-03 16:38:41",
"docstatus": 0,
"modified": "2013-04-03 15:51:32",
"modified_by": "Administrator",
@@ -187,17 +187,6 @@
},
{
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "permlevel": 0,
- "print_hide": 1,
- "read_only": 0
- },
- {
- "doctype": "DocField",
"fieldname": "amended_from",
"fieldtype": "Link",
"label": "Amended From",
diff --git a/projects/page/projects_home/projects_home.js b/projects/page/projects_home/projects_home.js
index cfde6b3..fd13a67 100644
--- a/projects/page/projects_home/projects_home.js
+++ b/projects/page/projects_home/projects_home.js
@@ -60,6 +60,11 @@
route: "query-report/Daily Time Log Summary",
doctype: "Time Log"
},
+ {
+ "label":wn._("Project wise Stock Tracking"),
+ route: "query-report/Project wise Stock Tracking",
+ doctype: "Project"
+ },
]
}]
diff --git a/projects/report/daily_time_log_summary/daily_time_log_summary.py b/projects/report/daily_time_log_summary/daily_time_log_summary.py
index 22e4807..8c1e266 100644
--- a/projects/report/daily_time_log_summary/daily_time_log_summary.py
+++ b/projects/report/daily_time_log_summary/daily_time_log_summary.py
@@ -1,5 +1,6 @@
from __future__ import unicode_literals
import webnotes
+from webnotes.utils import flt
def execute(filters=None):
if not filters:
@@ -18,17 +19,29 @@
time_logs = webnotes.conn.sql("""select * from `tabTime Log`
where docstatus < 2 %s order by owner asc""" % (conditions, ), filters, as_dict=1)
- data = []
if time_logs:
profiles = [time_logs[0].owner]
+ data = []
+ total_hours = total_employee_hours = count = 0
for tl in time_logs:
if tl.owner not in profiles:
profiles.append(tl.owner)
- data.append([])
-
+ data.append(["", "", "", "Total", total_employee_hours, "", "", "", "", ""])
+ total_employee_hours = 0
+
data.append([tl.name, profile_map[tl.owner], tl.from_time, tl.to_time, tl.hours,
tl.activity_type, tl.task, task_map.get(tl.task), tl.project, tl.status])
+
+ count += 1
+ total_hours += flt(tl.hours)
+ total_employee_hours += flt(tl.hours)
+
+ if count == len(time_logs):
+ data.append(["", "", "", "Total Hours", total_employee_hours, "", "", "", "", ""])
+
+ if total_hours:
+ data.append(["", "", "", "Grand Total", total_hours, "", "", "", "", ""])
return columns, data
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/projects/report/project_wise_stock_tracking/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to projects/report/project_wise_stock_tracking/__init__.py
diff --git a/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py b/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
new file mode 100644
index 0000000..7c702e4
--- /dev/null
+++ b/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.py
@@ -0,0 +1,90 @@
+# 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/>.
+
+import webnotes
+
+def execute(filters=None):
+ columns = get_columns()
+ proj_details = get_project_details()
+ pr_item_map = get_purchased_items_cost()
+ se_item_map = get_issued_items_cost()
+ dn_item_map = get_delivered_items_cost()
+
+ data = []
+ for project in proj_details:
+ data.append([project.name, pr_item_map.get(project.name, 0),
+ se_item_map.get(project.name, 0), dn_item_map.get(project.name, 0),
+ project.project_name, project.status, project.company,
+ project.customer, project.project_value, project.project_start_date,
+ project.completion_date])
+
+ return columns, data
+
+def get_columns():
+ return ["Project Id:Link/Project:140", "Cost of Purchased Items:Currency:160",
+ "Cost of Issued Items:Currency:160", "Cost of Delivered Items:Currency:160",
+ "Project Name::120", "Project Status::120", "Company:Link/Company:100",
+ "Customer:Link/Customer:140", "Project Value:Currency:120",
+ "Project Start Date:Date:120", "Completion Date:Date:120"]
+
+def get_project_details():
+ return webnotes.conn.sql(""" select name, project_name, status, company, customer, project_value,
+ project_start_date, completion_date from tabProject where docstatus < 2""", as_dict=1)
+
+def get_purchased_items_cost():
+ pr_items = webnotes.conn.sql("""select project_name, sum(amount) as amount
+ from `tabPurchase Receipt Item` where ifnull(project_name, '') != ''
+ and docstatus = 1 group by project_name""", as_dict=1)
+
+ pr_item_map = {}
+ for item in pr_items:
+ pr_item_map.setdefault(item.project_name, item.amount)
+
+ return pr_item_map
+
+def get_issued_items_cost():
+ se_items = webnotes.conn.sql("""select se.project_name, sum(se_item.amount) as amount
+ from `tabStock Entry` se, `tabStock Entry Detail` se_item
+ where se.name = se_item.parent and se.docstatus = 1 and ifnull(se_item.t_warehouse, '') = ''
+ and ifnull(se.project_name, '') != '' group by se.project_name""", as_dict=1)
+
+ se_item_map = {}
+ for item in se_items:
+ se_item_map.setdefault(item.project_name, item.amount)
+
+ return se_item_map
+
+def get_delivered_items_cost():
+ dn_items = webnotes.conn.sql("""select dn.project_name, sum(dn_item.amount) as amount
+ from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
+ where dn.name = dn_item.parent and dn.docstatus = 1 and ifnull(dn.project_name, '') != ''
+ group by dn.project_name""", as_dict=1)
+
+ si_items = webnotes.conn.sql("""select si.project_name, sum(si_item.amount) as amount
+ from `tabSales Invoice` si, `tabSales Invoice Item` si_item
+ where si.name = si_item.parent and si.docstatus = 1 and ifnull(si.update_stock, 0) = 1
+ and ifnull(si.is_pos, 0) = 1 and ifnull(si.project_name, '') != ''
+ group by si.project_name""", as_dict=1)
+
+
+ dn_item_map = {}
+ for item in dn_items:
+ dn_item_map.setdefault(item.project_name, item.amount)
+
+ for item in si_items:
+ dn_item_map.setdefault(item.project_name, item.amount)
+
+ return dn_item_map
\ No newline at end of file
diff --git a/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.txt b/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.txt
new file mode 100644
index 0000000..89f5085
--- /dev/null
+++ b/projects/report/project_wise_stock_tracking/project_wise_stock_tracking.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-03 17:37:41",
+ "docstatus": 0,
+ "modified": "2013-06-03 17:37:41",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Project",
+ "report_name": "Project wise Stock Tracking ",
+ "report_type": "Report Builder"
+ },
+ {
+ "doctype": "Report",
+ "name": "Project wise Stock Tracking"
+ }
+]
\ No newline at end of file
diff --git a/projects/search_criteria/__init__.py b/projects/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py b/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/projectwise_delivered_qty_and_costs/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
deleted file mode 100644
index c8b42dc..0000000
--- a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Delivery Note Item'});
-
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer'].df.filter_hide = 0;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
-
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
-
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
diff --git a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt b/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
deleted file mode 100644
index b2ecb6c..0000000
--- a/projects/search_criteria/projectwise_delivered_qty_and_costs/projectwise_delivered_qty_and_costs.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "parent_doc_type": "Delivery Note",
- "module": "Projects",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Delivery Note\u0001Submitted':1,'Delivery Note\u0001Status':'Submitted','Delivery Note\u0001Fiscal Year':''}",
- "doc_type": "Delivery Note Item",
- "name": "__common__",
- "add_cond": "IFNULL(`tabDelivery Note`.`project_name`,\"\")!=\"\"",
- "doctype": "Search Criteria",
- "sort_by": "`tabDelivery Note`.`name`",
- "page_len": 50,
- "criteria_name": "Projectwise Delivered Qty and Costs",
- "columns": "Delivery Note\u0001ID,Delivery Note\u0001Project Name,Delivery Note\u0001Customer,Delivery Note\u0001Customer Name,Delivery Note Item\u0001Item Code,Delivery Note Item\u0001Item Name,Delivery Note Item\u0001Quantity,Delivery Note\u0001Posting Date,Delivery Note\u0001% Billed,Delivery Note Item\u0001Amount*"
- },
- {
- "name": "projectwise_delivered_qty_and_costs",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py b/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/projectwise_pending_qty_and_costs/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
deleted file mode 100644
index ce56077..0000000
--- a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.js
+++ /dev/null
@@ -1,31 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- //this.add_filter({fieldname:'item_code', label:'Item Code', fieldtype:'Link', options:'Item',ignore : 1,parent:'Sales Order Item'});
-
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer Name'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
-
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
diff --git a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt b/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
deleted file mode 100644
index 37b6294..0000000
--- a/projects/search_criteria/projectwise_pending_qty_and_costs/projectwise_pending_qty_and_costs.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "add_col": "SUM(`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`) AS 'Pending Qty'\nSUM((`tabSales Order Item`.`qty` - `tabSales Order Item`.`delivered_qty`)* `tabSales Order Item`.basic_rate) AS 'Pending Amount'",
- "parent_doc_type": "Sales Order",
- "module": "Projects",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':'Submitted','Sales Order\u0001Fiscal Year':''}",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "add_cond": "`tabSales Order Item`.`qty` > `tabSales Order Item`.`delivered_qty`\nIFNULL(`tabSales Order`.`project_name`,\"\")!=\"\"\n`tabSales Order`.order_type = 'Sales'",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Projectwise Pending Qty and Costs",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Project Name,Sales Order\u0001Customer,Sales Order\u0001Customer Name,Sales Order Item\u0001Item Code,Sales Order Item\u0001Item Name,Sales Order\u0001% Delivered,Sales Order\u0001% Billed,Sales Order\u0001Sales Order Date,Sales Order\u0001Expected Delivery Date"
- },
- {
- "name": "projectwise_pending_qty_and_costs",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/__init__.py b/projects/search_criteria/projectwise_purchase_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/projectwise_purchase_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
deleted file mode 100644
index bd4be54..0000000
--- a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.js
+++ /dev/null
@@ -1,108 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- //hide all filters
- //------------------------------------------------
- this.hide_all_filters();
-
- //add filters
- //------------------------------------------------
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Purchase Order'+NEWLINE+'Purchase Invoice'+NEWLINE+'Purchase Receipt',report_default:'Purchase Order',ignore : 1,parent:'Purchase Order', single_select:1});
-
- this.add_filter({fieldname:'purchase_order', label:'Purchase Order', fieldtype:'Link', options:'Purchase Order', ignore : 1, parent:'Purchase Order'});
- this.add_filter({fieldname:'purchase_receipt', label:'Purchase Receipt',fieldtype:'Link', options:'Purchase Receipt',ignore : 1, parent:'Purchase Order'});
- this.add_filter({fieldname:'purchase_invoice', label:'Purchase Invoice',fieldtype:'Link', options:'Purchase Invoice',ignore : 1, parent:'Purchase Order'});
-
- //unhide filters
- //------------------------------------------------
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
-
- //move filter field in first page
- //------------------------------------------------
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Order'].df.in_first_page = 1;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Invoice'].df.in_first_page = 1;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Purchase Receipt'].df.in_first_page = 1;
-
- // default values
- //------------------------------------------------
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Purchase Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
-
-//hide select columns field
-//------------------------------------------------
-this.mytabs.items['Select Columns'].hide();
-
-
-report.get_query = function() {
-
- //get filter values
- based_on = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Based On'].get_value();
- purchase_order = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Order'].get_value();
- purchase_invoice = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Invoice'].get_value();
- purchase_receipt = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Purchase Receipt'].get_value();
- project_name = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Project Name'].get_value();
- company = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Company'].get_value();
- fy = this.filter_fields_dict['Purchase Order'+FILTER_SEP+'Fiscal Year'].get_value();
-
- // make query based on transaction
- //-------------------------------------------------------------------------------------------
-
- var cond = '';
- //for purchase order
- if(based_on == 'Purchase Order'){
-
- if(purchase_order) cond += ' AND `tabPurchase Order`.name = "'+purchase_order+'"';
- if(project_name) cond += ' AND `tabPurchase Order`.project_name = "'+project_name+'"';
- if(company) cond += ' AND `tabPurchase Order`.company = "'+company+'"';
- if(fy !='') cond += ' AND `tabPurchase Order`.fiscal_year = "'+fy+'"';
-
- var q = 'SELECT DISTINCT `tabPurchase Order`.name, `tabPurchase Order`.status, `tabPurchase Order`.project_name, `tabPurchase Order`.supplier,`tabPurchase Order`.supplier_name,`tabPurchase Order`.per_received, `tabPurchase Order`.per_billed, `tabPurchase Order`.grand_total FROM `tabPurchase Order` WHERE IFNULL(`tabPurchase Order`.project_name,"") != ""'+cond+' AND `tabPurchase Order`.docstatus != 2';
- return q;
- }
-
- //for purchase receipt
- else if(based_on == 'Purchase Receipt'){
- if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
- if(purchase_receipt) cond += ' t1.name = "'+purchase_receipt+'" AND ';
- if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
- if(company) cond += ' t1.company = "'+company+'" AND ';
- if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
-
-
- var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.supplier, t1.supplier_name,t1.grand_total FROM `tabPurchase Receipt` t1, `tabPurchase Receipt Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
-
- return q;
- }
- //for purchase invoice
- else if(based_on == 'Purchase Invoice'){
- if(purchase_order) cond += ' t2.purchase_order = "'+purchase_order+'" AND ';
- if(purchase_receipt) cond += ' t2.purchase_receipt = "'+purchase_receipt+'" AND';
- if(purchase_invoice) cond += ' t1.name = "'+purchase_invoice+'" AND';
- if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
- if(company) cond += ' t1.company = "'+company+'" AND ';
- if(fy !='') cond += ' t1.fiscal_year = "'+fy+'" AND ';
-
- var q = 'SELECT DISTINCT t1.name , t1.credit_to , t1.project_name, t1.supplier, t1.supplier_name , t1.grand_total FROM `tabPurchase Invoice` t1, `tabPurchase Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
-
- return q;
- }
-}
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
deleted file mode 100644
index ed82ceb..0000000
--- a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.py
+++ /dev/null
@@ -1,40 +0,0 @@
-# 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
-based_on = filter_values.get('based_on')
-# make default columns
-#for r in res:
-col = []
-if based_on == 'Purchase Order':
- col = [['Purchase Order ID','Link','Purchase Order'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['% Received','Data',''],['% Billed','Data',''],['Grand Total','Currency','']]
-
-elif based_on == 'Purchase Invoice':
- col = [['Purchase Receipt ID','Link','Purchase Invoice'],['Status','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
-
-elif based_on == 'Purchase Receipt':
- col = [['Purchase Invoice ID','Link','Purchase Receipt'],['Credit To','Data',''],['Project Name','Link','Project'],['Supplier','Link','Supplier'],['Supplier Name','Data',''],['Grand Total','Currency','']]
-
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- coloptions.append(c[2])
- l = (len(c[0])*9)
- if l < 150 : col_width = '150px'
- else: col_width = '%spx'%(l)
- colwidths.append(col_width)
- col_idx[c[0]] = len(colnames)-1
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt b/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
deleted file mode 100644
index cb88f58..0000000
--- a/projects/search_criteria/projectwise_purchase_details/projectwise_purchase_details.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "doc_type": "Purchase Order",
- "name": "__common__",
- "module": "Projects",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Purchase Order\u0001Status':'','Purchase Order\u0001Fiscal Year':''}",
- "page_len": 50,
- "criteria_name": "Projectwise Purchase Details",
- "standard": "Yes"
- },
- {
- "name": "projectwise_purchase_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/__init__.py b/projects/search_criteria/projectwise_sales_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/projectwise_sales_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
deleted file mode 100644
index 4e92c3c..0000000
--- a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.js
+++ /dev/null
@@ -1,112 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- //hide all filters
- //------------------------------------------------
- this.hide_all_filters();
-
- //add filters
- //------------------------------------------------
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1,parent:'Sales Order', single_select:1});
-
- this.add_filter({fieldname:'sales_order', label:'Sales Order', fieldtype:'Link', options:'Sales Order', ignore : 1, parent:'Sales Order'});
- this.add_filter({fieldname:'delivery_note', label:'Delivery Note', fieldtype:'Link', options:'Delivery Note',ignore : 1, parent:'Sales Order'});
- this.add_filter({fieldname:'sales_invoice', label:'Sales Invoice',fieldtype:'Link', options:'Sales Invoice',ignore : 1, parent:'Sales Order'});
-
- //unhide filters
- //------------------------------------------------
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
-
- //move filter field in first page
- //------------------------------------------------
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Based On'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Order'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Delivery Note'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Invoice'].df.in_first_page = 1;
-
- // default values
- //------------------------------------------------
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-
-}
-
-//hide select columns field
-//------------------------------------------------
-//this.mytabs.items['Select Columns'].hide();
-
-
-report.get_query = function() {
-
- //get filter values
- based_on = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Based On'].get_value();
- sales_order = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Order'].get_value();
- delivery_note = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Delivery Note'].get_value();
- sales_invoice = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Sales Invoice'].get_value();
- project_name = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Project Name'].get_value();
- company = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Company'].get_value();
- fy = this.filter_fields_dict['Sales Order'+FILTER_SEP+'Fiscal Year'].get_value();
-
- // make query based on transaction
- //-------------------------------------------------------------------------------------------
-
- var cond = '';
- //for sales order
- if(based_on == 'Sales Order'){
-
- if(sales_order) cond += ' AND `tabSales Order`.name = "'+sales_order+'"';
- if(project_name) cond += ' AND `tabSales Order`.project_name = "'+project_name+'"';
- if(company) cond += ' AND `tabSales Order`.company = "'+company+'"';
- if(fy) cond += ' AND `tabSales Order`.fiscal_year = "'+fy+'"';
-
- var q = 'SELECT DISTINCT `tabSales Order`.name, `tabSales Order`.order_type, `tabSales Order`.status, `tabSales Order`.project_name, `tabSales Order`.customer,`tabSales Order`.customer_name,`tabSales Order`.per_delivered, `tabSales Order`.per_billed, `tabSales Order`.grand_total FROM `tabSales Order` WHERE IFNULL(`tabSales Order`.project_name,"") != ""'+cond+' AND `tabSales Order`.docstatus != 2';
- return q;
- }
-
- //for delivery note
- else if(based_on == 'Delivery Note'){
- if(sales_order) cond += ' t1.name = t2.parent AND t2.prevdoc_docname = "'+sales_order+'" AND ';
- if(delivery_note) cond += ' t1.name = "'+delivery_note+'" AND ';
- if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
- if(company) cond += ' t1.company = "'+company+'" AND ';
- if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND ';
-
- var q = 'SELECT DISTINCT t1.name, t1.status, t1.project_name, t1.customer, t1.customer_name, t1.per_billed, t1.per_installed, t1.grand_total FROM `tabDelivery Note` t1, `tabDelivery Note Item` t2 WHERE '+cond+' IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2';
-
- return q;
- }
-
- //for sales invoice
- else if(based_on == 'Sales Invoice'){
- if(sales_order) cond += ' t2.sales_order = "'+sales_order+'" AND ';
- if(delivery_note) cond += ' t2.delivery_note = "'+delivery_note+'" AND ';
- if(sales_invoice) cond += ' t1.name = "'+sales_invoice+'" AND ';
- if(project_name) cond += ' t1.project_name = "'+project_name+'" AND ';
- if(company) cond += ' t1.company = "'+company+'" AND ';
- if(fy) cond += ' t1.fiscal_year = "'+fy+'" AND ';
-
-
- var q = 'SELECT DISTINCT t1.name , t1.debit_to , t1.project_name , t1.customer , t1.customer_name , t1.grand_total FROM `tabSales Invoice` t1, `tabSales Invoice Item` t2 WHERE '+cond +'IFNULL(t1.project_name,"") !="" AND t1.docstatus != 2 AND t1.name = t2.parent';
-
- return q;
- }
-
-}
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
deleted file mode 100644
index 50ade66..0000000
--- a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# 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
-based_on = filter_values.get('based_on')
-
-cols=[]
-
-if based_on == 'Sales Order':
- cols = [['Sales Order No','Link','150px','Sales Order'], ['Order Type','Data','100px',''], ['Status','Data','100px',''], ['Project Name','Link','150px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Delivered','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
-
-elif based_on == 'Delivery Note':
- cols = [['Delivery Note No','Link','150px','Delivery Note'], ['Status','Data','100px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['% Installed','Currency','100px',''], ['% Billed','Currency','100px',''], ['Grand Total','Currency','150px','']]
-
-elif based_on == 'Sales Invoice':
- cols = [['Sales Invoice No','Link','150px','Sales Invoice'], ['Debit To','Data','150px',''], ['Project Name','Link','200px','Project'], ['Customer','Link','150px','Customer'], ['Customer Name','Data','200px',''], ['Grand Total','Currency','150px','']]
-
-
-for c in cols:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt b/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
deleted file mode 100644
index 11a50a6..0000000
--- a/projects/search_criteria/projectwise_sales_details/projectwise_sales_details.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "doc_type": "Sales Order",
- "name": "__common__",
- "module": "Projects",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Saved':1,'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':''}",
- "page_len": 50,
- "criteria_name": "Projectwise Sales Details",
- "standard": "Yes"
- },
- {
- "name": "projectwise_sales_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/search_criteria/projectwise_sales_orders/__init__.py b/projects/search_criteria/projectwise_sales_orders/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/projectwise_sales_orders/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt b/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
deleted file mode 100644
index 29919e6..0000000
--- a/projects/search_criteria/projectwise_sales_orders/projectwise_sales_orders.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "Projects",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Saved':1,'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':'','Sales Order\u0001Fiscal Year':''}",
- "doc_type": "Sales Order",
- "name": "__common__",
- "add_cond": "ifnull(`tabSales Order`.project_name ,'') != ''",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Projectwise Sales Orders",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Status,Sales Order\u0001Project Name,Sales Order\u0001Customer,Sales Order\u0001Sales Order Date,Sales Order\u0001Expected Delivery Date,Sales Order\u0001Quotation No,Sales Order\u0001% Delivered,Sales Order\u0001% Billed,Sales Order\u0001Grand Total*"
- },
- {
- "name": "projectwise_sales_orders",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/search_criteria/timesheet_report/__init__.py b/projects/search_criteria/timesheet_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/projects/search_criteria/timesheet_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/projects/search_criteria/timesheet_report/timesheet_report.js b/projects/search_criteria/timesheet_report/timesheet_report.js
deleted file mode 100644
index 12d9680..0000000
--- a/projects/search_criteria/timesheet_report/timesheet_report.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Project Name'].df.in_first_page = 1;
- this.filter_fields_dict['Timesheet Detail'+FILTER_SEP +'Task Id'].df.in_first_page = 1;
-this.filter_fields_dict['Timesheet'+FILTER_SEP +'Timesheet by'].df.filter_hide = 1;
-}
-
-//this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/projects/search_criteria/timesheet_report/timesheet_report.txt b/projects/search_criteria/timesheet_report/timesheet_report.txt
deleted file mode 100644
index 14bbe08..0000000
--- a/projects/search_criteria/timesheet_report/timesheet_report.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Timesheet",
- "module": "Projects",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Timesheet\u0001Saved':1,'Timesheet\u0001Submitted':1}",
- "doc_type": "Timesheet Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabTimesheet`.`name`",
- "page_len": 50,
- "criteria_name": "Timesheet Report",
- "columns": "Timesheet\u0001ID,Timesheet\u0001Timesheet Date,Timesheet\u0001Timesheet by,Timesheet Detail\u0001Project Name,Timesheet Detail\u0001Task Id,Timesheet Detail\u0001Task Name,Timesheet Detail\u0001Actual Start Time,Timesheet Detail\u0001Actual End Time,Timesheet Detail\u0001Total Hours (Actual)"
- },
- {
- "name": "timesheet_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/projects/utils.py b/projects/utils.py
index a7a016a..e37a21c 100644
--- a/projects/utils.py
+++ b/projects/utils.py
@@ -5,4 +5,25 @@
@webnotes.whitelist()
def get_time_log_list(doctype, txt, searchfield, start, page_len, filters):
- return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"], debug=True)
\ No newline at end of file
+ return webnotes.conn.get_values("Time Log", filters, ["name", "activity_type", "owner"])
+
+@webnotes.whitelist()
+def query_task(doctype, txt, searchfield, start, page_len, filters):
+ from webnotes.widgets.reportview import build_match_conditions
+
+ search_string = "%%%s%%" % txt
+ order_by_string = "%s%%" % txt
+ match_conditions = build_match_conditions("Task")
+ match_conditions = ("and" + match_conditions) if match_conditions else ""
+
+ return webnotes.conn.sql("""select name, subject from `tabTask`
+ where (`%s` like %s or `subject` like %s) %s
+ order by
+ case when `subject` like %s then 0 else 1 end,
+ case when `%s` like %s then 0 else 1 end,
+ `%s`,
+ subject
+ limit %s, %s""" %
+ (searchfield, "%s", "%s", match_conditions, "%s",
+ searchfield, "%s", searchfield, "%s", "%s"),
+ (search_string, search_string, order_by_string, order_by_string, start, page_len))
\ No newline at end of file
diff --git a/public/js/complete_setup.js b/public/js/complete_setup.js
index f5d0672..37c2fba 100644
--- a/public/js/complete_setup.js
+++ b/public/js/complete_setup.js
@@ -40,7 +40,7 @@
{fieldname:'country', label: 'Country', reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'currency', label: 'Default Currency', reqd:1,
- options: "Currency", fieldtype: 'Link'},
+ options: "", fieldtype: 'Select'},
{fieldname:'timezone', label: 'Time Zone', reqd:1,
options: "", fieldtype: 'Select'},
{fieldname:'industry', label: 'Industry', reqd:1,
@@ -55,11 +55,17 @@
}
wn.call({
- method:"webnotes.country_info.get_all",
+ method:"webnotes.country_info.get_country_timezone_info",
callback: function(data) {
- erpnext.country_info = data.message;
+ erpnext.country_info = data.message.country_info;
+ erpnext.all_timezones = data.message.all_timezones;
d.get_input("country").empty()
- .add_options([""].concat(keys(data.message).sort()));
+ .add_options([""].concat(keys(erpnext.country_info).sort()));
+ d.get_input("currency").empty()
+ .add_options(wn.utils.unique([""].concat($.map(erpnext.country_info,
+ function(opts, country) { return opts.currency; }))).sort());
+ d.get_input("timezone").empty()
+ .add_options([""].concat(erpnext.all_timezones));
}
})
@@ -69,12 +75,17 @@
if(!data) return;
$(this).set_working();
$c_obj('Setup Control','setup_account',data,function(r, rt){
- sys_defaults = r.message;
- user_fullname = r.message.user_fullname;
- wn.boot.user_info[user].fullname = user_fullname;
- d.hide();
- $('header').toggle(true);
- wn.container.wntoolbar.set_user_name();
+ if(!r.exc) {
+ sys_defaults = r.message;
+ user_fullname = r.message.user_fullname;
+ wn.boot.user_info[user].fullname = user_fullname;
+ d.hide();
+ $('header').toggle(true);
+ wn.container.wntoolbar.set_user_name();
+
+ setTimeout(function() { window.location.reload(); }, 3000);
+ }
+
});
};
@@ -82,19 +93,15 @@
var country = d.fields_dict.country.input.value;
var $timezone = $(d.fields_dict.timezone.input);
$timezone.empty();
+ // add country specific timezones first
if(country){
- var timezone_list = erpnext.country_info[country].timezones;
- if(timezone_list.length==0) {
- timezone_list = $.map(erpnext.country_info, function(m) {
- return m.timezones
- });
- }
- $timezone.empty().add_options(timezone_list);
-
- console.log(d.get_input("currency"))
+ var timezone_list = erpnext.country_info[country].timezones || [];
+ $timezone.add_options(timezone_list.sort());
d.get_input("currency").val(erpnext.country_info[country].currency);
}
+ // add all timezones at the end, so that user has the option to change it to any timezone
+ $timezone.add_options([""].concat(erpnext.all_timezones));
};
@@ -127,5 +134,5 @@
'Finance', 'Food and Beverage', 'Government', 'Healthcare', 'Hospitality',
'Information Technology', 'Insurance', 'Machinery', 'Manufacturing', 'Media',
'Not For Profit', 'Recreation', 'Retail', 'Shipping', 'Technology',
- 'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'],
+ 'Telecommunications', 'Transportation', 'Trading', 'Utilities', 'Other'],
});
\ No newline at end of file
diff --git a/public/js/purchase_trends_filters.js b/public/js/purchase_trends_filters.js
new file mode 100644
index 0000000..117b9de
--- /dev/null
+++ b/public/js/purchase_trends_filters.js
@@ -0,0 +1,39 @@
+var get_filters = function(){
+ return [
+ {
+ "fieldname":"period",
+ "label": "Period",
+ "fieldtype": "Select",
+ "options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"),
+ "default": "Monthly"
+ },
+ {
+ "fieldname":"based_on",
+ "label": "Based On",
+ "fieldtype": "Select",
+ "options": ["Item", "Item Group", "Supplier", "Supplier Type", "Project"].join("\n"),
+ "default": "Item"
+ },
+ {
+ "fieldname":"group_by",
+ "label": "Group By",
+ "fieldtype": "Select",
+ "options": ["Item", "Supplier"].join("\n"),
+ "default": ""
+ },
+ {
+ "fieldname":"fiscal_year",
+ "label": "Fiscal Year",
+ "fieldtype": "Link",
+ "options":'Fiscal Year',
+ "default": sys_defaults.fiscal_year
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ },
+ ];
+}
\ No newline at end of file
diff --git a/public/js/queries.js b/public/js/queries.js
index 9809cd9..24ddc13 100644
--- a/public/js/queries.js
+++ b/public/js/queries.js
@@ -160,4 +160,8 @@
: "")
+ " LIMIT 50"
-}
\ No newline at end of file
+}
+
+erpnext.queries.task = function() {
+ return { query: "projects.utils.query_task" };
+};
\ No newline at end of file
diff --git a/public/js/sales_trends_filters.js b/public/js/sales_trends_filters.js
new file mode 100644
index 0000000..f461d08
--- /dev/null
+++ b/public/js/sales_trends_filters.js
@@ -0,0 +1,39 @@
+var get_filters = function(){
+ return[
+ {
+ "fieldname":"period",
+ "label": "Period",
+ "fieldtype": "Select",
+ "options": ["Monthly", "Quarterly", "Half-Yearly", "Yearly"].join("\n"),
+ "default": "Monthly"
+ },
+ {
+ "fieldname":"based_on",
+ "label": "Based On",
+ "fieldtype": "Select",
+ "options": ["Item", "Item Group", "Customer", "Customer Group", "Territory", "Project"].join("\n"),
+ "default": "Item"
+ },
+ {
+ "fieldname":"group_by",
+ "label": "Group By",
+ "fieldtype": "Select",
+ "options": ["Item", "Customer"].join("\n"),
+ "default": ""
+ },
+ {
+ "fieldname":"fiscal_year",
+ "label": "Fiscal Year",
+ "fieldtype": "Link",
+ "options":'Fiscal Year',
+ "default": sys_defaults.fiscal_year
+ },
+ {
+ "fieldname":"company",
+ "label": "Company",
+ "fieldtype": "Link",
+ "options": "Company",
+ "default": sys_defaults.company
+ },
+ ];
+}
\ No newline at end of file
diff --git a/public/js/stock_analytics.js b/public/js/stock_analytics.js
index c3ed1cb..91384f6 100644
--- a/public/js/stock_analytics.js
+++ b/public/js/stock_analytics.js
@@ -162,6 +162,8 @@
} else {
break;
}
+
+ me.round_item_values(item);
}
}
},
diff --git a/selling/doctype/customer/customer.js b/selling/doctype/customer/customer.js
index 403b83f..40a7846 100644
--- a/selling/doctype/customer/customer.js
+++ b/selling/doctype/customer/customer.js
@@ -57,7 +57,7 @@
if(!cur_frm.address_list) {
cur_frm.address_list = new wn.ui.Listing({
parent: cur_frm.fields_dict['address_html'].wrapper,
- page_length: 2,
+ page_length: 5,
new_doctype: "Address",
custom_new_doc: function(doctype) {
var address = wn.model.make_new_doc_and_get_name('Address');
@@ -88,7 +88,7 @@
if(!cur_frm.contact_list) {
cur_frm.contact_list = new wn.ui.Listing({
parent: cur_frm.fields_dict['contact_html'].wrapper,
- page_length: 2,
+ page_length: 5,
custom_new_doc: function(doctype) {
var contact = wn.model.make_new_doc_and_get_name('Contact');
contact = locals['Contact'][contact];
diff --git a/selling/doctype/customer/customer.py b/selling/doctype/customer/customer.py
index 7e16341..65ac865 100644
--- a/selling/doctype/customer/customer.py
+++ b/selling/doctype/customer/customer.py
@@ -115,18 +115,20 @@
if not webnotes.conn.exists("Account", (self.doc.name + " - " + abbr)):
parent_account = self.get_receivables_group()
# create
- from accounts.utils import add_ac
- ac = add_ac({
- 'account_name':self.doc.name,
+ ac_bean = webnotes.bean({
+ "doctype": "Account",
+ 'account_name': self.doc.name,
'parent_account': parent_account,
'group_or_ledger':'Ledger',
'company':self.doc.company,
- 'account_type':'',
- 'tax_rate':'0',
'master_type':'Customer',
- 'master_name':self.doc.name
+ 'master_name':self.doc.name,
+ "freeze_account": "No"
})
- msgprint("Account Head: %s created" % ac)
+ ac_bean.ignore_permissions = True
+ ac_bean.insert()
+
+ msgprint("Account Head: %s created" % ac_bean.doc.name)
else :
msgprint("Please Select Company under which you want to create account head")
@@ -216,35 +218,16 @@
if self.doc.lead_name:
sql("update `tabLead` set status='Interested' where name=%s",self.doc.lead_name)
- def on_rename(self, new, old):
+ def on_rename(self, new, old, merge=False):
#update customer_name if not naming series
if webnotes.defaults.get_global_default('cust_master_name') == 'Customer Name':
- update_fields = [
- ('Customer', 'name'),
- ('Address', 'customer'),
- ('Contact', 'customer'),
- ('Customer Issue', 'customer'),
- ('Delivery Note', 'customer'),
- ('Opportunity', 'customer'),
- ('Installation Note', 'customer'),
- ('Maintenance Schedule', 'customer'),
- ('Maintenance Visit', 'customer'),
- ('Project', 'customer'),
- ('Quotation', 'customer'),
- ('Sales Invoice', 'customer'),
- ('Sales Order', 'customer'),
- ('Serial No', 'customer'),
- ('Shipping Address', 'customer'),
- ('Stock Entry', 'customer'),
- ('Support Ticket', 'customer')]
- for rec in update_fields:
- sql("""update `tab%s` set customer_name = %s
- where `%s` = %s""" % (rec[0], "%s" ,rec[1], "%s"), (new, old))
+ webnotes.conn.sql("""update `tabCustomer` set customer_name = %s where name = %s""",
+ (new, old))
for account in webnotes.conn.sql("""select name, account_name from
tabAccount where master_name=%s and master_type='Customer'""", old, as_dict=1):
if account.account_name != new:
- webnotes.rename_doc("Account", account.name, new)
+ webnotes.rename_doc("Account", account.name, new, merge=merge)
#update master_name in doctype account
webnotes.conn.sql("""update `tabAccount` set master_name = %s,
diff --git a/selling/doctype/customer/customer.txt b/selling/doctype/customer/customer.txt
index a221daa..d7cecdd 100644
--- a/selling/doctype/customer/customer.txt
+++ b/selling/doctype/customer/customer.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-23 19:57:18",
+ "creation": "2013-06-11 14:26:44",
"docstatus": 0,
- "modified": "2013-01-29 16:28:03",
+ "modified": "2013-06-11 14:27:57",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -270,7 +270,7 @@
"label": "Credit Days",
"oldfieldname": "credit_days",
"oldfieldtype": "Int",
- "permlevel": 2
+ "permlevel": 1
},
{
"doctype": "DocField",
@@ -280,7 +280,7 @@
"oldfieldname": "credit_limit",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
- "permlevel": 2
+ "permlevel": 1
},
{
"doctype": "DocField",
@@ -339,7 +339,7 @@
},
{
"doctype": "DocPerm",
- "permlevel": 2,
+ "permlevel": 1,
"role": "Sales User"
},
{
@@ -355,7 +355,7 @@
},
{
"doctype": "DocPerm",
- "permlevel": 2,
+ "permlevel": 1,
"role": "Sales Master Manager",
"write": 1
}
diff --git a/selling/doctype/customer/test_customer.py b/selling/doctype/customer/test_customer.py
index 551b03f..806585f 100644
--- a/selling/doctype/customer/test_customer.py
+++ b/selling/doctype/customer/test_customer.py
@@ -1,4 +1,60 @@
+from __future__ import unicode_literals
+import webnotes
+import unittest
+
+class TestCustomer(unittest.TestCase):
+ def test_rename(self):
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"),
+ (("_Test Customer 1",),))
+
+ webnotes.rename_doc("Customer", "_Test Customer 1", "_Test Customer 1 Renamed")
+
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1 Renamed"),
+ (("_Test Customer 1 Renamed",),))
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"), ())
+
+ def test_merge(self):
+ from webnotes.test_runner import make_test_records
+ make_test_records("Sales Invoice")
+
+ # clear transactions for new name
+ webnotes.conn.sql("""delete from `tabSales Invoice` where customer='_Test Customer 1'""")
+
+ # check if they exist
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"),
+ (("_Test Customer",),))
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer 1"),
+ (("_Test Customer 1",),))
+ self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"),
+ (("_Test Customer - _TC",),))
+ self.assertEqual(webnotes.conn.exists("Account", "_Test Customer 1 - _TC"),
+ (("_Test Customer 1 - _TC",),))
+
+ # check if transactions exists
+ self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where customer='_Test Customer'""", )[0][0], 0)
+ self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where debit_to='_Test Customer - _TC'""", )[0][0], 0)
+
+ webnotes.rename_doc("Customer", "_Test Customer", "_Test Customer 1", merge=True)
+
+ # check that no transaction exists for old name
+ self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where customer='_Test Customer 1'""", )[0][0], 0)
+ self.assertNotEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where debit_to='_Test Customer 1 - _TC'""", )[0][0], 0)
+
+ # check that transactions exist for new name
+ self.assertEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where customer='_Test Customer'""", )[0][0], 0)
+ self.assertEquals(webnotes.conn.sql("""select count(*) from `tabSales Invoice`
+ where debit_to='_Test Customer - _TC'""", )[0][0], 0)
+
+ # check that old name doesn't exist
+ self.assertEqual(webnotes.conn.exists("Customer", "_Test Customer"), ())
+ self.assertEqual(webnotes.conn.exists("Account", "_Test Customer - _TC"), ())
+
test_records = [
[{
"doctype": "Customer",
@@ -7,5 +63,13 @@
"customer_group": "_Test Customer Group",
"territory": "_Test Territory",
"company": "_Test Company"
+ }],
+ [{
+ "doctype": "Customer",
+ "customer_name": "_Test Customer 1",
+ "customer_type": "Individual",
+ "customer_group": "_Test Customer Group",
+ "territory": "_Test Territory",
+ "company": "_Test Company"
}]
]
\ No newline at end of file
diff --git a/selling/doctype/installation_note/installation_note.py b/selling/doctype/installation_note/installation_note.py
index b0e1d96..ea20d51 100644
--- a/selling/doctype/installation_note/installation_note.py
+++ b/selling/doctype/installation_note/installation_note.py
@@ -18,9 +18,7 @@
import webnotes
from webnotes.utils import cstr, getdate
-from webnotes.model import db_exists
-from webnotes.model.doc import make_autoname
-from webnotes.model.bean import getlist, copy_doclist
+from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
from stock.utils import get_valid_serial_nos
@@ -37,9 +35,6 @@
self.tname = 'Installation Note Item'
self.fname = 'installed_item_details'
- def autoname(self):
- self.doc.name = make_autoname(self.doc.naming_series+'.#####')
-
def validate(self):
self.validate_fiscal_year()
self.validate_installation_date()
diff --git a/selling/doctype/installation_note/installation_note.txt b/selling/doctype/installation_note/installation_note.txt
index 52917e0..9dd851d 100644
--- a/selling/doctype/installation_note/installation_note.txt
+++ b/selling/doctype/installation_note/installation_note.txt
@@ -1,13 +1,13 @@
[
{
- "creation": "2013-01-10 16:34:18",
+ "creation": "2013-04-30 13:13:06",
"docstatus": 0,
- "modified": "2013-01-22 14:56:02",
+ "modified": "2013-05-09 14:43:28",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
- "autoname": "IN/.####",
+ "autoname": "naming_series:",
"doctype": "DocType",
"is_submittable": 1,
"module": "Selling",
@@ -33,6 +33,7 @@
"permlevel": 0,
"read": 1,
"report": 1,
+ "role": "Sales User",
"submit": 1,
"write": 1
},
@@ -302,15 +303,6 @@
"options": "Installation Note Item"
},
{
- "doctype": "DocPerm",
- "role": "System Manager"
- },
- {
- "doctype": "DocPerm",
- "role": "Sales User"
- },
- {
- "doctype": "DocPerm",
- "role": "Sales Manager"
+ "doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/selling/doctype/lead/lead.js b/selling/doctype/lead/lead.js
index d8d322d..118b4c7 100644
--- a/selling/doctype/lead/lead.js
+++ b/selling/doctype/lead/lead.js
@@ -104,7 +104,17 @@
'from_to_list':"[['Lead', 'Customer']]"
},
function(r,rt) {
- loaddoc("Customer", n);
+ wn.model.with_doctype("Customer", function() {
+ var customer = wn.model.get_doc("Customer", n);
+ var customer_copy = $.extend({}, customer);
+
+ var updated = wn.model.set_default_values(customer_copy);
+ $.each(updated, function(i, f) {
+ if(!customer[f]) customer[f] = customer_copy[f];
+ });
+
+ loaddoc("Customer", n);
+ });
}
);
}
diff --git a/selling/doctype/lead/lead.py b/selling/doctype/lead/lead.py
index 571cdfd..a54343a 100644
--- a/selling/doctype/lead/lead.py
+++ b/selling/doctype/lead/lead.py
@@ -17,8 +17,7 @@
from __future__ import unicode_literals
import webnotes
from webnotes import _
-from webnotes.utils import cstr, validate_email_add
-from webnotes.model.doc import Document, addchild
+from webnotes.utils import cstr, validate_email_add, cint
from webnotes import session, msgprint
sql = webnotes.conn.sql
@@ -30,6 +29,13 @@
self.doc = doc
self.doclist = doclist
+ self._prev = webnotes._dict({
+ "contact_date": webnotes.conn.get_value("Lead", self.doc.name, "contact_date") if \
+ (not cint(self.doc.fields.get("__islocal"))) else None,
+ "contact_by": webnotes.conn.get_value("Lead", self.doc.name, "contact_by") if \
+ (not cint(self.doc.fields.get("__islocal"))) else None,
+ })
+
def onload(self):
self.add_communication_list()
@@ -55,12 +61,18 @@
msgprint('Please enter valid email id.')
raise Exception
-
def on_update(self):
- if self.doc.contact_date:
- self.add_calendar_event()
-
self.check_email_id_is_unique()
+ self.add_calendar_event()
+
+ def add_calendar_event(self, opts=None, force=False):
+ super(DocType, self).add_calendar_event({
+ "owner": self.doc.lead_owner,
+ "subject": ('Contact ' + cstr(self.doc.lead_name)),
+ "description": ('Contact ' + cstr(self.doc.lead_name)) + \
+ (self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \
+ (self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '')
+ }, force)
def check_email_id_is_unique(self):
if self.doc.email_id:
@@ -71,27 +83,6 @@
items = [e[0] for e in email_list if e[0]!=self.doc.name]
webnotes.msgprint(_("""Email Id must be unique, already exists for: """) + \
", ".join(items), raise_exception=True)
-
- def add_calendar_event(self):
- # delete any earlier event by this lead
- sql("delete from tabEvent where ref_type='Lead' and ref_name=%s", self.doc.name)
-
- # create new event
- ev = Document('Event')
- ev.owner = self.doc.lead_owner
- ev.description = ('Contact ' + cstr(self.doc.lead_name)) + \
- (self.doc.contact_by and ('. By : ' + cstr(self.doc.contact_by)) or '') + \
- (self.doc.remark and ('.To Discuss : ' + cstr(self.doc.remark)) or '')
- ev.event_date = self.doc.contact_date
- ev.event_hour = '10:00'
- ev.event_type = 'Private'
- ev.ref_type = 'Lead'
- ev.ref_name = self.doc.name
- ev.save(1)
-
- event_user = addchild(ev, 'event_individuals', 'Event User')
- event_user.person = self.doc.contact_by
- event_user.save()
def get_sender(self, comm):
return webnotes.conn.get_value('Sales Email Settings',None,'email_id')
@@ -100,3 +91,5 @@
webnotes.conn.sql("""update tabCommunication set lead=null where lead=%s""", self.doc.name)
webnotes.conn.sql("""update `tabSupport Ticket` set lead='' where lead=%s""",
self.doc.name)
+
+ self.delete_events()
\ No newline at end of file
diff --git a/selling/doctype/opportunity/opportunity.py b/selling/doctype/opportunity/opportunity.py
index 75a7cd2..9fb061b 100644
--- a/selling/doctype/opportunity/opportunity.py
+++ b/selling/doctype/opportunity/opportunity.py
@@ -17,9 +17,7 @@
from __future__ import unicode_literals
import webnotes
-from webnotes.utils import add_days, cstr, getdate
-from webnotes.model import db_exists
-from webnotes.model.doc import Document, addchild
+from webnotes.utils import add_days, cstr, getdate, cint
from webnotes.model.bean import getlist
from webnotes import msgprint
@@ -34,6 +32,13 @@
self.fname = 'enq_details'
self.tname = 'Opportunity Item'
+ self._prev = webnotes._dict({
+ "contact_date": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_date") if \
+ (not cint(self.doc.fields.get("__islocal"))) else None,
+ "contact_by": webnotes.conn.get_value("Opportunity", self.doc.name, "contact_by") if \
+ (not cint(self.doc.fields.get("__islocal"))) else None,
+ })
+
def onload(self):
self.add_communication_list()
@@ -84,48 +89,34 @@
def on_update(self):
# Add to calendar
if self.doc.contact_date and self.doc.contact_date_ref != self.doc.contact_date:
- if self.doc.contact_by:
- self.add_calendar_event()
webnotes.conn.set(self.doc, 'contact_date_ref',self.doc.contact_date)
- webnotes.conn.set(self.doc, 'status', 'Draft')
- def add_calendar_event(self):
- desc=''
- user_lst =[]
+ self.add_calendar_event()
+
+ def add_calendar_event(self, opts=None, force=False):
+ if not opts:
+ opts = webnotes._dict()
+
+ opts.description = ""
+
if self.doc.customer:
if self.doc.contact_person:
- desc = 'Contact '+cstr(self.doc.contact_person)
+ opts.description = 'Contact '+cstr(self.doc.contact_person)
else:
- desc = 'Contact customer '+cstr(self.doc.customer)
+ opts.description = 'Contact customer '+cstr(self.doc.customer)
elif self.doc.lead:
if self.doc.contact_display:
- desc = 'Contact '+cstr(self.doc.contact_display)
+ opts.description = 'Contact '+cstr(self.doc.contact_display)
else:
- desc = 'Contact lead '+cstr(self.doc.lead)
- desc = desc+ '. By : ' + cstr(self.doc.contact_by)
+ opts.description = 'Contact lead '+cstr(self.doc.lead)
+
+ opts.subject = opts.description
+ opts.description += '. By : ' + cstr(self.doc.contact_by)
if self.doc.to_discuss:
- desc = desc+' To Discuss : ' + cstr(self.doc.to_discuss)
+ opts.description += ' To Discuss : ' + cstr(self.doc.to_discuss)
- ev = Document('Event')
- ev.description = desc
- ev.event_date = self.doc.contact_date
- ev.event_hour = '10:00'
- ev.event_type = 'Private'
- ev.ref_type = 'Opportunity'
- ev.ref_name = self.doc.name
- ev.save(1)
-
- user_lst.append(self.doc.owner)
-
- chk = sql("select t1.name from `tabProfile` t1, `tabSales Person` t2 where t2.email_id = t1.name and t2.name=%s",self.doc.contact_by)
- if chk:
- user_lst.append(chk[0][0])
-
- for d in user_lst:
- ch = addchild(ev, 'event_individuals', 'Event User')
- ch.person = d
- ch.save(1)
+ super(DocType, self).add_calendar_event(opts, force)
def set_last_contact_date(self):
if self.doc.contact_date_ref and self.doc.contact_date_ref != self.doc.contact_date:
@@ -159,6 +150,9 @@
self.set_last_contact_date()
self.validate_item_details()
self.validate_lead_cust()
+
+ if not self.doc.status:
+ self.doc.status = "Draft"
def on_submit(self):
webnotes.conn.set(self.doc, 'status', 'Submitted')
@@ -180,3 +174,6 @@
webnotes.conn.set(self.doc, 'status', 'Opportunity Lost')
webnotes.conn.set(self.doc, 'order_lost_reason', arg)
return 'true'
+
+ def on_trash(self):
+ self.delete_events()
\ No newline at end of file
diff --git a/selling/doctype/quotation/quotation.txt b/selling/doctype/quotation/quotation.txt
index feda14c..4115be8 100644
--- a/selling/doctype/quotation/quotation.txt
+++ b/selling/doctype/quotation/quotation.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-04-03 09:10:44",
+ "creation": "2013-05-22 12:10:46",
"docstatus": 0,
- "modified": "2013-04-03 09:58:02",
+ "modified": "2013-05-22 16:54:07",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -833,12 +833,11 @@
"width": "100px"
},
{
- "description": "Keep a track on communications regarding this Quotation. This will help you remember earlier communications in case the Customer comes back again",
"doctype": "DocField",
"fieldname": "communication_history",
"fieldtype": "Section Break",
- "label": "Communication History",
"oldfieldtype": "Section Break",
+ "options": "Simple",
"print_hide": 1,
"read_only": 0
},
@@ -869,29 +868,24 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "Sales Manager",
+ "role": "Sales User",
"submit": 1,
"write": 1
},
{
+ "doctype": "DocPerm",
+ "role": "Customer"
+ },
+ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "Sales User",
+ "role": "Sales Manager",
"submit": 1,
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "role": "Customer",
- "submit": 0,
- "write": 0
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
diff --git a/selling/doctype/quotation_item/quotation_item.txt b/selling/doctype/quotation_item/quotation_item.txt
index dccc503..bcb9281 100644
--- a/selling/doctype/quotation_item/quotation_item.txt
+++ b/selling/doctype/quotation_item/quotation_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:27:52",
+ "creation": "2013-03-07 11:42:57",
"docstatus": 0,
- "modified": "2013-03-07 07:03:29",
+ "modified": "2013-05-22 12:08:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -37,6 +37,7 @@
"options": "Item",
"print_hide": 0,
"print_width": "150px",
+ "read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "150px"
@@ -60,6 +61,7 @@
"oldfieldtype": "Data",
"print_hide": 1,
"print_width": "150px",
+ "read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "150px"
@@ -73,6 +75,7 @@
"oldfieldtype": "Small Text",
"print_hide": 0,
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"width": "300px"
},
@@ -87,6 +90,7 @@
"oldfieldtype": "Currency",
"print_hide": 0,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"search_index": 0,
"width": "100px"
@@ -115,6 +119,7 @@
"options": "currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"width": "100px"
},
@@ -128,6 +133,7 @@
"oldfieldtype": "Float",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"width": "100px"
},
{
@@ -142,6 +148,7 @@
"options": "currency",
"print_hide": 0,
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"search_index": 0,
"width": "100px"
@@ -188,6 +195,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"search_index": 0,
"width": "100px"
@@ -291,6 +299,7 @@
"oldfieldname": "page_break",
"oldfieldtype": "Check",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
}
]
\ No newline at end of file
diff --git a/stock/doctype/sales_bom/__init__.py b/selling/doctype/sales_bom/__init__.py
similarity index 100%
rename from stock/doctype/sales_bom/__init__.py
rename to selling/doctype/sales_bom/__init__.py
diff --git a/stock/doctype/sales_bom/locale/_messages_doc.json b/selling/doctype/sales_bom/locale/_messages_doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/_messages_doc.json
rename to selling/doctype/sales_bom/locale/_messages_doc.json
diff --git a/stock/doctype/sales_bom/locale/ar-doc.json b/selling/doctype/sales_bom/locale/ar-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/ar-doc.json
rename to selling/doctype/sales_bom/locale/ar-doc.json
diff --git a/stock/doctype/sales_bom/locale/de-doc.json b/selling/doctype/sales_bom/locale/de-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/de-doc.json
rename to selling/doctype/sales_bom/locale/de-doc.json
diff --git a/stock/doctype/sales_bom/locale/es-doc.json b/selling/doctype/sales_bom/locale/es-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/es-doc.json
rename to selling/doctype/sales_bom/locale/es-doc.json
diff --git a/stock/doctype/sales_bom/locale/fr-doc.json b/selling/doctype/sales_bom/locale/fr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/fr-doc.json
rename to selling/doctype/sales_bom/locale/fr-doc.json
diff --git a/stock/doctype/sales_bom/locale/hi-doc.json b/selling/doctype/sales_bom/locale/hi-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/hi-doc.json
rename to selling/doctype/sales_bom/locale/hi-doc.json
diff --git a/stock/doctype/sales_bom/locale/hr-doc.json b/selling/doctype/sales_bom/locale/hr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/hr-doc.json
rename to selling/doctype/sales_bom/locale/hr-doc.json
diff --git a/stock/doctype/sales_bom/locale/nl-doc.json b/selling/doctype/sales_bom/locale/nl-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/nl-doc.json
rename to selling/doctype/sales_bom/locale/nl-doc.json
diff --git a/stock/doctype/sales_bom/locale/pt-BR-doc.json b/selling/doctype/sales_bom/locale/pt-BR-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/pt-BR-doc.json
rename to selling/doctype/sales_bom/locale/pt-BR-doc.json
diff --git a/stock/doctype/sales_bom/locale/pt-doc.json b/selling/doctype/sales_bom/locale/pt-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/pt-doc.json
rename to selling/doctype/sales_bom/locale/pt-doc.json
diff --git a/stock/doctype/sales_bom/locale/sr-doc.json b/selling/doctype/sales_bom/locale/sr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/sr-doc.json
rename to selling/doctype/sales_bom/locale/sr-doc.json
diff --git a/stock/doctype/sales_bom/locale/ta-doc.json b/selling/doctype/sales_bom/locale/ta-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/ta-doc.json
rename to selling/doctype/sales_bom/locale/ta-doc.json
diff --git a/stock/doctype/sales_bom/locale/th-doc.json b/selling/doctype/sales_bom/locale/th-doc.json
similarity index 100%
rename from stock/doctype/sales_bom/locale/th-doc.json
rename to selling/doctype/sales_bom/locale/th-doc.json
diff --git a/stock/doctype/sales_bom/sales_bom.js b/selling/doctype/sales_bom/sales_bom.js
similarity index 100%
rename from stock/doctype/sales_bom/sales_bom.js
rename to selling/doctype/sales_bom/sales_bom.js
diff --git a/stock/doctype/sales_bom/sales_bom.py b/selling/doctype/sales_bom/sales_bom.py
similarity index 100%
rename from stock/doctype/sales_bom/sales_bom.py
rename to selling/doctype/sales_bom/sales_bom.py
diff --git a/stock/doctype/sales_bom/sales_bom.txt b/selling/doctype/sales_bom/sales_bom.txt
similarity index 94%
rename from stock/doctype/sales_bom/sales_bom.txt
rename to selling/doctype/sales_bom/sales_bom.txt
index 031f255..bf8fa47 100644
--- a/stock/doctype/sales_bom/sales_bom.txt
+++ b/selling/doctype/sales_bom/sales_bom.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:29",
+ "creation": "2013-06-20 11:53:21",
"docstatus": 0,
- "modified": "2013-01-22 14:57:23",
+ "modified": "2013-06-25 16:43:18",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -11,7 +11,7 @@
"doctype": "DocType",
"document_type": "Master",
"is_submittable": 0,
- "module": "Stock",
+ "module": "Selling",
"name": "__common__"
},
{
@@ -23,7 +23,6 @@
"permlevel": 0
},
{
- "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Sales BOM",
@@ -74,6 +73,7 @@
"reqd": 1
},
{
+ "amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
@@ -81,6 +81,7 @@
"write": 1
},
{
+ "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
@@ -88,6 +89,7 @@
"write": 0
},
{
+ "amend": 0,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
diff --git a/stock/doctype/sales_bom/test_sales_bom.py b/selling/doctype/sales_bom/test_sales_bom.py
similarity index 100%
rename from stock/doctype/sales_bom/test_sales_bom.py
rename to selling/doctype/sales_bom/test_sales_bom.py
diff --git a/stock/doctype/sales_bom_item/__init__.py b/selling/doctype/sales_bom_item/__init__.py
similarity index 100%
rename from stock/doctype/sales_bom_item/__init__.py
rename to selling/doctype/sales_bom_item/__init__.py
diff --git a/stock/doctype/sales_bom_item/locale/_messages_doc.json b/selling/doctype/sales_bom_item/locale/_messages_doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/_messages_doc.json
rename to selling/doctype/sales_bom_item/locale/_messages_doc.json
diff --git a/stock/doctype/sales_bom_item/locale/ar-doc.json b/selling/doctype/sales_bom_item/locale/ar-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/ar-doc.json
rename to selling/doctype/sales_bom_item/locale/ar-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/de-doc.json b/selling/doctype/sales_bom_item/locale/de-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/de-doc.json
rename to selling/doctype/sales_bom_item/locale/de-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/es-doc.json b/selling/doctype/sales_bom_item/locale/es-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/es-doc.json
rename to selling/doctype/sales_bom_item/locale/es-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/fr-doc.json b/selling/doctype/sales_bom_item/locale/fr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/fr-doc.json
rename to selling/doctype/sales_bom_item/locale/fr-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/hi-doc.json b/selling/doctype/sales_bom_item/locale/hi-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/hi-doc.json
rename to selling/doctype/sales_bom_item/locale/hi-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/hr-doc.json b/selling/doctype/sales_bom_item/locale/hr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/hr-doc.json
rename to selling/doctype/sales_bom_item/locale/hr-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/nl-doc.json b/selling/doctype/sales_bom_item/locale/nl-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/nl-doc.json
rename to selling/doctype/sales_bom_item/locale/nl-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/pt-BR-doc.json b/selling/doctype/sales_bom_item/locale/pt-BR-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/pt-BR-doc.json
rename to selling/doctype/sales_bom_item/locale/pt-BR-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/pt-doc.json b/selling/doctype/sales_bom_item/locale/pt-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/pt-doc.json
rename to selling/doctype/sales_bom_item/locale/pt-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/sr-doc.json b/selling/doctype/sales_bom_item/locale/sr-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/sr-doc.json
rename to selling/doctype/sales_bom_item/locale/sr-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/ta-doc.json b/selling/doctype/sales_bom_item/locale/ta-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/ta-doc.json
rename to selling/doctype/sales_bom_item/locale/ta-doc.json
diff --git a/stock/doctype/sales_bom_item/locale/th-doc.json b/selling/doctype/sales_bom_item/locale/th-doc.json
similarity index 100%
rename from stock/doctype/sales_bom_item/locale/th-doc.json
rename to selling/doctype/sales_bom_item/locale/th-doc.json
diff --git a/stock/doctype/sales_bom_item/sales_bom_item.py b/selling/doctype/sales_bom_item/sales_bom_item.py
similarity index 100%
rename from stock/doctype/sales_bom_item/sales_bom_item.py
rename to selling/doctype/sales_bom_item/sales_bom_item.py
diff --git a/stock/doctype/sales_bom_item/sales_bom_item.txt b/selling/doctype/sales_bom_item/sales_bom_item.txt
similarity index 92%
rename from stock/doctype/sales_bom_item/sales_bom_item.txt
rename to selling/doctype/sales_bom_item/sales_bom_item.txt
index 98285af..f7906b7 100644
--- a/stock/doctype/sales_bom_item/sales_bom_item.txt
+++ b/selling/doctype/sales_bom_item/sales_bom_item.txt
@@ -1,15 +1,15 @@
[
{
- "creation": "2013-02-22 01:28:03",
+ "creation": "2013-05-23 16:55:51",
"docstatus": 0,
- "modified": "2013-03-07 07:03:30",
+ "modified": "2013-06-26 13:45:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"doctype": "DocType",
"istable": 1,
- "module": "Stock",
+ "module": "Selling",
"name": "__common__"
},
{
diff --git a/selling/doctype/sales_common/sales_common.py b/selling/doctype/sales_common/sales_common.py
index 7b1528b..549128f 100644
--- a/selling/doctype/sales_common/sales_common.py
+++ b/selling/doctype/sales_common/sales_common.py
@@ -132,6 +132,7 @@
where name = %s and (ifnull(end_of_life,'')='' or end_of_life > now()
or end_of_life = '0000-00-00') and (is_sales_item = 'Yes'
or is_service_item = 'Yes')""", args['item_code'], as_dict=1)
+
tax = webnotes.conn.sql("""select tax_type, tax_rate from `tabItem Tax`
where parent = %s""", args['item_code'])
t = {}
@@ -167,8 +168,9 @@
ret['export_rate'] = flt(base_ref_rate)/flt(obj.doc.conversion_rate)
ret['base_ref_rate'] = flt(base_ref_rate)
ret['basic_rate'] = flt(base_ref_rate)
-
+
if ret['warehouse'] or ret['reserved_warehouse']:
+
av_qty = self.get_available_qty({'item_code': args['item_code'], 'warehouse': ret['warehouse'] or ret['reserved_warehouse']})
ret.update(av_qty)
@@ -179,7 +181,7 @@
(args['item_code'], obj.doc.customer))
if customer_item_code_row and customer_item_code_row[0][0]:
ret['customer_item_code'] = customer_item_code_row[0][0]
-
+
return ret
@@ -374,7 +376,7 @@
msgprint("Please Enter Appropriate Conversion Rate for Customer's Currency to Base Currency (%s --> %s)" % (obj.doc.currency, default_currency), raise_exception = 1)
if (obj.doc.price_list_currency == default_currency and flt(obj.doc.plc_conversion_rate) != 1.00) or not obj.doc.plc_conversion_rate or (obj.doc.price_list_currency != default_currency and flt(obj.doc.plc_conversion_rate) == 1.00):
- msgprint("Please Enter Appropriate Conversion Rate for Price List Currency to Base Currency ( (%s --> %s)" % (obj.doc.price_list_currency, default_currency), raise_exception = 1)
+ msgprint("Please Enter Appropriate Conversion Rate for Price List Currency to Base Currency (%s --> %s)" % (obj.doc.price_list_currency, default_currency), raise_exception = 1)
diff --git a/selling/doctype/sales_order/sales_order.js b/selling/doctype/sales_order/sales_order.js
index 86a6994..d50f06d 100644
--- a/selling/doctype/sales_order/sales_order.js
+++ b/selling/doctype/sales_order/sales_order.js
@@ -130,6 +130,29 @@
if(doc.customer) get_server_fields('get_customer_address', JSON.stringify({customer: doc.customer, address: doc.customer_address, contact: doc.contact_person}),'', doc, dt, dn, 1);
}
+cur_frm.fields_dict.shipping_address_name.get_query = cur_frm.fields_dict['customer_address'].get_query;
+
+cur_frm.cscript.shipping_address_name = function() {
+ if(cur_frm.doc.shipping_address_name) {
+ wn.model.with_doc("Address", cur_frm.doc.shipping_address_name, function(name) {
+ var address = wn.model.get_doc("Address", name);
+
+ var out = $.map(["address_line1", "address_line2", "city"],
+ function(f) { return address[f]; });
+
+ var state_pincode = $.map(["state", "pincode"], function(f) { return address[f]; }).join(" ");
+ if(state_pincode) out.push(state_pincode);
+
+ if(address["country"]) out.push(address["country"]);
+
+ out.concat($.map([["Phone:", address["phone"]], ["Fax:", address["fax"]]],
+ function(val) { return val[1] ? val.join(" ") : null; }));
+
+ cur_frm.set_value("shipping_address", out.join("\n"));
+ });
+ }
+};
+
cur_frm.cscript.pull_quotation_details = function(doc,dt,dn) {
var callback = function(r,rt){
var doc = locals[cur_frm.doctype][cur_frm.docname];
diff --git a/selling/doctype/sales_order/sales_order.py b/selling/doctype/sales_order/sales_order.py
index 6a52e5a..c8db1f9 100644
--- a/selling/doctype/sales_order/sales_order.py
+++ b/selling/doctype/sales_order/sales_order.py
@@ -217,7 +217,10 @@
self.validate_proj_cust()
self.validate_po()
#self.validate_reference_value()
- self.validate_for_items()
+
+ if self.doc.docstatus == 1:
+ self.validate_for_items()
+
sales_com_obj = get_obj(dt = 'Sales Common')
sales_com_obj.check_active_sales_items(self)
sales_com_obj.check_conversion_rate(self)
diff --git a/selling/doctype/sales_order/sales_order.txt b/selling/doctype/sales_order/sales_order.txt
index e6f762e..a898970 100644
--- a/selling/doctype/sales_order/sales_order.txt
+++ b/selling/doctype/sales_order/sales_order.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-22 15:24:17",
+ "creation": "2013-06-18 12:39:59",
"docstatus": 0,
- "modified": "2013-01-29 17:14:58",
+ "modified": "2013-06-18 17:49:11",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -203,7 +203,7 @@
"label": "Shipping Address Name",
"options": "Address",
"print_hide": 1,
- "read_only": 1
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -952,15 +952,6 @@
"print_hide": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 1,
"cancel": 1,
"create": 1,
@@ -981,14 +972,12 @@
"write": 1
},
{
- "amend": 0,
- "cancel": 0,
- "create": 0,
+ "doctype": "DocPerm",
+ "role": "Accounts User"
+ },
+ {
"doctype": "DocPerm",
"match": "customer",
- "report": 0,
- "role": "Customer",
- "submit": 0,
- "write": 0
+ "role": "Customer"
}
]
\ No newline at end of file
diff --git a/selling/doctype/sales_order_item/sales_order_item.txt b/selling/doctype/sales_order_item/sales_order_item.txt
index fff2d08..c65ac0d 100644
--- a/selling/doctype/sales_order_item/sales_order_item.txt
+++ b/selling/doctype/sales_order_item/sales_order_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:27:52",
+ "creation": "2013-03-07 11:42:58",
"docstatus": 0,
- "modified": "2013-03-07 07:03:30",
+ "modified": "2013-05-22 12:09:03",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"oldfieldtype": "Link",
"options": "Item",
"print_width": "150px",
+ "read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "150px"
@@ -57,6 +58,7 @@
"oldfieldtype": "Data",
"print_hide": 1,
"print_width": "150",
+ "read_only": 0,
"reqd": 1,
"width": "150"
},
@@ -69,6 +71,7 @@
"oldfieldname": "description",
"oldfieldtype": "Small Text",
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "300px"
@@ -82,6 +85,7 @@
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -109,6 +113,7 @@
"options": "currency",
"print_hide": 1,
"print_width": "70px",
+ "read_only": 0,
"reqd": 0,
"width": "70px"
},
@@ -122,6 +127,7 @@
"oldfieldtype": "Float",
"print_hide": 1,
"print_width": "70px",
+ "read_only": 0,
"width": "70px"
},
{
@@ -134,6 +140,7 @@
"oldfieldtype": "Currency",
"options": "currency",
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"width": "100px"
},
@@ -176,6 +183,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"width": "100px"
},
@@ -206,6 +214,7 @@
"options": "Warehouse",
"print_hide": 1,
"print_width": "150px",
+ "read_only": 0,
"reqd": 0,
"width": "150px"
},
@@ -329,6 +338,7 @@
"hidden": 0,
"in_filter": 1,
"label": "Quotation No.",
+ "no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Quotation",
@@ -345,6 +355,7 @@
"oldfieldname": "page_break",
"oldfieldtype": "Check",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 1
},
{
diff --git a/selling/doctype/sms_center/sms_center.py b/selling/doctype/sms_center/sms_center.py
index c5db738..8b404e6 100644
--- a/selling/doctype/sms_center/sms_center.py
+++ b/selling/doctype/sms_center/sms_center.py
@@ -24,7 +24,7 @@
from webnotes import msgprint
sql = webnotes.conn.sql
-
+
# ----------
class DocType:
@@ -35,27 +35,27 @@
def create_receiver_list(self):
rec, where_clause = '', ''
if self.doc.send_to == 'All Customer Contact':
- where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(is_customer, 0) = 1"
+ where_clause = self.doc.customer and " and customer = '%s'" % self.doc.customer or " and ifnull(customer, '') != ''"
if self.doc.send_to == 'All Supplier Contact':
- where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(is_supplier, 0) = 1"
+ where_clause = self.doc.supplier and " and ifnull(is_supplier, 0) = 1 and supplier = '%s'" % self.doc.supplier or " and ifnull(supplier, '') != ''"
if self.doc.send_to == 'All Sales Partner Contact':
- where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_aprtner = '%s'" % self.doc.sales_partner or " and ifnull(is_sales_partner, 0) = 1"
+ where_clause = self.doc.sales_partner and " and ifnull(is_sales_partner, 0) = 1 and sales_partner = '%s'" % self.doc.sales_partner or " and ifnull(sales_partner, '') != ''"
+
if self.doc.send_to in ['All Contact', 'All Customer Contact', 'All Supplier Contact', 'All Sales Partner Contact']:
rec = sql("select CONCAT(ifnull(first_name,''),'',ifnull(last_name,'')), mobile_no from `tabContact` where ifnull(mobile_no,'')!='' and docstatus != 2 %s" % where_clause)
elif self.doc.send_to == 'All Lead (Open)':
rec = sql("select lead_name, mobile_no from tabLead where ifnull(mobile_no,'')!='' and docstatus != 2 and status = 'Open'")
elif self.doc.send_to == 'All Employee (Active)':
- where_clause = self.doc.department and " and t1.department = '%s'" % self.doc.department or ""
- where_clause += self.doc.branch and " and t1.branch = '%s'" % self.doc.branch or ""
- rec = sql("select t1.employee_name, t2.cell_number from `tabEmployee` t1, `tabEmployee Profile` t2 where t2.employee = t1.name and t1.status = 'Active' and t1.docstatus != 2 and ifnull(t2.cell_number,'')!='' %s" % where_clause)
+ where_clause = self.doc.department and " and department = '%s'" % self.doc.department or ""
+ where_clause += self.doc.branch and " and branch = '%s'" % self.doc.branch or ""
+ rec = sql("select employee_name, cell_number from `tabEmployee` where status = 'Active' and docstatus < 2 and ifnull(cell_number,'')!='' %s" % where_clause)
elif self.doc.send_to == 'All Sales Person':
rec = sql("select sales_person_name, mobile_no from `tabSales Person` where docstatus != 2 and ifnull(mobile_no,'')!=''")
-
rec_list = ''
for d in rec:
rec_list += d[0] + ' - ' + d[1] + '\n'
self.doc.receiver_list = rec_list
-
+ webnotes.errprint(rec_list)
def get_receiver_nos(self):
receiver_nos = []
for d in self.doc.receiver_list.split('\n'):
diff --git a/selling/locale/_messages_js.json b/selling/locale/_messages_js.json
new file mode 100644
index 0000000..0637a08
--- /dev/null
+++ b/selling/locale/_messages_js.json
@@ -0,0 +1 @@
+[]
\ No newline at end of file
diff --git a/selling/locale/_messages_py.json b/selling/locale/_messages_py.json
new file mode 100644
index 0000000..f5b4a01
--- /dev/null
+++ b/selling/locale/_messages_py.json
@@ -0,0 +1,7 @@
+[
+ "is not a Stock Item",
+ "Item",
+ "Please check",
+ "reached its end of life on",
+ "is a cancelled Item"
+]
\ No newline at end of file
diff --git a/selling/locale/ar-py.json b/selling/locale/ar-py.json
new file mode 100644
index 0000000..b8dd151
--- /dev/null
+++ b/selling/locale/ar-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "\u0628\u0646\u062f",
+ "Please check": "\u064a\u0631\u062c\u0649 \u0645\u0631\u0627\u062c\u0639\u0629",
+ "is a cancelled Item": "\u0647\u0648 \u0628\u0646\u062f \u0625\u0644\u063a\u0627\u0621",
+ "is not a Stock Item": "\u0644\u064a\u0633 \u0627\u0644\u0625\u063a\u0644\u0627\u0642 \u0644\u0644\u0633\u0647\u0645",
+ "reached its end of life on": "\u0648\u0635\u0644 \u0625\u0644\u0649 \u0646\u0647\u0627\u064a\u062a\u0647 \u0645\u0646 \u0627\u0644\u062d\u064a\u0627\u0629 \u0639\u0644\u0649"
+}
\ No newline at end of file
diff --git a/selling/locale/de-py.json b/selling/locale/de-py.json
new file mode 100644
index 0000000..68b58d7
--- /dev/null
+++ b/selling/locale/de-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Artikel",
+ "Please check": "Bitte \u00fcberpr\u00fcfen Sie",
+ "is a cancelled Item": "ist ein gestempeltes",
+ "is not a Stock Item": "ist kein Lagerartikel",
+ "reached its end of life on": "erreichte Ende des Lebens auf"
+}
\ No newline at end of file
diff --git a/selling/locale/es-py.json b/selling/locale/es-py.json
new file mode 100644
index 0000000..7d145d1
--- /dev/null
+++ b/selling/locale/es-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Art\u00edculo",
+ "Please check": "Por favor, compruebe",
+ "is a cancelled Item": "Es un Tema cancelado",
+ "is not a Stock Item": "no es un elemento de serie",
+ "reached its end of life on": "llegado al final de su vida en la"
+}
\ No newline at end of file
diff --git a/selling/locale/fr-py.json b/selling/locale/fr-py.json
new file mode 100644
index 0000000..c466df4
--- /dev/null
+++ b/selling/locale/fr-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Article",
+ "Please check": "S'il vous pla\u00eet v\u00e9rifier",
+ "is a cancelled Item": "est un \u00e9l\u00e9ment annul\u00e9e",
+ "is not a Stock Item": "n'est pas un \u00e9l\u00e9ment de Stock",
+ "reached its end of life on": "atteint la fin de sa vie sur"
+}
\ No newline at end of file
diff --git a/selling/locale/hi-py.json b/selling/locale/hi-py.json
new file mode 100644
index 0000000..58d4e65
--- /dev/null
+++ b/selling/locale/hi-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "\u092e\u0926",
+ "Please check": "\u0915\u0943\u092a\u092f\u093e \u091c\u093e\u0901\u091a \u0915\u0930\u0947\u0902",
+ "is a cancelled Item": "\u0930\u0926\u094d\u0926 \u0906\u0907\u091f\u092e",
+ "is not a Stock Item": "\u0938\u094d\u091f\u0949\u0915 \u0906\u0907\u091f\u092e \u0928\u0939\u0940\u0902 \u0939\u0948",
+ "reached its end of life on": "\u092a\u0930 \u0905\u092a\u0928\u0947 \u091c\u0940\u0935\u0928 \u0915\u0947 \u0905\u0902\u0924 \u0924\u0915 \u092a\u0939\u0941\u0901\u091a"
+}
\ No newline at end of file
diff --git a/selling/locale/hr-py.json b/selling/locale/hr-py.json
new file mode 100644
index 0000000..24f60bb
--- /dev/null
+++ b/selling/locale/hr-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Stavka",
+ "Please check": "Molimo provjerite",
+ "is a cancelled Item": "je otkazan artikla",
+ "is not a Stock Item": "nije katalo\u0161ki artikla",
+ "reached its end of life on": "dosegla svoj kraj \u017eivota na"
+}
\ No newline at end of file
diff --git a/selling/locale/nl-py.json b/selling/locale/nl-py.json
new file mode 100644
index 0000000..7964d37
--- /dev/null
+++ b/selling/locale/nl-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Item",
+ "Please check": "Controleer",
+ "is a cancelled Item": "is een geannuleerde artikel",
+ "is not a Stock Item": "is niet een Stock Item",
+ "reached its end of life on": "het einde van zijn leven op"
+}
\ No newline at end of file
diff --git a/selling/locale/pt-BR-py.json b/selling/locale/pt-BR-py.json
new file mode 100644
index 0000000..0bf350c
--- /dev/null
+++ b/selling/locale/pt-BR-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Item",
+ "Please check": "Por favor, verifique",
+ "is a cancelled Item": "\u00e9 um Item cancelado",
+ "is not a Stock Item": "n\u00e3o \u00e9 um Item de Estoque",
+ "reached its end of life on": "chegou ao fim de vida em"
+}
\ No newline at end of file
diff --git a/selling/locale/pt-py.json b/selling/locale/pt-py.json
new file mode 100644
index 0000000..cfcbcec
--- /dev/null
+++ b/selling/locale/pt-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "Item",
+ "Please check": "Por favor, verifique",
+ "is a cancelled Item": "\u00e9 um item cancelado",
+ "is not a Stock Item": "n\u00e3o \u00e9 um item de estoque",
+ "reached its end of life on": "chegou ao fim da vida na"
+}
\ No newline at end of file
diff --git a/selling/locale/sr-py.json b/selling/locale/sr-py.json
new file mode 100644
index 0000000..ed1672f
--- /dev/null
+++ b/selling/locale/sr-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "\u0421\u0442\u0430\u0432\u043a\u0430",
+ "Please check": "\u041c\u043e\u043b\u0438\u043c\u043e \u0432\u0430\u0441 \u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u0435",
+ "is a cancelled Item": "\u0458\u0435 \u043e\u0442\u043a\u0430\u0437\u0430\u043d\u0430 \u0448\u0438\u0444\u0440\u0430",
+ "is not a Stock Item": "\u043d\u0438\u0458\u0435 \u0431\u0435\u0440\u0437\u0430 \u0448\u0438\u0444\u0440\u0430",
+ "reached its end of life on": "\u0434\u043e\u0441\u0442\u0438\u0433\u0430\u043e \u0441\u0432\u043e\u0458 \u043a\u0440\u0430\u0458 \u0436\u0438\u0432\u043e\u0442\u0430 \u043d\u0430"
+}
\ No newline at end of file
diff --git a/selling/locale/ta-py.json b/selling/locale/ta-py.json
new file mode 100644
index 0000000..355cc0e
--- /dev/null
+++ b/selling/locale/ta-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "\u0b89\u0bb0\u0bc1\u0baa\u0bcd\u0baa\u0b9f\u0bbf",
+ "Please check": "\u0b9a\u0bb0\u0bbf\u0baa\u0bbe\u0bb0\u0bcd\u0b95\u0bcd\u0b95\u0bb5\u0bc1\u0bae\u0bcd",
+ "is a cancelled Item": "\u0b92\u0bb0\u0bc1 \u0bb0\u0ba4\u0bcd\u0ba4\u0bc1 \u0b89\u0bb0\u0bc1\u0baa\u0bcd\u0baa\u0b9f\u0bbf \u0b89\u0bb3\u0bcd\u0bb3\u0ba4\u0bc1",
+ "is not a Stock Item": "\u0b92\u0bb0\u0bc1 \u0baa\u0b99\u0bcd\u0b95\u0bc1 \u0baa\u0bc6\u0bbe\u0bb0\u0bc1\u0bb3\u0bcd \u0b85\u0bb2\u0bcd\u0bb2",
+ "reached its end of life on": "\u0bb5\u0bbe\u0bb4\u0bcd\u0b95\u0bcd\u0b95\u0bc8 \u0b85\u0ba4\u0ba9\u0bcd \u0b87\u0bb1\u0bc1\u0ba4\u0bbf\u0baf\u0bbf\u0bb2\u0bcd \u0b85\u0b9f\u0bc8\u0ba8\u0bcd\u0ba4\u0ba4\u0bc1"
+}
\ No newline at end of file
diff --git a/selling/locale/th-py.json b/selling/locale/th-py.json
new file mode 100644
index 0000000..5f31a59
--- /dev/null
+++ b/selling/locale/th-py.json
@@ -0,0 +1,7 @@
+{
+ "Item": "\u0e0a\u0e34\u0e49\u0e19",
+ "Please check": "\u0e01\u0e23\u0e38\u0e13\u0e32\u0e15\u0e23\u0e27\u0e08\u0e2a\u0e2d\u0e1a",
+ "is a cancelled Item": "\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e22\u0e01\u0e40\u0e25\u0e34\u0e01\u0e40\u0e1b\u0e47\u0e19",
+ "is not a Stock Item": "\u0e44\u0e21\u0e48\u0e44\u0e14\u0e49\u0e40\u0e1b\u0e47\u0e19\u0e23\u0e32\u0e22\u0e01\u0e32\u0e23\u0e2a\u0e15\u0e47\u0e2d\u0e01",
+ "reached its end of life on": "\u0e16\u0e36\u0e07\u0e08\u0e38\u0e14\u0e2a\u0e34\u0e49\u0e19\u0e2a\u0e38\u0e14\u0e02\u0e2d\u0e07\u0e0a\u0e35\u0e27\u0e34\u0e15\u0e40\u0e21\u0e37\u0e48\u0e2d"
+}
\ No newline at end of file
diff --git a/selling/page/selling_home/selling_home.js b/selling/page/selling_home/selling_home.js
index 994bb4a..e912fd8 100644
--- a/selling/page/selling_home/selling_home.js
+++ b/selling/page/selling_home/selling_home.js
@@ -137,11 +137,6 @@
"label":wn._("Sales Analytics"),
page: "sales-analytics"
},
- {
- "label":wn._("Trend Analyzer"),
- route: "Report/Profile/Trend Analyzer",
- doctype: "Sales Order"
- },
]
},
{
@@ -154,8 +149,47 @@
route: "query-report/Customer Addresses And Contacts"
},
{
- "label":wn._("Sales Orders Pending to be Delivered"),
- route: "query-report/Sales Orders Pending To Be Delivered"
+ "label":wn._("Ordered Items To Be Delivered"),
+ route: "query-report/Ordered Items To Be Delivered",
+ },
+ {
+ "label":wn._("Sales Person-wise Transaction Summary"),
+ route: "query-report/Sales Person-wise Transaction Summary"
+ },
+ {
+ "label":wn._("Item-wise Sales History"),
+ route: "query-report/Item-wise Sales History"
+ },
+ {
+ "label":wn._("Territory Target Variance (Item Group-Wise)"),
+ route: "query-report/Territory Target Variance Item Group-Wise"
+ },
+ {
+ "label":wn._("Sales Person Target Variance (Item Group-Wise)"),
+ route: "query-report/Sales Person Target Variance Item Group-Wise"
+ },
+ {
+ "label":wn._("Customers Not Buying Since Long Time"),
+ route: "query-report/Customers Not Buying Since Long Time",
+ doctype: "Sales Order"
+ },
+ {
+ "label":wn._("Quotation Trend"),
+ route: "query-report/Quotation Trends",
+ doctype: "Quotation"
+ },
+ {
+ "label":wn._("Sales Order Trend"),
+ route: "query-report/Sales Order Trends",
+ doctype: "Sales Order"
+ },
+ {
+ "label":wn._("Available Stock for Packing Items"),
+ route: "query-report/Available Stock for Packing Items",
+ },
+ {
+ "label":wn._("Pending SO Items For Purchase Request"),
+ route: "query-report/Pending SO Items For Purchase Request"
},
]
}
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/available_stock_for_packing_items/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/available_stock_for_packing_items/__init__.py
diff --git a/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py b/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
new file mode 100644
index 0000000..171c3bb
--- /dev/null
+++ b/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.py
@@ -0,0 +1,92 @@
+# 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
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns()
+ iwq_map = get_item_warehouse_quantity_map()
+ item_map = get_item_details()
+
+ data = []
+ for sbom, warehouse in iwq_map.items():
+ total = 0
+ total_qty = 0
+
+ for wh, item_qty in warehouse.items():
+ total += 1
+ row = [sbom, item_map.get(sbom).item_name, item_map.get(sbom).description,
+ item_map.get(sbom).stock_uom, wh]
+ available_qty = min(item_qty.values())
+ total_qty += flt(available_qty)
+ row += [available_qty]
+
+ if available_qty:
+ data.append(row)
+ if (total == len(warehouse)):
+ row = ["", "", "Total", "", "", total_qty]
+ data.append(row)
+
+ return columns, data
+
+def get_columns():
+ columns = ["Item Code:Link/Item:100", "Item Name::100", "Description::120", \
+ "UOM:Link/UOM:80", "Warehouse:Link/Warehouse:100", "Quantity::100"]
+
+ return columns
+
+def get_sales_bom_items():
+ sbom_item_map = {}
+ for sbom in webnotes.conn.sql("""select parent, item_code, qty from `tabSales BOM Item`
+ where docstatus < 2""", as_dict=1):
+ sbom_item_map.setdefault(sbom.parent, {}).setdefault(sbom.item_code, sbom.qty)
+
+ return sbom_item_map
+
+def get_item_details():
+ item_map = {}
+ for item in webnotes.conn.sql("""select name, item_name, description, stock_uom
+ from `tabItem`""", as_dict=1):
+ item_map.setdefault(item.name, item)
+
+ return item_map
+
+def get_item_warehouse_quantity():
+ iwq_map = {}
+ bin = webnotes.conn.sql("""select item_code, warehouse, actual_qty from `tabBin`
+ where actual_qty > 0""")
+ for item, wh, qty in bin:
+ iwq_map.setdefault(item, {}).setdefault(wh, qty)
+
+ return iwq_map
+
+def get_item_warehouse_quantity_map():
+ sbom_map = {}
+ iwq_map = get_item_warehouse_quantity()
+ sbom_item_map = get_sales_bom_items()
+
+ for sbom, sbom_items in sbom_item_map.items():
+ for item, child_qty in sbom_items.items():
+ for wh, qty in iwq_map.get(item, {}).items():
+ avail_qty = flt(qty) / flt(child_qty)
+ sbom_map.setdefault(sbom, {}).setdefault(wh, {}) \
+ .setdefault(item, avail_qty)
+
+ return sbom_map
\ No newline at end of file
diff --git a/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.txt b/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.txt
new file mode 100644
index 0000000..5cf4133
--- /dev/null
+++ b/selling/report/available_stock_for_packing_items/available_stock_for_packing_items.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-21 13:40:05",
+ "docstatus": 0,
+ "modified": "2013-06-21 15:06:40",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales BOM",
+ "report_name": "Available Stock for Packing Items",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Available Stock for Packing Items"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/customers_not_buying_since_long_time/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/customers_not_buying_since_long_time/__init__.py
diff --git a/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
new file mode 100644
index 0000000..65d6348
--- /dev/null
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.js
@@ -0,0 +1,10 @@
+wn.query_reports["Customers Not Buying Since Long Time"] = {
+ "filters": [
+ {
+ "fieldname":"days_since_last_order",
+ "label": "Days Since Last Order",
+ "fieldtype": "Int",
+ "default": 60
+ }
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
new file mode 100644
index 0000000..08809a7
--- /dev/null
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.py
@@ -0,0 +1,75 @@
+# 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
+from webnotes.utils import getdate, cint
+
+def execute(filters=None):
+ if not filters: filters ={}
+
+ days_since_last_order = filters.get("days_since_last_order")
+ if cint(days_since_last_order) <= 0:
+ webnotes.msgprint("Please mention positive value in 'Days Since Last Order' field",raise_exception=1)
+
+ columns = get_columns()
+ customers = get_so_details()
+
+ data = []
+ for cust in customers:
+ if cust[8] >= days_since_last_order:
+ cust.insert(7,get_last_so_amt(cust[0]))
+ data.append(cust)
+ return columns, data
+
+def get_so_details():
+ return webnotes.conn.sql("""select
+ cust.name,
+ cust.customer_name,
+ cust.territory,
+ cust.customer_group,
+ count(distinct(so.name)) as 'num_of_order',
+ sum(net_total) as 'total_order_value',
+ sum(if(so.status = "Stopped",
+ so.net_total * so.per_delivered/100,
+ so.net_total)) as 'total_order_considered',
+ max(so.transaction_date) as 'last_sales_order_date',
+ DATEDIFF(CURDATE(), max(so.transaction_date)) as 'days_since_last_order'
+ from `tabCustomer` cust, `tabSales Order` so
+ where cust.name = so.customer and so.docstatus = 1
+ group by cust.name
+ order by 'days_since_last_order' desc """,as_list=1)
+
+def get_last_so_amt(customer):
+ res = webnotes.conn.sql("""select net_total from `tabSales Order`
+ where customer ='%(customer)s' and docstatus = 1 order by transaction_date desc
+ limit 1""" % {'customer':customer})
+
+ return res and res[0][0] or 0
+
+def get_columns():
+ return [
+ "Customer:Link/Customer:120",
+ "Customer Name:Data:120",
+ "Territory::120",
+ "Customer Group::120",
+ "Number of Order::120",
+ "Total Order Value:Currency:120",
+ "Total Order Considered:Currency:160",
+ "Last Order Amount:Currency:160",
+ "Last Sales Order Date:Date:160",
+ "Days Since Last Order::160"
+ ]
\ No newline at end of file
diff --git a/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt
new file mode 100644
index 0000000..4d94377
--- /dev/null
+++ b/selling/report/customers_not_buying_since_long_time/customers_not_buying_since_long_time.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-07 12:27:07",
+ "docstatus": 0,
+ "modified": "2013-06-07 12:27:07",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Customers Not Buying Since Long Time ",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Customers Not Buying Since Long Time"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/item_wise_sales_history/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/item_wise_sales_history/__init__.py
diff --git a/selling/report/item_wise_sales_history/item_wise_sales_history.txt b/selling/report/item_wise_sales_history/item_wise_sales_history.txt
new file mode 100644
index 0000000..adbfe69
--- /dev/null
+++ b/selling/report/item_wise_sales_history/item_wise_sales_history.txt
@@ -0,0 +1,24 @@
+[
+ {
+ "creation": "2013-05-23 17:42:24",
+ "docstatus": 0,
+ "modified": "2013-05-24 12:20:17",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "disabled": 0,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select\n so_item.item_code as \"Item Code:Link/Item:120\",\n\tso_item.item_name as \"Item Name::120\",\n\tso_item.description as \"Description::150\",\n\tso_item.qty as \"Qty:Float:100\",\n\tso_item.stock_uom as \"UOM:Link/UOM:80\",\n\tso_item.basic_rate as \"Rate:Currency:120\",\n\tso_item.amount as \"Amount:Currency:120\",\n\tso.name as \"Sales Order:Link/Sales Order:120\",\n\tso.transaction_date as \"Transaction Date:Date:140\",\n\tso.customer as \"Customer:Link/Customer:130\",\n\tso.territory as \"Territory:Link/Territory:130\",\n so.project_name as \"Project:Link/Project:130\",\n\tifnull(so_item.delivered_qty, 0) as \"Delivered Qty:Float:120\",\n\tifnull(so_item.billed_amt, 0) as \"Billed Amount:Currency:120\"\nfrom\n\t`tabSales Order` so, `tabSales Order Item` so_item\nwhere\n\tso.name = so_item.parent\n\tand so.docstatus = 1\norder by so.name desc",
+ "ref_doctype": "Sales Order",
+ "report_name": "Item-wise Sales History",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Item-wise Sales History"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/pending_so_items_for_purchase_request/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/pending_so_items_for_purchase_request/__init__.py
diff --git a/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt b/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt
new file mode 100644
index 0000000..e0c450a
--- /dev/null
+++ b/selling/report/pending_so_items_for_purchase_request/pending_so_items_for_purchase_request.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-06-21 16:46:45",
+ "docstatus": 0,
+ "modified": "2013-06-21 16:55:54",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select \n so_item.item_code as \"Item Code:Link/Item:120\",\n so_item.item_name as \"Item Name::120\",\n so_item.description as \"Description::120\",\n so.`name` as \"S.O. No.:Link/Sales Order:120\",\n so.`transaction_date` as \"Date:Date:120\",\n mr.name as \"Material Request:Link/Material Request:120\",\n so.customer as \"Customer:Link/Customer:120\",\n so.territory as \"Terretory:Link/Territory:120\",\n sum(so_item.qty) as \"SO Qty:Float:100 \",\n sum(mr_item.qty) as \"Requested Qty:Float:100\"\nfrom\n `tabSales Order` so, `tabSales Order Item` so_item, \n `tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n so_item.`parent` = so.`name` and mr_item.sales_order_no = so.name\n and mr_item.parent = mr.name \n and so.docstatus = 1 and so.status != \"Stopped\" \n and mr.docstatus = 1 and mr.status != \"Stopped\"\ngroup by so.name, so_item.item_code\norder by so.name desc, so_item.item_code asc",
+ "ref_doctype": "Sales Order",
+ "report_name": "Pending SO Items For Purchase Request",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Pending SO Items For Purchase Request"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/quotation_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/quotation_trends/__init__.py
diff --git a/selling/report/quotation_trends/quotation_trends.js b/selling/report/quotation_trends/quotation_trends.js
new file mode 100644
index 0000000..2f9f236
--- /dev/null
+++ b/selling/report/quotation_trends/quotation_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/sales_trends_filters.js");
+
+wn.query_reports["Quotation Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/selling/report/quotation_trends/quotation_trends.py
similarity index 74%
copy from patches/september_2012/reload_gross_profit.py
copy to selling/report/quotation_trends/quotation_trends.py
index 0a3f9ef..29f9ef8 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/selling/report/quotation_trends/quotation_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns, get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Quotation")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/selling/report/quotation_trends/quotation_trends.txt b/selling/report/quotation_trends/quotation_trends.txt
new file mode 100644
index 0000000..eebffcf
--- /dev/null
+++ b/selling/report/quotation_trends/quotation_trends.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-06-07 16:01:16",
+ "docstatus": 0,
+ "modified": "2013-06-12 16:31:23",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 0,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Quotation",
+ "report_name": "Quotation Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Quotation Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/sales_order_trends/__init__.py
similarity index 100%
rename from selling/report/sales_orders_pending_to_be_delivered/__init__.py
rename to selling/report/sales_order_trends/__init__.py
diff --git a/selling/report/sales_order_trends/sales_order_trends.js b/selling/report/sales_order_trends/sales_order_trends.js
new file mode 100644
index 0000000..458fee6
--- /dev/null
+++ b/selling/report/sales_order_trends/sales_order_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/sales_trends_filters.js");
+
+wn.query_reports["Sales Order Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/selling/report/sales_order_trends/sales_order_trends.py
similarity index 74%
copy from patches/september_2012/reload_gross_profit.py
copy to selling/report/sales_order_trends/sales_order_trends.py
index 0a3f9ef..ac7c3ab 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/selling/report/sales_order_trends/sales_order_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns,get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Sales Order")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/selling/report/sales_order_trends/sales_order_trends.txt b/selling/report/sales_order_trends/sales_order_trends.txt
new file mode 100644
index 0000000..16ee9ca
--- /dev/null
+++ b/selling/report/sales_order_trends/sales_order_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:43:30",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:43:30",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Sales Order Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Order Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/sales_orders_pending_to_be_delivered.txt b/selling/report/sales_orders_pending_to_be_delivered/sales_orders_pending_to_be_delivered.txt
deleted file mode 100644
index c145f4e..0000000
--- a/selling/report/sales_orders_pending_to_be_delivered/sales_orders_pending_to_be_delivered.txt
+++ /dev/null
@@ -1,22 +0,0 @@
-[
- {
- "creation": "2013-02-21 14:26:46",
- "docstatus": 0,
- "modified": "2013-02-22 15:53:24",
- "modified_by": "Administrator",
- "owner": "Administrator"
- },
- {
- "doctype": "Report",
- "is_standard": "Yes",
- "name": "__common__",
- "query": "select \n `tabSales Order`.`name` as \"S.O. No.:Link/Sales Order:120\",\n `tabSales Order`.`transaction_date` as \"S.O. Date:Date\",\n `tabSales Order`.`delivery_date` as \"Expected Delivery Date:Date\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order Item`.item_code as \"Item Code:Link/Item:120\",\n `tabSales Order Item`.description as \"Description\",\n `tabSales Order Item`.qty as \"Qty:Float\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float\",\n `tabSales Order`.`po_no` as \"P.O. No.\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc",
- "ref_doctype": "Sales Order",
- "report_name": "Sales Orders Pending To Be Delivered",
- "report_type": "Query Report"
- },
- {
- "doctype": "Report",
- "name": "Sales Orders Pending To Be Delivered"
- }
-]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/sales_person_target_variance_item_group_wise/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/sales_person_target_variance_item_group_wise/__init__.py
diff --git a/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js
new file mode 100644
index 0000000..c7a5d66
--- /dev/null
+++ b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.js
@@ -0,0 +1,25 @@
+wn.query_reports["Sales Person Target Variance Item Group-Wise"] = {
+ "filters": [
+ {
+ fieldname: "fiscal_year",
+ label: "Fiscal Year",
+ fieldtype: "Link",
+ options: "Fiscal Year",
+ default: sys_defaults.fiscal_year
+ },
+ {
+ fieldname: "period",
+ label: "Period",
+ fieldtype: "Select",
+ options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
+ default: "Monthly"
+ },
+ {
+ fieldname: "target_on",
+ label: "Target On",
+ fieldtype: "Select",
+ options: "Quantity\nAmount",
+ default: "Quantity"
+ },
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
new file mode 100644
index 0000000..ae3819c
--- /dev/null
+++ b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.py
@@ -0,0 +1,143 @@
+# 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
+from webnotes import _, msgprint
+from webnotes.utils import flt
+import time
+from accounts.utils import get_fiscal_year
+from controllers.trends import get_period_date_ranges, get_period_month_ranges
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
+ sim_map = get_salesperson_item_month_map(filters)
+
+ precision = webnotes.conn.get_value("Global Defaults", None, "float_precision") or 2
+
+ data = []
+
+ for salesperson, salesperson_items in sim_map.items():
+ for item_group, monthwise_data in salesperson_items.items():
+ row = [salesperson, item_group]
+ totals = [0, 0, 0]
+ for relevant_months in period_month_ranges:
+ period_data = [0, 0, 0]
+ for month in relevant_months:
+ month_data = monthwise_data.get(month, {})
+ for i, fieldname in enumerate(["target", "achieved", "variance"]):
+ value = flt(month_data.get(fieldname), precision)
+ period_data[i] += value
+ totals[i] += value
+ period_data[2] = period_data[0] - period_data[1]
+ row += period_data
+ totals[2] = totals[0] - totals[1]
+ row += totals
+ data.append(row)
+
+ return columns, sorted(data, key=lambda x: (x[0], x[1]))
+
+def get_columns(filters):
+ for fieldname in ["fiscal_year", "period", "target_on"]:
+ if not filters.get(fieldname):
+ label = (" ".join(fieldname.split("_"))).title()
+ msgprint(_("Please specify") + ": " + label,
+ raise_exception=True)
+
+ columns = ["Sales Person:Link/Sales Person:80", "Item Group:Link/Item Group:80"]
+
+ group_months = False if filters["period"] == "Monthly" else True
+
+ for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]):
+ for label in ["Target (%s)", "Achieved (%s)", "Variance (%s)"]:
+ if group_months:
+ columns.append(label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")))
+ else:
+ columns.append(label % from_date.strftime("%b"))
+
+ return columns + ["Total Target::80", "Total Achieved::80", "Total Variance::80"]
+
+#Get sales person & item group details
+def get_salesperson_details(filters):
+ return webnotes.conn.sql("""select sp.name, td.item_group, td.target_qty,
+ td.target_amount, sp.distribution_id
+ from `tabSales Person` sp, `tabTarget Detail` td
+ where td.parent=sp.name and td.fiscal_year=%s and
+ ifnull(sp.distribution_id, '')!='' order by sp.name""",
+ (filters["fiscal_year"]), as_dict=1)
+
+#Get target distribution details of item group
+def get_target_distribution_details(filters):
+ target_details = {}
+
+ for d in webnotes.conn.sql("""select bdd.month, bdd.percentage_allocation \
+ from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd, \
+ `tabTerritory` t where bdd.parent=bd.name and t.distribution_id=bd.name and \
+ bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
+ target_details.setdefault(d.month, d)
+
+ return target_details
+
+#Get achieved details from sales order
+def get_achieved_details(filters):
+ start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
+
+ return webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date,
+ st.sales_person, MONTHNAME(so.transaction_date) as month_name
+ from `tabSales Order Item` soi, `tabSales Order` so, `tabSales Team` st
+ where soi.parent=so.name and so.docstatus=1 and
+ st.parent=so.name and so.transaction_date>=%s and
+ so.transaction_date<=%s""" % ('%s', '%s'),
+ (start_date, end_date), as_dict=1)
+
+def get_salesperson_item_month_map(filters):
+ salesperson_details = get_salesperson_details(filters)
+ tdd = get_target_distribution_details(filters)
+ achieved_details = get_achieved_details(filters)
+
+ sim_map = {}
+
+ for sd in salesperson_details:
+ for month in tdd:
+ sim_map.setdefault(sd.name, {}).setdefault(sd.item_group, {})\
+ .setdefault(month, webnotes._dict({
+ "target": 0.0, "achieved": 0.0
+ }))
+
+ tav_dict = sim_map[sd.name][sd.item_group][month]
+
+ for ad in achieved_details:
+ if (filters["target_on"] == "Quantity"):
+ tav_dict.target = flt(sd.target_qty) * \
+ (tdd[month]["percentage_allocation"]/100)
+ if ad.month_name == month and get_item_group(ad.item_code) == sd.item_group \
+ and ad.sales_person == sd.name:
+ tav_dict.achieved += ad.qty
+
+ if (filters["target_on"] == "Amount"):
+ tav_dict.target = flt(sd.target_amount) * \
+ (tdd[month]["percentage_allocation"]/100)
+ if ad.month_name == month and get_item_group(ad.item_code) == sd.item_group \
+ and ad.sales_person == sd.name:
+ tav_dict.achieved += ad.amount
+
+ return sim_map
+
+def get_item_group(item_name):
+ return webnotes.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
diff --git a/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.txt b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.txt
new file mode 100644
index 0000000..e587c2c
--- /dev/null
+++ b/selling/report/sales_person_target_variance_item_group_wise/sales_person_target_variance_item_group_wise.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-21 12:14:15",
+ "docstatus": 0,
+ "modified": "2013-06-21 12:14:15",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Sales Person Target Variance Item Group-Wise",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Person Target Variance Item Group-Wise"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/sales_person_wise_transaction_summary/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/sales_person_wise_transaction_summary/__init__.py
diff --git a/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
new file mode 100644
index 0000000..2e1996e
--- /dev/null
+++ b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.js
@@ -0,0 +1,60 @@
+wn.query_reports["Sales Person-wise Transaction Summary"] = {
+ "filters": [
+ {
+ fieldname: "sales_person",
+ label: "Sales Person",
+ fieldtype: "Link",
+ options: "Sales Person"
+ },
+ {
+ fieldname: "doc_type",
+ label: "Document Type",
+ fieldtype: "Select",
+ options: "Sales Order\nDelivery Note\nSales Invoice",
+ default: "Sales Order"
+ },
+ {
+ fieldname: "from_date",
+ label: "From Date",
+ fieldtype: "Date",
+ default: wn.defaults.get_user_default("year_start_date"),
+ },
+ {
+ fieldname:"to_date",
+ label: "To Date",
+ fieldtype: "Date",
+ default: get_today()
+ },
+ {
+ fieldname:"company",
+ label: "Company",
+ fieldtype: "Link",
+ options: "Company",
+ default: sys_defaults.company
+ },
+ {
+ fieldname:"item_group",
+ label: "Item Group",
+ fieldtype: "Link",
+ options: "Item Group",
+ },
+ {
+ fieldname:"brand",
+ label: "Brand",
+ fieldtype: "Link",
+ options: "Brand",
+ },
+ {
+ fieldname:"customer",
+ label: "Customer",
+ fieldtype: "Link",
+ options: "Customer",
+ },
+ {
+ fieldname:"territory",
+ label: "Territory",
+ fieldtype: "Link",
+ options: "Territory",
+ },
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
new file mode 100644
index 0000000..8ec3a18
--- /dev/null
+++ b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.py
@@ -0,0 +1,82 @@
+# 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
+from webnotes import msgprint, _
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ data = get_entries(filters)
+
+ return columns, data
+
+def get_columns(filters):
+ if not filters.get("doc_type"):
+ msgprint(_("Please select the document type first"), raise_exception=1)
+
+ return [filters["doc_type"] + ":Link/" + filters["doc_type"] + ":140",
+ "Customer:Link/Customer:140", "Territory:Link/Territory:100", "Posting Date:Date:100",
+ "Item Code:Link/Item:120", "Qty:Float:100", "Amount:Currency:120",
+ "Sales Person:Link/Sales Person:140", "Contribution %:Float:110",
+ "Contribution Amount:Currency:140"]
+
+def get_entries(filters):
+ date_field = filters["doc_type"] == "Sales Order" and "transaction_date" or "posting_date"
+ conditions, items = get_conditions(filters, date_field)
+ entries = webnotes.conn.sql("""select dt.name, dt.customer, dt.territory, dt.%s,
+ dt_item.item_code, dt_item.qty, dt_item.amount, st.sales_person,
+ st.allocated_percentage, dt_item.amount*st.allocated_percentage/100
+ from `tab%s` dt, `tab%s Item` dt_item, `tabSales Team` st
+ where st.parent = dt.name and dt.name = dt_item.parent and st.parenttype = '%s'
+ and dt.docstatus = 1 %s order by st.sales_person, dt.name desc""" %
+ (date_field, filters["doc_type"], filters["doc_type"], filters["doc_type"], conditions),
+ tuple(items), as_list=1)
+
+ return entries
+
+def get_conditions(filters, date_field):
+ conditions = ""
+ if filters.get("company"): conditions += " and dt.company = '%s'" % filters["company"]
+ if filters.get("customer"): conditions += " and dt.customer = '%s'" % filters["customer"]
+ if filters.get("territory"): conditions += " and dt.territory = '%s'" % filters["territory"]
+
+ if filters.get("from_date"): conditions += " and dt.%s >= '%s'" % \
+ (date_field, filters["from_date"])
+ if filters.get("to_date"): conditions += " and dt.%s <= '%s'" % (date_field, filters["to_date"])
+
+ if filters.get("sales_person"): conditions += " and st.sales_person = '%s'" % \
+ filters["sales_person"]
+
+ items = get_items(filters)
+ if items:
+ conditions += " and dt_item.item_code in (%s)" % ', '.join(['%s']*len(items))
+
+ return conditions, items
+
+def get_items(filters):
+ if filters.get("item_group"): key = "item_group"
+ elif filters.get("brand"): key = "brand"
+ else: key = ""
+
+ items = []
+ if key:
+ items = webnotes.conn.sql_list("""select name from tabItem where %s = %s""" %
+ (key, '%s'), (filters[key]))
+
+ return items
\ No newline at end of file
diff --git a/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.txt b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.txt
new file mode 100644
index 0000000..abd69f3
--- /dev/null
+++ b/selling/report/sales_person_wise_transaction_summary/sales_person_wise_transaction_summary.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-03 11:31:05",
+ "docstatus": 0,
+ "modified": "2013-05-03 11:31:05",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Sales Person-wise Transaction Summary",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Sales Person-wise Transaction Summary"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/selling/report/territory_target_variance_item_group_wise/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to selling/report/territory_target_variance_item_group_wise/__init__.py
diff --git a/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js
new file mode 100644
index 0000000..146b17d
--- /dev/null
+++ b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.js
@@ -0,0 +1,25 @@
+wn.query_reports["Territory Target Variance Item Group-Wise"] = {
+ "filters": [
+ {
+ fieldname: "fiscal_year",
+ label: "Fiscal Year",
+ fieldtype: "Link",
+ options: "Fiscal Year",
+ default: sys_defaults.fiscal_year
+ },
+ {
+ fieldname: "period",
+ label: "Period",
+ fieldtype: "Select",
+ options: "Monthly\nQuarterly\nHalf-Yearly\nYearly",
+ default: "Monthly"
+ },
+ {
+ fieldname: "target_on",
+ label: "Target On",
+ fieldtype: "Select",
+ options: "Quantity\nAmount",
+ default: "Quantity"
+ },
+ ]
+}
\ No newline at end of file
diff --git a/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
new file mode 100644
index 0000000..109acbd
--- /dev/null
+++ b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.py
@@ -0,0 +1,141 @@
+# 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
+from webnotes import _, msgprint
+from webnotes.utils import flt
+import time
+from accounts.utils import get_fiscal_year
+from controllers.trends import get_period_date_ranges, get_period_month_ranges
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ period_month_ranges = get_period_month_ranges(filters["period"], filters["fiscal_year"])
+ tim_map = get_territory_item_month_map(filters)
+
+ precision = webnotes.conn.get_value("Global Defaults", None, "float_precision") or 2
+
+ data = []
+
+ for territory, territory_items in tim_map.items():
+ for item_group, monthwise_data in territory_items.items():
+ row = [territory, item_group]
+ totals = [0, 0, 0]
+ for relevant_months in period_month_ranges:
+ period_data = [0, 0, 0]
+ for month in relevant_months:
+ month_data = monthwise_data.get(month, {})
+ for i, fieldname in enumerate(["target", "achieved", "variance"]):
+ value = flt(month_data.get(fieldname), precision)
+ period_data[i] += value
+ totals[i] += value
+ period_data[2] = period_data[0] - period_data[1]
+ row += period_data
+ totals[2] = totals[0] - totals[1]
+ row += totals
+ data.append(row)
+
+ return columns, sorted(data, key=lambda x: (x[0], x[1]))
+
+def get_columns(filters):
+ for fieldname in ["fiscal_year", "period", "target_on"]:
+ if not filters.get(fieldname):
+ label = (" ".join(fieldname.split("_"))).title()
+ msgprint(_("Please specify") + ": " + label, raise_exception=True)
+
+ columns = ["Territory:Link/Territory:80", "Item Group:Link/Item Group:80"]
+
+ group_months = False if filters["period"] == "Monthly" else True
+
+ for from_date, to_date in get_period_date_ranges(filters["period"], filters["fiscal_year"]):
+ for label in ["Target (%s)", "Achieved (%s)", "Variance (%s)"]:
+ if group_months:
+ columns.append(label % (from_date.strftime("%b") + " - " + to_date.strftime("%b")))
+ else:
+ columns.append(label % from_date.strftime("%b"))
+
+ return columns + ["Total Target::80", "Total Achieved::80", "Total Variance::80"]
+
+#Get territory & item group details
+def get_territory_details(filters):
+ return webnotes.conn.sql("""select t.name, td.item_group, td.target_qty,
+ td.target_amount, t.distribution_id
+ from `tabTerritory` t, `tabTarget Detail` td
+ where td.parent=t.name and td.fiscal_year=%s and
+ ifnull(t.distribution_id, '')!='' order by t.name""",
+ (filters["fiscal_year"]), as_dict=1)
+
+#Get target distribution details of item group
+def get_target_distribution_details(filters):
+ target_details = {}
+
+ for d in webnotes.conn.sql("""select bdd.month, bdd.percentage_allocation \
+ from `tabBudget Distribution Detail` bdd, `tabBudget Distribution` bd, \
+ `tabTerritory` t where bdd.parent=bd.name and t.distribution_id=bd.name and \
+ bd.fiscal_year=%s""", (filters["fiscal_year"]), as_dict=1):
+ target_details.setdefault(d.month, d)
+
+ return target_details
+
+#Get achieved details from sales order
+def get_achieved_details(filters):
+ start_date, end_date = get_fiscal_year(fiscal_year = filters["fiscal_year"])[1:]
+
+ return webnotes.conn.sql("""select soi.item_code, soi.qty, soi.amount, so.transaction_date,
+ so.territory, MONTHNAME(so.transaction_date) as month_name
+ from `tabSales Order Item` soi, `tabSales Order` so
+ where soi.parent=so.name and so.docstatus=1 and so.transaction_date>=%s and
+ so.transaction_date<=%s""" % ('%s', '%s'),
+ (start_date, end_date), as_dict=1)
+
+def get_territory_item_month_map(filters):
+ territory_details = get_territory_details(filters)
+ tdd = get_target_distribution_details(filters)
+ achieved_details = get_achieved_details(filters)
+
+ tim_map = {}
+
+ for td in territory_details:
+ for month in tdd:
+ tim_map.setdefault(td.name, {}).setdefault(td.item_group, {})\
+ .setdefault(month, webnotes._dict({
+ "target": 0.0, "achieved": 0.0
+ }))
+
+ tav_dict = tim_map[td.name][td.item_group][month]
+
+ for ad in achieved_details:
+ if (filters["target_on"] == "Quantity"):
+ tav_dict.target = flt(td.target_qty) * \
+ (tdd[month]["percentage_allocation"]/100)
+ if ad.month_name == month and get_item_group(ad.item_code) == td.item_group \
+ and ad.territory == td.name:
+ tav_dict.achieved += ad.qty
+
+ if (filters["target_on"] == "Amount"):
+ tav_dict.target = flt(td.target_amount) * \
+ (tdd[month]["percentage_allocation"]/100)
+ if ad.month_name == month and get_item_group(ad.item_code) == td.item_group \
+ and ad.territory == td.name:
+ tav_dict.achieved += ad.amount
+
+ return tim_map
+
+def get_item_group(item_name):
+ return webnotes.conn.get_value("Item", item_name, "item_group")
\ No newline at end of file
diff --git a/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.txt b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.txt
new file mode 100644
index 0000000..6e16b64
--- /dev/null
+++ b/selling/report/territory_target_variance_item_group_wise/territory_target_variance_item_group_wise.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-21 12:15:00",
+ "docstatus": 0,
+ "modified": "2013-06-21 12:15:00",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Sales Order",
+ "report_name": "Territory Target Variance Item Group-Wise",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Territory Target Variance Item Group-Wise"
+ }
+]
\ No newline at end of file
diff --git a/selling/search_criteria/__init__.py b/selling/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/delivered_items_to_be_install/__init__.py b/selling/search_criteria/delivered_items_to_be_install/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/delivered_items_to_be_install/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js b/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js
deleted file mode 100644
index df8fc21..0000000
--- a/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt b/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
deleted file mode 100644
index ab23a29..0000000
--- a/selling/search_criteria/delivered_items_to_be_install/delivered_items_to_be_install.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "add_col": "(`tabDelivery Note Item`.`qty`- ifnull(`tabDelivery Note Item`.`installed_qty`, 0)) AS 'Pending to Install'",
- "parent_doc_type": "Delivery Note",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Delivery Note\u0001Saved':1,'Delivery Note\u0001Submitted':1,'Delivery Note\u0001Status':'','Delivery Note\u0001Fiscal Year':''}",
- "description": "Delivered Items to be Install",
- "doc_type": "Delivery Note Item",
- "name": "__common__",
- "add_cond": "`tabDelivery Note Item`.`qty` > ifnull(`tabDelivery Note Item`.`installed_qty`, 0)",
- "doctype": "Search Criteria",
- "sort_by": "`tabDelivery Note`.`name`",
- "page_len": 50,
- "criteria_name": "Delivered Items to be Install",
- "columns": "Delivery Note\u0001ID,Delivery Note\u0001Status,Delivery Note\u0001Customer,Delivery Note\u0001Customer Name,Delivery Note\u0001Contact Person,Delivery Note\u0001Voucher Date,Delivery Note Item\u0001Item Code,Delivery Note Item\u0001Item Name,Delivery Note Item\u0001Quantity,Delivery Note Item\u0001Installed Qty,Delivery Note\u0001% Installed"
- },
- {
- "name": "delivered_items_to_be_install",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/draft_sales_orders/__init__.py b/selling/search_criteria/draft_sales_orders/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/draft_sales_orders/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/draft_sales_orders/draft_sales_orders.js b/selling/search_criteria/draft_sales_orders/draft_sales_orders.js
deleted file mode 100644
index 7f8aed8..0000000
--- a/selling/search_criteria/draft_sales_orders/draft_sales_orders.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-
-}
\ No newline at end of file
diff --git a/selling/search_criteria/draft_sales_orders/draft_sales_orders.txt b/selling/search_criteria/draft_sales_orders/draft_sales_orders.txt
deleted file mode 100644
index af60e71..0000000
--- a/selling/search_criteria/draft_sales_orders/draft_sales_orders.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "creation": "2012-05-14 18:20:52",
- "docstatus": 0,
- "modified": "2013-01-30 15:19:07",
- "modified_by": "Administrator",
- "owner": "Administrator"
- },
- {
- "columns": "Sales Order\u0001ID,Sales Order\u0001Status,Sales Order\u0001Sales Order Date,Sales Order\u0001Customer,Sales Order\u0001P.O. No,Sales Order\u0001Currency,Sales Order\u0001Grand Total (Export)",
- "criteria_name": "Draft Sales Orders",
- "custom_query": "",
- "description": "List of Open Sales orders filtered by period, customer and other details",
- "doc_type": "Sales Order",
- "doctype": "Search Criteria",
- "filters": "{\"Sales Order\\u0001Saved\":1,\"Sales Order\\u0001Submitted\":1,\"Sales Order\\u0001To Sales Order Date\\u0001upper\":\"2013-01-30\",\"Sales Order\\u0001Company\":\"Alpha\",\"Sales Order\\u0001Fiscal Year\":[\"\"],\"Sales Order\\u0001Status\":[\"Draft\"]}",
- "module": "Selling",
- "name": "__common__",
- "page_len": 50,
- "report_script": null,
- "sort_by": "`tabSales Order`.`name`",
- "sort_order": "DESC",
- "standard": "Yes"
- },
- {
- "doctype": "Search Criteria",
- "name": "draft_sales_orders"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/follow_up_report/__init__.py b/selling/search_criteria/follow_up_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/follow_up_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/follow_up_report/follow_up_report.js b/selling/search_criteria/follow_up_report/follow_up_report.js
deleted file mode 100644
index 2126d0b..0000000
--- a/selling/search_criteria/follow_up_report/follow_up_report.js
+++ /dev/null
@@ -1,63 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.mytabs.items['Select Columns'].hide()
- this.mytabs.items['More Filters'].hide()
-
- this.hide_all_filters();
- this.add_filter({fieldname:'follow_up_on', label:'Communication on', fieldtype:'Select', options:''+NEWLINE+'Lead'+NEWLINE+'Opportunity'+NEWLINE+'Quotation',ignore : 1,parent:'Communication Log', in_first_page : 1, single_select :1});
- this.add_filter({fieldname:'lead_name', label:'Lead', fieldtype:'Link', options:'Lead', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
- this.add_filter({fieldname:'enq_name', label:'Opportunity', fieldtype:'Link', options:'Opportunity', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
- this.add_filter({fieldname:'qtn_name', label:'Quotation', fieldtype:'Link', options:'Quotation', report_default:'', ignore : 1, parent:'Communication Log', in_first_page : 1});
-
- this.get_filter('Communication Log', 'Communication type').set_as_single();
- this.set_filter_properties('Communication Log', 'Communication by', {filter_hide:0, in_first_page : 1});
- this.set_filter_properties('Communication Log', 'Communication type', {filter_hide:0, in_first_page : 1});
- this.set_filter_properties('Communication Log', 'From Date', {filter_hide:0, in_first_page : 1});
- this.set_filter_properties('Communication Log', 'To Date', {filter_hide:0, in_first_page : 1});
-
- this.orig_sort_list = [['Date','`tabCommunication Log`.`date`'],['Document Type','`tabCommunication Log`.`parenttype`'],['Document','`tabCommunication Log`.`parent`'],['Follow Up By','`tabCommunication Log`.`follow_up_by`'],['Follow Up Type','`tabCommunication Log`.`follow_up_type`']];
-}
-
-
-report.get_query = function() {
- var lead_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Lead'].get_value();
- var enq_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Opportunity'].get_value();
- var quo_id = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Quotation'].get_value();
-
- var follow_up_on = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication on'].get_value();
- var follow_up_by = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication by'].get_value();
-
- var on_type = this.filter_fields_dict['Communication Log'+FILTER_SEP+'Communication type'].get_value();
- var from_date = this.filter_fields_dict['Communication Log'+FILTER_SEP+'From Date'].get_value();
- var to_date = this.filter_fields_dict['Communication Log'+FILTER_SEP+'To Date'].get_value();
-
- var cond = 'parenttype IN ("Lead","Opportunity","Quotation")';
- if(follow_up_on) cond = 'parenttype = "'+follow_up_on+'"';
-
- if((follow_up_on == 'Lead' && lead_id) || (lead_id && !follow_up_on)) cond +=' AND parent = "'+lead_id+'"';
- if((follow_up_on == 'Opportunity' && enq_id) || (enq_id && !follow_up_on)) cond +=' AND parent = "'+enq_id+'"';
- if((follow_up_on == 'Quotation' && quo_id) || (quo_id && !follow_up_on)) cond +=' AND parent = "'+quo_id+'"';
-
- if(on_type) cond += ' AND follow_up_type ="'+on_type+'"';
- if(from_date) cond += ' AND date >="'+from_date+'"';
- if(to_date) cond += ' AND date <="'+to_date+'"';
- if(follow_up_by) cond += ' AND follow_up_by = "'+follow_up_by+'"';
-
- var q ='SELECT distinct `tabCommunication Log`.`parenttype`, `tabCommunication Log`.`parent`, `tabCommunication Log`.`date`, `tabCommunication Log`.`notes`, `tabCommunication Log`.`follow_up_type`, `tabCommunication Log`.`follow_up_by` FROM `tabCommunication Log` WHERE '+cond+' ORDER BY '+sel_val(this.dt.sort_sel)+' '+this.dt.sort_order;
- return q;
-}
diff --git a/selling/search_criteria/follow_up_report/follow_up_report.py b/selling/search_criteria/follow_up_report/follow_up_report.py
deleted file mode 100644
index 4006627..0000000
--- a/selling/search_criteria/follow_up_report/follow_up_report.py
+++ /dev/null
@@ -1,33 +0,0 @@
-# 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
-follow_up_on = filter_values.get('follow_up_on')
-
-cols = [['Document Type', 'Data', '150px', '']
- ,['Document', 'Link', '150px', follow_up_on]
- ,['Follow Up Date', 'Date', '150px', '']
- ,['Description','Data','300px','']
- ,['Follow Up Type','Data','150px','']
- ,['Follow Up By','Link','150px','Sales Person']
- ]
-
-for c in cols:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
diff --git a/selling/search_criteria/follow_up_report/follow_up_report.txt b/selling/search_criteria/follow_up_report/follow_up_report.txt
deleted file mode 100644
index b789bd9..0000000
--- a/selling/search_criteria/follow_up_report/follow_up_report.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "parent_doc_type": "Lead",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Lead\u0001Status':'','Lead\u0001Source':'','Lead\u0001Lead Type':'','Lead\u0001Rating':'','Lead\u0001Market Segment':'','Lead\u0001Fiscal Year':''}",
- "doc_type": "Communication Log",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabLead`.`name`",
- "page_len": 50,
- "criteria_name": "Follow-up Report",
- "columns": "Lead\u0001ID,Communication Log\u0001Date,Communication Log\u0001Notes,Communication Log\u0001Communication Log type"
- },
- {
- "name": "follow-up_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/itemwise_delivery_details/__init__.py b/selling/search_criteria/itemwise_delivery_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/itemwise_delivery_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js b/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js
deleted file mode 100644
index b056676..0000000
--- a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'From Posting Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Delivery Note'+FILTER_SEP +'To Posting Date'].df['report_default'] = dateutil.obj_to_str(new Date());
-
-}
diff --git a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py b/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py
deleted file mode 100644
index 0529d1b..0000000
--- a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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
-out=[]
-qty,amt,bill_amt=0,0,0
-
-for r in res:
- qty += flt(r[col_idx['Quantity']])
- amt += flt(r[col_idx['Amount*']])
- bill_amt += flt(r[col_idx['Billed Amt']])
- out.append(r)
-
-
-#Add the totals row
-l_row = ['' for i in range(len(colnames))]
-l_row[col_idx['Item Name']] = '<b>TOTALS</b>'
-l_row[col_idx['Quantity']] = qty
-l_row[col_idx['Amount*']] = amt
-l_row[col_idx['Billed Amt']] = bill_amt
-out.append(l_row)
diff --git a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt b/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
deleted file mode 100644
index 9ba342e..0000000
--- a/selling/search_criteria/itemwise_delivery_details/itemwise_delivery_details.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-23 12:46:00",
- "modified_by": "Administrator",
- "modified": "2012-05-03 18:13:49"
- },
- {
- "parent_doc_type": "Delivery Note",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"Delivery Note\\u0001Submitted\":1,\"Delivery Note\\u0001Status\":[\"\"],\"Delivery Note\\u0001Fiscal Year\":[\"\"]}",
- "doc_type": "Delivery Note Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabDelivery Note`.`name`",
- "page_len": 50,
- "criteria_name": "Itemwise Delivery Details",
- "columns": "Delivery Note\u0001ID,Delivery Note Item\u0001Item Code,Delivery Note Item\u0001Item Name,Delivery Note Item\u0001Quantity,Delivery Note Item\u0001Rate*,Delivery Note Item\u0001Amount*,Delivery Note Item\u0001Billed Amt"
- },
- {
- "name": "itemwise_delivery_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/itemwise_sales_details/__init__.py b/selling/search_criteria/itemwise_sales_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/itemwise_sales_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js b/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js
deleted file mode 100644
index 7ff214a..0000000
--- a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'ID'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df['report_default'] = sys_defaults.year_start_date;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df['report_default'] = dateutil.obj_to_str(new Date());
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Order Item'+FILTER_SEP +'Item Code'].df.in_first_page = 1;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Status'].df.filter_hide = 1;
-}
-
-//this.mytabs.items['Select Columns'].hide();
-this.mytabs.items['More Filters'].hide();
\ No newline at end of file
diff --git a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py b/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py
deleted file mode 100644
index 1b7a195..0000000
--- a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.py
+++ /dev/null
@@ -1,36 +0,0 @@
-# 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
-out=[]
-qty,amt,del_qty,bill_amt=0,0,0,0
-
-for r in res:
- qty += flt(r[col_idx['Quantity']])
- amt += flt(r[col_idx['Amount*']])
- del_qty += flt(r[col_idx['Delivered Qty']])
- bill_amt += flt(r[col_idx['Billed Amt']])
- out.append(r)
-
-
-#Add the totals row
-l_row = ['' for i in range(len(colnames))]
-l_row[col_idx['Item Name']] = '<b>TOTALS</b>'
-l_row[col_idx['Quantity']] = qty
-l_row[col_idx['Amount*']] = amt
-l_row[col_idx['Delivered Qty']] = del_qty
-l_row[col_idx['Billed Amt']] = bill_amt
-out.append(l_row)
diff --git a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt b/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
deleted file mode 100644
index 7737040..0000000
--- a/selling/search_criteria/itemwise_sales_details/itemwise_sales_details.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-23 12:46:00",
- "modified_by": "Administrator",
- "modified": "2012-05-03 18:18:31"
- },
- {
- "parent_doc_type": "Sales Order",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{\"Sales Order\\u0001Submitted\":1,\"Sales Order\\u0001Fiscal Year\":[\"\"],\"Sales Order\\u0001Status\":[\"\"]}",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Itemwise Sales Details",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Customer,Sales Order Item\u0001Item Code,Sales Order Item\u0001Item Name,Sales Order Item\u0001Quantity,Sales Order Item\u0001Basic Rate*,Sales Order Item\u0001Amount*,Sales Order Item\u0001Delivered Qty,Sales Order Item\u0001Billed Amt"
- },
- {
- "name": "itemwise_sales_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/lead_to_follow_up/__init__.py b/selling/search_criteria/lead_to_follow_up/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/lead_to_follow_up/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.js b/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.js
deleted file mode 100644
index 94f2ef5..0000000
--- a/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.js
+++ /dev/null
@@ -1,21 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Lead'+FILTER_SEP +'Status'].df.filter_hide = 1;
- this.filter_fields_dict['Lead'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
-
\ No newline at end of file
diff --git a/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt b/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
deleted file mode 100644
index 2ddd5e9..0000000
--- a/selling/search_criteria/lead_to_follow_up/lead_to_follow_up.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Lead\u0001Status':'','Lead\u0001Source':'','Lead\u0001Expected Month':'','Lead\u0001Industry':'','Lead\u0001Market Segment':'','Lead\u0001Rating':''}",
- "doc_type": "Lead",
- "name": "__common__",
- "add_cond": "`tabLead`.status!='Converted' \n`tabLead`.status!='Lead Lost' \n`tabLead`.status!='Not Interested'",
- "doctype": "Search Criteria",
- "sort_by": "`tabLead`.`name`",
- "page_len": 50,
- "criteria_name": "Lead-To follow up",
- "columns": "Lead\u0001ID,Lead\u0001Status,Lead\u0001Lead Name,Lead\u0001Lead Date,Lead\u0001Lead Owner,Lead\u0001Next Contact Date"
- },
- {
- "name": "lead-to_follow_up",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/lead_to_follow_up/sales_order_overdue.js b/selling/search_criteria/lead_to_follow_up/sales_order_overdue.js
deleted file mode 100644
index 799cd22..0000000
--- a/selling/search_criteria/lead_to_follow_up/sales_order_overdue.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Customer'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'ID'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Quotation No'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Sales Partner'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'From Sales Order Date'].df.filter_hide = 0;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'To Sales Order Date'].df.filter_hide = 0;
-}
\ No newline at end of file
diff --git a/selling/search_criteria/opportunity_to_follow_up/__init__.py b/selling/search_criteria/opportunity_to_follow_up/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/opportunity_to_follow_up/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt b/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt
deleted file mode 100644
index b524e6a..0000000
--- a/selling/search_criteria/opportunity_to_follow_up/opportunity_to_follow_up.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-03-30 14:50:44",
- "modified_by": "Administrator",
- "modified": "2012-03-30 14:50:44"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Opportunity\u0001Fiscal Year':''}",
- "doc_type": "Opportunity",
- "name": "__common__",
- "add_cond": "`tabOpportunity`.name=`tabQuotation`.enq_no\n`tabOpportunity`.docstatus=1\n`tabQuotation`.status='Submitted'",
- "doctype": "Search Criteria",
- "sort_by": "`tabOpportunity`.`name`",
- "page_len": 50,
- "criteria_name": "Opportunity-To follow up",
- "columns": "Opportunity\u0001ID,Opportunity\u0001Owner,Opportunity\u0001Company,Opportunity\u0001Fiscal Year"
- },
- {
- "name": "opportunity-to_follow_up",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py b/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt b/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
deleted file mode 100644
index 9050204..0000000
--- a/selling/search_criteria/sales_orderwise_booking_&_delivery_summary/sales_orderwise_booking_&_delivery_summary.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "add_col": "SUM(CASE WHEN `tabSales Order`.`status` = 'Stopped' THEN (`tabSales Order Item`.`delivered_qty` * `tabSales Order Item`.`basic_rate`) ELSE (`tabSales Order Item`.`qty` * `tabSales Order Item`.`basic_rate`) END) AS 'Booking Total'\nSUM(`tabSales Order Item`.`delivered_qty` * `tabSales Order Item`.`basic_rate`) AS 'Delivered Amount'",
- "parent_doc_type": "Sales Order",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':'','Sales Order\u0001Fiscal Year':''}",
- "description": "Sales Orderwise Booking & Delivery Summary",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "group_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Sales Orderwise Booking & Delivery Summary",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Status,Sales Order\u0001% Billed,Sales Order\u0001Sales Order Date,Sales Order\u0001Customer,Sales Order\u0001Customer Name,Sales Order\u0001Territory"
- },
- {
- "name": "sales_orderwise_booking_&_delivery_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py b/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js b/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js
deleted file mode 100644
index 1b3837a..0000000
--- a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt b/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
deleted file mode 100644
index 1a8d19b..0000000
--- a/selling/search_criteria/sales_orderwise_pending_amount_to_bill/sales_orderwise_pending_amount_to_bill.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-[
- {
- "owner": "dhanalekshmi@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "add_col": "SUM((`tabSales Order Item`.`qty` - ifnull(`tabSales Order Item`.`billed_qty`, 0)) * `tabSales Order Item`.`basic_rate`) AS \"Pending Amount\"",
- "parent_doc_type": "Sales Order",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Saved':1,'Sales Order\u0001Submitted':1,'Sales Order\u0001Company Name':'','Sales Order\u0001Fiscal Year':''}",
- "description": "Sales Orderwise Pending Amount To Bill",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "add_cond": "`tabSales Order`.status != \"Stopped\"\n`tabSales Order`.order_type!=\"Maintenance\"",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "group_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Sales Orderwise Pending Amount To Bill",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Customer,Sales Order\u0001Customer Address,Sales Order\u0001Status,Sales Order\u0001% Delivered,Sales Order\u0001% Billed,Sales Order\u0001Company Name,Sales Order\u0001Sales Order Date,Sales Order\u0001Net Total,Sales Order\u0001Zone,Sales Order\u0001Territory,Sales Order\u0001Email Id"
- },
- {
- "name": "sales_orderwise_pending_amount_to_bill",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py b/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt b/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
deleted file mode 100644
index d9b1581..0000000
--- a/selling/search_criteria/sales_orderwise_pending_qty_to_deliver/sales_orderwise_pending_qty_to_deliver.txt
+++ /dev/null
@@ -1,31 +0,0 @@
-[
- {
- "owner": "dhanalekshmi@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "add_col": "SUM(`tabSales Order Item`.`qty` - ifnull(`tabSales Order Item`.`delivered_qty`, 0)) AS \"Pending Qty\"",
- "parent_doc_type": "Sales Order",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Saved':1,'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':'','Sales Order\u0001Fiscal Year':''}",
- "description": "Sales Orderwise Pending Qty To Deliver",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "add_cond": "`tabSales Order`.status != \"Stopped\"\n`tabSales Order Item`.`qty` > ifnull(`tabSales Order Item`.`delivered_qty`, 0)",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "group_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Sales Orderwise Pending Qty To Deliver",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Customer,Sales Order\u0001Customer Name,Sales Order\u0001Customer Address,Sales Order\u0001Status,Sales Order\u0001% Delivered,Sales Order\u0001% Billed,Sales Order\u0001Sales Order Date,Sales Order\u0001Territory,Sales Order\u0001Email Id"
- },
- {
- "name": "sales_orderwise_pending_qty_to_deliver",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py b/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/sales_persons_target_variance_item_group_wise/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js b/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
deleted file mode 100644
index 8e46f42..0000000
--- a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.js
+++ /dev/null
@@ -1,57 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- this.hide_all_filters();
-
- this.add_filter({fieldname:'sales_person', label:'Sales Person', fieldtype:'Link', options:'Sales Person',ignore : 1,parent:'Target Detail'});
-
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail'});
- this.filter_fields_dict['Target Detail'+FILTER_SEP +'Sales Person'].df.in_first_page = 1;
-}
-this.mytabs.items['Select Columns'].hide();
-report.get_query = function() {
-
- sales_person = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Sales Person'].get_value();
- target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();
- under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();
- if(under == 'Sales Invoice') under = 'Sales Invoice';
-
- if(target_on == 'Quantity'){
- q1 = 't1.target_qty AS "Target Quantity"';
- q2 = '0 AS "Target Quantity"';
- cond1 = 'ifnull(t1.target_qty,"")!=""';
- cond2 = 'ifnull(t6.target_qty,"")!=""';
- }
- else{
- q1 = 't1.target_amount AS "Target Amount"';
- q2 = '0 AS "Target Amount"';
- cond1 = 'ifnull(t1.target_amount,"")!=""';
- cond2 = 'ifnull(t6.target_amount,"")!=""';
- }
-
- var q ='SELECT t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabSales Person` t2 WHERE t1.parenttype = "Sales Person" AND t1.parent = "'+sales_person+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"") != "" AND '+cond1+' UNION SELECT t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+under+' Item` t3,`tabSales Team` t4,`tab'+under+'` t5 where t3.item_group NOT IN (SELECT t6.item_group AS "Item Group" FROM `tabTarget Detail` t6, `tabSales Person` t7 WHERE t6.parenttype = "Sales Person" AND t6.parent = "'+sales_person+'" AND t6.parent=t7.name AND '+cond2+') AND t4.sales_person = "'+sales_person+'" AND t3.parent = t5.name AND t4.parent = t5.name AND t5.docstatus = 1';
-
- return q;
-
-}
diff --git a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py b/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
deleted file mode 100644
index 3c822a6..0000000
--- a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.py
+++ /dev/null
@@ -1,145 +0,0 @@
-# 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/>.
-# validate Filters
-from __future__ import unicode_literals
-flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'sales_person':'Sales Person', 'target_on':'Target On'}
-for f in flt_dict:
- if not filter_values.get(f):
- msgprint("Please Select " + cstr(flt_dict[f]))
- raise Exception
-
-# Get Values from fliters
-fiscal_year = filter_values.get('fiscal_year')[0]
-period = filter_values.get('period')
-under = filter_values.get('under')
-sales_person = filter_values.get('sales_person')
-target_on = filter_values.get('target_on')
-
-
-# set colnames
-for d in ['Item Group', 'Total Target Allocated', 'Distribution Id']:
- colnames.append(d)
- coltypes.append('Data')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[d] = len(colnames) - 1
-
-
-
-# Set required field names
-based_on_fn = 'sales_person'
-
-date_fn = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date'
-
-mon_list = []
-
-data = {'start_date':0, 'end_date':1}
-
-def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
- count = 1
- if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
- for m in range(12):
- # get last date
- last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-
- # make mon_list for Monthly Period
- if period == 'Monthly' :
- mon_list.append([start_date, last_date])
- # add months as Column names
- month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
- append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
-
- # get start date
- start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
- # make mon_list for Quaterly Period
- if period == 'Quarterly' and count % 3 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column names
- append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Half Yearly Period
- if period == 'Half Yearly' and count % 6 == 0 :
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Annual Period
- if period == 'Annual' and count % 12 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
- count = count +1
-
-def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
- col = ['Target', 'Actual', 'Variance']
- for c in col:
- n = str(name) and ' (' + str(name) +')' or ''
- colnames.append(str(c) + n )
- coltypes.append('Currency')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[str(c) + n ] = len(colnames) - 1
-
-
-
-
-# get start date
-start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
-if not start_date:
- msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
- raise Exception
-start_date = start_date.strftime('%Y-%m-%d')
-
-# make month list and columns
-make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
-
-
-bc_obj = get_obj('Budget Control')
-for r in res:
-
- count = 0
-
- for idx in range(3, len(colnames), 3):
-
- cidx = 2
- # ================= Calculate Target ==========================================
- r.append(bc_obj.get_monthly_budget(r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
-
- #================== Actual Amount =============================================
- actual = 0
-
-
- #----------------------------------------------------------
- if target_on == "Quantity":
-
- actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Item` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- #----------------------------------------------------------
- if target_on == "Amount":
-
- actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Item` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t2.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, under, based_on_fn, sales_person, r[0].strip(), date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- #----------------------------------------------------------
-
- actual = actual and flt(actual[0][0]) or 0
- r.append(actual)
- # ================ Variance ===================================================
-
- r.append(r[idx] - r[idx + 1])
-
- count = count +1
diff --git a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt b/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
deleted file mode 100644
index 5535182..0000000
--- a/selling/search_criteria/sales_persons_target_variance_item_group_wise/sales_persons_target_variance_item_group_wise.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "parent_doc_type": "Sales Person",
- "module": "Selling",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Sales Person\u0001Country':'','Sales Person\u0001State':'','Target Detail\u0001Fiscal Year':''}",
- "standard": "Yes",
- "doc_type": "Target Detail",
- "name": "__common__",
- "sort_by": "`tabTarget Detail`.`target_amount`",
- "page_len": 50,
- "criteria_name": "Sales Persons Target Variance (Item Group wise)"
- },
- {
- "name": "sales_persons_target_variance_item_group_wise",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/sales_personwise_transaction_summary/__init__.py b/selling/search_criteria/sales_personwise_transaction_summary/__init__.py
deleted file mode 100755
index baffc48..0000000
--- a/selling/search_criteria/sales_personwise_transaction_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js b/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
deleted file mode 100755
index 79dd9d5..0000000
--- a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.js
+++ /dev/null
@@ -1,53 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
-
- //Add filter
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice', report_default:'Sales Order', ignore : 1,parent:'Sales Person', single_select :1, in_first_page:1});
- this.add_filter({fieldname:'transaction_date', label:'Date', fieldtype:'Date', options:'', ignore : 1,parent:'Sales Person', in_first_page:1});
- this.add_filter({fieldname:'voucher_id', label:'Voucher Id', fieldtype:'Data', options:'', ignore : 1,parent:'Sales Person', in_first_page:1});
- this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory', ignore : 1,parent:'Sales Person', in_first_page:1});
- this.add_filter({fieldname:'sales_person', label:'Sales Person', fieldtype:'Link', options:'Sales Person', ignore : 1,parent:'Sales Person', in_first_page:1});
-}
-
-// hide sections
-this.mytabs.items['More Filters'].hide();
-this.mytabs.items['Select Columns'].hide();
-
-// Get query
-report.get_query = function() {
- based_on = this.get_filter('Sales Person', 'Based On').get_value();
- from_date = this.get_filter('Sales Person', 'From Date').get_value();
- to_date = this.get_filter('Sales Person', 'To Date').get_value();
- vid = this.get_filter('Sales Person', 'Voucher Id').get_value();
- terr = this.get_filter('Sales Person', 'Territory').get_value();
- sp = this.get_filter('Sales Person', 'Sales Person').get_value();
-
- date_fld = 'transaction_date';
- if(based_on == 'Sales Invoice' || based_on == "Delivery Note") date_fld = 'posting_date';
-
- sp_cond = '';
- if (from_date) sp_cond += ' AND t1.' + date_fld + '>= "' + from_date + '"';
- if (to_date) sp_cond += ' AND t1.' + date_fld + '<= "' + to_date + '"';
- if (vid) sp_cond += ' AND t1.name LIKE "%' + vid + '%"';
- if (terr) sp_cond += ' AND t1.territory = "' + terr + '"';
- if (sp) sp_cond += ' AND t2.sales_person = "' + sp + '"';
-
- return 'SELECT t1.`name`, t1.`customer_name`, t1.`territory`, t1.`' + date_fld + '`, t1.`net_total`, t1.`grand_total`, t2.`sales_person`, t2.`allocated_percentage`, t2.`allocated_amount` FROM `tab' + based_on + '` t1, `tabSales Team` t2 WHERE t1.docstatus=1 AND t2.`parenttype` = "' + based_on + '" AND t2.`parent` = t1.`name`' + sp_cond + ' ORDER BY t1.`name` DESC';
-}
-
diff --git a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py b/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
deleted file mode 100755
index 632e545..0000000
--- a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.py
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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
-if filter_values.get('based_on') == 'Sales Invoice':
- based_on_dt = 'Sales Invoice'
-else:
- based_on_dt = filter_values.get('based_on')
-
-cols = [[filter_values.get('based_on'), 'Link','150px', based_on_dt], ['Customer', 'Link','150px','Customer'], ['Territory', 'Link','120px','Territory'], ['Transaction Date', 'Date', '120px', ''], ['Net Total', 'Currency', '80px', ''], ['Grand Total', 'Currency', '80px', ''], ['Sales Person', 'Link', '150px', 'Sales Person'], ['% Contribution', 'Currency', '120px', ''], ['Contribution Amt', 'Currency', '120px', '']]
-
-for c in cols:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
diff --git a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt b/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
deleted file mode 100755
index 5f29981..0000000
--- a/selling/search_criteria/sales_personwise_transaction_summary/sales_personwise_transaction_summary.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Person\u0001Saved':1,'Sales Person\u0001Submitted':1,'Sales Person\u0001Country':'','Sales Person\u0001State':''}",
- "doctype": "Search Criteria",
- "doc_type": "Sales Person",
- "name": "__common__",
- "sort_by": "`tabSales Person`.`name`",
- "page_len": 50,
- "criteria_name": "Sales Personwise Transaction Summary",
- "columns": "Sales Person\u0001ID"
- },
- {
- "name": "sales_personwise_transaction_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py b/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/serial_no_amc_expiring_this_month/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt b/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
deleted file mode 100644
index 463d077..0000000
--- a/selling/search_criteria/serial_no_amc_expiring_this_month/serial_no_amc_expiring_this_month.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Serial No\u0001Saved':1,'Serial No\u0001Submitted':1,'Serial No\u0001Status':'','Serial No\u0001Warranty Status':''}",
- "doc_type": "Serial No",
- "name": "__common__",
- "add_cond": "`tab Serial No`.month(amc_expiry_date)=month(now()) \n`tab Serial No`.year(amc_expiry_date)=year(now())",
- "doctype": "Search Criteria",
- "sort_by": "`tabSerial No`.`name`",
- "page_len": 50,
- "criteria_name": "Serial No-AMC expiring this month",
- "columns": "Serial No\u0001ID,Serial No\u0001Status,Serial No\u0001AMC Expiry Date,Serial No\u0001Customer Name"
- },
- {
- "name": "serial_no-amc_expiring_this_month",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py b/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/serial_no_warranty_expiring_this_month/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt b/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
deleted file mode 100644
index 05a9f0f..0000000
--- a/selling/search_criteria/serial_no_warranty_expiring_this_month/serial_no_warranty_expiring_this_month.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:52",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:52"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Serial No\u0001Saved':1,'Serial No\u0001Submitted':1,'Serial No\u0001Status':'Issued','Serial No\u0001Maintenance Status':''}",
- "doc_type": "Serial No",
- "name": "__common__",
- "add_cond": "`tab Serial No`.docstatus!=2\n`tab Serial No`.maintenance_status='Under Warranty'\n`tab Serial No`.status!='Scrapped'\n`tab Serial No`.status!='Not in Use'\n`tab Serial No`.month(ifnull(warranty_expiry_date,0)) = month(now()) \n`tab Serial No`.yearmonth(ifnull(warranty_expiry_date,0)) = year(now())",
- "doctype": "Search Criteria",
- "sort_by": "`tabSerial No`.`name`",
- "page_len": 50,
- "criteria_name": "Serial No-Warranty expiring this month",
- "columns": "Serial No\u0001ID,Serial No\u0001Status,Serial No\u0001Warranty Expiry Date,Serial No\u0001Customer Name"
- },
- {
- "name": "serial_no-warranty_expiring_this_month",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/target_variance_report/__init__.py b/selling/search_criteria/target_variance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/target_variance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/target_variance_report/target_variance_report.js b/selling/search_criteria/target_variance_report/target_variance_report.js
deleted file mode 100644
index cc8e03e..0000000
--- a/selling/search_criteria/target_variance_report/target_variance_report.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Cost Center'+NEWLINE+'Sales Person'+NEWLINE+'Sales Partner',report_default:'Cost Center',ignore : 1,parent:'Target Detail'});
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
-
-}
-
-report.get_query = function() {
- group_by = '';
- group_by = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Group By'].get_value();
- based_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Based On'].get_value();
- sel_fields = '`tabTarget Detail`.parent AS "' + cstr(based_on)+'"';
- cond = ' and ifnull(`tabTarget Detail`.item_group, "") = ""'
- if (group_by == 'Item Group'){
- sel_fields = cstr(sel_fields) + ', `tabTarget Detail`.item_group';
- cond = ' and ifnull(`tabTarget Detail`.item_group,"") != ""'
- }
- sel_fields = cstr(sel_fields) + ', `tabTarget Detail`.target_amount, `tabTarget Detail`.distribution_id';
- var q = 'SELECT '+ cstr(sel_fields) +' FROM `tabTarget Detail` WHERE `tabTarget Detail`.parenttype = "' + cstr(based_on) + '"'+ cstr(cond);
- return q
-}
-
-this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/selling/search_criteria/target_variance_report/target_variance_report.py b/selling/search_criteria/target_variance_report/target_variance_report.py
deleted file mode 100644
index 0c14112..0000000
--- a/selling/search_criteria/target_variance_report/target_variance_report.py
+++ /dev/null
@@ -1,127 +0,0 @@
-# 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/>.
-
-# validate Filters
-from __future__ import unicode_literals
-flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'company':'Company', 'under' : 'Under', 'based_on' : 'Based On'}
-for f in flt_dict:
- if not filter_values.get(f):
- msgprint("Please Select " + cstr(flt_dict[f]))
- raise Exception
-
-# Get Values from fliters
-fiscal_year = filter_values.get('fiscal_year')
-period = filter_values.get('period')
-under = filter_values.get('under')
-based_on = filter_values.get('based_on')
-group_by = filter_values.get('group_by')
-
-# Set required field names
-based_on_fn = (based_on == 'Cost Center') and 'cost_center' or (based_on == 'Sales Partner') and 'sales_partner' or (based_on == 'Sales Person') and 'sales_person'
-date_fn = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date'
-
-mon_list = []
-data = {'start_date':0, 'end_date':1}
-
-def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
- count = 1
- if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
- for m in range(12):
- # get last date
- last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-
- # make mon_list for Monthly Period
- if period == 'Monthly' :
- mon_list.append([start_date, last_date])
- # add months as Column names
- month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
- append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
-
- # get start date
- start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
- # make mon_list for Quaterly Period
- if period == 'Quarterly' and count % 3 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column names
- append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Half Yearly Period
- if period == 'Half Yearly' and count % 6 == 0 :
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Annual Period
- if period == 'Annual' and count % 12 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
- count = count +1
-
-def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
- col = ['Budget', 'Actual', 'Variance']
- for c in col:
- colnames.append(str(c) + ' (' + str(name) +')' )
- coltypes.append('Currency')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[str(c) + ' (' + str(name) +')' ] = len(colnames) - 1
-
-# make default columns
-coltypes[col_idx[based_on]] = 'Link'
-coloptions[col_idx[based_on]]= based_on
-
-# get start date
-start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
-if not start_date:
- msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
- raise Exception
-start_date = start_date.strftime('%Y-%m-%d')
-
-# make month list and columns
-make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
-
-bc_obj = get_obj('Budget Control')
-for r in res:
- count = 0
- for idx in range((group_by == 'Item Group') and 4 or 3, len(colnames), 3):
- cidx = (group_by == 'Item Group') and 3 or 2
- # ================= Calculate Target ==========================================
- r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
-
- #================== Actual Amount =============================================
- actual = 0
- if based_on == 'Cost Center' or based_on == 'Sales Partner':
- if group_by =='Item Group':
- actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- actual = flt(actual[0][0])
- else:
- actual = sql("select sum(ifnull(net_total,0)) from `tab%s` where %s = '%s' and docstatus = 1 and %s between '%s' and '%s' " % (under, based_on_fn, r[0], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- actual = flt(actual[0][0])
- elif based_on == 'Sales Person':
- if group_by =='Item Group':
- actual = sql("select sum(ifnull(t2.amount,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, r[0], r[1], date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- actual = flt(actual[0][0])
- else:
- actual = sql("select sum(ifnull(t2.allocated_amount,0)) from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and t1.%s between '%s' and '%s'"%(under, based_on_fn, r[0], under, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- actual = flt(actual[0][0])
- r.append(actual)
- # ================ Variance ===================================================
- r.append(r[idx] - r[idx + 1])
- count = count +1
\ No newline at end of file
diff --git a/selling/search_criteria/target_variance_report/target_variance_report.txt b/selling/search_criteria/target_variance_report/target_variance_report.txt
deleted file mode 100644
index c892366..0000000
--- a/selling/search_criteria/target_variance_report/target_variance_report.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "harshada@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Sales Person",
- "module": "Selling",
- "standard": "Yes",
- "disabled": 0,
- "sort_order": "DESC",
- "filters": "{'Sales Person\u0001Saved':1,'Sales Person\u0001Submitted':1,'Sales Person\u0001Country':'','Sales Person\u0001State':'','Target Detail\u0001Fiscal Year':''}",
- "doc_type": "Target Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "page_len": 50,
- "criteria_name": "Target Variance Report",
- "columns": "Sales Person\u0001ID,Sales Person\u0001Owner,Sales Person\u0001Sales Person,Sales Person\u0001Country,Sales Person\u0001State,Target Detail\u0001Item Group,Target Detail\u0001Fiscal Year,Target Detail\u0001Target Amount"
- },
- {
- "name": "target_variance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py b/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/territories_target_variance_item_group_wise/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js b/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
deleted file mode 100644
index d7dcf70..0000000
--- a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- this.hide_all_filters();
-
- this.add_filter({fieldname:'territory', label:'Territory', fieldtype:'Link', options:'Territory',ignore : 1,parent:'Target Detail'});
-
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
-
- this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail'});
- this.filter_fields_dict['Target Detail'+FILTER_SEP +'Territory'].df.in_first_page = 1;
-}
-this.mytabs.items['Select Columns'].hide();
-report.get_query = function() {
-
- territory = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Territory'].get_value();
- target_on = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Target On'].get_value();
- under = this.filter_fields_dict['Target Detail'+FILTER_SEP+'Under'].get_value();
- if(under == 'Sales Invoice') under = 'Sales Invoice';
-
- if(target_on == 'Quantity'){
- q1 = 't1.target_qty AS "Target Quantity"';
- q2 = '0 AS "Target Quantity"';
- cond1 = 'ifnull(t1.target_qty,"")!=""';
- cond2 = 'ifnull(t5.target_qty,"")!=""';
- }
- else{
- q1 = 't1.target_amount AS "Target Amount"';
- q2 = '0 AS "Target Amount"';
- cond1 = 'ifnull(t1.target_amount,"")!=""';
- cond2 = 'ifnull(t5.target_amount,"")!=""';
- }
- if(under =='Sales Invoice')
- tab = 'RV';
- else
- tab = under;
-
- var q ='SELECT distinct t1.item_group AS "Item Group", '+q1+', t2.distribution_id AS "Distribution Id" FROM `tabTarget Detail` t1, `tabTerritory` t2 WHERE t1.parenttype = "Territory" AND t1.parent = "'+territory+'" AND t1.parent=t2.name AND ifnull(t1.item_group,"")!="" AND '+cond1+' UNION SELECT distinct t3.item_group AS "Item Group", '+q2+',"" AS "Distribution Id" FROM `tab'+tab+' Detail` t3,`tab'+under+'` t4 where t3.item_group NOT IN (SELECT t5.item_group FROM `tabTarget Detail` t5, `tabTerritory` t6 WHERE t5.parenttype = "Territory" AND t5.parent = "'+territory+'" AND t5.parent=t6.name AND '+cond2+') AND t4.territory = "'+territory+'" AND t3.parent = t4.name AND t4.docstatus = 1';
-
- return q;
-
-}
\ No newline at end of file
diff --git a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py b/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
deleted file mode 100644
index 17acb47..0000000
--- a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.py
+++ /dev/null
@@ -1,144 +0,0 @@
-# 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/>.
-
-# validate Filters
-from __future__ import unicode_literals
-flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'territory':'Territory', 'target_on':'Target On'}
-for f in flt_dict:
- if not filter_values.get(f):
- msgprint("Please Select " + cstr(flt_dict[f]))
- raise Exception
-
-# Get Values from fliters
-fiscal_year = filter_values.get('fiscal_year')
-period = filter_values.get('period')
-under = filter_values.get('under')
-if under == 'Sales Invoice': under = 'Sales Invoice'
-territory = filter_values.get('territory')
-target_on = filter_values.get('target_on')
-
-
-# Set required field names
-based_on_fn = 'territory'
-
-date_fn = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date'
-
-mon_list = []
-
-data = {'start_date':0, 'end_date':1}
-
-def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
- count = 1
- if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
- for m in range(12):
- # get last date
- last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-
- # make mon_list for Monthly Period
- if period == 'Monthly' :
- mon_list.append([start_date, last_date])
- # add months as Column names
- month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
- append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
-
- # get start date
- start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
- # make mon_list for Quaterly Period
- if period == 'Quarterly' and count % 3 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column names
- append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Half Yearly Period
- if period == 'Half Yearly' and count % 6 == 0 :
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Annual Period
- if period == 'Annual' and count % 12 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
- count = count +1
-
-def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
- col = ['Target', 'Actual', 'Variance']
- for c in col:
- n = str(name) and ' (' + str(name) +')' or ''
- colnames.append(str(c) + n )
- coltypes.append('Currency')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[str(c) + n ] = len(colnames) - 1
-
-
-
-# make default columns
-#coltypes[col_idx['Item Group']] = 'Link'
-#coloptions[col_idx['Item Group']]= 'Sales '
-
-# get start date
-start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
-if not start_date:
- msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
- raise Exception
-start_date = start_date.strftime('%Y-%m-%d')
-
-# make month list and columns
-make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
-
-
-
-bc_obj = get_obj('Budget Control')
-for r in res:
-
- count = 0
-
- for idx in range(3, len(colnames), 3):
-
- cidx = 2
- # ================= Calculate Target ==========================================
- r.append(bc_obj.get_monthly_budget(r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
-
- #================== Actual Amount =============================================
- actual = 0
-
-
-
- #----------------------------------------------------------
- if target_on == "Quantity":
-
- actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
-
- #----------------------------------------------------------
- if target_on == "Amount":
-
- actual = sql("select sum(ifnull(t2.amount,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s = '%s' and t1.docstatus = 1 and t2.item_group = '%s' and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, territory, r[0],date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- #----------------------------------------------------------
-
- actual = actual and flt(actual[0][0]) or 0
- r.append(actual)
- # ================ Variance ===================================================
-
- r.append(r[idx] - r[idx + 1])
-
- count = count +1
\ No newline at end of file
diff --git a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt b/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
deleted file mode 100644
index a64b47e..0000000
--- a/selling/search_criteria/territories_target_variance_item_group_wise/territories_target_variance_item_group_wise.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Sales Person",
- "module": "Selling",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Sales Person\u0001Country':'','Sales Person\u0001State':'','Target Detail\u0001Fiscal Year':''}",
- "standard": "Yes",
- "doc_type": "Target Detail",
- "name": "__common__",
- "sort_by": "`tabTarget Detail`.`target_amount`",
- "page_len": 50,
- "criteria_name": "Territories Target Variance (Item Group wise)"
- },
- {
- "name": "territories_target_variance_item_group_wise",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/territory_sales___variance_report/__init__.py b/selling/search_criteria/territory_sales___variance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/territory_sales___variance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js b/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
deleted file mode 100644
index aabd4e1..0000000
--- a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.js
+++ /dev/null
@@ -1,22 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Territory'});
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Territory'});
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Territory'});
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Territory'});
-}
\ No newline at end of file
diff --git a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py b/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py
deleted file mode 100644
index e9e40aa..0000000
--- a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.py
+++ /dev/null
@@ -1,205 +0,0 @@
-# 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
-if filter_values.get('period'):
- period_values = filter_values['period']
- if len(period_values.split(NEWLINE))>1:
- msgprint("You can view report only for one period. Please select only one value in period.")
- raise Exception
- else:
- period = period_values.split(NEWLINE)[0]
-
-if filter_values.get('based_on'):
- based_on = filter_values['based_on']
- if len(based_on.split(NEWLINE)) > 1:
- msgprint("You can view report based on only one criteria. Please select only one value in Based On.")
- raise Exception
- else:
- based_on = based_on.split(NEWLINE)[0]
-
-if not filter_values.get('fiscal_year'):
- msgprint("Please Select Fiscal Year")
- raise Exception
-elif not filter_values.get('period'):
- msgprint("Please Select Period")
- raise Exception
-elif not filter_values.get('based_on'):
- msgprint("Please Select the Criteria on which you want your report to be based")
- raise Exception
-
-fiscal_year = filter_values.get('fiscal_year')
-
-# get fiscal year start date and start month
-# ---------------------------------------------------------
-year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
-start_date = year_start_date and year_start_date[0][0] or ''
-start_month = year_start_date and year_start_date[0][1] or ''
-month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-
-# Add columns based on period
-# --------------------------------
-columns = []
-# ================ Annual ======================
-if period == 'Annual':
- columns.append(['Target','Currency','120px',''])
- columns.append(['Actual','Currency','120px',''])
-
-# =========== Half Yearly ======================
-elif period == 'Half Yearly':
- columns.append(['Target (H1)','Currency','120px','']) # first half
- columns.append(['Actual (H1)','Currency','120px','']) # first half
- if start_month == 1: # this is case when fiscal year starts with JAN
- columns.append(['Target (H2)','Currency','120px',''])
- columns.append(['Actual (H2)','Currency','120px',''])
- else: #this is case when fiscal year starts with other than JAN
- columns.append(['Target (H2)','Currency','120px',''])
- columns.append(['Actual (H2)','Currency','120px',''])
-
-# ================ Quarterly ===================
-elif period == 'Quarterly':
- length_1 = (len(month_name) - start_month + 1) / 3 #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4
- q_no = 1
- for i in range(length_1):
- value = 3*i + val
- columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
- columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
- q_no += 1
- length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
- columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
- q_no += 1;
-
-
-# =============== Monthly ======================
-elif period == 'Monthly':
- for i in range(start_month-1,len(month_name)):
- columns.append(['Target ('+month_name[i]+')','Currency','120px',''])
- columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
-
- for i in range(start_month-1):
- columns.append(['Target('+month_name[i]+')','Currency','120px',''])
- columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
-
-
-
-for c in columns:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
-
-
-condition = ' docstatus = 1 and fiscal_year = "'+fiscal_year+'"'
-
-
-for r in res:
- query = ''
-
- # ================= Annual Report ===============
- if period == 'Annual':
-
- target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s ",(r[col_idx['ID']],fiscal_year))
- target = target and flt(target[0][0]) or 0
- r.append(target)
-
-
- so = sql("select sum(net_total) from `tab%s` where territory = '%s' and %s" % (based_on, r[col_idx['ID']],condition))
- so = so and flt(so[0][0]) or 0
- r.append(so)
-
- # ================= Half Yearly Report ===============
- elif period == 'Half Yearly':
- target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
- target = target and flt(flt(target[0][0])/2) or 0
- r.append(target)
-
- query += ' MONTH(transaction_date) BETWEEN '+cstr(start_month)+' and '+cstr(start_month+5)
- so = sql("select sum(net_total) from `tab%s` where territory = '%s' and %s and %s" % (based_on, r[col_idx['ID']],condition,query))
- so = so and flt(so[0][0]) or 0
- r.append(so)
-
- r.append(target)
-
- query =''
- query += 'MONTH(transaction_date) NOT BETWEEN '+cstr(start_month)+' and '+cstr(start_month+5)
- so = sql("select sum(net_total) from `tab%s` where territory = '%s' and %s and %s" % (based_on, r[col_idx['ID']],condition,query))
- so = so and flt(so[0][0]) or 0
- r.append(so)
- query = ''
-
- # =============== Quarterly Report ==============
- elif period == 'Quarterly':
- query = ''
- length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4;
- for i in range(length_1):
- value = 3*i + val;
- query +='SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
- length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- query += 'SUM(CASE WHEN MONTH(transaction_date) BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END)';
-
- target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
- target = target and flt(flt(target[0][0])/4) or 0
-
-
- so = sql("SELECT %s from `tab%s` where territory ='%s' and %s " %(query,based_on,r[col_idx['ID']],condition))
- i = 0
- length_l = 0
- for c in columns:
- if length_l == 0:
- r.append(target)
- length_l += 1
- else:
- so_total = so and flt(so[0][i]) or 0
- r.append(so_total)
- i +=1
- length_l = 0
-
- # ================ Monthly Report ===============
- elif period == 'Monthly':
- query =''
- target = sql("select sum(target_amount) from `tabTarget Detail` where parent = %s and parenttype= 'Territory' and fiscal_year = %s",(r[col_idx['ID']],fiscal_year))
- #msgprint(target)
- target = target and flt(flt(target[0][0])/12) or 0
-
-
- # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
- for i in range(start_month-1,len(month_name)):
- query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
-
- for i in range(start_month-1):
- if i != (start_month-2):
- query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
- else:
- query += 'SUM(CASE WHEN MONTH(transaction_date) = '+cstr(i+1)+' THEN net_total ELSE NULL END)';
- so = sql("SELECT %s from `tab%s` where territory ='%s' and %s " %(query,based_on,r[col_idx['ID']],condition))
-
- i = 0
- length_l = 0
- for c in columns:
- if length_l == 0:
- r.append(target)
- length_l += 1
- else:
- so_total = so and flt(so[0][i]) or 0
- r.append(so_total)
- i +=1
- length_l = 0
\ No newline at end of file
diff --git a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt b/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
deleted file mode 100644
index 011b957..0000000
--- a/selling/search_criteria/territory_sales___variance_report/territory_sales___variance_report.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Territory\u0001State':'','Territory\u0001Based On':'Sales Order','Territory\u0001Fiscal Year':'2009-2010','Territory\u0001Company':'Alpha Company','Territory\u0001Period':'Quarterly'}",
- "doctype": "Search Criteria",
- "doc_type": "Territory",
- "name": "__common__",
- "sort_by": "ID",
- "page_len": 50,
- "criteria_name": "Territory Sales - Variance Report",
- "columns": "Territory\u0001ID"
- },
- {
- "name": "territory_sales_-_variance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/total_target_variance_report/__init__.py b/selling/search_criteria/total_target_variance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/total_target_variance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/total_target_variance_report/total_target_variance_report.js b/selling/search_criteria/total_target_variance_report/total_target_variance_report.js
deleted file mode 100644
index 59a9b89..0000000
--- a/selling/search_criteria/total_target_variance_report/total_target_variance_report.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Sales Person',report_default:'Territory',ignore : 1,parent:'Target Detail', single_select :1});
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail', single_select :1});
- this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail', single_select :1});
- this.add_filter({fieldname : 'target_on', label:'Target On', fieldtype:'Select', options:'Quantity'+NEWLINE+'Amount',report_default:'Quantity',ignore : 1,parent:'Target Detail', single_select :1});
-}
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{whiteSpace:'pre'});
-}
-this.mytabs.items['Select Columns'].hide();
\ No newline at end of file
diff --git a/selling/search_criteria/total_target_variance_report/total_target_variance_report.py b/selling/search_criteria/total_target_variance_report/total_target_variance_report.py
deleted file mode 100644
index 954f9f2..0000000
--- a/selling/search_criteria/total_target_variance_report/total_target_variance_report.py
+++ /dev/null
@@ -1,223 +0,0 @@
-# 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/>.
-
-# validate Filters
-from __future__ import unicode_literals
-flt_dict = {'fiscal_year': 'Fiscal Year', 'period': 'Period', 'under' : 'Under', 'based_on' : 'Based On','target_on':'Target On'}
-for f in flt_dict:
- if not filter_values.get(f):
- msgprint("Please Select " + cstr(flt_dict[f]))
- raise Exception
-
-# Get Values from fliters
-fiscal_year = filter_values.get('fiscal_year')
-period = filter_values.get('period')
-under = filter_values.get('under')
-if under == 'Sales Invoice': under = 'Sales Invoice'
-based_on = filter_values.get('based_on')
-target_on = filter_values.get('target_on')
-
-#add distributed id field
-col = []
-col.append([based_on,'Date','150px',''])
-if target_on == 'Quantity':
- col.append(['Target Quantity','Currency','150px',''])
-else:
- col.append(['Target Amount','Currency','150px',''])
-col.append(['Distribution Id','Date','150px',''])
-
-for c in col:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
-
- col_idx[c[0]] = len(colnames)-1
-
-def make_child_lst(based_on,name):
- rg = sql("select lft, rgt from `tab%s` where name = '%s'"%(based_on,name))
- ch_name = sql("select name from `tab%s` where lft between %d and %d"%(based_on,int(rg[0][0]),int(rg[0][1])))
- chl ='('
- flag = 1
- for c in ch_name:
- if flag == 1:
- chl += "'%s'"%c[0]
- flag = 2
- else:
- chl +=",'%s'"%c[0]
-
- chl +=")"
- return chl
-
-
-def get_target(target_on,based_on,fiscal_year,r):
-
- if target_on == 'Quantity':
- q1 = "select t1.target_qty "
- q2 = "select sum(t1.target_qty)"
- if target_on == 'Amount':
- q1 = "select t1.target_amount "
- q2 = "select sum(t1.target_amount)"
-
- cond1 =" t1.fiscal_year ='%s' and t1.parent=t2.name and t1.parenttype = '%s' and t1.docstatus !=2"
- #----------------------------------------------------------------
- q = "select t1.name from `tabTarget Detail` t1, `tab%s` t2 where "+cond1+" and t2.name = '%s'"
- ch = sql(q%(based_on,fiscal_year,based_on,r))
-
- return {'q1':q1,'q2':q2,'cond1':cond1,'ch':ch}
-
-for r in res:
-
- tt = get_target(target_on,based_on,fiscal_year,r[0].strip())
-
- if tt['ch']:
-
- cond2 = " ifnull(t1.item_group,'')='' and"
- qur = tt['q1']+"from `tabTarget Detail` t1, `tab%s` t2 where "+cond2+tt['cond1']+" and t2.name = '%s'"
- ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
-
- #----------------------------------------------------------------
- if not ret_amt:
- qur = tt['q2']+"from `tabTarget Detail` t1, `tab%s` t2 where "+tt['cond1']+" and t2.name = '%s'"
- ret_amt = sql(qur%(based_on,fiscal_year,based_on,r[0].strip()))
-
- #----------------------------------------------------------------
- else:
- node_lst = make_child_lst(based_on,r[0].strip())
- qur = tt['q2']+"from `tabTarget Detail` t1, `tab%s` t2 where "+tt['cond1']+" and t2.name in %s"
- ret_amt = sql(qur%(based_on,fiscal_year,based_on,node_lst))
-
- #----------------------------------------------------------------
- ret_dis_id = sql("select distribution_id from `tab%s` where name = '%s'"%(based_on,r[0].strip()))
-
- target_amt = ret_amt and flt(ret_amt[0][0]) or 0
- dis_id = ret_dis_id and ret_dis_id[0][0] or ''
-
- r.append(target_amt)
- r.append(dis_id)
-
-
-# Set required field names
-based_on_fn = (based_on == 'Territory') and 'territory' or 'sales_person'
-
-date_fn = (under == 'Sales Order' ) and 'transaction_date' or 'posting_date'
-
-mon_list = []
-
-data = {'start_date':0, 'end_date':1}
-
-def make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx):
- count = 1
- if period == 'Quarterly' or period == 'Half Yearly' or period == 'Annual': mon_list.append([str(start_date)])
- for m in range(12):
- # get last date
- last_date = str(sql("select LAST_DAY('%s')" % start_date)[0][0])
-
- # make mon_list for Monthly Period
- if period == 'Monthly' :
- mon_list.append([start_date, last_date])
- # add months as Column names
- month_name = sql("select MONTHNAME('%s')" % start_date)[0][0]
- append_colnames(str(month_name)[:3], colnames, coltypes, colwidths, coloptions, col_idx)
-
- # get start date
- start_date = str(sql("select DATE_ADD('%s',INTERVAL 1 DAY)" % last_date)[0][0])
-
- # make mon_list for Quaterly Period
- if period == 'Quarterly' and count % 3 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column names
- append_colnames('Q '+ str(count / 3), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Half Yearly Period
- if period == 'Half Yearly' and count % 6 == 0 :
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('H'+str(count / 6), colnames, coltypes, colwidths, coloptions, col_idx)
- if count != 12: mon_list.append([start_date])
-
- # make mon_list for Annual Period
- if period == 'Annual' and count % 12 == 0:
- mon_list[len(mon_list) - 1 ].append(last_date)
- # add Column Names
- append_colnames('', colnames, coltypes, colwidths, coloptions, col_idx)
- count = count +1
-
-def append_colnames(name, colnames, coltypes, colwidths, coloptions, col_idx):
- col = ['Target', 'Actual', 'Variance']
- for c in col:
- n = str(name) and ' (' + str(name) +')' or ''
- colnames.append(str(c) + n)
- coltypes.append('Currency')
- colwidths.append('150px')
- coloptions.append('')
- col_idx[str(c) + n ] = len(colnames) - 1
-
-
-
-# make default columns
-#coltypes[col_idx[based_on]] = 'Link'
-#coloptions[col_idx[based_on]]= based_on
-
-# get start date
-start_date = webnotes.conn.get_value('Fiscal Year', fiscal_year, 'year_start_date')
-if not start_date:
- msgprint("Please Define Year Start Date for Fiscal Year " + str(fiscal_year))
- raise Exception
-start_date = start_date.strftime('%Y-%m-%d')
-
-# make month list and columns
-make_month_list(append_colnames, start_date, mon_list, period, colnames, coltypes, colwidths, coloptions, col_idx)
-
-
-bc_obj = get_obj('Budget Control')
-for r in res:
- count = 0
-
- for idx in range(3, len(colnames), 3):
- cidx = 2
-
- # ================= Calculate Target ==========================================
- r.append(bc_obj.get_monthly_budget( r[cidx], fiscal_year, mon_list[count][data['start_date']], mon_list[count][data['end_date']], r[cidx-1]))
-
- #================== Actual Amount =============================================
- actual = 0
-
- ch = make_child_lst(based_on,r[0].strip())
-
- #----------------------------------------------------------
- if target_on == "Quantity":
- if based_on == "Territory":
- actual = sql("select sum(ifnull(t2.qty,0)) from `tab%s` t1, `tab%s Detail` t2 where t2.parenttype = '%s' and t2.parent = t1.name and t1.%s in %s and t1.docstatus = 1 and t1.%s between '%s' and '%s'" % (under, (under == 'Sales Invoice') and 'RV' or under, under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- elif based_on == 'Sales Person':
- actual = sql("select sum(ifnull(t2.qty,0) * ifnull(t3.allocated_percentage,0) / 100) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3 where t2.parent = t1.name and t3.parent = t1.name and t3.%s in %s and t1.docstatus != 2 and t1.docstatus = 1 and t1.%s between '%s' and '%s' "%(under, (under == 'Sales Invoice') and 'RV' or under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- #----------------------------------------------------------
- if target_on == "Amount":
- if based_on == 'Territory':
-
- actual = sql("select sum(ifnull(net_total,0)) from `tab%s` where %s in %s and docstatus = 1 and %s between '%s' and '%s' " % (under, based_on_fn, ch, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
-
- elif based_on == 'Sales Person':
- actual = sql("select sum(ifnull(t2.allocated_amount,0)) from `tab%s` t1, `tabSales Team` t2 where t2.%s in %s and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and t1.%s between '%s' and '%s'"%(under, based_on_fn, ch, under, date_fn, mon_list[count][data['start_date']], mon_list[count][data['end_date']]))
- #----------------------------------------------------------
- actual = flt(actual[0][0])
- r.append(actual)
- # ================ Variance ===================================================
- r.append(r[idx] - r[idx + 1])
- count = count +1
\ No newline at end of file
diff --git a/selling/search_criteria/total_target_variance_report/total_target_variance_report.sql b/selling/search_criteria/total_target_variance_report/total_target_variance_report.sql
deleted file mode 100644
index ebd7ae8..0000000
--- a/selling/search_criteria/total_target_variance_report/total_target_variance_report.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tab%(based_on)s` AS node,`tab%(based_on)s` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
diff --git a/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt b/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt
deleted file mode 100644
index cf1484b..0000000
--- a/selling/search_criteria/total_target_variance_report/total_target_variance_report.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Sales Person",
- "module": "Selling",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Person\u0001Saved':1,'Sales Person\u0001Submitted':1,'Sales Person\u0001Country':'','Sales Person\u0001State':'','Target Detail\u0001Fiscal Year':''}",
- "doc_type": "Target Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Person`.`name`",
- "page_len": 50,
- "criteria_name": "Total Target Variance Report",
- "columns": "Sales Person\u0001ID,Sales Person\u0001Owner,Sales Person\u0001Sales Person,Sales Person\u0001Country,Sales Person\u0001State,Sales Person\u0001lft,Sales Person\u0001rgt,Target Detail\u0001Item Group,Target Detail\u0001Fiscal Year,Target Detail\u0001Target Amount"
- },
- {
- "name": "total_target_variance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/selling/search_criteria/variance_report/__init__.py b/selling/search_criteria/variance_report/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/selling/search_criteria/variance_report/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/selling/search_criteria/variance_report/variance_report.js b/selling/search_criteria/variance_report/variance_report.js
deleted file mode 100644
index b5fe3fb..0000000
--- a/selling/search_criteria/variance_report/variance_report.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Sales Person'+NEWLINE+'Sales Partner',report_default:'Territory',ignore : 1,parent:'Target Detail'});
- this.add_filter({fieldname:'fiscal_year', label:'Fiscal Year', fieldtype:'Link', options:'Fiscal Year', report_default:sys_defaults.fiscal_year, ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'company', label:'Company', fieldtype:'Link', options:'Company',report_default:sys_defaults.company, ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'period', label:'Period', fieldtype:'Select', options:'Monthly'+NEWLINE+'Quarterly'+NEWLINE+'Half Yearly'+NEWLINE+'Annual',report_default:'Quarterly',ignore : 1, parent:'Target Detail'});
-// this.add_filter({fieldname:'item_group', label:'Item Group', fieldtype:'Link', options:'Item Group', ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'group_by', label:'Group By', fieldtype:'Select', options:NEWLINE+'Item Group',ignore : 1, parent:'Target Detail'});
- this.add_filter({fieldname:'under', label:'Under',fieldtype:'Select', options:'Sales Order'+NEWLINE+'Delivery Note'+NEWLINE+'Sales Invoice',report_default:'Sales Order',ignore : 1, parent:'Target Detail'});
-}
-
-//this.mytabs.items['Select Columns'].hide()
diff --git a/selling/search_criteria/variance_report/variance_report.py b/selling/search_criteria/variance_report/variance_report.py
deleted file mode 100644
index 7b6856c..0000000
--- a/selling/search_criteria/variance_report/variance_report.py
+++ /dev/null
@@ -1,520 +0,0 @@
-# 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/>.
-
-# Add columns
-# -----------
-from __future__ import unicode_literals
-row_list = [['ID','Data','150px','']]
-
-for r in row_list:
- colnames.append(r[0])
- coltypes.append(r[1])
- colwidths.append(r[2])
- coloptions.append(r[3])
- col_idx[r[0]] = len(colnames)-1
-
-if not filter_values.get('fiscal_year'):
- msgprint("Please Select Fiscal Year")
- raise Exception
-elif not filter_values.get('period'):
- msgprint("Please Select Period")
- raise Exception
-elif not filter_values.get('based_on'):
- msgprint("Please Select the Criteria on which you want your report to be based")
- raise Exception
-elif not filter_values.get('group_by') and filter_values.get('item_group'):
- msgprint("Item Group cannot be selected if Group By is not Item Group")
- raise Exception
-
-fiscal_year = filter_values.get('fiscal_year')
-period = filter_values.get('period')
-based_on = filter_values.get('based_on')
-group_by = filter_values.get('group_by')
-item_group = filter_values.get('item_group')
-msgprint(item_group)
-company = filter_values.get('company')
-under = filter_values.get('under')
-
-#if filter_values.get('item_group'):
-# itm_grp = filter_values.get('item_group')
-
-if based_on == 'Territory':
- based = 'territory'
-elif based_on == 'Sales Person':
- based = 'sales_person'
-elif based_on == 'Sales Partner':
- based = 'sales_partner'
-
-
-if under == 'Sales Invoice':
- under_detail = 'RV'
- dt = 'posting_date'
-else:
- under_detail = under
- dt = "transaction_date"
-
-# get fiscal year start date and start month
-year_start_date = sql("select year_start_date,MONTH(year_start_date) from `tabFiscal Year` where name = %s",fiscal_year)
-start_date = year_start_date and year_start_date[0][0] or ''
-start_month = year_start_date and year_start_date[0][1] or ''
-month_name = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec']
-
-# Add columns based on period
-# --------------------------------
-columns = []
-if group_by == 'Item Group':
- columns.append(['Item Group','Data','120px',''])
-# ================ Annual ======================
-if period == 'Annual':
- columns.append(['Target','Currency','120px',''])
- columns.append(['Actual','Currency','120px',''])
-
-# =========== Half Yearly ======================
-elif period == 'Half Yearly':
- columns.append(['Target (H1)','Currency','120px','']) # first half
- columns.append(['Actual (H1)','Currency','120px','']) # first half
- columns.append(['Target (H2)','Currency','120px',''])
- columns.append(['Actual (H2)','Currency','120px',''])
-
-# ================ Quarterly ===================
-elif period == 'Quarterly':
- length_1 = (len(month_name) - start_month + 1) / 3 #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4
- q_no = 1
- for i in range(length_1):
- value = 3*i + val
- columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
- columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
- q_no += 1
- length_2 = (start_month - 1) / 3 #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- columns.append(['Target (Q'+cstr(q_no)+')','Currency','120px',''])
- columns.append(['Actual (Q'+cstr(q_no)+')','Currency','120px',''])
- q_no += 1;
-
-# =============== Monthly ======================
-elif period == 'Monthly':
- for i in range(start_month-1,len(month_name)):
- columns.append(['Target ('+month_name[i]+')','Currency','120px',''])
- columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
-
- for i in range(start_month-1):
- columns.append(['Target('+month_name[i]+')','Currency','120px',''])
- columns.append(['Actual ('+month_name[i]+')','Currency','120px',''])
-
-for c in columns:
- colnames.append(c[0])
- coltypes.append(c[1])
- colwidths.append(c[2])
- coloptions.append(c[3])
- col_idx[c[0]] = len(colnames)-1
-
-out = []
-if company:
- condition = ' fiscal_year = "'+fiscal_year+'" and company = "'+company+'"'
-else:
- condition = ' fiscal_year = "'+fiscal_year+'"'
-
-#=================== function for fetching allocated percentage in Distribution id according to period=============
-def get_budget_distribution(period,dist_id,fiscal_year):
- query = ''
- id1 = 1
- if period == 'Half Yearly':
- id2 = 6
- for i in range(2):
- query += 'SUM(CASE WHEN t2.idx BETWEEN '+str(id1)+' AND '+str(id2)+' THEN t2.percentage_allocation ELSE NULL END)'
- id1 += 6
- id2 += 6
- if i < 1 :
- query += ','
-
- elif period == 'Quarterly':
- id2 = 3
- for i in range(4):
- query += 'SUM(CASE WHEN t2.idx BETWEEN '+str(id1)+' AND '+str(id2)+' THEN t2.percentage_allocation ELSE NULL END)'
- id1 += 3
- id2 += 3
- if i < 3 :
- query += ','
-
- elif period == 'Monthly':
- for i in range(12):
- query += 'SUM(CASE WHEN t2.idx ='+str(id1)+' THEN t2.percentage_allocation ELSE NULL END)'
- id1 += 1
- if i < 11 :
- query += ','
-
-# msgprint(query)
-
- # Main Query
- dist = sql("select %s from `tabBudget Distribution` t1, `tabBudget Distribution Detail` t2 where t1.name = '%s' and t2.parent = t1.name and t1.fiscal_year = '%s'"%(query,dist_id,fiscal_year))
- dist = dist and dist[0] or 0
-# msgprint(dist)
- bug = []
- for i in dist:
- i = i and float(i) or 0
- bug.append(i)
-# msgprint(bug)
- return bug
-
-
-#============ function for appending target amt and actual amt in a proper order =======================
-def appending_func(ran,tl,lst,actual,flt):
-
- c = 2
- for i in range(ran):
- #==== for each itemgroup their actual amt is appended/inserted between target amt
- if tl == 0:
- lst.insert(c,actual and flt(actual[0][i]) or 0)
- #======== here actual amt is appended/inserted b/w target amt for a particular territory/sales person/sales partner only if target is not zero
- elif tl == 1:
-# msgprint(lst)
- lst.insert(c,actual and flt(actual[0][i]) or 0)
- c += 2
- return lst
-
-def get_target(tar_det,group_by,period,fiscal_year,rng,r,get_budget_distribution,flt):
-
- grp,lst = [],[]
- list_range,tl = 0,0
- if group_by == 'Item Group':
- for i in tar_det:
- if i[0] != '':
- igrp = [i[0]]
- if i[2]:
- dist_id = i[2]
- dist = get_budget_distribution(period,dist_id,fiscal_year)
- for d in dist:
- t = flt(flt(flt(i[1]) * flt(d))/ 100)
- igrp.append(t)
- else:
- t = i and flt(i[1]/rng) or 0
- for i in range(rng):
- igrp.append(t)
-
- grp.append(igrp)
- list_range +=1
- lst = [1,grp,list_range]
-
- #============== Total target(on basis of whole target ) ============
- else:
- for i in tar_det:
- if i[0] == '':
- if i[2]:
- dist_id = i[2]
- dist = get_budget_distribution(period,dist_id,fiscal_year)
- for d in dist:
- t = flt((flt(i[1]) * flt(d))/ 100)
- r.append(t)
- else:
- tot_target = i and flt(i[1]/rng) or 0
- for i in range(rng):
- r.append(tot_target)
- tl = 1
- lst = [0,r,tl]
- return lst
-#============ report display function =====================
-for r in res:
- query = ''
- grp=[]
- list_range, count, ap, tot_target, tl = 0,0,0,0,0
-
- #============= ANNUAL REPORT ===================
- if period == 'Annual':
- tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year))
-# msgprint(tar_det)
-
- #================ Target based on individual item group ==============
- if group_by == 'Item Group':
- for i in tar_det:
- if i[0] != '':
- grp_target = i and flt(i[1]) or 0
- igrp = [i[0],grp_target]
- grp.append(igrp)
-# msgprint(grp)
- list_range +=1
- count = 3
-
- #============== Total target(will be displayed only if target is specified by the user) ============
- else:
- for i in tar_det:
- # ======= here target is considered and not sum of target of item groups
- if i[0] == '':
- tot_target = tar_det and flt(i[1]) or 0
-# msgprint(tot_target)
-
- #================== Actual Amount =============================================
- if based_on == 'Territory' or based_on == 'Sales Partner':
-
- if group_by =='Item Group':
-
- for i in grp:
- item_group = i[0]
- actual = sql("select sum(t2.amount) from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(under,under_detail,based,r[col_idx['ID']],item_group,condition))
- msgprint(actual)
- actual = actual and flt(actual[0][0]) or 0
- i.append(actual)
-
- else:
- actual = sql("select sum(net_total) from `tab%s` where %s = '%s' and docstatus = 1 and %s" % (under, based, r[col_idx['ID']],condition))
- actual = actual and flt(actual[0][0]) or 0
-
- elif based_on == 'Sales Person':
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select sum(t2.amount) from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(under,under_detail,based,r[col_idx['ID']],item_group,condition))
- actual = actual and flt(actual[0][0]) or 0
-# msgprint(actual)
- i.append(actual)
-
- else:
- actual = sql("select sum(t1.net_total) from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(under,based,r[col_idx['ID']],under,condition))
- actual = actual and flt(actual[0][0]) or 0
-# msgprint(actual)
-
- # ================= Half Yearly Report ===============
- elif period == 'Half Yearly':
- tl = 0
- grp_target = []
-
- tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year))
-# msgprint(tar_det)
-
- tar = get_target(tar_det,group_by,period,fiscal_year,2,r,get_budget_distribution,flt)
- if tar[0] == 1:
- grp = tar[1]
- list_range = tar[2]
- count = 5
- else:
- r = tar[1]
- tl = tar[2]
-
- #============= Actual Amount======================
- if group_by == 'Item Group':
- # first half
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t2.amount ELSE NULL END),'
- # second half
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t2.amount ELSE NULL END)';
-
- elif based_on != 'Sales Person':
- # first half
- query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END),'
- # second half
- query += 'SUM(CASE WHEN MONTH('+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN net_total ELSE NULL END)';
-
- else:
- # first half
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t1.net_total ELSE NULL END),'
- # second half
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') NOT BETWEEN '+cstr(start_month)+' AND '+cstr(start_month+5)+' THEN t1.net_total ELSE NULL END)';
-
- #=========== Main Query ===============
- if based_on == 'Territory' or based_on == 'Sales Partner':
-
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- i = appending_func(2,tl,i,actual,flt)
-
- else:
- actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and %s" % (query,under, based, r[col_idx['ID']],condition))
-# msgprint(actual)
-
- elif based_on == 'Sales Person':
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- i = appending_func(2,tl,i,actual,flt)
- else:
- actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
-# msgprint(actual)
-
- if tl == 1:
- r = appending_func(2,tl,r,actual,flt)
-# msgprint(r)
-
- #============== Quarterly Report =========================
- elif period == 'Quarterly':
- tl = 0
- grp_target = []
- tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year))
-
- tar = get_target(tar_det,group_by,period,fiscal_year,4,r,get_budget_distribution,flt)
- if tar[0] == 1:
- grp = tar[1]
- list_range = tar[2]
- count = 9
- else:
- r = tar[1]
- tl = tar[2]
-
- #======= Actual Amt ==================
- length_1 = (len(month_name) - start_month + 1) / 3; #this gives the total no. of times we need to iterate for quarter
- val = length_1 % 4;
- for i in range(length_1):
- value = 3*i + val;
-
- if group_by == 'Item Group':
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN t2.amount ELSE NULL END),'
-
- elif based_on != 'Sales Person':
- query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN net_total ELSE NULL END),'
-
- else:
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(value+1)+' AND '+cstr(value+3)+' THEN t1.net_total ELSE NULL END),'
-
- length_2 = (start_month - 1) / 3; #this gives the total no. of times we need to iterate for quarter (this is required only if fiscal year starts from april)
- for i in range(length_2):
- if group_by == 'Item Group':
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN t2.amount ELSE NULL END)';
-
- elif based_on != 'Sales Person':
- query += 'SUM(CASE WHEN MONTH('+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN net_total ELSE NULL END)';
-
- else:
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') BETWEEN '+cstr(3*i+1)+' AND '+cstr(3*i+3)+' THEN t1.net_total ELSE NULL END)';
-
- #=========== Main Query ===============
- if based_on == 'Territory' or based_on == 'Sales Partner':
-
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- #================common function
- i = appending_func(4,tl,i,actual,flt)
-
- else:
- actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and %s" % (query,under, based, r[col_idx['ID']],condition))
-# msgprint(actual)
-
- elif based_on == 'Sales Person':
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- i = appending_func(4,tl,i,actual,flt)
- else:
- actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
-# msgprint(actual)
-
- if tl == 1:
- r = appending_func(4,tl,r,actual,flt)
-# msgprint(r)
-
- #================ Monthly Report ===========================
- elif period == 'Monthly':
- tl = 0
- grp_target = []
- tar_det = sql("select item_group, target_amount, distribution_id from `tabTarget Detail` where parent = %s and parenttype = %s and fiscal_year = %s",(r[col_idx['ID']],based_on,fiscal_year))
-
- tar = get_target(tar_det,group_by,period,fiscal_year,12,r,get_budget_distribution,flt)
- if tar[0] == 1:
- grp = tar[1]
- list_range = tar[2]
- count = 25
- else:
- r = tar[1]
- tl = tar[2]
-
- #======= Actual Amt ==================
- # for loop is required twice coz fiscal year starts from April (this will also work if fiscal year starts in January)
- for i in range(start_month-1,len(month_name)):
- if group_by == 'Item Group':
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END),'
-
- elif based_on != 'Sales Person':
- query += 'SUM(CASE WHEN MONTH('+dt+') = '+cstr(i+1)+' THEN net_total ELSE NULL END),'
-
- else:
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t1.net_total ELSE NULL END),'
-
- for i in range(start_month-1):
- if i != (start_month-1):
- if group_by == 'Item Group':
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t2.amount ELSE NULL END)'
-
- elif based_on != 'Sales Person':
- query += 'SUM(CASE WHEN MONTH('+dt+') = '+cstr(i+1)+' THEN net_total ELSE NULL END)'
-
- else:
- query += 'SUM(CASE WHEN MONTH(t1.'+dt+') = '+cstr(i+1)+' THEN t1.net_total ELSE NULL END)'
-
- if i < (start_month -2):
- query += ','
-
- #=========== Main Query ===============
- if based_on == 'Territory' or based_on == 'Sales Partner':
-
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabItem` t3 where t2.parent = t1.name and t1.%s = '%s' and t3.name = t2.item_code and t3.item_group = '%s' and t1.docstatus = 1 and t1.docstatus != 2 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- #===============common function=====================
- i = appending_func(12,tl,i,actual,flt)
-
- else:
- actual = sql("select %s from `tab%s` where %s = '%s' and docstatus = 1 and %s" % (query,under, based, r[col_idx['ID']],condition))
-# msgprint(actual)
-
- elif based_on == 'Sales Person':
- if group_by =='Item Group':
- for i in grp:
- item_group = i[0]
- actual = sql("select %s from `tab%s` t1, `tab%s Detail` t2, `tabSales Team` t3, `tabItem` t4 where t2.parent = t1.name and t3.parent = t1.name and t3.%s = '%s' and t4.name = t2.item_code and t4.item_group = '%s' and t1.docstatus != 2 and t1.docstatus = 1 and %s"%(query,under,under_detail,based,r[col_idx['ID']],item_group,condition))
-# msgprint(actual)
- i = appending_func(12,tl,i,actual,flt)
- else:
- actual = sql("select %s from `tab%s` t1, `tabSales Team` t2 where t2.%s = '%s' and t2.parenttype='%s' and t1.docstatus != 2 and t2.parent = t1.name and %s"%(query,under,based,r[col_idx['ID']],under,condition))
-# msgprint(actual)
-
- if tl == 1:
- r = appending_func(12,tl,r,actual,flt)
-# msgprint(r)
-
-#-------------DISPLAY OF TARGET vs ACTUAL ON BASIS OF TOTAL TARGET / ITEM GROUP
-
- if group_by == 'Item Group':
- for col in range(len(colnames)-1): # this would make all first row blank. just for look
- r.append('')
-
- for des in range(list_range):
- if ap == 0:
- out.append(r)
- ap = 1
- t_row = ['' for i in range(len(colnames))]
-
- for v in range(count):
- t_row[col_idx[colnames[v+1]]] = grp[des][v]
-# msgprint(t_row)
- out.append(t_row)
-
- elif tot_target != 0 and period =='Annual':
- r.append(tot_target)
- r.append(actual)
- out.append(r)
- tot_target = 0
-
- elif tl == 1:
- out.append(r)
diff --git a/selling/search_criteria/variance_report/variance_report.sql b/selling/search_criteria/variance_report/variance_report.sql
deleted file mode 100644
index 89becb7..0000000
--- a/selling/search_criteria/variance_report/variance_report.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT DISTINCT t1.`name` FROM `tab%(based_on)s` t1, `tabTarget Detail` t2 WHERE t2.parent = t1.name and (t2.target_amount != 0 or t2.target_amount is not null)
\ No newline at end of file
diff --git a/selling/search_criteria/variance_report/variance_report.txt b/selling/search_criteria/variance_report/variance_report.txt
deleted file mode 100644
index e141191..0000000
--- a/selling/search_criteria/variance_report/variance_report.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "parent_doc_type": "Territory",
- "module": "Selling",
- "doctype": "Search Criteria",
- "sort_order": "DESC",
- "filters": "{'Territory\u0001State':'','Target Detail\u0001Fiscal Year':'2009-2010','Target Detail\u0001Based On':'Territory','Target Detail\u0001Company':'Alpha Company','Target Detail\u0001Period':'Quarterly','Target Detail\u0001Under':'Sales Order'}",
- "standard": "Yes",
- "doc_type": "Target Detail",
- "name": "__common__",
- "sort_by": "ID",
- "page_len": 50,
- "criteria_name": "Variance Report"
- },
- {
- "name": "variance_report",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/setup/doctype/backup_manager/backup_dropbox.py b/setup/doctype/backup_manager/backup_dropbox.py
index 2901638..054d2b2 100644
--- a/setup/doctype/backup_manager/backup_dropbox.py
+++ b/setup/doctype/backup_manager/backup_dropbox.py
@@ -7,12 +7,14 @@
# dropbox_access_key
# dropbox_access_secret
-
+from __future__ import unicode_literals
import os
import webnotes
-from webnotes.utils import get_request_site_address, get_base_path
+from webnotes.utils import get_request_site_address, get_base_path, cstr
from webnotes import _
+from backup_manager import ignore_list
+
@webnotes.whitelist()
def get_dropbox_authorize_url():
sess = get_dropbox_session()
@@ -58,7 +60,7 @@
webnotes.message_title = "Dropbox Approval"
webnotes.message = "<h3>%s</h3><p>Please close this window.</p>" % message
-
+
webnotes.conn.commit()
webnotes.response['type'] = 'page'
webnotes.response['page_name'] = 'message.html'
@@ -81,12 +83,19 @@
backup = new_backup()
filename = os.path.join(get_base_path(), "public", "backups",
os.path.basename(backup.backup_path_db))
- upload_file_to_dropbox(filename, "database", dropbox_client)
+ upload_file_to_dropbox(filename, "/database", dropbox_client)
+ webnotes.conn.close()
response = dropbox_client.metadata("/files")
+
# upload files to files folder
+ did_not_upload = []
+ error_log = []
path = os.path.join(get_base_path(), "public", "files")
for filename in os.listdir(path):
+ if filename in ignore_list:
+ continue
+
found = False
filepath = os.path.join(path, filename)
for file_metadata in response["contents"]:
@@ -94,7 +103,14 @@
found = True
break
if not found:
- upload_file_to_dropbox(filepath, "files", dropbox_client)
+ try:
+ upload_file_to_dropbox(filepath, "/files", dropbox_client)
+ except Exception, e:
+ did_not_upload.append(filename)
+ error_log.append(cstr(e))
+
+ webnotes.connect()
+ return did_not_upload, list(set(error_log))
def get_dropbox_session():
try:
@@ -113,21 +129,21 @@
def upload_file_to_dropbox(filename, folder, dropbox_client):
from dropbox import rest
size = os.stat(filename).st_size
- f = open(filename,'r')
- # if max packet size reached, use chunked uploader
- max_packet_size = 4194304
+ with open(filename, 'r') as f:
+ # if max packet size reached, use chunked uploader
+ max_packet_size = 4194304
- if size > max_packet_size:
- uploader = dropbox_client.get_chunked_uploader(f, size)
- while uploader.offset < size:
- try:
- uploader.upload_chunked()
- uploader.finish(folder + "/" + os.path.basename(filename), overwrite=True)
- except rest.ErrorResponse:
- pass
- else:
- dropbox_client.put_file(folder + "/" + os.path.basename(filename), f, overwrite=True)
+ if size > max_packet_size:
+ uploader = dropbox_client.get_chunked_uploader(f, size)
+ while uploader.offset < size:
+ try:
+ uploader.upload_chunked()
+ uploader.finish(folder + "/" + os.path.basename(filename), overwrite=True)
+ except rest.ErrorResponse:
+ pass
+ else:
+ dropbox_client.put_file(folder + "/" + os.path.basename(filename), f, overwrite=True)
if __name__=="__main__":
backup_to_dropbox()
\ No newline at end of file
diff --git a/setup/doctype/backup_manager/backup_googledrive.py b/setup/doctype/backup_manager/backup_googledrive.py
index 4b2a82c..533b37d 100644
--- a/setup/doctype/backup_manager/backup_googledrive.py
+++ b/setup/doctype/backup_manager/backup_googledrive.py
@@ -10,16 +10,22 @@
# gdrive_client_id
# gdrive_client_secret
+from __future__ import unicode_literals
import httplib2
import os
import mimetypes
import webnotes
import oauth2client.client
-from webnotes.utils import get_base_path
+from webnotes.utils import get_base_path, cstr
from webnotes import _, msgprint
from apiclient.discovery import build
from apiclient.http import MediaFileUpload
+# define log config for google drive api's log messages
+# basicConfig redirects log to stderr
+import logging
+logging.basicConfig()
+
@webnotes.whitelist()
def get_gdrive_authorize_url():
flow = get_gdrive_flow()
@@ -28,7 +34,6 @@
"authorize_url": authorize_url,
}
-@webnotes.whitelist()
def upload_files(name, mimetype, service, folder_id):
if not webnotes.conn:
webnotes.connect()
@@ -67,8 +72,14 @@
# upload files to database folder
upload_files(filename, 'application/x-gzip', drive_service,
webnotes.conn.get_value("Backup Manager", None, "database_folder_id"))
-
+
# upload files to files folder
+ did_not_upload = []
+ error_log = []
+
+ files_folder_id = webnotes.conn.get_value("Backup Manager", None, "files_folder_id")
+
+ webnotes.conn.close()
path = os.path.join(get_base_path(), "public", "files")
for filename in os.listdir(path):
found = False
@@ -78,19 +89,24 @@
if ext == 'gz' or ext == 'gzip':
mimetype = 'application/x-gzip'
else:
- mimetype = mimetypes.types_map["." + ext]
+ mimetype = mimetypes.types_map.get("." + ext) or "application/octet-stream"
+
#Compare Local File with Server File
- param = {}
- children = drive_service.children().list(
- folderId=webnotes.conn.get_value("Backup Manager", None, "files_folder_id"),
- **param).execute()
+ children = drive_service.children().list(folderId=files_folder_id).execute()
for child in children.get('items', []):
file = drive_service.files().get(fileId=child['id']).execute()
if filename == file['title'] and size == int(file['fileSize']):
found = True
break
if not found:
- upload_files(filepath, mimetype, drive_service, webnotes.conn.get_value("Backup Manager", None, "files_folder_id"))
+ try:
+ upload_files(filepath, mimetype, drive_service, files_folder_id)
+ except Exception, e:
+ did_not_upload.append(filename)
+ error_log.append(cstr(e))
+
+ webnotes.connect()
+ return did_not_upload, list(set(error_log))
def get_gdrive_flow():
from oauth2client.client import OAuth2WebServerFlow
diff --git a/setup/doctype/backup_manager/backup_manager.js b/setup/doctype/backup_manager/backup_manager.js
index 28315c5..c78be3a 100644
--- a/setup/doctype/backup_manager/backup_manager.js
+++ b/setup/doctype/backup_manager/backup_manager.js
@@ -1,65 +1,90 @@
-cur_frm.cscript.refresh = function(doc) {
- cur_frm.disable_save();
-}
-
-//dropbox
-cur_frm.cscript.allow_dropbox_access = function(doc) {
- if (doc.send_notifications_to == '') {
- msgprint("Please enter email address.")
- }
- else {
- wn.call({
- method: "setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
- callback: function(r) {
- if(!r.exc) {
- cur_frm.set_value("dropbox_access_secret", r.message.secret);
- cur_frm.set_value("dropbox_access_key", r.message.key);
- cur_frm.save(null, function() {
- window.open(r.message.url);
- });
+$.extend(cur_frm.cscript, {
+ refresh: function() {
+ cur_frm.disable_save();
+
+ if(!(cint(cur_frm.doc.dropbox_access_allowed) ||
+ cint(cur_frm.doc.gdrive_access_allowed))) {
+ cur_frm.set_intro(wn._("You can start by selecting backup frequency and \
+ granting access for sync"));
+ } else {
+ var services = {
+ "dropbox": wn._("Dropbox"),
+ "gdrive": wn._("Google Drive")
+ }
+ var active_services = [];
+
+ $.each(services, function(service, label) {
+ var access_allowed = cint(cur_frm.doc[service + "_access_allowed"]);
+ var frequency = cur_frm.doc["upload_backups_to_" + service];
+ if(access_allowed && frequency && frequency !== "Never") {
+ active_services.push(label + " [" + frequency + "]");
}
+ });
+
+ if(active_services.length > 0) {
+ cur_frm.set_intro(wn._("Backups will be uploaded to") + ": " +
+ wn.utils.comma_and(active_services));
+ } else {
+ cur_frm.set_intro("");
}
- })
- }
-}
-
-cur_frm.cscript.backup_right_now = function(doc) {
- msgprint("Backing up and uploading. This may take a few minutes.")
- wn.call({
- method: "setup.doctype.backup_manager.backup_manager.take_backups_dropbox",
- callback: function(r) {
- msgprint("Backups taken. Please check your email for the response.")
}
- })
-}
-//gdrive
-cur_frm.cscript.allow_gdrive_access = function(doc) {
- if (doc.send_notifications_to == '') {
- msgprint("Please enter email address.")
- }
- else {
+
+ },
+
+ validate_send_notifications_to: function() {
+ if(!cur_frm.doc.send_notifications_to) {
+ msgprint(wn._("Please specify") + ": " +
+ wn._(wn.meta.get_label(cur_frm.doctype, "send_notifications_to")));
+ return false;
+ }
+
+ return true;
+ },
+
+ allow_dropbox_access: function() {
+ if(cur_frm.cscript.validate_send_notifications_to()) {
+ wn.call({
+ method: "setup.doctype.backup_manager.backup_dropbox.get_dropbox_authorize_url",
+ callback: function(r) {
+ if(!r.exc) {
+ cur_frm.set_value("dropbox_access_secret", r.message.secret);
+ cur_frm.set_value("dropbox_access_key", r.message.key);
+ cur_frm.save(null, function() {
+ window.open(r.message.url);
+ });
+ }
+ }
+ });
+ }
+ },
+
+ allow_gdrive_access: function() {
+ if(cur_frm.cscript.validate_send_notifications_to()) {
+ wn.call({
+ method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
+ callback: function(r) {
+ if(!r.exc) {
+ window.open(r.message.authorize_url);
+ }
+ }
+ });
+ }
+ },
+
+ validate_gdrive: function() {
wn.call({
- method: "setup.doctype.backup_manager.backup_googledrive.get_gdrive_authorize_url",
- callback: function(r) {
- window.open(r.message.authorize_url);
- }
- })
- }
-}
-
-cur_frm.cscript.validate_gdrive = function(doc) {
- wn.call({
- method: "setup.doctype.backup_manager.backup_manager.gdrive_callback",
- args: {
- verification_code: doc.verification_code
- },
- });
-}
-
-cur_frm.cscript.upload_backups_to_dropbox = function(doc) {
- cur_frm.save()
-}
-
-cur_frm.cscript.upload_backups_to_gdrive = function(doc) {
- cur_frm.save()
-}
+ method: "setup.doctype.backup_manager.backup_googledrive.gdrive_callback",
+ args: {
+ verification_code: cur_frm.doc.verification_code
+ },
+ });
+ },
+
+ upload_backups_to_dropbox: function() {
+ cur_frm.save();
+ },
+
+ upload_backups_to_gdrive: function() {
+ cur_frm.save();
+ },
+});
\ No newline at end of file
diff --git a/setup/doctype/backup_manager/backup_manager.py b/setup/doctype/backup_manager/backup_manager.py
index 4fb6ab3..c91cf11 100644
--- a/setup/doctype/backup_manager/backup_manager.py
+++ b/setup/doctype/backup_manager/backup_manager.py
@@ -4,6 +4,8 @@
import webnotes
from webnotes import _
+ignore_list = []
+
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
@@ -18,27 +20,39 @@
if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_dropbox")==freq:
take_backups_dropbox()
- if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
- take_backups_gdrive()
+ # if webnotes.conn.get_value("Backup Manager", None, "upload_backups_to_gdrive")==freq:
+ # take_backups_gdrive()
@webnotes.whitelist()
def take_backups_dropbox():
+ did_not_upload, error_log = [], []
try:
from setup.doctype.backup_manager.backup_dropbox import backup_to_dropbox
- backup_to_dropbox()
+ did_not_upload, error_log = backup_to_dropbox()
+ if did_not_upload: raise Exception
+
send_email(True, "Dropbox")
- except Exception, e:
- send_email(False, "Dropbox", e)
+ except Exception:
+ file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
+ error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback())
+ webnotes.errprint(error_message)
+ send_email(False, "Dropbox", error_message)
#backup to gdrive
@webnotes.whitelist()
def take_backups_gdrive():
+ did_not_upload, error_log = [], []
try:
from setup.doctype.backup_manager.backup_googledrive import backup_to_gdrive
- backup_to_gdrive()
+ did_not_upload, error_log = backup_to_gdrive()
+ if did_not_upload: raise Exception
+
send_email(True, "Google Drive")
- except Exception, e:
- send_email(False, "Google Drive", e)
+ except Exception:
+ file_and_error = [" - ".join(f) for f in zip(did_not_upload, error_log)]
+ error_message = ("\n".join(file_and_error) + "\n" + webnotes.getTraceback())
+ webnotes.errprint(error_message)
+ send_email(False, "Google Drive", error_message)
def send_email(success, service_name, error_status=None):
if success:
@@ -58,4 +72,4 @@
# email system managers
from webnotes.utils.email_lib import sendmail
sendmail(webnotes.conn.get_value("Backup Manager", None, "send_notifications_to").split(","),
- subject=subject, msg=message)
\ No newline at end of file
+ subject=subject, msg=message)
diff --git a/setup/doctype/backup_manager/backup_manager.txt b/setup/doctype/backup_manager/backup_manager.txt
index 9a43f34..2d6f191 100644
--- a/setup/doctype/backup_manager/backup_manager.txt
+++ b/setup/doctype/backup_manager/backup_manager.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-15 11:06:59",
+ "creation": "2013-04-30 12:58:38",
"docstatus": 0,
- "modified": "2013-03-15 17:27:33",
+ "modified": "2013-05-02 11:42:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -109,6 +109,7 @@
"doctype": "DocField",
"fieldname": "sync_with_gdrive",
"fieldtype": "Section Break",
+ "hidden": 1,
"label": "Sync with Google Drive"
},
{
diff --git a/setup/doctype/company/company.py b/setup/doctype/company/company.py
index 78be538..2564503 100644
--- a/setup/doctype/company/company.py
+++ b/setup/doctype/company/company.py
@@ -16,6 +16,7 @@
from __future__ import unicode_literals
import webnotes
+from webnotes import _, msgprint
from webnotes.utils import cstr
from webnotes.model.doc import Document
@@ -221,7 +222,6 @@
# Create default cost center
# ---------------------------------------------------
def create_default_cost_center(self):
- from accounts.utils import add_cc
cc_list = [
{
'cost_center_name':'Root',
@@ -243,7 +243,10 @@
}
]
for cc in cc_list:
- add_cc(cc)
+ cc.update({"doctype": "Cost Center"})
+ cc_bean = webnotes.bean(cc)
+ cc_bean.ignore_permissions = True
+ cc_bean.insert()
webnotes.conn.set_value("Company", self.doc.name, "cost_center",
"Default CC Ledger - " + self.doc.abbr)
@@ -287,7 +290,10 @@
where doctype='Global Defaults' and field='default_company'
and value=%s""", self.doc.name)
- def on_rename(self,newdn,olddn):
+ def on_rename(self,newdn,olddn, merge=False):
+ if merge:
+ msgprint(_("Sorry. Companies cannot be merged"), raise_exception=True)
+
webnotes.conn.sql("""update `tabCompany` set company_name=%s
where name=%s""", (newdn, olddn))
diff --git a/setup/doctype/global_defaults/global_defaults.py b/setup/doctype/global_defaults/global_defaults.py
index 8275513..dc7f6b4 100644
--- a/setup/doctype/global_defaults/global_defaults.py
+++ b/setup/doctype/global_defaults/global_defaults.py
@@ -21,6 +21,7 @@
from webnotes.utils import cint
keydict = {
+ # "key in defaults": "key in Global Defaults"
"print_style": "print_style",
"fiscal_year": "current_fiscal_year",
'company': 'default_company',
@@ -31,6 +32,7 @@
'item_group': 'default_item_group',
'customer_group': 'default_customer_group',
'cust_master_name': 'cust_master_name',
+ "item_naming_by": "item_naming_by",
'supplier_type': 'default_supplier_type',
'supp_master_name': 'supp_master_name',
'territory': 'default_territory',
diff --git a/setup/doctype/global_defaults/global_defaults.txt b/setup/doctype/global_defaults/global_defaults.txt
index 7f81618..175ca94 100644
--- a/setup/doctype/global_defaults/global_defaults.txt
+++ b/setup/doctype/global_defaults/global_defaults.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-25 11:08:14",
+ "creation": "2013-05-02 17:53:24",
"docstatus": 0,
- "modified": "2013-03-28 15:41:03",
+ "modified": "2013-05-22 15:57:26",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -169,6 +169,14 @@
},
{
"doctype": "DocField",
+ "fieldname": "item_naming_by",
+ "fieldtype": "Select",
+ "label": "Item Naming By",
+ "options": "Item Code\nNaming Series",
+ "read_only": 0
+ },
+ {
+ "doctype": "DocField",
"fieldname": "default_item_group",
"fieldtype": "Link",
"label": "Default Item Group",
@@ -209,20 +217,27 @@
},
{
"doctype": "DocField",
- "fieldname": "default_warehouse_type",
- "fieldtype": "Link",
- "label": "Default Warehouse Type",
- "options": "Warehouse Type",
- "read_only": 0
- },
- {
- "doctype": "DocField",
"fieldname": "auto_indent",
"fieldtype": "Check",
"label": "Raise Material Request when stock reaches re-order level",
"read_only": 0
},
{
+ "doctype": "DocField",
+ "fieldname": "reorder_email_notify",
+ "fieldtype": "Check",
+ "label": "Notify by Email on creation of automatic Material Request"
+ },
+ {
+ "default": "Hourly",
+ "doctype": "DocField",
+ "fieldname": "reorder_level_checking_frequency",
+ "fieldtype": "Select",
+ "hidden": 1,
+ "label": "Reorder Level Checking Frequency",
+ "options": "Hourly\nDaily"
+ },
+ {
"default": "1",
"doctype": "DocField",
"fieldname": "column_break3",
@@ -231,6 +246,14 @@
"width": "50%"
},
{
+ "doctype": "DocField",
+ "fieldname": "default_warehouse_type",
+ "fieldtype": "Link",
+ "label": "Default Warehouse Type",
+ "options": "Warehouse Type",
+ "read_only": 0
+ },
+ {
"description": "Percentage you are allowed to receive or deliver more against the quantity ordered. <p>For example: If you have ordered 100 units. and your Allowance is 10% then you are allowed to receive 110 units</p>",
"doctype": "DocField",
"fieldname": "tolerance",
@@ -269,7 +292,8 @@
"fieldtype": "Check",
"label": "Auto Inventory Accounting",
"no_copy": 0,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"description": "Accounting entry frozen up to this date, nobody can do / modify entry except authorized person",
diff --git a/setup/doctype/item_group/item_group.py b/setup/doctype/item_group/item_group.py
index 1445f39..1ff3d4a 100644
--- a/setup/doctype/item_group/item_group.py
+++ b/setup/doctype/item_group/item_group.py
@@ -81,3 +81,4 @@
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
get_slideshow(self)
+
\ No newline at end of file
diff --git a/setup/doctype/item_group/item_group.txt b/setup/doctype/item_group/item_group.txt
index a8da12c..568cf9d 100644
--- a/setup/doctype/item_group/item_group.txt
+++ b/setup/doctype/item_group/item_group.txt
@@ -174,15 +174,6 @@
"search_index": 0
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 0,
"cancel": 0,
"create": 0,
diff --git a/setup/doctype/naming_series/naming_series.py b/setup/doctype/naming_series/naming_series.py
index 5991181..eb293f2 100644
--- a/setup/doctype/naming_series/naming_series.py
+++ b/setup/doctype/naming_series/naming_series.py
@@ -29,12 +29,12 @@
def get_transactions(self, arg=None):
return {
- "transactions": "\n".join([''] + [i[0] for i in
- sql("""select `tabDocField`.`parent`
- FROM `tabDocField`, `tabDocType`
- WHERE `tabDocField`.`fieldname` = 'naming_series'
- and `tabDocType`.name=`tabDocField`.parent
- order by `tabDocField`.parent""")]),
+ "transactions": "\n".join([''] + sorted(list(set(
+ webnotes.conn.sql_list("""select parent
+ from `tabDocField` where fieldname='naming_series'""")
+ + webnotes.conn.sql_list("""select dt from `tabCustom Field`
+ where fieldname='naming_series'""")
+ )))),
"prefixes": "\n".join([''] + [i[0] for i in
sql("""select name from tabSeries""")])
}
@@ -89,7 +89,6 @@
'property': prop,
'value': prop_dict[prop],
'property_type': 'Select',
- 'select_doctype': doctype
})
ps.save(1)
@@ -101,11 +100,18 @@
from core.doctype.doctype.doctype import DocType
dt = DocType()
- parent = sql("""select dt.name from `tabDocField` df, `tabDocType` dt
- where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""",
- self.doc.select_doc_for_series)
- sr = ([webnotes.model.doctype.get_property(p[0], 'options', 'naming_series'), p[0]]
- for p in parent)
+ parent = list(set(
+ webnotes.conn.sql_list("""select dt.name
+ from `tabDocField` df, `tabDocType` dt
+ where dt.name = df.parent and df.fieldname='naming_series' and dt.name != %s""",
+ self.doc.select_doc_for_series)
+ + webnotes.conn.sql_list("""select dt.name
+ from `tabCustom Field` df, `tabDocType` dt
+ where dt.name = df.dt and df.fieldname='naming_series' and dt.name != %s""",
+ self.doc.select_doc_for_series)
+ ))
+ sr = [[webnotes.model.doctype.get_property(p, 'options', 'naming_series'), p]
+ for p in parent]
options = self.scrub_options_list(self.doc.set_options.split("\n"))
for series in options:
dt.validate_series(series, self.doc.select_doc_for_series)
@@ -117,9 +123,9 @@
def validate_series_name(self, n):
import re
- if not re.match('[a-zA-Z0-9]+(([-/][a-zA-Z0-9])?[-/][a-zA-Z0-9]*)*',n):
- msgprint('Special Characters except "-" and "/" not allowed in naming series')
- raise Exception
+ if not re.match("^[a-zA-Z0-9-/.#]*$", n):
+ msgprint('Special Characters except "-" and "/" not allowed in naming series',
+ raise_exception=True)
def get_options(self, arg=''):
sr = webnotes.model.doctype.get_property(self.doc.select_doc_for_series,
diff --git a/setup/doctype/naming_series/naming_series.txt b/setup/doctype/naming_series/naming_series.txt
index 3de9e5c..0dab9e9 100644
--- a/setup/doctype/naming_series/naming_series.txt
+++ b/setup/doctype/naming_series/naming_series.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:23",
+ "creation": "2013-01-25 11:35:08",
"docstatus": 0,
- "modified": "2013-01-22 14:56:34",
+ "modified": "2013-05-02 15:34:41",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -25,8 +25,6 @@
"permlevel": 0
},
{
- "amend": 0,
- "cancel": 0,
"create": 1,
"doctype": "DocPerm",
"name": "__common__",
@@ -62,7 +60,7 @@
"fieldname": "help_html",
"fieldtype": "HTML",
"label": "Help HTML",
- "options": "<div class=\"help-box\">\nEdit list of Series in the box below. Each Series Prefix on a new line.<br><br>\nAllowed special characters are \"/\" and \"-\"<br>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\n</div>"
+ "options": "<div class=\"well\">\nEdit list of Series in the box below. Rules:\n<ul>\n<li>Each Series Prefix on a new line.</li>\n<li>Allowed special characters are \"/\" and \"-\"</li>\n<li>Optionally, set the number of digits in the series using dot (.) followed by hashes (#). For example, \".####\" means that the series will have four digits. Default is five digits.</li>\n</ul>\nExamples:<br>\nINV-<br>\nINV-10-<br>\nINVK-<br>\nINV-.####<br>\n</div>"
},
{
"doctype": "DocField",
diff --git a/setup/doctype/price_list/price_list.js b/setup/doctype/price_list/price_list.js
index 75d3d0f..b68627f 100644
--- a/setup/doctype/price_list/price_list.js
+++ b/setup/doctype/price_list/price_list.js
@@ -14,10 +14,46 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
+cur_frm.cscript.onload = function() {
+ cur_frm.cscript.show_item_prices();
+}
+
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
cur_frm.set_intro("");
if(doc.__islocal) {
cur_frm.set_intro("Save this list to begin.");
return;
+ } else {
+ cur_frm.cscript.show_item_prices();
}
}
+
+cur_frm.cscript.show_item_prices = function() {
+ var item_price = wn.model.get("Item Price", {price_list_name: cur_frm.doc.name});
+
+ var show = item_price && item_price.length;
+
+ cur_frm.toggle_display("item_prices_section", show);
+ $(cur_frm.fields_dict.item_prices.wrapper).empty();
+ if (!show) return;
+
+ var out = '<table class="table table-striped table-bordered">\
+ <thead><tr>\
+ <th>' + wn._("Item Code") + '</th>\
+ <th>' + wn._("Price") + '</th>\
+ <th>' + wn._("Valid For Selling") + '</th>\
+ <th>' + wn._("Valid For Buying") + '</th>\
+ </tr></thead>\
+ <tbody>'
+ + $.map(item_price.sort(function(a, b) { return a.parent.localeCompare(b.parent); }), function(d) {
+ return '<tr>'
+ + '<td>' + d.parent + '</td>'
+ + '<td style="text-align: right;">' + format_currency(d.ref_rate, d.ref_currency) + '</td>'
+ + '<td>' + (cint(d.selling) ? '<i class="icon-check"></i>' : "") + '</td>'
+ + '<td>' + (cint(d.buying) ? '<i class="icon-check"></i>' : "") + '</td>'
+ + '</tr>'
+ }).join("\n")
+ + '</tbody>\
+ </table>';
+ $(out).appendTo($(cur_frm.fields_dict.item_prices.wrapper));
+}
diff --git a/setup/doctype/price_list/price_list.py b/setup/doctype/price_list/price_list.py
index a88309b..5c03a3a 100644
--- a/setup/doctype/price_list/price_list.py
+++ b/setup/doctype/price_list/price_list.py
@@ -16,73 +16,23 @@
from __future__ import unicode_literals
import webnotes
-
-from webnotes.model.doc import Document
-from webnotes import msgprint
+from webnotes import msgprint, _
+from webnotes.utils import cint
class DocType:
def __init__(self, d, dl):
self.doc, self.doclist = d, dl
- self.cl = []
-
- # validate currency
- def is_currency_valid(self, currency):
- if currency in self.cl:
- return 1
-
- if webnotes.conn.sql("select name from tabCurrency where name=%s", currency):
- self.cl.append(currency)
- return 1
- else:
- return 0
-
- def download_template(self, arg=None):
- """download 3 column template with all Items"""
- default_currency = webnotes.conn.get_default('currency')
- item_list = webnotes.conn.sql("""select name from tabItem where
- (ifnull(is_sales_item,'')='Yes' or ifnull(is_service_item,'')='Yes')""")
- data = [self.get_price(i[0], default_currency) for i in item_list]
- return [['Item', 'Rate', 'Currency']] + data
-
- def get_price(self, item, default_currency):
- rate = webnotes.conn.sql("""select ref_rate, ref_currency from `tabItem Price`
- where parent=%s and price_list_name=%s""", (item, self.doc.name))
- return [item, rate and rate[0][0] or 0, rate and rate[0][1] or default_currency]
-
- # update prices in Price List
- def update_prices(self):
- from webnotes.utils.datautils import read_csv_content_from_attached_file
- data = read_csv_content_from_attached_file(self.doc)
- webnotes.conn.auto_commit_on_many_writes = 1
-
- updated = 0
-
- for line in data:
- if line and len(line)==3 and line[0]!='Item':
- # if item exists
- if webnotes.conn.sql("select name from tabItem where name=%s", line[0]):
- if self.is_currency_valid(line[2]):
- # if price exists
- ref_ret_detail = webnotes.conn.sql("select name from `tabItem Price` where parent=%s and price_list_name=%s and ref_currency=%s", \
- (line[0], self.doc.name, line[2]))
- if ref_ret_detail:
- webnotes.conn.sql("update `tabItem Price` set ref_rate=%s where name=%s", (line[1], ref_ret_detail[0][0]))
- else:
- d = Document('Item Price')
- d.parent = line[0]
- d.parentfield = 'ref_rate_details'
- d.parenttype = 'Item'
- d.price_list_name = self.doc.name
- d.ref_rate = line[1]
- d.ref_currency = line[2]
- d.save(1)
- updated += 1
- else:
- msgprint("[Ignored] Unknown currency '%s' for Item '%s'" % (line[2], line[0]))
- else:
- msgprint("[Ignored] Did not find Item '%s'" % line[1])
-
- msgprint("<b>%s</b> items updated" % updated)
- webnotes.conn.auto_commit_on_many_writes = 0
\ No newline at end of file
+ def onload(self):
+ self.doclist.extend(webnotes.conn.sql("""select * from `tabItem Price`
+ where price_list_name=%s""", self.doc.name, as_dict=True, update={"doctype": "Item Price"}))
+
+ def validate(self):
+ if not (cint(self.doc.valid_for_all_countries) or len(self.doclist.get({"parentfield": "valid_for_countries"}))):
+ msgprint(_("""Please check "Valid For All Countries" or \
+ enter atlease one row in the "Countries" table."""), raise_exception=True)
+
+ def on_trash(self):
+ webnotes.conn.sql("""delete from `tabItem Price` where price_list_name = %s""",
+ self.doc.name)
\ No newline at end of file
diff --git a/setup/doctype/price_list/price_list.txt b/setup/doctype/price_list/price_list.txt
index 7e48b78..781eae5 100644
--- a/setup/doctype/price_list/price_list.txt
+++ b/setup/doctype/price_list/price_list.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:23",
+ "creation": "2013-01-25 11:35:09",
"docstatus": 0,
- "modified": "2013-01-22 14:56:41",
+ "modified": "2013-05-02 14:45:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -53,19 +53,54 @@
"reqd": 1
},
{
- "depends_on": "price_list_name",
+ "doctype": "DocField",
+ "fieldname": "currency",
+ "fieldtype": "Link",
+ "label": "Currency",
+ "options": "Currency",
+ "reqd": 1
+ },
+ {
+ "default": "1",
+ "doctype": "DocField",
+ "fieldname": "valid_for_all_countries",
+ "fieldtype": "Check",
+ "label": "Valid for all countries"
+ },
+ {
+ "description": "A list of Countries, for which, this Price List is valid",
+ "doctype": "DocField",
+ "fieldname": "valid_for_countries",
+ "fieldtype": "Table",
+ "label": "Valid for the following countries",
+ "options": "Price List Country"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "item_prices_section",
+ "fieldtype": "Section Break",
+ "label": "Item Prices"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "item_prices",
+ "fieldtype": "HTML",
+ "label": "Item Prices"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
+ "doctype": "DocField",
+ "fieldname": "section_break_1",
+ "fieldtype": "Section Break",
+ "label": "How to upload"
+ },
+ {
+ "depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "how_to_upload",
"fieldtype": "HTML",
"label": "How to upload",
- "options": "<div class=\"help\">Use the <a href=\"#data-import-tool\">Data Import Tool</a> to upload, update Item Prices in bulk:\n<ol> \n<li>Go to Data Import Tool.\n<li>Select \"Item\"\n<li>Check on \"With Data\"\n<li>Download \"Item Price\" from Child Tables.\n<li>Update the prices required and add new rows if required.\n<li>Check on \"Overwrite\"\n<li>Upload the modified sheet.\n</div>\n"
- },
- {
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List"
+ "options": "<div class=\"well\">Use the <a href=\"#data-import-tool\">Data Import Tool</a> to upload, update Item Prices in bulk:\n<ol> \n<li>Go to Data Import Tool.\n<li>Select \"Item\"\n<li>Check on \"With Data\"\n<li>Download \"Item Price\" from Child Tables.\n<li>Update the prices required and add new rows if required.\n<li>Check on \"Overwrite\"\n<li>Upload the modified sheet.\n</div>\n"
},
{
"cancel": 0,
diff --git a/setup/doctype/price_list/test_price_list.py b/setup/doctype/price_list/test_price_list.py
index 53b86a3..fe87821 100644
--- a/setup/doctype/price_list/test_price_list.py
+++ b/setup/doctype/price_list/test_price_list.py
@@ -1,6 +1,8 @@
test_records = [
[{
"doctype": "Price List",
- "price_list_name": "_Test Price List"
+ "price_list_name": "_Test Price List",
+ "currency": "INR",
+ "valid_for_all_countries": 1
}]
]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/setup/doctype/price_list_country/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to setup/doctype/price_list_country/__init__.py
diff --git a/setup/doctype/price_list_country/price_list_country.py b/setup/doctype/price_list_country/price_list_country.py
new file mode 100644
index 0000000..928aa9f
--- /dev/null
+++ b/setup/doctype/price_list_country/price_list_country.py
@@ -0,0 +1,8 @@
+# For license information, please see license.txt
+
+from __future__ import unicode_literals
+import webnotes
+
+class DocType:
+ def __init__(self, d, dl):
+ self.doc, self.doclist = d, dl
\ No newline at end of file
diff --git a/setup/doctype/price_list_country/price_list_country.txt b/setup/doctype/price_list_country/price_list_country.txt
new file mode 100644
index 0000000..640b0a8
--- /dev/null
+++ b/setup/doctype/price_list_country/price_list_country.txt
@@ -0,0 +1,36 @@
+[
+ {
+ "creation": "2013-04-29 18:24:32",
+ "docstatus": 0,
+ "modified": "2013-04-29 18:24:32",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "autoname": "PLCNTRY-.#####",
+ "doctype": "DocType",
+ "istable": 1,
+ "module": "Setup",
+ "name": "__common__"
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "country",
+ "fieldtype": "Link",
+ "label": "Country",
+ "name": "__common__",
+ "options": "Country",
+ "parent": "Price List Country",
+ "parentfield": "fields",
+ "parenttype": "DocType",
+ "permlevel": 0,
+ "reqd": 1
+ },
+ {
+ "doctype": "DocType",
+ "name": "Price List Country"
+ },
+ {
+ "doctype": "DocField"
+ }
+]
\ No newline at end of file
diff --git a/setup/doctype/setup_control/setup_control.py b/setup/doctype/setup_control/setup_control.py
index 5bfe4a7..bf8b87f 100644
--- a/setup/doctype/setup_control/setup_control.py
+++ b/setup/doctype/setup_control/setup_control.py
@@ -97,7 +97,7 @@
self.create_email_digest()
webnotes.clear_cache()
- msgprint("Company setup is complete. Please refresh the page before continuing.")
+ msgprint("Company setup is complete. This page will be refreshed in a moment.")
import webnotes.utils
user_fullname = (args.get('first_name') or '') + (args.get('last_name')
diff --git a/setup/page/setup/setup.js b/setup/page/setup/setup.js
index 4ab7578..788021a 100644
--- a/setup/page/setup/setup.js
+++ b/setup/page/setup/setup.js
@@ -73,7 +73,7 @@
{
"route":"Form/Naming Series/Naming Series",
doctype: "Naming Series",
- label: wn._("Manage numbering series"),
+ label: wn._("Manage Numbering Series"),
"description":wn._("Set multiple numbering series for transactions")
},
{
@@ -82,6 +82,12 @@
label: wn._("Rename Tool"),
"description":wn._("Rename multiple items in one go")
},
+ {
+ "route":"List/File Data",
+ doctype: "File Data",
+ label: wn._("File Manager"),
+ "description":wn._("List, delete uploaded files.")
+ },
]
},
{
@@ -187,21 +193,8 @@
]
},
{
- title: wn._("Backups"),
- icon: "icon-cloud-upload",
- right: true,
- items: [
- {
- "route":"Form/Backup Manager",
- doctype:"Backup Manager",
- label: wn._("Backup Manager"),
- "description":wn._("Sync backups with remote tools like Dropbox etc.")
- },
- ]
- },
- {
- title: wn._("Update Manager"),
- icon: "icon-magnet",
+ title: wn._("Administration"),
+ icon: "icon-rocket",
right: true,
items: [
{
@@ -209,6 +202,18 @@
label: wn._("Update This Application"),
"description":wn._("Apply latest updates and patches to this app")
},
+ {
+ "route":"Form/Backup Manager",
+ doctype:"Backup Manager",
+ label: wn._("Backup Manager"),
+ "description":wn._("Sync backups with remote tools like Dropbox etc.")
+ },
+ {
+ "route":"List/Scheduler Log",
+ doctype:"Scheduler Log",
+ label: wn._("Scheduler Error Log"),
+ "description":wn._("Get a list of errors encountered by the Scheduler")
+ },
]
},
]
diff --git a/startup/install.py b/startup/install.py
index 5ddbf09..204df87 100644
--- a/startup/install.py
+++ b/startup/install.py
@@ -139,8 +139,10 @@
{'doctype': 'Supplier Type', 'name': 'Default Supplier Type', 'supplier_type': 'Default Supplier Type'},
# Price List
- {'doctype': 'Price List', 'name': 'Default Price List', 'price_list_name': 'Default Price List'},
- {'doctype': 'Price List', 'name': 'Standard', 'price_list_name': 'Standard'},
+ {'doctype': 'Price List', 'name': 'Default Price List',
+ 'price_list_name': 'Default Price List', "valid_for_all_countries": 1},
+ {'doctype': 'Price List', 'name': 'Standard', 'price_list_name': 'Standard',
+ "valid_for_all_countries": 1},
# warehouse type
{'doctype': 'Warehouse Type', 'name': 'Default Warehouse Type', 'warehouse_type': 'Default Warehouse Type'},
@@ -176,6 +178,6 @@
]
for r in records:
- doc = webnotes.doc(r)
- doc.insert()
-
\ No newline at end of file
+ if not webnotes.conn.exists(r['doctype'], r['name']):
+ bean = webnotes.bean(r)
+ bean.insert()
\ No newline at end of file
diff --git a/startup/report_data_map.py b/startup/report_data_map.py
index 501db4f..c3a5dd2 100644
--- a/startup/report_data_map.py
+++ b/startup/report_data_map.py
@@ -47,8 +47,8 @@
"order_by": "lft"
},
"GL Entry": {
- "columns": ["name", "account", "posting_date", "cost_center", "debit", "credit", "is_opening",
- "company", "voucher_type", "voucher_no", "remarks"],
+ "columns": ["name", "account", "posting_date", "cost_center", "debit", "credit",
+ "is_opening", "company", "voucher_type", "voucher_no", "remarks"],
"conditions": ["ifnull(is_cancelled, 'No')='No'"],
"order_by": "posting_date, account",
"links": {
@@ -72,7 +72,7 @@
},
"Item Group": {
"columns": ["name", "parent_item_group"],
- "conditions": ["docstatus < 2"],
+ # "conditions": ["docstatus < 2"],
"order_by": "lft"
},
"Brand": {
diff --git a/startup/schedule_handlers.py b/startup/schedule_handlers.py
index 0799817..99cc05b 100644
--- a/startup/schedule_handlers.py
+++ b/startup/schedule_handlers.py
@@ -53,11 +53,15 @@
# daily backup
from setup.doctype.backup_manager.backup_manager import take_backups_daily
- take_backups_daily()
+ run_fn(take_backups_daily)
+
+ # check reorder level
+ from stock.utils import reorder_item
+ run_fn(reorder_item)
def execute_weekly():
from setup.doctype.backup_manager.backup_manager import take_backups_weekly
- take_backups_weekly()
+ run_fn(take_backups_weekly)
def execute_monthly():
pass
diff --git a/startup/website.py b/startup/website.py
index 295e5bb..5e6c311 100644
--- a/startup/website.py
+++ b/startup/website.py
@@ -1,4 +1,5 @@
import webnotes, conf, os
+from webnotes.utils import cint, cstr, encode
def get_templates_path():
return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates")
@@ -61,15 +62,17 @@
settings = webnotes.doc("Website Settings", "Website Settings")
for k in ["banner_html", "brand_html", "copyright", "address", "twitter_share_via",
- "favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]:
+ "favicon", "facebook_share", "google_plus_one", "twitter_share", "linked_in_share",
+ "disable_signup"]:
if k in settings.fields:
args[k] = settings.fields.get(k)
- for k in ["facebook_share", "google_plus_one", "twitter_share", "linked_in_share"]:
- args[k] = int(args.get(k) or 0)
+ for k in ["facebook_share", "google_plus_one", "twitter_share", "linked_in_share",
+ "disable_signup"]:
+ args[k] = cint(args.get(k) or 0)
args.url = quote(str(get_request_site_address(full_address=True)), str(""))
- args.encoded_title = quote(str(args.title or ""), str(""))
+ args.encoded_title = quote(encode(args.title or ""), str(""))
return args
\ No newline at end of file
diff --git a/stock/doctype/batch/batch.txt b/stock/doctype/batch/batch.txt
index 6a6de8b..c6ed3c3 100644
--- a/stock/doctype/batch/batch.txt
+++ b/stock/doctype/batch/batch.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-01 08:21:54",
+ "creation": "2013-03-05 14:50:38",
"docstatus": 0,
- "modified": "2013-03-01 08:22:16",
+ "modified": "2013-05-01 15:49:47",
"modified_by": "Administrator",
"owner": "harshada@webnotestech.com"
},
@@ -99,24 +99,6 @@
"oldfieldtype": "Date"
},
{
- "doctype": "DocField",
- "fieldname": "trash_reason",
- "fieldtype": "Small Text",
- "label": "Trash Reason",
- "oldfieldname": "trash_reason",
- "oldfieldtype": "Small Text",
- "read_only": 1
- },
- {
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/stock/doctype/bin/bin.py b/stock/doctype/bin/bin.py
index be34312..61baafa 100644
--- a/stock/doctype/bin/bin.py
+++ b/stock/doctype/bin/bin.py
@@ -77,10 +77,6 @@
self.doc.save()
- if (flt(args.get("actual_qty")) < 0 or flt(args.get("reserved_qty")) > 0) \
- and args.get("is_cancelled") == 'No' and args.get("is_amended")=='No':
- self.reorder_item(args.get("voucher_type"), args.get("voucher_no"))
-
def get_first_sle(self):
sle = sql("""
select * from `tabStock Ledger Entry`
@@ -90,82 +86,4 @@
order by timestamp(posting_date, posting_time) asc, name asc
limit 1
""", (self.doc.item_code, self.doc.warehouse), as_dict=1)
- return sle and sle[0] or None
-
- def reorder_item(self,doc_type,doc_name):
- """ Reorder item if stock reaches reorder level"""
- if not hasattr(webnotes, "auto_indent"):
- webnotes.auto_indent = webnotes.conn.get_value('Global Defaults', None, 'auto_indent')
-
- if webnotes.auto_indent:
- #check if re-order is required
- item_reorder = webnotes.conn.get("Item Reorder",
- {"parent": self.doc.item_code, "warehouse": self.doc.warehouse})
- if item_reorder:
- reorder_level = item_reorder.warehouse_reorder_level
- reorder_qty = item_reorder.warehouse_reorder_qty
- material_request_type = item_reorder.material_request_type or "Purchase"
- else:
- reorder_level, reorder_qty = webnotes.conn.get_value("Item", self.doc.item_code,
- ["re_order_level", "re_order_qty"])
- material_request_type = "Purchase"
-
- if flt(reorder_qty) and flt(self.doc.projected_qty) < flt(reorder_level):
- self.create_material_request(doc_type, doc_name, reorder_level, reorder_qty,
- material_request_type)
-
- def create_material_request(self, doc_type, doc_name, reorder_level, reorder_qty,
- material_request_type="Purchase"):
- """ Create indent on reaching reorder level """
- defaults = webnotes.defaults.get_defaults()
- item = webnotes.doc("Item", self.doc.item_code)
-
- mr = webnotes.bean([{
- "doctype": "Material Request",
- "company": defaults.company,
- "fiscal_year": defaults.fiscal_year,
- "transaction_date": nowdate(),
- "material_request_type": material_request_type,
- "remark": _("This is an auto generated Material Request.") + \
- _("It was raised because the (actual + ordered + indented - reserved) quantity reaches re-order level when the following record was created") + \
- ": " + _(doc_type) + " " + doc_name
- }, {
- "doctype": "Material Request Item",
- "parenttype": "Material Request",
- "parentfield": "indent_details",
- "item_code": self.doc.item_code,
- "schedule_date": add_days(nowdate(),cint(item.lead_time_days)),
- "uom": self.doc.stock_uom,
- "warehouse": self.doc.warehouse,
- "item_name": item.item_name,
- "description": item.description,
- "item_group": item.item_group,
- "qty": reorder_qty,
- "brand": item.brand,
- }])
- mr.insert()
- mr.submit()
-
- msgprint("""Item: %s is to be re-ordered. Material Request %s raised.
- It was generated from %s: %s""" %
- (self.doc.item_code, mr.doc.name, doc_type, doc_name))
-
- if(item.email_notify):
- self.send_email_notification(doc_type, doc_name, mr)
-
- def send_email_notification(self, doc_type, doc_name, bean):
- """ Notify user about auto creation of indent"""
-
- from webnotes.utils.email_lib import sendmail
- email_list=[d[0] for d in sql("""select distinct r.parent from tabUserRole r, tabProfile p
- where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
- and r.role in ('Purchase Manager','Material Manager')
- and p.name not in ('Administrator', 'All', 'Guest')""")]
-
- msg="""A new Material Request has been raised for Item: %s and Warehouse: %s \
- on %s due to %s: %s. See %s: %s """ % (self.doc.item_code, self.doc.warehouse,
- formatdate(), doc_type, doc_name, bean.doc.doctype,
- get_url_to_form(bean.doc.doctype, bean.doc.name))
-
- sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg)
-
+ return sle and sle[0] or None
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.js b/stock/doctype/delivery_note/delivery_note.js
index ad39b7a..5992d01 100644
--- a/stock/doctype/delivery_note/delivery_note.js
+++ b/stock/doctype/delivery_note/delivery_note.js
@@ -323,6 +323,17 @@
}
// cost center
+ cur_frm.cscript.cost_center = function(doc, cdt, cdn){
+ var d = locals[cdt][cdn];
+ if(d.cost_center) {
+ var cl = getchildren('Delivery Note Item', doc.name, cur_frm.cscript.fname, doc.doctype);
+ for(var i = 0; i < cl.length; i++){
+ if(!cl[i].cost_center) cl[i].cost_center = d.cost_center;
+ }
+ }
+ refresh_field(cur_frm.cscript.fname);
+ }
+
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
return {
query: "accounts.utils.get_cost_center_list",
diff --git a/stock/doctype/delivery_note/delivery_note.py b/stock/doctype/delivery_note/delivery_note.py
index 15e24ef..6ffd960 100644
--- a/stock/doctype/delivery_note/delivery_note.py
+++ b/stock/doctype/delivery_note/delivery_note.py
@@ -419,4 +419,4 @@
if gl_entries:
from accounts.general_ledger import make_gl_entries
- make_gl_entries(gl_entries)
\ No newline at end of file
+ make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
\ No newline at end of file
diff --git a/stock/doctype/delivery_note/delivery_note.txt b/stock/doctype/delivery_note/delivery_note.txt
index 618d172..36c2789 100644
--- a/stock/doctype/delivery_note/delivery_note.txt
+++ b/stock/doctype/delivery_note/delivery_note.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-29 17:54:12",
+ "creation": "2013-04-02 10:50:50",
"docstatus": 0,
"modified": "2013-02-02 19:18:38",
"modified_by": "Administrator",
@@ -32,9 +32,7 @@
"parent": "Delivery Note",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1
+ "read": 1
},
{
"doctype": "DocType",
@@ -1123,20 +1121,25 @@
"read_only": 0
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1,
- "read_only": 0
+ "amend": 1,
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Material User",
+ "submit": 1,
+ "write": 1
},
{
+ "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "role": "Accounts User",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "Material User",
"submit": 0,
"write": 0
},
@@ -1145,31 +1148,73 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "Sales User",
- "submit": 1,
- "write": 1
- },
- {
- "doctype": "DocPerm",
- "match": "customer_name",
- "role": "Customer"
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
"role": "Material Manager",
"submit": 1,
"write": 1
},
{
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "Material Manager",
+ "submit": 0,
+ "write": 0
+ },
+ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "Material User",
+ "match": "",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Sales User",
"submit": 1,
"write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "Sales User",
+ "submit": 0,
+ "write": 0
+ },
+ {
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Accounts User",
+ "submit": 0,
+ "write": 0
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "role": "Accounts User",
+ "submit": 0
+ },
+ {
+ "doctype": "DocPerm",
+ "match": "customer_name",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Customer"
}
]
\ No newline at end of file
diff --git a/stock/doctype/delivery_note_item/delivery_note_item.txt b/stock/doctype/delivery_note_item/delivery_note_item.txt
index 1073f0c..f90ba69 100644
--- a/stock/doctype/delivery_note_item/delivery_note_item.txt
+++ b/stock/doctype/delivery_note_item/delivery_note_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-04-01 10:49:21",
+ "creation": "2013-04-22 13:15:44",
"docstatus": 0,
- "modified": "2013-04-17 17:20:58",
+ "modified": "2013-05-22 12:05:32",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -340,6 +340,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Document Type",
+ "no_copy": 1,
"oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -371,6 +372,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Against Document Date",
+ "no_copy": 1,
"oldfieldname": "prevdoc_date",
"oldfieldtype": "Date",
"print_hide": 1,
@@ -383,6 +385,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Against Document Detail No",
+ "no_copy": 1,
"oldfieldname": "prevdoc_detail_docname",
"oldfieldtype": "Data",
"print_hide": 1,
diff --git a/stock/doctype/item/item.js b/stock/doctype/item/item.js
index 8b3e044..acc78e7 100644
--- a/stock/doctype/item/item.js
+++ b/stock/doctype/item/item.js
@@ -14,11 +14,17 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
+cur_frm.add_fetch("price_list_name", "currency", "ref_currency")
+
cur_frm.cscript.refresh = function(doc) {
// make sensitive fields(has_serial_no, is_stock_item, valuation_method)
// read only if any stock ledger entry exists
- cur_frm.toggle_enable("item_code", doc.__islocal);
+ cur_frm.toggle_display("naming_series", sys_defaults.item_naming_by=="Naming Series"
+ && doc.__islocal)
+ cur_frm.toggle_display("item_code", sys_defaults.item_naming_by!="Naming Series"
+ && doc.__islocal)
+
if ((!doc.__islocal) && (doc.is_stock_item == 'Yes')) {
var callback = function(r, rt) {
@@ -128,11 +134,7 @@
erpnext.utils.supplier_query;
cur_frm.cscript.on_remove_attachment = function(doc) {
- // refresh image list before unsetting image
- refresh_field("image");
if(!inList(cur_frm.fields_dict.image.df.options.split("\n"), doc.image)) {
- // if the selected image is removed from attachment, unset it
- cur_frm.set_value("image", "");
msgprint(wn._("Attachment removed. You may need to update: ")
+ wn.meta.get_docfield(doc.doctype, "description_html").label);
}
@@ -151,3 +153,7 @@
cur_frm.refresh();
});
}
+
+cur_frm.cscript.image = function() {
+ refresh_field("image_view");
+}
\ No newline at end of file
diff --git a/stock/doctype/item/item.py b/stock/doctype/item/item.py
index a16296d..d743a98 100644
--- a/stock/doctype/item/item.py
+++ b/stock/doctype/item/item.py
@@ -23,51 +23,197 @@
from webnotes import msgprint, _
from webnotes.model.controller import DocListController
-class DocType(DocListController):
- def get_tax_rate(self, tax_type):
- rate = webnotes.conn.sql("select tax_rate from tabAccount where name = %s", tax_type)
- ret = {
- 'tax_rate' : rate and flt(rate[0][0]) or 0
- }
- return ret
+class PriceListCurrencyMismatch(Exception): pass
+
+class DocType(DocListController):
+ def autoname(self):
+ if webnotes.conn.get_default("item_naming_by")=="Naming Series":
+ from webnotes.model.doc import make_autoname
+ self.doc.item_code = make_autoname(self.doc.naming_series+'.#####')
+ elif not self.doc.item_code:
+ msgprint(_("Item Code is mandatory"), raise_exception=1)
+
+ self.doc.name = self.doc.item_code
+
+ def validate(self):
+ if not self.doc.stock_uom:
+ msgprint(_("Please enter Default Unit of Measure"), raise_exception=1)
+
+ self.check_stock_uom_with_bin()
+ self.validate_conversion_factor()
+ self.add_default_uom_in_conversion_factor_table()
+ self.valiadte_item_type()
+ self.check_for_active_boms()
+ self.validate_price_lists()
+ self.fill_customer_code()
+ self.check_item_tax()
+ self.validate_barcode()
+ self.check_non_asset_warehouse()
+ self.cant_change()
+ self.validate_item_type_for_reorder()
+
+ if self.doc.name:
+ self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
+
def on_update(self):
self.validate_name_with_item_group()
-
- # webpage updates
self.update_website()
-
- bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
- self.doc.item_code)
- if bin and cstr(bin[0][0]) and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
- msgprint("Please Update Stock UOM with the help of Stock UOM Replace Utility.")
- raise Exception
+
+ def add_default_uom_in_conversion_factor_table(self):
+ uom_conv_list = [d.uom for d in self.doclist.get({"parentfield": "uom_conversion_details"})]
+ if self.doc.stock_uom not in uom_conv_list:
+ ch = addchild(self.doc, 'uom_conversion_details', 'UOM Conversion Detail', self.doclist)
+ ch.uom = self.doc.stock_uom
+ ch.conversion_factor = 1
+
+ def check_stock_uom_with_bin(self):
+ if not self.doc.fields.get("__islocal"):
+ bin = webnotes.conn.sql("select stock_uom from `tabBin` where item_code = %s",
+ self.doc.name)
+ if self.doc.stock_uom and bin and cstr(bin[0][0]) \
+ and cstr(bin[0][0]) != cstr(self.doc.stock_uom):
+ msgprint(_("Please Update Stock UOM with the help of Stock UOM Replace Utility."),
+ raise_exception=1)
+
+ def validate_conversion_factor(self):
check_list = []
for d in getlist(self.doclist,'uom_conversion_details'):
- if not self.doc.stock_uom:
- msgprint("Please enter Stock UOM first.")
- raise Exception
-
if cstr(d.uom) in check_list:
- msgprint("UOM %s has been entered more than once in Conversion Factor Details." % cstr(d.uom))
- raise Exception
+ msgprint(_("UOM %s has been entered more than once in Conversion Factor Table." %
+ cstr(d.uom)), raise_exception=1)
else:
check_list.append(cstr(d.uom))
- if cstr(d.uom) == cstr(self.doc.stock_uom):
- if flt(d.conversion_factor) != 1:
- msgprint("Conversion Factor of UOM : %s should be equal to 1. As UOM : %s is Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
- raise Exception
- elif cstr(d.uom) != cstr(self.doc.stock_uom) and flt(d.conversion_factor) == 1:
- msgprint("Conversion Factor of UOM : %s should not be equal to 1. As UOM : %s is not Stock UOM of Item: %s." % ( cstr(d.uom), cstr(d.uom), cstr(self.doc.name)))
- raise Exception
+ if d.uom and cstr(d.uom) == cstr(self.doc.stock_uom) and flt(d.conversion_factor) != 1:
+ msgprint(_("""Conversion Factor of UOM: %s should be equal to 1.
+ As UOM: %s is Stock UOM of Item: %s.""" %
+ (d.uom, d.uom, self.doc.name)), raise_exception=1)
+ elif d.uom and cstr(d.uom)!= self.doc.stock_uom and flt(d.conversion_factor) == 1:
+ msgprint(_("""Conversion Factor of UOM: %s should not be equal to 1.
+ As UOM: %s is not Stock UOM of Item: %s""" %
+ (d.uom, d.uom, self.doc.name)), raise_exception=1)
+
+ def valiadte_item_type(self):
+ if cstr(self.doc.is_manufactured_item) == "No":
+ self.doc.is_pro_applicable = "No"
- if not cstr(self.doc.stock_uom) in check_list :
- child = addchild( self.doc, 'uom_conversion_details',
- 'UOM Conversion Detail', self.doclist)
- child.uom = self.doc.stock_uom
- child.conversion_factor = 1
- child.save()
+ if self.doc.is_pro_applicable == 'Yes' and self.doc.is_stock_item == 'No':
+ msgprint("As Production Order can be made for this Item, then Is Stock Item Should be 'Yes' as we maintain it's stock. Refer Manufacturing and Inventory section.", raise_exception=1)
+
+ if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
+ msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1)
+
+ def check_for_active_boms(self):
+ def _check_for_active_boms(field_label):
+ if field_label in ['Is Active', 'Is Purchase Item']:
+ bom_mat = webnotes.conn.sql("""select distinct t1.parent
+ from `tabBOM Item` t1, `tabBOM` t2 where t2.name = t1.parent
+ and t1.item_code =%s and ifnull(t1.bom_no, '') = '' and t2.is_active = 1
+ and t2.docstatus = 1 and t1.docstatus =1 """, self.doc.name)
+ if bom_mat and bom_mat[0][0]:
+ msgprint(_(field_label) + _(" should be 'Yes'. As Item: ") + self.doc.name +
+ _(" is present in one or many Active BOMs"), raise_exception=1)
+
+ if ((field_label == 'Allow Production Order'
+ and self.doc.is_sub_contracted_item != 'Yes')
+ or (field_label == 'Is Sub Contracted Item'
+ and self.doc.is_manufactured_item != 'Yes')):
+ bom = webnotes.conn.sql("""select name from `tabBOM` where item = %s
+ and is_active = 1""", (self.doc.name,))
+ if bom and bom[0][0]:
+ msgprint(_(field_label) + _(" should be 'Yes'. As Item: ") + self.doc.name +
+ _(" is present in one or many Active BOMs"), raise_exception=1)
+
+ if not cint(self.doc.fields.get("__islocal")):
+ fl = {'is_manufactured_item' :'Allow Bill of Materials',
+ 'is_sub_contracted_item':'Is Sub Contracted Item',
+ 'is_purchase_item' :'Is Purchase Item',
+ 'is_pro_applicable' :'Allow Production Order'}
+ for d in fl:
+ if cstr(self.doc.fields.get(d)) != 'Yes':
+ _check_for_active_boms(fl[d])
+
+ def validate_price_lists(self):
+ price_lists=[]
+ for d in getlist(self.doclist,'ref_rate_details'):
+ if d.price_list_name in price_lists:
+ msgprint(_("Cannot have two prices for same Price List") + ": " + d.price_list_name,
+ raise_exception= webnotes.DuplicateEntryError)
+ else:
+ price_list_currency = webnotes.conn.get_value("Price List", d.price_list_name, "currency")
+ if price_list_currency and d.ref_currency != price_list_currency:
+ msgprint(_("Currency does not match Price List Currency for Price List") \
+ + ": " + d.price_list_name, raise_exception=PriceListCurrencyMismatch)
+
+ price_lists.append(d.price_list_name)
+
+
+ def fill_customer_code(self):
+ """ Append all the customer codes and insert into "customer_code" field of item table """
+ cust_code=[]
+ for d in getlist(self.doclist,'item_customer_details'):
+ cust_code.append(d.ref_code)
+ self.doc.customer_code=','.join(cust_code)
+
+ def check_item_tax(self):
+ """Check whether Tax Rate is not entered twice for same Tax Type"""
+ check_list=[]
+ for d in getlist(self.doclist,'item_tax'):
+ if d.tax_type:
+ account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
+
+ if account_type not in ['Tax', 'Chargeable']:
+ msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
+ else:
+ if d.tax_type in check_list:
+ msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
+ else:
+ check_list.append(d.tax_type)
+
+ def validate_barcode(self):
+ if self.doc.barcode:
+ duplicate = webnotes.conn.sql("""select name from tabItem where barcode = %s
+ and name != %s""", (self.doc.barcode, self.doc.name))
+ if duplicate:
+ msgprint("Barcode: %s already used in item: %s" %
+ (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
+
+ def check_non_asset_warehouse(self):
+ if not self.doc.__islocal and self.doc.is_asset_item == "Yes":
+ existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
+ for e in existing_qty:
+ msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." %
+ (e[1],e[0]))
+ if existing_qty:
+ self.doc.is_asset_item = 'No'
+ msgprint(_("""Please transfer the above quantities to an asset warehouse \
+ before changing this item to an asset item"""), raise_exception=1)
+
+ def cant_change(self):
+ if not self.doc.fields.get("__islocal"):
+ vals = webnotes.conn.get_value("Item", self.doc.name,
+ ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True)
+
+ if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or
+ vals.has_serial_no != self.doc.has_serial_no or
+ vals.valuation_method != self.doc.valuation_method):
+ if self.check_if_sle_exists() == "exists":
+ webnotes.msgprint(_("As there are existing stock transactions for this \
+ item, you can not change the values of 'Has Serial No', \
+ 'Is Stock Item' and 'Valuation Method'"), raise_exception=1)
+
+ def validate_item_type_for_reorder(self):
+ if self.doc.re_order_level or len(self.doclist.get({"parentfield": "item_reorder",
+ "material_request_type": "Purchase"})):
+ if not self.doc.is_purchase_item:
+ webnotes.msgprint(_("""To set reorder level, item must be Purchase Item"""),
+ raise_exception=1)
+
+ def check_if_sle_exists(self):
+ sle = webnotes.conn.sql("""select name from `tabStock Ledger Entry`
+ where item_code = %s and ifnull(is_cancelled, 'No') = 'No'""", self.doc.name)
+ return sle and 'exists' or 'not exists'
def validate_name_with_item_group(self):
if webnotes.conn.exists("Item Group", self.doc.name):
@@ -104,107 +250,17 @@
webnotes.conn.set(self.doc, "page_name", None)
- # On delete 1. Delete BIN (if none of the corrosponding transactions present, it gets deleted. if present, rolled back due to exception)
- def on_trash(self):
- webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
- webnotes.conn.sql("""delete from `tabStock Ledger Entry`
- where item_code=%s and is_cancelled='Yes' """, self.doc.item_code)
-
- if self.doc.page_name:
- from webnotes.webutils import clear_cache
- clear_cache(self.doc.page_name)
-
- # Check whether Ref Rate is not entered twice for same Price List and Currency
- def check_ref_rate_detail(self):
- check_list=[]
- for d in getlist(self.doclist,'ref_rate_details'):
- if [cstr(d.price_list_name),cstr(d.ref_currency),cint(d.selling),cint(d.buying)] in check_list:
- msgprint("Ref Rate is entered twice for Price List : '%s' and Currency : '%s'." % (d.price_list_name,d.ref_currency))
- raise Exception
- else:
- check_list.append([cstr(d.price_list_name),cstr(d.ref_currency)])
+ def get_tax_rate(self, tax_type):
+ return { "tax_rate": webnotes.conn.get_value("Account", tax_type, "tax_rate") }
- # Append all the customer codes and insert into "customer_code" field of item table
- def fill_customer_code(self):
- cust_code=[]
- for d in getlist(self.doclist,'item_customer_details'):
- cust_code.append(d.ref_code)
- self.doc.customer_code=','.join(cust_code)
+ def prepare_template_args(self):
+ from website.helpers.product import get_parent_item_groups
+ self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
+ self.doc.title = self.doc.item_name
- def check_item_tax(self):
- """Check whether Tax Rate is not entered twice for same Tax Type"""
- check_list=[]
- for d in getlist(self.doclist,'item_tax'):
- if d.tax_type:
- account_type = webnotes.conn.get_value("Account", d.tax_type, "account_type")
-
- if account_type not in ['Tax', 'Chargeable']:
- msgprint("'%s' is not Tax / Chargeable Account" % d.tax_type, raise_exception=1)
- else:
- if d.tax_type in check_list:
- msgprint("Rate is entered twice for: '%s'" % d.tax_type, raise_exception=1)
- else:
- check_list.append(d.tax_type)
-
- def check_for_active_boms(self, field_label):
- if field_label in ['Is Active', 'Is Purchase Item']:
- bom_mat = webnotes.conn.sql("select distinct t1.parent from `tabBOM Item` t1, `tabBOM` t2 where t1.item_code =%s and (t1.bom_no = '' or t1.bom_no is NULL) and t2.name = t1.parent and t2.is_active = 1 and t2.docstatus = 1 and t1.docstatus =1 ", self.doc.name)
- if bom_mat and bom_mat[0][0]:
- msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
- raise Exception
- if ((field_label == 'Allow Production Order'
- and self.doc.is_sub_contracted_item != 'Yes')
- or (field_label == 'Is Sub Contracted Item'
- and self.doc.is_manufactured_item != 'Yes')):
- bom = webnotes.conn.sql("select name from `tabBOM` where item = %s and is_active = 1",
- (self.doc.name,))
- if bom and bom[0][0]:
- msgprint("%s should be 'Yes'. As Item %s is present in one or many Active BOMs." % (cstr(field_label), cstr(self.doc.name)))
- raise Exception
-
- def validate_barcode(self):
- if self.doc.barcode:
- duplicate = webnotes.conn.sql("select name from tabItem where barcode = %s and name != %s", (self.doc.barcode, self.doc.name))
- if duplicate:
- msgprint("Barcode: %s already used in item: %s" % (self.doc.barcode, cstr(duplicate[0][0])), raise_exception = 1)
-
- def validate(self):
- if not cint(self.doc.fields.get("__islocal")):
- fl = {'is_manufactured_item' :'Allow Bill of Materials',
- 'is_sub_contracted_item':'Is Sub Contracted Item',
- 'is_purchase_item' :'Is Purchase Item',
- 'is_pro_applicable' :'Allow Production Order'}
- for d in fl:
- if cstr(self.doc.fields.get(d)) != 'Yes':
- self.check_for_active_boms(fl[d])
- self.check_ref_rate_detail()
- self.fill_customer_code()
- self.check_item_tax()
- self.validate_barcode()
- self.check_non_asset_warehouse()
- self.cant_change()
-
- if cstr(self.doc.is_manufactured_item) == "No":
- self.doc.is_pro_applicable = "No"
-
- if self.doc.is_pro_applicable == 'Yes' and self.doc.is_stock_item == 'No':
- msgprint("As Production Order can be made for this Item, then Is Stock Item Should be 'Yes' as we maintain it's stock. Refer Manufacturing and Inventory section.", raise_exception=1)
-
- if self.doc.has_serial_no == 'Yes' and self.doc.is_stock_item == 'No':
- msgprint("'Has Serial No' can not be 'Yes' for non-stock item", raise_exception=1)
-
- if self.doc.name:
- self.old_page_name = webnotes.conn.get_value('Item', self.doc.name, 'page_name')
-
- def check_non_asset_warehouse(self):
- if self.doc.is_asset_item == "Yes":
- existing_qty = webnotes.conn.sql("select t1.warehouse, t1.actual_qty from tabBin t1, tabWarehouse t2 where t1.item_code=%s and (t2.warehouse_type!='Fixed Asset' or t2.warehouse_type is null) and t1.warehouse=t2.name and t1.actual_qty > 0", self.doc.name)
- for e in existing_qty:
- msgprint("%s Units exist in Warehouse %s, which is not an Asset Warehouse." % (e[1],e[0]))
- if existing_qty:
- msgprint("Please transfer the above quantities to an asset warehouse before changing this item to an asset item.")
- self.doc.is_asset_item = 'No'
- raise Exception
+ if self.doc.slideshow:
+ from website.helpers.slideshow import get_slideshow
+ get_slideshow(self)
def get_file_details(self, arg = ''):
file = webnotes.conn.sql("select file_group, description from tabFile where name = %s", eval(arg)['file_name'], as_dict = 1)
@@ -215,35 +271,17 @@
}
return ret
+ def on_trash(self):
+ webnotes.conn.sql("""delete from tabBin where item_code=%s""", self.doc.item_code)
+ webnotes.conn.sql("""delete from `tabStock Ledger Entry`
+ where item_code=%s and is_cancelled='Yes' """, self.doc.item_code)
- def check_if_sle_exists(self):
- sle = webnotes.conn.sql("select name from `tabStock Ledger Entry` where item_code = %s and ifnull(is_cancelled, 'No') = 'No'", self.doc.name)
- return sle and 'exists' or 'not exists'
-
- def on_rename(self,newdn,olddn):
- webnotes.conn.sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
if self.doc.page_name:
from webnotes.webutils import clear_cache
clear_cache(self.doc.page_name)
-
- def prepare_template_args(self):
- from website.helpers.product import get_parent_item_groups
- self.parent_groups = get_parent_item_groups(self.doc.item_group) + [{"name":self.doc.name}]
- self.doc.title = self.doc.item_name
- if self.doc.slideshow:
- from website.helpers.slideshow import get_slideshow
- get_slideshow(self)
-
- def cant_change(self):
- if not self.doc.fields.get("__islocal"):
- vals = webnotes.conn.get_value("Item", self.doc.name,
- ["has_serial_no", "is_stock_item", "valuation_method"], as_dict=True)
-
- if vals and ((self.doc.is_stock_item == "No" and vals.is_stock_item == "Yes") or
- vals.has_serial_no != self.doc.has_serial_no or
- vals.valuation_method != self.doc.valuation_method):
- if self.check_if_sle_exists() == "exists":
- webnotes.msgprint(_("As there are existing stock transactions for this \
- item, you can not change the values of 'Has Serial No', \
- 'Is Stock Item' and 'Valuation Method'"), raise_exception=1)
+ def on_rename(self,newdn,olddn, merge=False):
+ webnotes.conn.sql("update tabItem set item_code = %s where name = %s", (newdn, olddn))
+ if self.doc.page_name:
+ from webnotes.webutils import clear_cache
+ clear_cache(self.doc.page_name)
\ No newline at end of file
diff --git a/stock/doctype/item/item.txt b/stock/doctype/item/item.txt
index b7f7be4..9e0a2fb 100644
--- a/stock/doctype/item/item.txt
+++ b/stock/doctype/item/item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-07 15:53:11",
+ "creation": "2013-05-03 10:45:46",
"docstatus": 0,
- "modified": "2013-03-20 15:10:12",
+ "modified": "2013-05-22 15:48:27",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -33,6 +33,7 @@
"parent": "Item",
"parentfield": "permissions",
"parenttype": "DocType",
+ "permlevel": 0,
"read": 1,
"report": 1,
"submit": 0
@@ -47,7 +48,16 @@
"fieldtype": "Section Break",
"label": "Item",
"no_copy": 0,
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
+ },
+ {
+ "doctype": "DocField",
+ "fieldname": "naming_series",
+ "fieldtype": "Select",
+ "label": "Naming Series",
+ "options": "\nITEM",
+ "read_only": 0
},
{
"description": "Item will be saved by this name in the data base.",
@@ -56,9 +66,11 @@
"fieldtype": "Data",
"in_filter": 0,
"label": "Item Code",
+ "no_copy": 1,
"oldfieldname": "item_code",
"oldfieldtype": "Data",
- "reqd": 1,
+ "read_only": 0,
+ "reqd": 0,
"search_index": 0
},
{
@@ -70,6 +82,7 @@
"label": "Item Name",
"oldfieldname": "item_name",
"oldfieldtype": "Data",
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -83,6 +96,7 @@
"oldfieldname": "item_group",
"oldfieldtype": "Link",
"options": "Item Group",
+ "read_only": 0,
"reqd": 1
},
{
@@ -94,7 +108,8 @@
"oldfieldname": "stock_uom",
"oldfieldtype": "Link",
"options": "UOM",
- "reqd": 0
+ "read_only": 0,
+ "reqd": 1
},
{
"doctype": "DocField",
@@ -106,25 +121,29 @@
"oldfieldtype": "Link",
"options": "Brand",
"print_hide": 1,
+ "read_only": 0,
"reqd": 0
},
{
"doctype": "DocField",
"fieldname": "barcode",
"fieldtype": "Data",
- "label": "Barcode"
+ "label": "Barcode",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break0",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "image",
"fieldtype": "Select",
"label": "Image",
- "options": "attach_files:"
+ "options": "attach_files:",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -132,7 +151,8 @@
"fieldtype": "Image",
"in_list_view": 1,
"label": "Image View",
- "options": "image"
+ "options": "image",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -143,6 +163,7 @@
"label": "Description",
"oldfieldname": "description",
"oldfieldtype": "Text",
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -150,21 +171,24 @@
"doctype": "DocField",
"fieldname": "description_html",
"fieldtype": "Small Text",
- "label": "Description HTML"
+ "label": "Description HTML",
+ "read_only": 0
},
{
"description": "Generates HTML to include selected image in the description",
"doctype": "DocField",
"fieldname": "add_image",
"fieldtype": "Button",
- "label": "Generate Description HTML"
+ "label": "Generate Description HTML",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "inventory",
"fieldtype": "Section Break",
"label": "Inventory",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"default": "Yes",
@@ -176,6 +200,7 @@
"oldfieldname": "is_stock_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -187,7 +212,8 @@
"label": "Default Reserved Warehouse",
"oldfieldname": "default_warehouse",
"oldfieldtype": "Link",
- "options": "Warehouse"
+ "options": "Warehouse",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -197,7 +223,8 @@
"fieldtype": "Float",
"label": "Allowance Percent",
"oldfieldname": "tolerance",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -205,7 +232,8 @@
"fieldname": "valuation_method",
"fieldtype": "Select",
"label": "Valuation Method",
- "options": "\nFIFO\nMoving Average"
+ "options": "\nFIFO\nMoving Average",
+ "read_only": 0
},
{
"default": "0.00",
@@ -217,7 +245,8 @@
"hidden": 0,
"label": "Minimum Order Qty",
"oldfieldname": "min_order_qty",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -225,6 +254,7 @@
"fieldname": "column_break1",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -238,6 +268,7 @@
"oldfieldname": "is_asset_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -250,6 +281,7 @@
"oldfieldname": "has_batch_no",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -264,6 +296,7 @@
"oldfieldname": "has_serial_no",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -273,7 +306,8 @@
"fieldtype": "Data",
"label": "Warranty Period (in days)",
"oldfieldname": "warranty_period",
- "oldfieldtype": "Data"
+ "oldfieldtype": "Data",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -282,7 +316,8 @@
"fieldtype": "Date",
"label": "End of Life",
"oldfieldname": "end_of_life",
- "oldfieldtype": "Date"
+ "oldfieldtype": "Date",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -290,7 +325,8 @@
"doctype": "DocField",
"fieldname": "net_weight",
"fieldtype": "Float",
- "label": "Net Weight"
+ "label": "Net Weight",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -298,14 +334,16 @@
"fieldname": "weight_uom",
"fieldtype": "Link",
"label": "Weight UOM",
- "options": "UOM"
+ "options": "UOM",
+ "read_only": 0
},
{
"description": "Auto-raise Material Request if quantity goes below re-order level in a warehouse",
"doctype": "DocField",
"fieldname": "reorder_section",
"fieldtype": "Section Break",
- "label": "Re-order"
+ "label": "Re-order",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
@@ -314,47 +352,39 @@
"fieldtype": "Float",
"label": "Re-Order Level",
"oldfieldname": "re_order_level",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_stock_item==\"Yes\"",
"doctype": "DocField",
"fieldname": "re_order_qty",
"fieldtype": "Float",
- "label": "Re-Order Qty"
- },
- {
- "doctype": "DocField",
- "fieldname": "column_break_31",
- "fieldtype": "Column Break"
- },
- {
- "depends_on": "eval:doc.is_stock_item==\"Yes\"",
- "description": "Send an email to users of role \"Material Manager\" and \"Purchase Manager\" when re-order level is crossed.",
- "doctype": "DocField",
- "fieldname": "email_notify",
- "fieldtype": "Check",
- "label": "Notify by Email on Re-order"
+ "label": "Re-Order Qty",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "section_break_31",
"fieldtype": "Section Break",
- "options": "Simple"
+ "options": "Simple",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "item_reorder",
"fieldtype": "Table",
"label": "Warehouse-wise Item Reorder",
- "options": "Item Reorder"
+ "options": "Item Reorder",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "purchase_details",
"fieldtype": "Section Break",
"label": "Purchase Details",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"default": "Yes",
@@ -366,6 +396,7 @@
"oldfieldname": "is_purchase_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -377,7 +408,8 @@
"label": "Lead Time Days",
"no_copy": 1,
"oldfieldname": "lead_time_days",
- "oldfieldtype": "Int"
+ "oldfieldtype": "Int",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
@@ -388,7 +420,8 @@
"label": "Default Expense Account",
"oldfieldname": "purchase_account",
"oldfieldtype": "Link",
- "options": "Account"
+ "options": "Account",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
@@ -399,7 +432,8 @@
"label": "Default Cost Center",
"oldfieldname": "cost_center",
"oldfieldtype": "Link",
- "options": "Cost Center"
+ "options": "Cost Center",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
@@ -419,7 +453,8 @@
"fieldtype": "Float",
"label": "Standard Rate",
"oldfieldname": "standard_rate",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
@@ -427,6 +462,7 @@
"fieldname": "column_break2",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -438,21 +474,24 @@
"no_copy": 1,
"oldfieldname": "uom_conversion_details",
"oldfieldtype": "Table",
- "options": "UOM Conversion Detail"
+ "options": "UOM Conversion Detail",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
"doctype": "DocField",
"fieldname": "manufacturer",
"fieldtype": "Data",
- "label": "Manufacturer"
+ "label": "Manufacturer",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
"doctype": "DocField",
"fieldname": "manufacturer_part_no",
"fieldtype": "Data",
- "label": "Manufacturer Part Number"
+ "label": "Manufacturer Part Number",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_purchase_item==\"Yes\"",
@@ -460,14 +499,16 @@
"fieldname": "item_supplier_details",
"fieldtype": "Table",
"label": "Item Supplier Details",
- "options": "Item Supplier"
+ "options": "Item Supplier",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "sales_details",
"fieldtype": "Section Break",
"label": "Sales Details",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"default": "Yes",
@@ -480,6 +521,7 @@
"oldfieldname": "is_sales_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -494,6 +536,7 @@
"oldfieldname": "is_service_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -507,6 +550,7 @@
"oldfieldname": "is_sample_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -516,7 +560,8 @@
"fieldtype": "Float",
"label": "Max Discount (%)",
"oldfieldname": "max_discount",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
@@ -524,7 +569,8 @@
"fieldname": "default_income_account",
"fieldtype": "Link",
"label": "Default Income Account",
- "options": "Account"
+ "options": "Account",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
@@ -532,7 +578,8 @@
"fieldname": "default_sales_cost_center",
"fieldtype": "Link",
"label": "Cost Center",
- "options": "Cost Center"
+ "options": "Cost Center",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
@@ -542,7 +589,8 @@
"hidden": 1,
"label": "Sales Rate",
"oldfieldname": "sales_rate",
- "oldfieldtype": "Currency"
+ "oldfieldtype": "Currency",
+ "read_only": 0
},
{
"depends_on": "eval:doc.is_sales_item==\"Yes\"",
@@ -550,6 +598,7 @@
"fieldname": "column_break3",
"fieldtype": "Column Break",
"oldfieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -559,14 +608,16 @@
"fieldname": "item_customer_details",
"fieldtype": "Table",
"label": "Customer Codes",
- "options": "Item Customer Detail"
+ "options": "Item Customer Detail",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "item_tax_section_break",
"fieldtype": "Section Break",
"label": "Item Tax",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -575,13 +626,15 @@
"label": "Item Tax1",
"oldfieldname": "item_tax",
"oldfieldtype": "Table",
- "options": "Item Tax"
+ "options": "Item Tax",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "price_list_section",
"fieldtype": "Section Break",
- "label": "Price Lists and Rates"
+ "label": "Price Lists and Rates",
+ "read_only": 0
},
{
"description": "Create a price list from Price List master and enter standard ref rates against each of them. On selection of a price list in Quotation, Sales Order or Delivery Note, corresponding ref rate will be fetched for this item.",
@@ -591,14 +644,16 @@
"label": "Item Prices",
"oldfieldname": "ref_rate_details",
"oldfieldtype": "Table",
- "options": "Item Price"
+ "options": "Item Price",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "inspection_criteria",
"fieldtype": "Section Break",
"label": "Inspection Criteria",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"default": "No",
@@ -610,6 +665,7 @@
"oldfieldname": "inspection_required",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -621,14 +677,16 @@
"label": "Item Quality Inspection Parameter",
"oldfieldname": "item_specification_details",
"oldfieldtype": "Table",
- "options": "Item Quality Inspection Parameter"
+ "options": "Item Quality Inspection Parameter",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "manufacturing",
"fieldtype": "Section Break",
"label": "Manufacturing",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"default": "No",
@@ -640,6 +698,7 @@
"oldfieldname": "is_manufactured_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -665,6 +724,7 @@
"oldfieldname": "is_pro_applicable",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
@@ -677,38 +737,33 @@
"oldfieldname": "is_sub_contracted_item",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"reqd": 1
},
{
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
- "doctype": "DocField",
"fieldname": "customer_code",
"fieldtype": "Data",
"hidden": 1,
"in_filter": 1,
"label": "Customer Code",
"no_copy": 1,
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "website_section",
"fieldtype": "Section Break",
- "label": "Website"
+ "label": "Website",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "show_in_website",
"fieldtype": "Check",
- "label": "Show in Website"
+ "label": "Show in Website",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -726,6 +781,7 @@
"fieldname": "weightage",
"fieldtype": "Int",
"label": "Weightage",
+ "read_only": 0,
"search_index": 1
},
{
@@ -735,7 +791,8 @@
"fieldname": "slideshow",
"fieldtype": "Link",
"label": "Slideshow",
- "options": "Website Slideshow"
+ "options": "Website Slideshow",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -744,12 +801,14 @@
"fieldname": "website_image",
"fieldtype": "Select",
"label": "Image",
- "options": "attach_files:"
+ "options": "attach_files:",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "cb72",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -758,7 +817,8 @@
"fieldname": "website_price_list",
"fieldtype": "Link",
"label": "Website Price List",
- "options": "Price List"
+ "options": "Price List",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -767,7 +827,8 @@
"fieldname": "website_warehouse",
"fieldtype": "Link",
"label": "Website Warehouse",
- "options": "Warehouse"
+ "options": "Warehouse",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -776,19 +837,22 @@
"fieldname": "website_item_groups",
"fieldtype": "Table",
"label": "Website Item Groups",
- "options": "Website Item Group"
+ "options": "Website Item Group",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
"fieldname": "sb72",
- "fieldtype": "Section Break"
+ "fieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "copy_from_item_group",
"fieldtype": "Button",
- "label": "Copy From Item Group"
+ "label": "Copy From Item Group",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
@@ -796,37 +860,21 @@
"fieldname": "item_website_specifications",
"fieldtype": "Table",
"label": "Item Website Specifications",
- "options": "Item Website Specification"
+ "options": "Item Website Specification",
+ "read_only": 0
},
{
"depends_on": "show_in_website",
"doctype": "DocField",
"fieldname": "web_long_description",
"fieldtype": "Text Editor",
- "label": "Website Description"
+ "label": "Website Description",
+ "read_only": 0
},
{
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "permlevel": 0,
- "role": "System Manager",
- "write": 1
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Material Master Manager",
- "write": 0
- },
- {
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
- "permlevel": 0,
"role": "Material Master Manager",
"write": 1
},
@@ -835,15 +883,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "permlevel": 1,
- "role": "System Manager"
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
"role": "Material Manager",
"write": 0
},
@@ -852,25 +891,6 @@
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "permlevel": 0,
- "role": "Material Manager",
- "write": 0
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 1,
- "role": "Material User",
- "write": 0
- },
- {
- "amend": 0,
- "cancel": 0,
- "create": 0,
- "doctype": "DocPerm",
- "permlevel": 0,
"role": "Material User",
"write": 0
}
diff --git a/stock/doctype/item/test_item.py b/stock/doctype/item/test_item.py
index dbbeecc..f5a688c 100644
--- a/stock/doctype/item/test_item.py
+++ b/stock/doctype/item/test_item.py
@@ -20,6 +20,22 @@
test_ignore = ["BOM"]
+class TestItem(unittest.TestCase):
+ def test_duplicate_price_list(self):
+ item = webnotes.bean(copy=test_records[0])
+ item.doc.item_code = "_Test Item 10"
+ item_price = item.doclist.get({"doctype": "Item Price"})[0]
+ item.doclist.append(webnotes.doc(item_price.fields.copy()))
+ self.assertRaises(webnotes.DuplicateEntryError, item.insert)
+
+ def test_price_list_mismatch(self):
+ from stock.doctype.item.item import PriceListCurrencyMismatch
+ item = webnotes.bean(copy=test_records[0])
+ item.doc.item_code = "_Test Item 11"
+ item_price = item.doclist.get({"doctype": "Item Price"})[0].ref_currency="USD"
+ self.assertRaises(PriceListCurrencyMismatch, item.insert)
+
+
test_records = [
[{
"doctype": "Item",
@@ -45,7 +61,14 @@
"warehouse": "_Test Warehouse",
"warehouse_reorder_level": 20,
"warehouse_reorder_qty": 20
- }],
+ }, {
+ "doctype": "Item Price",
+ "parentfield": "ref_rate_details",
+ "price_list_name": "_Test Price List",
+ "ref_rate": 100,
+ "ref_currency": "INR"
+ }
+ ],
[{
"doctype": "Item",
"item_code": "_Test Item Home Desktop 100",
diff --git a/stock/doctype/item_price/item_price.txt b/stock/doctype/item_price/item_price.txt
index 721902b..ad0b840 100644
--- a/stock/doctype/item_price/item_price.txt
+++ b/stock/doctype/item_price/item_price.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-08 15:37:16",
+ "creation": "2013-04-29 15:18:04",
"docstatus": 0,
- "modified": "2013-03-21 17:29:15",
+ "modified": "2013-04-29 19:16:45",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -68,13 +68,13 @@
"doctype": "DocField",
"fieldname": "selling",
"fieldtype": "Check",
- "label": "For Selling"
+ "label": "Valid For Selling"
},
{
"description": "Allow this price in purchase related forms",
"doctype": "DocField",
"fieldname": "buying",
"fieldtype": "Check",
- "label": "For Buying"
+ "label": "Valid For Buying"
}
]
\ No newline at end of file
diff --git a/stock/doctype/material_request/material_request.txt b/stock/doctype/material_request/material_request.txt
index f2e6b35..eb788e4 100644
--- a/stock/doctype/material_request/material_request.txt
+++ b/stock/doctype/material_request/material_request.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-02-21 14:15:25",
+ "creation": "2013-03-07 14:48:38",
"docstatus": 0,
"modified": "2013-02-25 15:38:02",
"modified_by": "Administrator",
@@ -332,15 +332,6 @@
"print_hide": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"amend": 0,
"cancel": 0,
"create": 0,
diff --git a/stock/doctype/material_request/test_material_request.py b/stock/doctype/material_request/test_material_request.py
index 080989f..f5dbb52 100644
--- a/stock/doctype/material_request/test_material_request.py
+++ b/stock/doctype/material_request/test_material_request.py
@@ -263,6 +263,12 @@
se = webnotes.bean(copy=se_doclist)
self.assertRaises(webnotes.MappingMismatchError, se.insert)
+ def test_warehouse_company_validation(self):
+ from controllers.buying_controller import WrongWarehouseCompany
+ mr = webnotes.bean(copy=test_records[0])
+ mr.doc.company = "_Test Company 1"
+ self.assertRaises(WrongWarehouseCompany, mr.insert)
+
test_records = [
[
{
diff --git a/stock/doctype/purchase_receipt/purchase_receipt.txt b/stock/doctype/purchase_receipt/purchase_receipt.txt
index 3ecbb03..350777d 100755
--- a/stock/doctype/purchase_receipt/purchase_receipt.txt
+++ b/stock/doctype/purchase_receipt/purchase_receipt.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-01-22 15:24:18",
+ "creation": "2013-03-25 16:01:29",
"docstatus": 0,
"modified": "2013-02-02 19:09:37",
"modified_by": "Administrator",
@@ -31,9 +31,7 @@
"parent": "Purchase Receipt",
"parentfield": "permissions",
"parenttype": "DocType",
- "permlevel": 0,
- "read": 1,
- "report": 1
+ "read": 1
},
{
"doctype": "DocType",
@@ -886,44 +884,78 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "Material Manager",
+ "submit": 0,
+ "write": 0
},
{
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "role": "Purchase User",
- "submit": 1,
- "write": 1
- },
- {
- "doctype": "DocPerm",
- "match": "supplier",
- "role": "Supplier"
- },
- {
- "amend": 1,
- "cancel": 1,
- "create": 1,
- "doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
"role": "Material Manager",
"submit": 1,
"write": 1
},
{
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "report": 0,
+ "role": "Material User",
+ "submit": 0,
+ "write": 0
+ },
+ {
"amend": 1,
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
+ "permlevel": 0,
+ "report": 1,
"role": "Material User",
"submit": 1,
"write": 1
+ },
+ {
+ "amend": 1,
+ "cancel": 1,
+ "create": 1,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Purchase User",
+ "submit": 1,
+ "write": 1
+ },
+ {
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
+ "doctype": "DocPerm",
+ "match": "",
+ "permlevel": 1,
+ "role": "Purchase User",
+ "submit": 0
+ },
+ {
+ "doctype": "DocPerm",
+ "match": "supplier",
+ "permlevel": 0,
+ "report": 1,
+ "role": "Supplier"
}
]
\ No newline at end of file
diff --git a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
index 7f4e827..8cef6a3 100755
--- a/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
+++ b/stock/doctype/purchase_receipt_item/purchase_receipt_item.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-22 01:28:03",
+ "creation": "2013-03-07 11:42:59",
"docstatus": 0,
- "modified": "2013-03-07 07:03:28",
+ "modified": "2013-05-22 12:01:08",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -35,6 +35,7 @@
"oldfieldtype": "Link",
"options": "Item",
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"search_index": 1,
"width": "100px"
@@ -48,6 +49,7 @@
"oldfieldname": "item_name",
"oldfieldtype": "Data",
"print_hide": 1,
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -59,6 +61,7 @@
"oldfieldname": "description",
"oldfieldtype": "Text",
"print_width": "300px",
+ "read_only": 0,
"reqd": 1,
"width": "300px"
},
@@ -72,6 +75,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -84,6 +88,7 @@
"oldfieldname": "qty",
"oldfieldtype": "Currency",
"print_width": "100px",
+ "read_only": 0,
"width": "100px"
},
{
@@ -97,6 +102,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"search_index": 0,
"width": "100px"
},
@@ -110,6 +116,7 @@
"options": "UOM",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -119,14 +126,16 @@
"fieldtype": "Currency",
"label": "Ref Rate ",
"options": "currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "discount_rate",
"fieldtype": "Float",
"label": "Discount %",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "0.00",
@@ -139,6 +148,7 @@
"options": "currency",
"print_hide": 0,
"print_width": "100px",
+ "read_only": 0,
"width": "100px"
},
{
@@ -157,7 +167,8 @@
"fieldtype": "Currency",
"label": "Ref Rate*",
"options": "Company:company:default_currency",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"default": "0.00",
@@ -170,6 +181,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -184,6 +196,7 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 0,
"width": "100px"
},
@@ -198,6 +211,7 @@
"options": "Warehouse",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"width": "100px"
},
{
@@ -209,6 +223,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"reqd": 1,
"width": "100px"
},
@@ -235,6 +250,7 @@
"oldfieldname": "serial_no",
"oldfieldtype": "Text",
"print_hide": 0,
+ "read_only": 0,
"report_hide": 0
},
{
@@ -242,7 +258,8 @@
"fieldname": "rejected_serial_no",
"fieldtype": "Text",
"label": "Rejected Serial No",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -252,7 +269,8 @@
"oldfieldname": "batch_no",
"oldfieldtype": "Link",
"options": "Batch",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -278,6 +296,7 @@
"oldfieldname": "schedule_date",
"oldfieldtype": "Date",
"print_hide": 1,
+ "read_only": 0,
"report_hide": 0,
"reqd": 0
},
@@ -288,7 +307,8 @@
"in_filter": 1,
"label": "Project Name",
"options": "Project",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -299,7 +319,8 @@
"oldfieldname": "qa_no",
"oldfieldtype": "Link",
"options": "Quality Inspection",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -336,6 +357,7 @@
"oldfieldtype": "Currency",
"print_hide": 1,
"print_width": "100px",
+ "read_only": 0,
"width": "100px"
},
{
@@ -344,9 +366,11 @@
"fieldtype": "Data",
"hidden": 1,
"label": "Prevdoc Doctype",
+ "no_copy": 1,
"oldfieldname": "prevdoc_doctype",
"oldfieldtype": "Data",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -355,7 +379,7 @@
"hidden": 0,
"in_filter": 1,
"label": "PO No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_docname",
"oldfieldtype": "Link",
"options": "Purchase Order",
@@ -373,6 +397,7 @@
"hidden": 1,
"in_filter": 1,
"label": "PO Date",
+ "no_copy": 1,
"oldfieldname": "prevdoc_date",
"oldfieldtype": "Date",
"print_hide": 1,
@@ -418,7 +443,7 @@
"hidden": 1,
"in_filter": 1,
"label": "Purchase Order Item No",
- "no_copy": 0,
+ "no_copy": 1,
"oldfieldname": "prevdoc_detail_docname",
"oldfieldtype": "Data",
"print_hide": 1,
@@ -479,6 +504,7 @@
"label": "Page Break",
"oldfieldname": "page_break",
"oldfieldtype": "Check",
- "print_hide": 1
+ "print_hide": 1,
+ "read_only": 0
}
]
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.py b/stock/doctype/serial_no/serial_no.py
index bbf55b3..09181db 100644
--- a/stock/doctype/serial_no/serial_no.py
+++ b/stock/doctype/serial_no/serial_no.py
@@ -19,7 +19,7 @@
from webnotes.utils import cint, getdate, nowdate
import datetime
-from webnotes import msgprint
+from webnotes import msgprint, _
from controllers.stock_controller import StockController
@@ -117,8 +117,11 @@
self.make_stock_ledger_entry(1)
self.make_gl_entries()
- def on_rename(self, new, old):
+ def on_rename(self, new, old, merge=False):
"""rename serial_no text fields"""
+ if merge:
+ msgprint(_("Sorry. Serial Nos. cannot be merged"), raise_exception=True)
+
for dt in webnotes.conn.sql("""select parent from tabDocField
where fieldname='serial_no' and fieldtype='Text'"""):
@@ -139,7 +142,8 @@
gl_entries = self.get_gl_entries_for_stock(against_stock_account, self.doc.purchase_rate)
for entry in gl_entries:
- entry["posting_date"] = self.doc.purchase_date
+ entry["posting_date"] = self.doc.purchase_date or (self.doc.creation and
+ self.doc.creation.split(' ')[0]) or nowdate()
if gl_entries:
make_gl_entries(gl_entries, cancel)
\ No newline at end of file
diff --git a/stock/doctype/serial_no/serial_no.txt b/stock/doctype/serial_no/serial_no.txt
index 086575f..33160c7 100644
--- a/stock/doctype/serial_no/serial_no.txt
+++ b/stock/doctype/serial_no/serial_no.txt
@@ -1,14 +1,14 @@
[
{
- "creation": "2013-01-10 16:34:29",
+ "creation": "2013-05-16 10:59:15",
"docstatus": 0,
- "modified": "2013-01-29 16:27:57",
+ "modified": "2013-06-20 11:23:01",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
"allow_attach": 1,
- "allow_rename": 1,
+ "allow_rename": 0,
"autoname": "field:serial_no",
"description": "Distinct unit of an Item",
"doctype": "DocType",
@@ -32,7 +32,9 @@
"parentfield": "permissions",
"parenttype": "DocType",
"permlevel": 0,
- "read": 1
+ "read": 1,
+ "report": 1,
+ "submit": 0
},
{
"doctype": "DocType",
@@ -43,12 +45,14 @@
"fieldname": "details",
"fieldtype": "Section Break",
"label": "Details",
- "oldfieldtype": "Section Break"
+ "oldfieldtype": "Section Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break0",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"default": "In Store",
@@ -75,6 +79,7 @@
"no_copy": 1,
"oldfieldname": "serial_no",
"oldfieldtype": "Data",
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -88,13 +93,15 @@
"oldfieldname": "item_code",
"oldfieldtype": "Link",
"options": "Item",
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
{
"doctype": "DocField",
"fieldname": "column_break1",
- "fieldtype": "Column Break"
+ "fieldtype": "Column Break",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -146,12 +153,14 @@
"doctype": "DocField",
"fieldname": "purchase_details",
"fieldtype": "Section Break",
- "label": "Purchase Details"
+ "label": "Purchase Details",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break2",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -160,7 +169,8 @@
"fieldtype": "Select",
"label": "Purchase Document Type",
"no_copy": 1,
- "options": "\nPurchase Receipt\nStock Entry"
+ "options": "\nPurchase Receipt\nStock Entry",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -168,7 +178,8 @@
"fieldtype": "Data",
"hidden": 0,
"label": "Purchase Document No",
- "no_copy": 1
+ "no_copy": 1,
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -179,6 +190,7 @@
"no_copy": 1,
"oldfieldname": "purchase_date",
"oldfieldtype": "Date",
+ "read_only": 0,
"reqd": 0,
"search_index": 0
},
@@ -188,6 +200,7 @@
"fieldtype": "Time",
"label": "Incoming Time",
"no_copy": 1,
+ "read_only": 0,
"reqd": 1
},
{
@@ -200,6 +213,7 @@
"oldfieldname": "purchase_rate",
"oldfieldtype": "Currency",
"options": "Company:company:default_currency",
+ "read_only": 0,
"reqd": 1,
"search_index": 0
},
@@ -207,6 +221,7 @@
"doctype": "DocField",
"fieldname": "column_break3",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -220,6 +235,7 @@
"oldfieldname": "warehouse",
"oldfieldtype": "Link",
"options": "Warehouse",
+ "read_only": 0,
"reqd": 0,
"search_index": 1
},
@@ -230,7 +246,8 @@
"in_filter": 1,
"label": "Supplier",
"no_copy": 1,
- "options": "Supplier"
+ "options": "Supplier",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -254,12 +271,14 @@
"fieldname": "delivery_details",
"fieldtype": "Section Break",
"label": "Delivery Details",
- "oldfieldtype": "Column Break"
+ "oldfieldtype": "Column Break",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break4",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -318,12 +337,14 @@
"oldfieldname": "is_cancelled",
"oldfieldtype": "Select",
"options": "\nYes\nNo",
+ "read_only": 0,
"report_hide": 1
},
{
"doctype": "DocField",
"fieldname": "column_break5",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -378,12 +399,14 @@
"doctype": "DocField",
"fieldname": "warranty_amc_details",
"fieldtype": "Section Break",
- "label": "Warranty / AMC Details"
+ "label": "Warranty / AMC Details",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "column_break6",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -396,6 +419,7 @@
"oldfieldname": "maintenance_status",
"oldfieldtype": "Select",
"options": "\nUnder Warranty\nOut of Warranty\nUnder AMC\nOut of AMC",
+ "read_only": 0,
"search_index": 1,
"width": "150px"
},
@@ -406,12 +430,14 @@
"label": "Warranty Period (Days)",
"oldfieldname": "warranty_period",
"oldfieldtype": "Int",
+ "read_only": 0,
"width": "150px"
},
{
"doctype": "DocField",
"fieldname": "column_break7",
"fieldtype": "Column Break",
+ "read_only": 0,
"width": "50%"
},
{
@@ -422,6 +448,7 @@
"label": "Warranty Expiry Date",
"oldfieldname": "warranty_expiry_date",
"oldfieldtype": "Date",
+ "read_only": 0,
"width": "150px"
},
{
@@ -432,6 +459,7 @@
"label": "AMC Expiry Date",
"oldfieldname": "amc_expiry_date",
"oldfieldtype": "Date",
+ "read_only": 0,
"search_index": 0,
"width": "150px"
},
@@ -439,13 +467,15 @@
"doctype": "DocField",
"fieldname": "more_info",
"fieldtype": "Section Break",
- "label": "More Info"
+ "label": "More Info",
+ "read_only": 0
},
{
"doctype": "DocField",
"fieldname": "serial_no_details",
"fieldtype": "Text Editor",
- "label": "Serial No Details"
+ "label": "Serial No Details",
+ "read_only": 0
},
{
"doctype": "DocField",
@@ -454,6 +484,7 @@
"in_filter": 1,
"label": "Company",
"options": "link:Company",
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -464,6 +495,7 @@
"in_filter": 1,
"label": "Fiscal Year",
"options": "link:Fiscal Year",
+ "read_only": 0,
"reqd": 1,
"search_index": 1
},
@@ -478,15 +510,6 @@
},
{
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
- "doctype": "DocField",
"fieldname": "sle_exists",
"fieldtype": "Check",
"hidden": 1,
@@ -500,21 +523,30 @@
"cancel": 1,
"create": 1,
"doctype": "DocPerm",
- "report": 1,
- "role": "Material User",
- "submit": 0,
+ "role": "System Manager",
"write": 1
},
{
+ "cancel": 1,
+ "create": 1,
"doctype": "DocPerm",
- "role": "Sales User"
+ "role": "Material Master Manager",
+ "write": 1
},
{
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
"doctype": "DocPerm",
- "role": "Purchase User"
+ "role": "Material Manager",
+ "write": 0
},
{
+ "amend": 0,
+ "cancel": 0,
+ "create": 0,
"doctype": "DocPerm",
- "role": "Accounts User"
+ "role": "Material User",
+ "write": 0
}
]
\ No newline at end of file
diff --git a/stock/doctype/stock_entry/stock_entry.py b/stock/doctype/stock_entry/stock_entry.py
index fa60072..522a14a 100644
--- a/stock/doctype/stock_entry/stock_entry.py
+++ b/stock/doctype/stock_entry/stock_entry.py
@@ -57,6 +57,7 @@
self.validate_return_reference_doc()
self.validate_with_material_request()
self.validate_fiscal_year()
+ self.set_total_amount()
def on_submit(self):
self.update_serial_no(1)
@@ -174,6 +175,9 @@
elif self.doc.purpose != "Material Transfer":
self.doc.production_order = None
+ def set_total_amount(self):
+ self.doc.total_amount = sum([flt(item.amount) for item in self.doclist.get({"parentfield": "mtn_details"})])
+
def make_gl_entries(self):
if not cint(webnotes.defaults.get_global_default("auto_inventory_accounting")):
return
@@ -194,10 +198,10 @@
total_valuation_amount = 0
for item in self.doclist.get({"parentfield": "mtn_details"}):
if item.t_warehouse and not item.s_warehouse:
- total_valuation_amount += flt(item.incoming_rate) * flt(item.transfer_qty)
+ total_valuation_amount += flt(item.incoming_rate, 2) * flt(item.transfer_qty)
if item.s_warehouse and not item.t_warehouse:
- total_valuation_amount -= flt(item.incoming_rate) * flt(item.transfer_qty)
+ total_valuation_amount -= flt(item.incoming_rate, 2) * flt(item.transfer_qty)
return total_valuation_amount
@@ -220,7 +224,7 @@
if not flt(d.incoming_rate):
d.incoming_rate = self.get_incoming_rate(args)
- d.amount = flt(d.qty) * flt(d.incoming_rate)
+ d.amount = flt(d.transfer_qty) * flt(d.incoming_rate)
def get_incoming_rate(self, args):
incoming_rate = 0
@@ -502,17 +506,13 @@
if self.doc.use_multi_level_bom:
# get all raw materials with sub assembly childs
- fl_bom_sa_child_item = sql("""select
- item_code,ifnull(sum(qty_consumed_per_unit),0)*%s as qty,
- description,stock_uom
- from ( select distinct fb.name, fb.description, fb.item_code,
- fb.qty_consumed_per_unit, fb.stock_uom
- from `tabBOM Explosion Item` fb,`tabItem` it
- where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No'
- and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus<2
- and fb.parent=%s
- ) a
- group by item_code, stock_uom""" , (qty, self.doc.bom_no), as_dict=1)
+ fl_bom_sa_child_item = sql("""select fb.item_code,
+ ifnull(sum(fb.qty_consumed_per_unit),0)*%s as qty, fb.description, fb.stock_uom
+ from `tabBOM Explosion Item` fb,`tabItem` it
+ where it.name = fb.item_code and ifnull(it.is_pro_applicable, 'No') = 'No'
+ and ifnull(it.is_sub_contracted_item, 'No') = 'No' and fb.docstatus < 2
+ and fb.parent=%s group by item_code, stock_uom""",
+ (qty, self.doc.bom_no), as_dict=1)
if fl_bom_sa_child_item:
_make_items_dict(fl_bom_sa_child_item)
@@ -520,10 +520,10 @@
# Get all raw materials considering multi level BOM,
# if multi level bom consider childs of Sub-Assembly items
fl_bom_sa_items = sql("""select item_code,
- ifnull(sum(qty_consumed_per_unit), 0) * '%s' as qty,
+ ifnull(sum(qty_consumed_per_unit), 0) *%s as qty,
description, stock_uom from `tabBOM Item`
- where parent = '%s' and docstatus < 2
- group by item_code""" % (qty, self.doc.bom_no), as_dict=1)
+ where parent = %s and docstatus < 2
+ group by item_code""", (qty, self.doc.bom_no), as_dict=1)
if fl_bom_sa_items:
_make_items_dict(fl_bom_sa_items)
@@ -607,7 +607,7 @@
'voucher_no': self.doc.name,
'voucher_detail_no': d.name,
'actual_qty': qty,
- 'incoming_rate': flt(d.incoming_rate) or 0,
+ 'incoming_rate': flt(d.incoming_rate, 2) or 0,
'stock_uom': d.stock_uom,
'company': self.doc.company,
'is_cancelled': (is_cancelled ==1) and 'Yes' or 'No',
diff --git a/stock/doctype/stock_entry/stock_entry.txt b/stock/doctype/stock_entry/stock_entry.txt
index fef710b..d88b0b7 100644
--- a/stock/doctype/stock_entry/stock_entry.txt
+++ b/stock/doctype/stock_entry/stock_entry.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-28 15:56:40",
+ "creation": "2013-04-09 11:43:55",
"docstatus": 0,
- "modified": "2013-03-29 15:31:42",
+ "modified": "2013-05-09 13:31:00",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -520,6 +520,14 @@
},
{
"doctype": "DocField",
+ "fieldname": "total_amount",
+ "fieldtype": "Currency",
+ "label": "Total Amount",
+ "options": "Company:company:default_currency",
+ "read_only": 1
+ },
+ {
+ "doctype": "DocField",
"fieldname": "project_name",
"fieldtype": "Link",
"in_filter": 1,
@@ -559,6 +567,14 @@
"reqd": 1
},
{
+ "doctype": "DocField",
+ "fieldname": "col5",
+ "fieldtype": "Column Break",
+ "print_width": "50%",
+ "read_only": 0,
+ "width": "50%"
+ },
+ {
"allow_on_submit": 0,
"doctype": "DocField",
"fieldname": "company",
@@ -577,14 +593,6 @@
"search_index": 0
},
{
- "doctype": "DocField",
- "fieldname": "col5",
- "fieldtype": "Column Break",
- "print_width": "50%",
- "read_only": 0,
- "width": "50%"
- },
- {
"allow_on_submit": 0,
"doctype": "DocField",
"fieldname": "amended_from",
diff --git a/stock/doctype/stock_entry/test_stock_entry.py b/stock/doctype/stock_entry/test_stock_entry.py
index 7c406f8..2ab2b1d 100644
--- a/stock/doctype/stock_entry/test_stock_entry.py
+++ b/stock/doctype/stock_entry/test_stock_entry.py
@@ -21,10 +21,15 @@
st2.insert()
st2.submit()
+ from stock.utils import reorder_item
+ reorder_item()
+
mr_name = webnotes.conn.sql("""select parent from `tabMaterial Request Item`
where item_code='_Test Item'""")
self.assertTrue(mr_name)
+
+ webnotes.conn.set_default("company", self.old_default_company)
def test_warehouse_company_validation(self):
from stock.doctype.stock_ledger_entry.stock_ledger_entry import InvalidWarehouseCompany
@@ -71,7 +76,7 @@
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
def test_material_issue_gl_entry(self):
- webnotes.conn.sql("delete from `tabStock Ledger Entry`")
+ self._clear_stock()
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
mr = webnotes.bean(copy=test_records[0])
@@ -111,9 +116,10 @@
)
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
+ webnotes.conn.set_default("company", self.old_default_company)
def test_material_transfer_gl_entry(self):
- webnotes.conn.sql("delete from `tabStock Ledger Entry`")
+ self._clear_stock()
webnotes.defaults.set_global_default("auto_inventory_accounting", 1)
mr = webnotes.bean(copy=test_records[0])
@@ -145,6 +151,7 @@
self.assertFalse(gl_entries)
webnotes.defaults.set_global_default("auto_inventory_accounting", 0)
+ webnotes.conn.set_default("company", self.old_default_company)
def check_stock_ledger_entries(self, voucher_type, voucher_no, expected_sle):
# check stock ledger entries
@@ -173,6 +180,9 @@
def _clear_stock(self):
webnotes.conn.sql("delete from `tabStock Ledger Entry`")
webnotes.conn.sql("""delete from `tabBin`""")
+
+ self.old_default_company = webnotes.conn.get_default("company")
+ webnotes.conn.set_default("company", "_Test Company")
def _insert_material_receipt(self):
self._clear_stock()
@@ -185,6 +195,8 @@
se2.insert()
se2.submit()
+ webnotes.conn.set_default("company", self.old_default_company)
+
def _get_actual_qty(self):
return flt(webnotes.conn.get_value("Bin", {"item_code": "_Test Item",
"warehouse": "_Test Warehouse"}, "actual_qty"))
@@ -463,6 +475,8 @@
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
+ webnotes.conn.set_default("company", self.old_default_company)
+
return se, pr.doc.name
def test_over_stock_return(self):
@@ -563,6 +577,8 @@
self.assertEquals(actual_qty_1 - 5, actual_qty_2)
+ webnotes.conn.set_default("company", self.old_default_company)
+
return se, pr.doc.name
test_records = [
diff --git a/stock/doctype/stock_ledger/stock_ledger.py b/stock/doctype/stock_ledger/stock_ledger.py
index 3c83de3..8fdb50e 100644
--- a/stock/doctype/stock_ledger/stock_ledger.py
+++ b/stock/doctype/stock_ledger/stock_ledger.py
@@ -114,7 +114,8 @@
def update_serial_purchase_details(self, obj, d, serial_no, is_submit, purpose = '', rejected=None):
exists = webnotes.conn.sql("select name, status, docstatus from `tabSerial No` where name = '%s'" % (serial_no))
if is_submit:
- if exists and exists[0][2] != 2 and purpose not in ['Material Transfer', 'Sales Return']:
+ if exists and exists[0][2] != 2 and \
+ purpose not in ['Material Transfer', "Material Receipt", 'Sales Return']:
msgprint("Serial No: %s already %s" % (serial_no, exists and exists[0][1]), raise_exception = 1)
elif exists:
s = Document('Serial No', exists and exists[0][0])
diff --git a/stock/doctype/stock_reconciliation/stock_reconciliation.txt b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
index 760620b..9b5b2a1 100644
--- a/stock/doctype/stock_reconciliation/stock_reconciliation.txt
+++ b/stock/doctype/stock_reconciliation/stock_reconciliation.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-26 06:51:17",
+ "creation": "2013-03-28 10:35:31",
"docstatus": 0,
- "modified": "2013-03-26 08:32:03",
+ "modified": "2013-04-10 13:44:19",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -52,6 +52,7 @@
"fieldname": "posting_date",
"fieldtype": "Date",
"in_filter": 0,
+ "in_list_view": 1,
"label": "Posting Date",
"oldfieldname": "reconciliation_date",
"oldfieldtype": "Date",
@@ -63,6 +64,7 @@
"fieldname": "posting_time",
"fieldtype": "Time",
"in_filter": 0,
+ "in_list_view": 1,
"label": "Posting Time",
"oldfieldname": "reconciliation_time",
"oldfieldtype": "Time",
@@ -148,6 +150,7 @@
"fieldname": "stock_value_difference",
"fieldtype": "Currency",
"hidden": 1,
+ "in_list_view": 1,
"label": "Stock Value Difference",
"print_hide": 1
},
diff --git a/stock/doctype/warehouse/test_warehouse.py b/stock/doctype/warehouse/test_warehouse.py
index 26501be..f3a0458 100644
--- a/stock/doctype/warehouse/test_warehouse.py
+++ b/stock/doctype/warehouse/test_warehouse.py
@@ -2,7 +2,8 @@
[{
"doctype": "Warehouse",
"warehouse_name": "_Test Warehouse",
- "warehouse_type": "_Test Warehouse Type"
+ "warehouse_type": "_Test Warehouse Type",
+ "company": "_Test Company"
}],
[{
"doctype": "Warehouse",
diff --git a/stock/page/stock_ageing/stock_ageing.js b/stock/page/stock_ageing/stock_ageing.js
index edad9a7..456f5f1 100644
--- a/stock/page/stock_ageing/stock_ageing.js
+++ b/stock/page/stock_ageing/stock_ageing.js
@@ -95,6 +95,8 @@
this.data = [].concat(this._data);
+ this.serialized_buying_rates = this.get_serialized_buying_rates();
+
$.each(this.data, function(i, d) {
me.reset_item_values(d);
});
diff --git a/stock/page/stock_balance/stock_balance.js b/stock/page/stock_balance/stock_balance.js
index 163b74f..f4deb4f 100644
--- a/stock/page/stock_balance/stock_balance.js
+++ b/stock/page/stock_balance/stock_balance.js
@@ -119,7 +119,7 @@
var qty_diff = sl.qty;
var value_diff = me.get_value_diff(wh, sl, is_fifo);
-
+
if(sl_posting_date < from_date) {
item.opening_qty += qty_diff;
item.opening_value += value_diff;
@@ -146,6 +146,8 @@
} else {
break;
}
+
+ me.round_item_values(item);
}
}
diff --git a/stock/page/stock_home/stock_home.js b/stock/page/stock_home/stock_home.js
index db77fce..532eb66 100644
--- a/stock/page/stock_home/stock_home.js
+++ b/stock/page/stock_home/stock_home.js
@@ -197,6 +197,42 @@
route: "query-report/Item-Wise Price List",
doctype: "Item"
},
+ {
+ "label":wn._("Purchase In Transit"),
+ route: "query-report/Purchase In Transit",
+ },
+ {
+ "label":wn._("Requested Items To Be Transferred"),
+ route: "query-report/Requested Items To Be Transferred",
+ },
+ {
+ "label":wn._("Batch-Wise Balance History"),
+ route: "query-report/Batch-Wise Balance History",
+ },
+ {
+ "label":wn._("Warehouse-Wise Stock Balance"),
+ route: "query-report/Warehouse-Wise Stock Balance",
+ },
+ {
+ "label":wn._("Item Prices"),
+ route: "query-report/Item Prices",
+
+ },
+ {
+ "label":wn._("Itemwise Recommended Reorder Level"),
+ route: "query-report/Itemwise Recommended Reorder Level",
+ doctype: "Item"
+ },
+ {
+ "label":wn._("Delivery Note Trends"),
+ route: "query-report/Delivery Note Trends",
+ doctype: "Delivery Note"
+ },
+ {
+ "label":wn._("Purchase Receipt Trends"),
+ route: "query-report/Purchase Receipt Trends",
+ doctype: "Purchase Receipt"
+ },
]
}
]
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/batch_wise_balance_history/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/batch_wise_balance_history/__init__.py
diff --git a/stock/report/batch_wise_balance_history/batch_wise_balance_history.js b/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
new file mode 100644
index 0000000..98293e4
--- /dev/null
+++ b/stock/report/batch_wise_balance_history/batch_wise_balance_history.js
@@ -0,0 +1,18 @@
+wn.query_reports["Batch-Wise Balance History"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "width": "80",
+ "default": sys_defaults.year_start_date,
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "width": "80",
+ "default": wn.datetime.get_today()
+ }
+ ]
+}
\ No newline at end of file
diff --git a/stock/report/batch_wise_balance_history/batch_wise_balance_history.py b/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
new file mode 100644
index 0000000..530465e
--- /dev/null
+++ b/stock/report/batch_wise_balance_history/batch_wise_balance_history.py
@@ -0,0 +1,98 @@
+# 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
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ item_map = get_item_details(filters)
+ iwb_map = get_item_warehouse_batch_map(filters)
+
+ data = []
+ for item in sorted(iwb_map):
+ for wh in sorted(iwb_map[item]):
+ for batch in sorted(iwb_map[item][wh]):
+ qty_dict = iwb_map[item][wh][batch]
+ data.append([item, item_map[item]["item_name"],
+ item_map[item]["description"], wh, batch,
+ qty_dict.opening_qty, qty_dict.in_qty,
+ qty_dict.out_qty, qty_dict.bal_qty
+ ])
+
+ return columns, data
+
+def get_columns(filters):
+ """return columns based on filters"""
+
+ columns = ["Item:Link/Item:100"] + ["Item Name::150"] + ["Description::150"] + \
+ ["Warehouse:Link/Warehouse:100"] + ["Batch:Link/Batch:100"] + ["Opening Qty::90"] + \
+ ["In Qty::80"] + ["Out Qty::80"] + ["Balance Qty::90"]
+
+ return columns
+
+def get_conditions(filters):
+ conditions = ""
+ if not filters.get("from_date"):
+ webnotes.msgprint("Please enter From Date", raise_exception=1)
+
+ if filters.get("to_date"):
+ conditions += " and posting_date <= '%s'" % filters["to_date"]
+ else:
+ webnotes.msgprint("Please enter To Date", raise_exception=1)
+
+ return conditions
+
+#get all details
+def get_stock_ledger_entries(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select item_code, batch_no, warehouse,
+ posting_date, actual_qty
+ from `tabStock Ledger Entry`
+ where ifnull(is_cancelled, 'No') = 'No' %s order by item_code, warehouse""" %
+ conditions, as_dict=1)
+
+def get_item_warehouse_batch_map(filters):
+ sle = get_stock_ledger_entries(filters)
+ iwb_map = {}
+
+ for d in sle:
+ iwb_map.setdefault(d.item_code, {}).setdefault(d.warehouse, {})\
+ .setdefault(d.batch_no, webnotes._dict({
+ "opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
+ }))
+ qty_dict = iwb_map[d.item_code][d.warehouse][d.batch_no]
+ if d.posting_date < filters["from_date"]:
+ qty_dict.opening_qty += flt(d.actual_qty)
+ elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
+ if flt(d.actual_qty) > 0:
+ qty_dict.in_qty += flt(d.actual_qty)
+ else:
+ qty_dict.out_qty += abs(flt(d.actual_qty))
+
+ qty_dict.bal_qty += flt(d.actual_qty)
+
+ return iwb_map
+
+def get_item_details(filters):
+ item_map = {}
+ for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
+ item_map.setdefault(d.name, d)
+
+ return item_map
\ No newline at end of file
diff --git a/stock/report/batch_wise_balance_history/batch_wise_balance_history.txt b/stock/report/batch_wise_balance_history/batch_wise_balance_history.txt
new file mode 100644
index 0000000..9e795b9
--- /dev/null
+++ b/stock/report/batch_wise_balance_history/batch_wise_balance_history.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-04 11:03:47",
+ "docstatus": 0,
+ "modified": "2013-06-04 19:32:27",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Stock Ledger Entry",
+ "report_name": "Batch-Wise Balance History",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Batch-Wise Balance History"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/delivery_note_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/delivery_note_trends/__init__.py
diff --git a/stock/report/delivery_note_trends/delivery_note_trends.js b/stock/report/delivery_note_trends/delivery_note_trends.js
new file mode 100644
index 0000000..3ec5e59
--- /dev/null
+++ b/stock/report/delivery_note_trends/delivery_note_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/sales_trends_filters.js");
+
+wn.query_reports["Delivery Note Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/stock/report/delivery_note_trends/delivery_note_trends.py
similarity index 74%
copy from patches/september_2012/reload_gross_profit.py
copy to stock/report/delivery_note_trends/delivery_note_trends.py
index 0a3f9ef..e5b2cd0 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/stock/report/delivery_note_trends/delivery_note_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns,get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Delivery Note")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/stock/report/delivery_note_trends/delivery_note_trends.txt b/stock/report/delivery_note_trends/delivery_note_trends.txt
new file mode 100644
index 0000000..bb87200
--- /dev/null
+++ b/stock/report/delivery_note_trends/delivery_note_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:42:11",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:42:11",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Delivery Note",
+ "report_name": "Delivery Note Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Delivery Note Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/item_prices/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/item_prices/__init__.py
diff --git a/stock/report/item_prices/item_prices.py b/stock/report/item_prices/item_prices.py
new file mode 100644
index 0000000..fb69086
--- /dev/null
+++ b/stock/report/item_prices/item_prices.py
@@ -0,0 +1,150 @@
+# 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
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ item_map = get_item_details()
+ pl = get_price_list()
+ last_purchase_rate = get_last_purchase_rate()
+ bom_rate = get_item_bom_rate()
+ val_rate_map = get_valuation_rate()
+
+ precision = webnotes.conn.get_value("Global Defaults", None, "float_precision") or 2
+
+ data = []
+ for item in sorted(item_map):
+ data.append([item, item_map[item]["item_name"],
+ item_map[item]["description"], item_map[item]["stock_uom"],
+ flt(last_purchase_rate.get(item, 0), precision),
+ flt(val_rate_map.get(item, 0), precision),
+ pl.get(item, {}).get("selling"),
+ pl.get(item, {}).get("buying"),
+ flt(bom_rate.get(item, 0), precision),
+ flt(item_map[item]["standard_rate"], precision)
+ ])
+
+ return columns, data
+
+def get_columns(filters):
+ """return columns based on filters"""
+
+ columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", "UOM:Link/UOM:80",
+ "Last Purchase Rate:Currency:90", "Valuation Rate:Currency:80", "Sales Price List::80",
+ "Purchase Price List::80", "BOM Rate:Currency:90", "Standard Rate:Currency:100"]
+
+ return columns
+
+def get_item_details():
+ """returns all items details"""
+
+ item_map = {}
+
+ for i in webnotes.conn.sql("select name, item_name, description, \
+ stock_uom, standard_rate from tabItem \
+ order by item_code", as_dict=1):
+ item_map.setdefault(i.name, i)
+
+ return item_map
+
+def get_price_list():
+ """Get selling & buying price list of every item"""
+
+ rate = {}
+
+ price_list = webnotes.conn.sql("""select parent, selling, buying,
+ concat(price_list_name, " - ", ref_currency, " ", ref_rate) as price
+ from `tabItem Price` where docstatus<2""", as_dict=1)
+
+ for j in price_list:
+ if j.price:
+ if j.selling:
+ rate.setdefault(j.parent, {}).setdefault("selling", []).append(j.price)
+ if j.buying:
+ rate.setdefault(j.parent, {}).setdefault("buying", []).append(j.price)
+
+ item_rate_map = {}
+
+ for item in rate:
+ item_rate_map.setdefault(item, {}).setdefault("selling",
+ ", ".join(rate[item].get("selling", [])))
+ item_rate_map[item]["buying"] = ", ".join(rate[item].get("buying", []))
+
+ return item_rate_map
+
+def get_last_purchase_rate():
+
+ item_last_purchase_rate_map = {}
+
+ query = """select * from (select
+ result.item_code,
+ result.purchase_rate
+ from (
+ (select
+ po_item.item_code,
+ po_item.item_name,
+ po.transaction_date as posting_date,
+ po_item.purchase_ref_rate,
+ po_item.discount_rate,
+ po_item.purchase_rate
+ from `tabPurchase Order` po, `tabPurchase Order Item` po_item
+ where po.name = po_item.parent and po.docstatus = 1)
+ union
+ (select
+ pr_item.item_code,
+ pr_item.item_name,
+ pr.posting_date,
+ pr_item.purchase_ref_rate,
+ pr_item.discount_rate,
+ pr_item.purchase_rate
+ from `tabPurchase Receipt` pr, `tabPurchase Receipt Item` pr_item
+ where pr.name = pr_item.parent and pr.docstatus = 1)
+ ) result
+ order by result.item_code asc, result.posting_date desc) result_wrapper
+ group by item_code"""
+
+ for d in webnotes.conn.sql(query, as_dict=1):
+ item_last_purchase_rate_map.setdefault(d.item_code, d.purchase_rate)
+
+ return item_last_purchase_rate_map
+
+def get_item_bom_rate():
+ """Get BOM rate of an item from BOM"""
+
+ item_bom_map = {}
+
+ for b in webnotes.conn.sql("""select item, (total_cost/quantity) as bom_rate
+ from `tabBOM` where is_active=1 and is_default=1""", as_dict=1):
+ item_bom_map.setdefault(b.item, flt(b.bom_rate))
+
+ return item_bom_map
+
+def get_valuation_rate():
+ """Get an average valuation rate of an item from all warehouses"""
+
+ item_val_rate_map = {}
+
+ for d in webnotes.conn.sql("""select item_code,
+ sum(actual_qty*valuation_rate)/sum(actual_qty) as val_rate
+ from tabBin where actual_qty > 0 group by item_code""", as_dict=1):
+ item_val_rate_map.setdefault(d.item_code, d.val_rate)
+
+ return item_val_rate_map
diff --git a/stock/report/item_prices/item_prices.txt b/stock/report/item_prices/item_prices.txt
new file mode 100644
index 0000000..4c49ca1
--- /dev/null
+++ b/stock/report/item_prices/item_prices.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-05 11:43:30",
+ "docstatus": 0,
+ "modified": "2013-06-05 11:43:30",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Stock Ledger Entry",
+ "report_name": "Item Prices",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Item Prices"
+ }
+]
\ No newline at end of file
diff --git a/stock/report/item_wise_price_list/item_wise_price_list.txt b/stock/report/item_wise_price_list/item_wise_price_list.txt
index 6c2afad..824c603 100644
--- a/stock/report/item_wise_price_list/item_wise_price_list.txt
+++ b/stock/report/item_wise_price_list/item_wise_price_list.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-02 14:22:51",
+ "creation": "2013-02-22 18:01:55",
"docstatus": 0,
- "modified": "2013-02-22 15:53:01",
+ "modified": "2013-05-07 11:50:46",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
- "query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.price_list_name as \"Price List::80\",\n item_price.ref_currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Currency:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price\nwhere\n item_price.parent = item.name",
+ "query": "select\n item.name as \"ID:Link/Item:120\", \n item.item_name as \"Item Name::120\", \n item_price.price_list_name as \"Price List::80\",\n item_price.ref_currency as \"Currency::40\", \n item_price.ref_rate as \"Rate:Float:80\",\n item.description as \"Description::160\",\n item.item_group as \"Item Group:Link/Item Group:100\",\n item.brand as \"Brand::100\"\nfrom `tabItem` item, `tabItem Price` item_price\nwhere\n item_price.parent = item.name",
"ref_doctype": "Item",
"report_name": "Item-Wise Price List",
"report_type": "Query Report"
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/itemwise_recommended_reorder_level/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/itemwise_recommended_reorder_level/__init__.py
diff --git a/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
new file mode 100644
index 0000000..b8aa378
--- /dev/null
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.js
@@ -0,0 +1,16 @@
+wn.query_reports["Itemwise Recommended Reorder Level"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "default": sys_defaults.year_start_date
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "default": get_today()
+ }
+ ]
+}
\ No newline at end of file
diff --git a/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
new file mode 100644
index 0000000..588132f
--- /dev/null
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.py
@@ -0,0 +1,104 @@
+# 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/>.
+
+import webnotes
+from webnotes.utils import getdate, flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+ float_preceision = webnotes.conn.get_default("float_preceision")
+
+ condition =get_condition(filters)
+
+ avg_daily_outgoing = 0
+ diff = ((getdate(filters.get("to_date")) - getdate(filters.get("from_date"))).days)+1
+ if diff <= 0:
+ webnotes.msgprint("To Date should not be less than eual to From Date",raise_exception=1)
+
+ columns = get_columns()
+ items = get_item_info()
+ consumed_item_map = get_consumed_items(condition)
+ delivered_item_map = get_delivered_items(condition)
+
+ data = []
+ for item in items:
+
+ total_outgoing = consumed_item_map.get(item.name, 0)+delivered_item_map.get(item.name,0)
+ avg_daily_outgoing = flt(total_outgoing/diff, float_preceision)
+ reorder_level = (avg_daily_outgoing * flt(item.lead_time_days)) + flt(item.min_order_qty)
+
+ data.append([item.name, item.item_name, item.description, item.min_order_qty, item.lead_time_days,
+ consumed_item_map.get(item.name, 0), delivered_item_map.get(item.name,0), total_outgoing,
+ avg_daily_outgoing, reorder_level])
+
+ return columns , data
+
+def get_columns():
+ return[
+ "Item:Link/Item:120", "Item name:Data:120", "Description::160",
+ "Minimum Inventory Level:Float:160", "Lead Time Days:Float:120", "Consumed:Float:120",
+ "Delivered:Float:120", "Total Outgoing:Float:120", "Avg Daily Outgoing:Float:160",
+ "Reorder Level:Float:120"
+ ]
+
+def get_item_info():
+ return webnotes.conn.sql("""select name, item_name, description, min_order_qty,
+ lead_time_days from tabItem""", as_dict=1)
+
+def get_consumed_items(condition):
+
+ cn_items = webnotes.conn.sql("""select se_item.item_code,
+ sum(se_item.actual_qty) as 'consume_qty'
+ from `tabStock Entry` se, `tabStock Entry Detail` se_item
+ where se.name = se_item.parent and se.docstatus = 1
+ and ifnull(se_item.t_warehouse, '') = '' %s
+ group by se_item.item_code""" % (condition), as_dict=1)
+
+ cn_items_map = {}
+ for item in cn_items:
+ cn_items_map.setdefault(item.item_code, item.consume_qty)
+
+ return cn_items_map
+
+def get_delivered_items(condition):
+
+ dn_items = webnotes.conn.sql("""select dn_item.item_code, sum(dn_item.qty) as dn_qty
+ from `tabDelivery Note` dn, `tabDelivery Note Item` dn_item
+ where dn.name = dn_item.parent and dn.docstatus = 1 %s
+ group by dn_item.item_code""" % (condition), as_dict=1)
+
+ si_items = webnotes.conn.sql("""select si_item.item_name, sum(si_item.qty) as si_qty
+ from `tabSales Invoice` si, `tabSales Invoice Item` si_item
+ where si.name = si_item.parent and si.docstatus = 1 and
+ ifnull(si.update_stock, 0) = 1 and ifnull(si.is_pos, 0) = 1 %s
+ group by si_item.item_name""" % (condition), as_dict=1)
+
+ dn_item_map = {}
+ for item in dn_items:
+ dn_item_map.setdefault(item.item_code, item.dn_qty)
+
+ for item in si_items:
+ dn_item_map.setdefault(item.item_code, item.si_qty)
+
+ return dn_item_map
+
+def get_condition(filters):
+ conditions = ""
+ if filters.get("from_date") and filters.get("to_date"):
+ conditions += " and posting_date between '%s' and '%s'" % (filters["from_date"],filters["to_date"])
+ else:
+ webnotes.msgprint("Please set date in from date field",raise_exception=1)
+ return conditions
\ No newline at end of file
diff --git a/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt
new file mode 100644
index 0000000..2763f21
--- /dev/null
+++ b/stock/report/itemwise_recommended_reorder_level/itemwise_recommended_reorder_level.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-07 12:47:22",
+ "docstatus": 0,
+ "modified": "2013-06-07 13:03:54",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Item",
+ "report_name": "Itemwise Recommended Reorder Level",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Itemwise Recommended Reorder Level"
+ }
+]
\ No newline at end of file
diff --git a/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt b/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
index 730e3d7..65ee389 100644
--- a/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
+++ b/stock/report/ordered_items_to_be_delivered/ordered_items_to_be_delivered.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-02-21 14:26:49",
+ "creation": "2013-02-22 18:01:55",
"docstatus": 0,
- "modified": "2013-02-22 15:53:01",
+ "modified": "2013-07-08 11:17:54",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
- "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`status` as \"Status\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc",
+ "query": "select \n `tabSales Order`.`name` as \"Sales Order:Link/Sales Order:120\",\n `tabSales Order`.`customer` as \"Customer:Link/Customer:120\",\n `tabSales Order`.`transaction_date` as \"Date:Date\",\n `tabSales Order`.`project_name` as \"Project\",\n `tabSales Order Item`.item_code as \"Item:Link/Item:120\",\n `tabSales Order Item`.qty as \"Qty:Float:140\",\n `tabSales Order Item`.delivered_qty as \"Delivered Qty:Float:140\",\n (`tabSales Order Item`.qty - ifnull(`tabSales Order Item`.delivered_qty, 0)) as \"Qty to Deliver:Float:140\",\n `tabSales Order Item`.amount as \"Amount:Float:140\",\n `tabSales Order`.`delivery_date` as \"Expected Delivery Date:Date:120\",\n `tabSales Order Item`.item_name as \"Item Name::150\",\n `tabSales Order Item`.description as \"Description::200\",\n `tabSales Order Item`.item_group as \"Item Group:Link/Item Group:120\"\nfrom\n `tabSales Order`, `tabSales Order Item`\nwhere\n `tabSales Order Item`.`parent` = `tabSales Order`.`name`\n and `tabSales Order`.docstatus = 1\n and `tabSales Order`.status != \"Stopped\"\n and ifnull(`tabSales Order Item`.delivered_qty,0) < ifnull(`tabSales Order Item`.qty,0)\norder by `tabSales Order`.transaction_date asc",
"ref_doctype": "Delivery Note",
"report_name": "Ordered Items To Be Delivered",
"report_type": "Query Report"
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/purchase_in_transit/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/purchase_in_transit/__init__.py
diff --git a/stock/report/purchase_in_transit/purchase_in_transit.txt b/stock/report/purchase_in_transit/purchase_in_transit.txt
new file mode 100644
index 0000000..60ce0da
--- /dev/null
+++ b/stock/report/purchase_in_transit/purchase_in_transit.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-06 12:09:05",
+ "docstatus": 0,
+ "modified": "2013-05-06 12:22:52",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "SELECT\n pi.name as \"Purchase Invoice:Link/Purchase Invoice:120\",\n\tpi.posting_date as \"Posting Date:Date:100\",\n\tpi.credit_to as \"Supplier Account:Link/Account:120\",\n\tpi_item.item_code as \"Item Code:Link/Item:120\",\n\tpi_item.description as \"Description:Data:140\",\n\tpi_item.qty as \"Qty:Float:120\",\n\tpi_item.amount as \"Amount:Currency:120\",\n\tpi_item.purchase_order as \"Purchase Order:Link/Purchase Order:120\",\n\tpi_item.purchase_receipt as \"Purchase Receipt:Link/Purchase Receipt:120\",\n\tpr.posting_date as \"PR Posting Date:Date:130\",\n\tpi.company as \"Company:Link/Company:120\"\nFROM\n\t`tabPurchase Invoice` pi, `tabPurchase Invoice Item` pi_item, `tabPurchase Receipt` pr\nWHERE\n\tpi.name = pi_item.parent and pi_item.purchase_receipt = pr.name\n\tand pi.docstatus = 1 and pr.posting_date > pi.posting_date\nORDER BY\n\tpi.name desc",
+ "ref_doctype": "Purchase Receipt",
+ "report_name": "Purchase In Transit",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase In Transit"
+ }
+]
\ No newline at end of file
diff --git a/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt b/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt
index 45e3a42..c588dde 100644
--- a/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt
+++ b/stock/report/purchase_order_items_to_be_received/purchase_order_items_to_be_received.txt
@@ -1,16 +1,17 @@
[
{
- "creation": "2013-02-21 14:26:49",
+ "creation": "2013-02-22 18:01:55",
"docstatus": 0,
- "modified": "2013-02-22 15:53:01",
+ "modified": "2013-05-28 16:03:15",
"modified_by": "Administrator",
"owner": "Administrator"
},
{
+ "add_total_row": 1,
"doctype": "Report",
"is_standard": "Yes",
"name": "__common__",
- "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n `tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n `tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n `tabPurchase Order`.`project_name` as \"Project\",\n `tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n `tabPurchase Order Item`.qty as \"Qty:Float:100\",\n `tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n (`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n `tabPurchase Order Item`.item_name as \"Item Name::150\",\n `tabPurchase Order Item`.description as \"Description::200\"\nfrom\n `tabPurchase Order`, `tabPurchase Order Item`\nwhere\n `tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n and `tabPurchase Order`.docstatus = 1\n and `tabPurchase Order`.status != \"Stopped\"\n and ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc",
+ "query": "select \n `tabPurchase Order`.`name` as \"Purchase Order:Link/Purchase Order:120\",\n\t`tabPurchase Order`.`transaction_date` as \"Date:Date:100\",\n\t`tabPurchase Order`.`supplier` as \"Supplier:Link/Supplier:120\",\n\t`tabPurchase Order Item`.`project_name` as \"Project\",\n\t`tabPurchase Order Item`.item_code as \"Item Code:Link/Item:120\",\n\t`tabPurchase Order Item`.qty as \"Qty:Float:100\",\n\t`tabPurchase Order Item`.received_qty as \"Received Qty:Float:100\", \n\t(`tabPurchase Order Item`.qty - ifnull(`tabPurchase Order Item`.received_qty, 0)) as \"Qty to Receive:Float:100\",\n\t`tabPurchase Order Item`.item_name as \"Item Name::150\",\n\t`tabPurchase Order Item`.description as \"Description::200\"\nfrom\n\t`tabPurchase Order`, `tabPurchase Order Item`\nwhere\n\t`tabPurchase Order Item`.`parent` = `tabPurchase Order`.`name`\n\tand `tabPurchase Order`.docstatus = 1\n\tand `tabPurchase Order`.status != \"Stopped\"\n\tand ifnull(`tabPurchase Order Item`.received_qty, 0) < ifnull(`tabPurchase Order Item`.qty, 0)\norder by `tabPurchase Order`.transaction_date asc",
"ref_doctype": "Purchase Receipt",
"report_name": "Purchase Order Items To Be Received",
"report_type": "Query Report"
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/purchase_receipt_trends/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/purchase_receipt_trends/__init__.py
diff --git a/stock/report/purchase_receipt_trends/purchase_receipt_trends.js b/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
new file mode 100644
index 0000000..ecfa5a4
--- /dev/null
+++ b/stock/report/purchase_receipt_trends/purchase_receipt_trends.js
@@ -0,0 +1,5 @@
+wn.require("app/js/purchase_trends_filters.js");
+
+wn.query_reports["Purchase Receipt Trends"] = {
+ filters: get_filters()
+ }
\ No newline at end of file
diff --git a/patches/september_2012/reload_gross_profit.py b/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
similarity index 73%
copy from patches/september_2012/reload_gross_profit.py
copy to stock/report/purchase_receipt_trends/purchase_receipt_trends.py
index 0a3f9ef..b41ce28 100644
--- a/patches/september_2012/reload_gross_profit.py
+++ b/stock/report/purchase_receipt_trends/purchase_receipt_trends.py
@@ -15,7 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from __future__ import unicode_literals
-def execute():
- # reload gross profit report
- from webnotes.modules import reload_doc
- reload_doc('selling', 'search_criteria', 'gross_profit')
\ No newline at end of file
+import webnotes
+from controllers.trends import get_columns,get_data
+
+def execute(filters=None):
+ if not filters: filters ={}
+ data = []
+ conditions = get_columns(filters, "Purchase Receipt")
+ data = get_data(filters, conditions)
+
+ return conditions["columns"], data
\ No newline at end of file
diff --git a/stock/report/purchase_receipt_trends/purchase_receipt_trends.txt b/stock/report/purchase_receipt_trends/purchase_receipt_trends.txt
new file mode 100644
index 0000000..179c524
--- /dev/null
+++ b/stock/report/purchase_receipt_trends/purchase_receipt_trends.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-13 18:45:44",
+ "docstatus": 0,
+ "modified": "2013-06-13 18:45:44",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Purchase Receipt",
+ "report_name": "Purchase Receipt Trends",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Purchase Receipt Trends"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/requested_items_to_be_transferred/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/requested_items_to_be_transferred/__init__.py
diff --git a/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt b/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt
new file mode 100644
index 0000000..030ed24
--- /dev/null
+++ b/stock/report/requested_items_to_be_transferred/requested_items_to_be_transferred.txt
@@ -0,0 +1,23 @@
+[
+ {
+ "creation": "2013-05-13 16:23:05",
+ "docstatus": 0,
+ "modified": "2013-05-13 16:25:08",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "add_total_row": 1,
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "select \n mr.name as \"Material Request:Link/Material Request:120\",\n\tmr.transaction_date as \"Date:Date:100\",\n\tmr_item.item_code as \"Item Code:Link/Item:120\",\n\tmr_item.qty as \"Qty:Float:100\",\n\tmr_item.ordered_qty as \"Transferred Qty:Float:100\", \n\t(mr_item.qty - ifnull(mr_item.ordered_qty, 0)) as \"Qty to Transfer:Float:100\",\n\tmr_item.item_name as \"Item Name::150\",\n\tmr_item.description as \"Description::200\"\nfrom\n\t`tabMaterial Request` mr, `tabMaterial Request Item` mr_item\nwhere\n\tmr_item.parent = mr.name\n\tand mr.material_request_type = \"Transfer\"\n\tand mr.docstatus = 1\n\tand mr.status != \"Stopped\"\n\tand ifnull(mr_item.ordered_qty, 0) < ifnull(mr_item.qty, 0)\norder by mr.transaction_date asc",
+ "ref_doctype": "Stock Entry",
+ "report_name": "Requested Items To Be Transferred",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Requested Items To Be Transferred"
+ }
+]
\ No newline at end of file
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/stock/report/warehouse_wise_stock_balance/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to stock/report/warehouse_wise_stock_balance/__init__.py
diff --git a/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js
new file mode 100644
index 0000000..2ce5b4b
--- /dev/null
+++ b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.js
@@ -0,0 +1,18 @@
+wn.query_reports["Warehouse-Wise Stock Balance"] = {
+ "filters": [
+ {
+ "fieldname":"from_date",
+ "label": "From Date",
+ "fieldtype": "Date",
+ "width": "80",
+ "default": sys_defaults.year_start_date,
+ },
+ {
+ "fieldname":"to_date",
+ "label": "To Date",
+ "fieldtype": "Date",
+ "width": "80",
+ "default": wn.datetime.get_today()
+ }
+ ]
+}
\ No newline at end of file
diff --git a/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
new file mode 100644
index 0000000..4389aa5
--- /dev/null
+++ b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.py
@@ -0,0 +1,98 @@
+# 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
+from webnotes.utils import flt
+
+def execute(filters=None):
+ if not filters: filters = {}
+
+ columns = get_columns(filters)
+ item_map = get_item_details(filters)
+ iwb_map = get_item_warehouse_map(filters)
+
+ data = []
+ for company in sorted(iwb_map):
+ for item in sorted(iwb_map[company]):
+ for wh in sorted(iwb_map[company][item]):
+ qty_dict = iwb_map[company][item][wh]
+ data.append([item, item_map[item]["item_name"],
+ item_map[item]["description"], wh,
+ qty_dict.opening_qty, qty_dict.in_qty,
+ qty_dict.out_qty, qty_dict.bal_qty, company
+ ])
+
+ return columns, data
+
+def get_columns(filters):
+ """return columns based on filters"""
+
+ columns = ["Item:Link/Item:100", "Item Name::150", "Description::150", \
+ "Warehouse:Link/Warehouse:100", "Opening Qty::90", \
+ "In Qty::80", "Out Qty::80", "Balance Qty::90", "Company:Link/Company:100"]
+
+ return columns
+
+def get_conditions(filters):
+ conditions = ""
+ if not filters.get("from_date"):
+ webnotes.msgprint("Please enter From Date", raise_exception=1)
+
+ if filters.get("to_date"):
+ conditions += " and posting_date <= '%s'" % filters["to_date"]
+ else:
+ webnotes.msgprint("Please enter To Date", raise_exception=1)
+
+ return conditions
+
+#get all details
+def get_stock_ledger_entries(filters):
+ conditions = get_conditions(filters)
+ return webnotes.conn.sql("""select item_code, warehouse,
+ posting_date, actual_qty, company
+ from `tabStock Ledger Entry`
+ where ifnull(is_cancelled, 'No') = 'No' %s order by item_code, warehouse""" %
+ conditions, as_dict=1)
+
+def get_item_warehouse_map(filters):
+ sle = get_stock_ledger_entries(filters)
+ iwb_map = {}
+
+ for d in sle:
+ iwb_map.setdefault(d.company, {}).setdefault(d.item_code, {}).\
+ setdefault(d.warehouse, webnotes._dict({\
+ "opening_qty": 0.0, "in_qty": 0.0, "out_qty": 0.0, "bal_qty": 0.0
+ }))
+ qty_dict = iwb_map[d.company][d.item_code][d.warehouse]
+ if d.posting_date < filters["from_date"]:
+ qty_dict.opening_qty += flt(d.actual_qty)
+ elif d.posting_date >= filters["from_date"] and d.posting_date <= filters["to_date"]:
+ if flt(d.actual_qty) > 0:
+ qty_dict.in_qty += flt(d.actual_qty)
+ else:
+ qty_dict.out_qty += abs(flt(d.actual_qty))
+
+ qty_dict.bal_qty += flt(d.actual_qty)
+
+ return iwb_map
+
+def get_item_details(filters):
+ item_map = {}
+ for d in webnotes.conn.sql("select name, item_name, description from tabItem", as_dict=1):
+ item_map.setdefault(d.name, d)
+
+ return item_map
\ No newline at end of file
diff --git a/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.txt b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.txt
new file mode 100644
index 0000000..2513587
--- /dev/null
+++ b/stock/report/warehouse_wise_stock_balance/warehouse_wise_stock_balance.txt
@@ -0,0 +1,21 @@
+[
+ {
+ "creation": "2013-06-05 11:00:31",
+ "docstatus": 0,
+ "modified": "2013-06-05 11:00:31",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "ref_doctype": "Stock Ledger Entry",
+ "report_name": "Warehouse-Wise Stock Balance",
+ "report_type": "Script Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Warehouse-Wise Stock Balance"
+ }
+]
\ No newline at end of file
diff --git a/stock/stock_ledger.py b/stock/stock_ledger.py
index 2480263..10e490c 100644
--- a/stock/stock_ledger.py
+++ b/stock/stock_ledger.py
@@ -35,6 +35,9 @@
"posting_time": "12:00"
}
"""
+ global _exceptions
+ _exceptions = []
+
previous_sle = get_sle_before_datetime(args)
qty_after_transaction = flt(previous_sle.get("qty_after_transaction"))
diff --git a/stock/utils.py b/stock/utils.py
index a2541dc..53ad69b 100644
--- a/stock/utils.py
+++ b/stock/utils.py
@@ -17,15 +17,16 @@
import webnotes
from webnotes import msgprint, _
import json
-from webnotes.utils import flt, cstr
+from webnotes.utils import flt, cstr, nowdate, add_days, cint
from webnotes.defaults import get_global_default
+from webnotes.utils.email_lib import sendmail
def validate_end_of_life(item_code, end_of_life=None, verbose=1):
if not end_of_life:
end_of_life = webnotes.conn.get_value("Item", item_code, "end_of_life")
from webnotes.utils import getdate, now_datetime, formatdate
- if end_of_life and getdate(end_of_life) > now_datetime().date():
+ if end_of_life and getdate(end_of_life) <= now_datetime().date():
msg = (_("Item") + " %(item_code)s: " + _("reached its end of life on") + \
" %(date)s. " + _("Please check") + ": %(end_of_life_label)s " + \
"in Item master") % {
@@ -194,4 +195,152 @@
buying_amount = previous_stock_value - flt(sle.stock_value)
return buying_amount
- return 0.0
\ No newline at end of file
+ return 0.0
+
+
+def reorder_item():
+ """ Reorder item if stock reaches reorder level"""
+ if not hasattr(webnotes, "auto_indent"):
+ webnotes.auto_indent = webnotes.conn.get_value('Global Defaults', None, 'auto_indent')
+
+ if webnotes.auto_indent:
+ material_requests = {}
+ bin_list = webnotes.conn.sql("""select item_code, warehouse, projected_qty
+ from tabBin where ifnull(item_code, '') != '' and ifnull(warehouse, '') != ''
+ and exists (select name from `tabItem`
+ where `tabItem`.name = `tabBin`.item_code and
+ is_stock_item='Yes' and (is_purchase_item='Yes' or is_sub_contracted_item='Yes') and
+ (ifnull(end_of_life, '')='') or end_of_life > now())""",
+ as_dict=True)
+ for bin in bin_list:
+ #check if re-order is required
+ item_reorder = webnotes.conn.get("Item Reorder",
+ {"parent": bin.item_code, "warehouse": bin.warehouse})
+ if item_reorder:
+ reorder_level = item_reorder.warehouse_reorder_level
+ reorder_qty = item_reorder.warehouse_reorder_qty
+ material_request_type = item_reorder.material_request_type or "Purchase"
+ else:
+ reorder_level, reorder_qty = webnotes.conn.get_value("Item", bin.item_code,
+ ["re_order_level", "re_order_qty"])
+ material_request_type = "Purchase"
+
+ if flt(reorder_level) and flt(bin.projected_qty) < flt(reorder_level):
+ if flt(reorder_level) - flt(bin.projected_qty) > flt(reorder_qty):
+ reorder_qty = flt(reorder_level) - flt(bin.projected_qty)
+
+ company = webnotes.conn.get_value("Warehouse", bin.warehouse, "company") or \
+ webnotes.defaults.get_defaults()["company"] or \
+ webnotes.conn.sql("""select name from tabCompany limit 1""")[0][0]
+
+ material_requests.setdefault(material_request_type, webnotes._dict()).setdefault(
+ company, []).append(webnotes._dict({
+ "item_code": bin.item_code,
+ "warehouse": bin.warehouse,
+ "reorder_qty": reorder_qty
+ })
+ )
+
+ create_material_request(material_requests)
+
+def create_material_request(material_requests):
+ """ Create indent on reaching reorder level """
+ mr_list = []
+ defaults = webnotes.defaults.get_defaults()
+ exceptions_list = []
+ for request_type in material_requests:
+ for company in material_requests[request_type]:
+ try:
+ items = material_requests[request_type][company]
+ if not items:
+ continue
+
+ mr = [{
+ "doctype": "Material Request",
+ "company": company,
+ "fiscal_year": defaults.fiscal_year,
+ "transaction_date": nowdate(),
+ "material_request_type": request_type,
+ "remark": _("This is an auto generated Material Request.") + \
+ _("""It was raised because the (actual + ordered + indented - reserved)
+ quantity reaches re-order level when the following record was created""")
+ }]
+
+ for d in items:
+ item = webnotes.doc("Item", d.item_code)
+ mr.append({
+ "doctype": "Material Request Item",
+ "parenttype": "Material Request",
+ "parentfield": "indent_details",
+ "item_code": d.item_code,
+ "schedule_date": add_days(nowdate(),cint(item.lead_time_days)),
+ "uom": item.stock_uom,
+ "warehouse": d.warehouse,
+ "item_name": item.item_name,
+ "description": item.description,
+ "item_group": item.item_group,
+ "qty": d.reorder_qty,
+ "brand": item.brand,
+ })
+
+ mr_bean = webnotes.bean(mr)
+ mr_bean.insert()
+ mr_bean.submit()
+ mr_list.append(mr_bean)
+
+ except:
+ if webnotes.message_log:
+ exceptions_list.append([] + webnotes.message_log)
+ webnotes.message_log = []
+ else:
+ exceptions_list.append(webnotes.getTraceback())
+
+ if mr_list:
+ if not hasattr(webnotes, "reorder_email_notify"):
+ webnotes.reorder_email_notify = webnotes.conn.get_value('Global Defaults', None,
+ 'reorder_email_notify')
+
+ if(webnotes.reorder_email_notify):
+ send_email_notification(mr_list)
+
+ if exceptions_list:
+ notify_errors(exceptions_list)
+
+def send_email_notification(mr_list):
+ """ Notify user about auto creation of indent"""
+
+ email_list = webnotes.conn.sql_list("""select distinct r.parent
+ from tabUserRole r, tabProfile p
+ where p.name = r.parent and p.enabled = 1 and p.docstatus < 2
+ and r.role in ('Purchase Manager','Material Manager')
+ and p.name not in ('Administrator', 'All', 'Guest')""")
+
+ msg="""<h3>Following Material Requests has been raised automatically \
+ based on item reorder level:</h3>"""
+ for mr in mr_list:
+ msg += "<p><b><u>" + mr.doc.name + """</u></b></p><table class='table table-bordered'><tr>
+ <th>Item Code</th><th>Warehouse</th><th>Qty</th><th>UOM</th></tr>"""
+ for item in mr.doclist.get({"parentfield": "indent_details"}):
+ msg += "<tr><td>" + item.item_code + "</td><td>" + item.warehouse + "</td><td>" + \
+ cstr(item.qty) + "</td><td>" + cstr(item.uom) + "</td></tr>"
+ msg += "</table>"
+
+ sendmail(email_list, subject='Auto Material Request Generation Notification', msg = msg)
+
+def notify_errors(exceptions_list):
+ subject = "[Important] [ERPNext] Error(s) while creating Material Requests based on Re-order Levels"
+ msg = """Dear System Manager,
+
+ An error occured for certain Items while creating Material Requests based on Re-order level.
+
+ Please rectify these issues:
+ ---
+
+ %s
+
+ ---
+ Regards,
+ Administrator""" % ("\n\n".join(["\n".join(msg) for msg in exceptions_list]),)
+
+ from webnotes.profile import get_system_managers
+ sendmail(get_system_managers(), subject=subject, msg=msg)
diff --git a/support/doctype/maintenance_schedule/maintenance_schedule.py b/support/doctype/maintenance_schedule/maintenance_schedule.py
index 60962b1..baed6a9 100644
--- a/support/doctype/maintenance_schedule/maintenance_schedule.py
+++ b/support/doctype/maintenance_schedule/maintenance_schedule.py
@@ -18,7 +18,7 @@
import webnotes
from webnotes.utils import add_days, cstr, getdate
-from webnotes.model.doc import Document, addchild
+from webnotes.model.doc import addchild
from webnotes.model.bean import getlist
from webnotes.model.code import get_obj
from webnotes import msgprint
@@ -26,7 +26,7 @@
sql = webnotes.conn.sql
-from utilities.transaction_base import TransactionBase
+from utilities.transaction_base import TransactionBase, delete_events
class DocType(TransactionBase):
def __init__(self, doc, doclist=[]):
@@ -100,23 +100,21 @@
for key in scheduled_date:
if email_map[d.incharge_name]:
- self.add_calender_event(key["scheduled_date"],email_map[d.incharge_name],d.item_code)
+ description = "Reference: %s, Item Code: %s and Customer: %s" % \
+ (self.doc.name, d.item_code, self.doc.customer)
+ webnotes.bean({
+ "doctype": "Event",
+ "owner": email_map[d.incharge_name] or self.doc.owner,
+ "subject": description,
+ "description": description,
+ "starts_on": key["scheduled_date"] + " 10:00:00",
+ "event_type": "Private",
+ "ref_type": self.doc.doctype,
+ "ref_name": self.doc.name
+ }).insert()
+
webnotes.conn.set(self.doc, 'status', 'Submitted')
-
- def add_calender_event(self,scheduled_date,incharge_email,item_code):
- """ Add calendar event for Maintenece Schedule in calendar of Allocated person"""
- event = Document('Event')
- event.owner = incharge_email
- event.description = "Reference:%s, Item Code:%s and Customer: %s" %(self.doc.name, item_code, self.doc.customer)
- event.event_date = scheduled_date
- event.event_hour = '10:00'
- event.event_type = 'Private'
- event.ref_type = 'Maintenance Schedule'
- event.ref_name = self.doc.name
- event.save(1)
-
-
#get schedule dates
#----------------------
def create_schedule_list(self, start_date, end_date, no_of_visit):
@@ -329,8 +327,7 @@
if d.serial_no:
self.update_amc_date(d.serial_no, '')
webnotes.conn.set(self.doc, 'status', 'Cancelled')
- sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name))
- def on_trash(self):
- sql("delete from `tabEvent` where ref_type='Maintenance Schedule' and ref_name='%s' " %(self.doc.name))
+ delete_events(self.doc.doctype, self.doc.name)
-
+ def on_trash(self):
+ delete_events(self.doc.doctype, self.doc.name)
diff --git a/support/doctype/support_ticket/get_support_mails.py b/support/doctype/support_ticket/get_support_mails.py
index d1fe0dc..82ae9a3 100644
--- a/support/doctype/support_ticket/get_support_mails.py
+++ b/support/doctype/support_ticket/get_support_mails.py
@@ -50,7 +50,7 @@
"subject": mail.mail["Subject"],
"raised_by": mail.from_email,
"content_type": mail.content_type,
- "status": "Open"
+ "status": "Open",
}])
ticket.insert()
new_ticket = True
@@ -58,7 +58,7 @@
mail.save_attachments_in_doc(ticket.doc)
make(content=mail.content, sender=mail.from_email, subject = ticket.doc.subject,
- doctype="Support Ticket", name=ticket.doc.name,
+ doctype="Support Ticket", name=ticket.doc.name,
lead = ticket.doc.lead, contact=ticket.doc.contact, date=mail.date)
if new_ticket and cint(self.email_settings.send_autoreply) and \
diff --git a/support/doctype/support_ticket/support_ticket.js b/support/doctype/support_ticket/support_ticket.js
index 3da81d9..4ee4c1d 100644
--- a/support/doctype/support_ticket/support_ticket.js
+++ b/support/doctype/support_ticket/support_ticket.js
@@ -29,17 +29,13 @@
erpnext.hide_naming_series();
cur_frm.cscript.make_listing(doc);
if(!doc.__islocal) {
- if(in_list(user_roles,'System Manager')) {
- if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
- if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
- }else if(doc.allocated_to) {
- cur_frm.set_df_property('status','read_only', 1);
- if(user==doc.allocated_to && doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
+ if(user_roles.indexOf("Support Manager")!==-1) {
+ if(doc.status!='Closed') cur_frm.add_custom_button('Close Ticket', cur_frm.cscript['Close Ticket']);
+ if(doc.status=='Closed') cur_frm.add_custom_button('Re-Open Ticket', cur_frm.cscript['Re-Open Ticket']);
}
- cur_frm.set_df_property('subject','read_only', 1);
- cur_frm.set_df_property('description','hidden', 1);
- cur_frm.set_df_property('raised_by','read_only', 1);
+ cur_frm.toggle_enable(["subject", "raised_by"], false);
+ cur_frm.toggle_display("description", false);
}
refresh_field('status');
},
diff --git a/support/doctype/support_ticket/support_ticket.py b/support/doctype/support_ticket/support_ticket.py
index 5625f11..63548d3 100644
--- a/support/doctype/support_ticket/support_ticket.py
+++ b/support/doctype/support_ticket/support_ticket.py
@@ -18,7 +18,6 @@
import webnotes
from utilities.transaction_base import TransactionBase
-from home import update_feed
from webnotes.utils import now
class DocType(TransactionBase):
@@ -44,13 +43,28 @@
def validate(self):
self.update_status()
+ self.set_lead_contact(self.doc.raised_by)
+
+ if self.doc.status == "Closed":
+ from webnotes.widgets.form.assign_to import clear
+ clear(self.doc.doctype, self.doc.name)
def on_communication_sent(self, comm):
webnotes.conn.set(self.doc, 'status', 'Waiting for Customer')
- if comm.lead and not self.doc.lead:
- webnotes.conn.set(self.doc, 'lead', comm.lead)
- if comm.contact and not self.doc.contact:
- webnotes.conn.set(self.doc, 'contact', comm.contact)
+
+
+ def set_lead_contact(self, email_id):
+ import email.utils
+ email_id = email.utils.parseaddr(email_id)
+ if email_id:
+ if not self.doc.lead:
+ self.doc.lead = webnotes.conn.get_value("Lead", {"email_id": email_id})
+ if not self.doc.contact:
+ self.doc.contact = webnotes.conn.get_value("Contact", {"email_id": email_id})
+
+ if not self.doc.company:
+ self.doc.company = webnotes.conn.get_value("Lead", self.doc.lead, "company") or \
+ webnotes.conn.get_default("company")
def on_trash(self):
webnotes.conn.sql("""update `tabCommunication` set support_ticket=NULL
@@ -82,7 +96,7 @@
webnotes.session.user, as_dict=1)
return tickets
-def get_website_args():
+def get_website_args():
bean = webnotes.bean("Support Ticket", webnotes.form_dict.name)
if bean.doc.raised_by != webnotes.session.user:
return {
diff --git a/support/doctype/support_ticket/support_ticket.txt b/support/doctype/support_ticket/support_ticket.txt
index f058a9e..50e547e 100644
--- a/support/doctype/support_ticket/support_ticket.txt
+++ b/support/doctype/support_ticket/support_ticket.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-01-10 16:34:31",
+ "creation": "2013-02-01 10:36:25",
"docstatus": 0,
- "modified": "2013-01-31 22:17:24",
+ "modified": "2013-05-21 16:27:46",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -197,6 +197,15 @@
"read_only": 1
},
{
+ "doctype": "DocField",
+ "fieldname": "company",
+ "fieldtype": "Link",
+ "label": "Company",
+ "options": "Company",
+ "print_hide": 1,
+ "reqd": 0
+ },
+ {
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
"fieldname": "column_break1",
@@ -242,15 +251,6 @@
"label": "Content Type"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"cancel": 0,
"doctype": "DocPerm",
"role": "Guest"
diff --git a/support/page/support_home/support_home.js b/support/page/support_home/support_home.js
index d397daa..bde5e5c 100644
--- a/support/page/support_home/support_home.js
+++ b/support/page/support_home/support_home.js
@@ -72,6 +72,18 @@
},
]
},
+ {
+ title: wn._("Reports"),
+ right: true,
+ icon: "icon-list",
+ items: [
+ {
+ "label":wn._("Maintenance Schedules"),
+ route: "query-report/Maintenance Schedules",
+ doctype: "Maintenance Schedule"
+ }
+ ]
+ }
]
pscript['onload_support-home'] = function(wrapper) {
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/support/report/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to support/report/__init__.py
diff --git a/selling/report/sales_orders_pending_to_be_delivered/__init__.py b/support/report/maintenance_schedules/__init__.py
similarity index 100%
copy from selling/report/sales_orders_pending_to_be_delivered/__init__.py
copy to support/report/maintenance_schedules/__init__.py
diff --git a/support/report/maintenance_schedules/maintenance_schedules.txt b/support/report/maintenance_schedules/maintenance_schedules.txt
new file mode 100644
index 0000000..525f483
--- /dev/null
+++ b/support/report/maintenance_schedules/maintenance_schedules.txt
@@ -0,0 +1,22 @@
+[
+ {
+ "creation": "2013-05-06 14:25:21",
+ "docstatus": 0,
+ "modified": "2013-05-06 14:32:47",
+ "modified_by": "Administrator",
+ "owner": "Administrator"
+ },
+ {
+ "doctype": "Report",
+ "is_standard": "Yes",
+ "name": "__common__",
+ "query": "SELECT\n ms_item.scheduled_date as \"Schedule Date:Date:120\",\n\tms_item.item_code as \"Item Code:Link/Item:120\",\n\tms_item.item_name as \"Item Name::120\",\n\tms_item.serial_no as \"Serial No::120\",\n\tms_item.incharge_name as \"Incharge::120\",\n\tms.customer_name as \"Customer:Link/Customer:120\",\n\tms.address_display as \"Customer Address::120\",\n\tms.sales_order_no as \"Sales Order:Link/Sales Order:120\",\n\tms.company as \"Company:Link/Company:120\"\n\t\nFROM\n\t`tabMaintenance Schedule` ms, `tabMaintenance Schedule Detail` ms_item\nWHERE\n\tms.name = ms_item.parent and ms.docstatus = 1\nORDER BY\n\tms_item.scheduled_date asc, ms_item.item_code asc",
+ "ref_doctype": "Maintenance Schedule",
+ "report_name": "Maintenance Schedules",
+ "report_type": "Query Report"
+ },
+ {
+ "doctype": "Report",
+ "name": "Maintenance Schedules"
+ }
+]
\ No newline at end of file
diff --git a/support/search_criteria/__init__.py b/support/search_criteria/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/amc_summary/__init__.py b/support/search_criteria/amc_summary/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/amc_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/amc_summary/amc_summary.js b/support/search_criteria/amc_summary/amc_summary.js
deleted file mode 100644
index 0ce3619..0000000
--- a/support/search_criteria/amc_summary/amc_summary.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.mytabs.items['Select Columns'].hide();
- this.mytabs.items['More Filters'].hide()
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.filter_hide = 0;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.filter_hide = 0;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Territory'].df.in_first_page = 1;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Item Group'].df.in_first_page = 1;
-}
\ No newline at end of file
diff --git a/support/search_criteria/amc_summary/amc_summary.py b/support/search_criteria/amc_summary/amc_summary.py
deleted file mode 100644
index 926da01..0000000
--- a/support/search_criteria/amc_summary/amc_summary.py
+++ /dev/null
@@ -1,87 +0,0 @@
-# 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/>.
-
-# ADD NEW COLUMNS
-from __future__ import unicode_literals
-row_list = [['Item Group','Data','150px',''],
- ['Out of AMC','Int','150px',''],
- ['Under AMC','Int','150px',''],
- ['Out of Warranty','Int','150px',''],
- ['Under Warranty','Int','150px',''],
- ['Total','Int','150px','']
- ]
-
-for r in row_list:
- colnames.append(r[0])
- coltypes.append(r[1])
- colwidths.append(r[2])
- coloptions.append(r[3])
- col_idx[r[0]] = len(colnames)-1
-
-
-#ADD VALUES TO THE COLUMN
-out=[]
-oa,ua,ow,uw,sum=0,0,0,0,0
-nowdate = nowdate()
-for r in res:
- cc = r[col_idx['Territory']]
- item_groups = sql("select distinct item_group from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(cc,filter_values.get('item_group')))
-
- for col in range(len(colnames)-1): # this would make all first row blank. just for look
- r.append('')
- out.append(r)
-
- # Add Totals for each Territory
- # -----------------------------
- det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group like '%%%s'" %(nowdate,nowdate,nowdate,nowdate,cc,filter_values.get('item_group')))
- r[col_idx['Item Group']] = ''
-
- r[col_idx['Out of AMC']] = cstr(det[0][0])
- r[col_idx['Under AMC']] = cstr(det[0][1])
- r[col_idx['Out of Warranty']] = cstr(det[0][2])
- r[col_idx['Under Warranty']] = cstr(det[0][3])
- tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
- r[col_idx['Total']] = cstr(tot)
-
-
- oa += cint(det[0][0])
- ua += cint(det[0][1])
- ow += cint(det[0][2])
- uw += cint(det[0][3])
- sum += tot
-
-
- # Add Brand Details belonging to Territory
- # ----------------------------------------
- for br in item_groups:
- br_det = sql("select COUNT(CASE WHEN amc_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN amc_expiry_date <= '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date > '%s' THEN name ELSE NULL END), COUNT(CASE WHEN warranty_expiry_date <= '%s' THEN name ELSE NULL END) from `tabSerial No` where territory = '%s' and item_group = '%s'"%(nowdate,nowdate,nowdate,nowdate,cc,br[0]))
- t_row = ['' for i in range(len(colnames))]
- t_row[col_idx['Item Group']] = br[0]
-
- t_row[col_idx['Out of AMC']] = cint(br_det[0][0])
- t_row[col_idx['Under AMC']] = cint(br_det[0][1])
- t_row[col_idx['Out of Warranty']] = cint(br_det[0][2])
- t_row[col_idx['Under Warranty']] = cint(br_det[0][3])
- tot = cint(br_det[0][0]) + cint(br_det[0][1]) + cint(br_det[0][2])+ cint(br_det[0][3])
- t_row[col_idx['Total']] = tot
- out.append(t_row)
-
-
-#ADD NEW ROW
-# ----------
-newrow=['','TOTAL',oa,ua,ow,uw,sum]
-out.append(newrow)
-res=out
\ No newline at end of file
diff --git a/support/search_criteria/amc_summary/amc_summary.txt b/support/search_criteria/amc_summary/amc_summary.txt
deleted file mode 100644
index a83e0d3..0000000
--- a/support/search_criteria/amc_summary/amc_summary.txt
+++ /dev/null
@@ -1,28 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:50",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:50"
- },
- {
- "module": "Support",
- "standard": "Yes",
- "sort_order": "ASC",
- "filters": "{'Serial No\u0001Saved':1,'Serial No\u0001Status':''}",
- "doc_type": "Serial No",
- "name": "__common__",
- "add_cond": "`tabSerial No`.`territory` is not null\n`tabSerial No`.`territory` != ''\n`tabSerial No`.`status` not in ('In Store', 'Scrapped')",
- "doctype": "Search Criteria",
- "sort_by": "`tabSerial No`.`cost_center`",
- "group_by": "`tabSerial No`.`cost_center`",
- "page_len": 50,
- "criteria_name": "AMC Summary",
- "columns": "Serial No\u0001Territory"
- },
- {
- "name": "amc_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/support/search_criteria/customer_issues/__init__.py b/support/search_criteria/customer_issues/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/customer_issues/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/customer_issues/customer_issues.js b/support/search_criteria/customer_issues/customer_issues.js
deleted file mode 100644
index 8eaf6f6..0000000
--- a/support/search_criteria/customer_issues/customer_issues.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Status'].df.in_first_page = 1;
- this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Allocated To'].df.in_first_page = 1;
- this.filter_fields_dict['Customer Issue'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-}
-
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/support/search_criteria/customer_issues/customer_issues.txt b/support/search_criteria/customer_issues/customer_issues.txt
deleted file mode 100644
index caa0775..0000000
--- a/support/search_criteria/customer_issues/customer_issues.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "module": "Support",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Customer Issue\u0001Saved':1,'Customer Issue\u0001Submitted':1,'Customer Issue\u0001Status':'','Customer Issue\u0001Fiscal Year':''}",
- "doctype": "Search Criteria",
- "doc_type": "Customer Issue",
- "name": "__common__",
- "sort_by": "`tabCustomer Issue`.`name`",
- "page_len": 50,
- "criteria_name": "Customer Issues",
- "columns": "Customer Issue\u0001ID,Customer Issue\u0001Status,Customer Issue\u0001Complaint Date,Customer Issue\u0001Complaint,Customer Issue\u0001Item Code,Customer Issue\u0001Item Name,Customer Issue\u0001Allocated To,Customer Issue\u0001Allocated On,Customer Issue\u0001Resolved By,Customer Issue\u0001Resolution Date,Customer Issue\u0001Customer Name,Customer Issue\u0001Fiscal Year"
- },
- {
- "name": "customer_issues",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py b/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js b/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js
deleted file mode 100644
index 1b3837a..0000000
--- a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.js
+++ /dev/null
@@ -1,20 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
- this.filter_fields_dict['Sales Order'+FILTER_SEP +'Fiscal Year'].df['report_default'] = sys_defaults.fiscal_year;
-}
\ No newline at end of file
diff --git a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt b/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
deleted file mode 100644
index ad9fe08..0000000
--- a/support/search_criteria/maintenance_orderwise_pending_amount_to_bill/maintenance_orderwise_pending_amount_to_bill.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-[
- {
- "owner": "ashwini@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "add_col": "SUM((`tabSales Order Item`.`qty` - `tabSales Order Item`.`billed_qty`) * `tabSales Order Item`.`basic_rate`) AS 'Pending Amount'",
- "parent_doc_type": "Sales Order",
- "module": "Support",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Sales Order\u0001Saved':1,'Sales Order\u0001Submitted':1,'Sales Order\u0001Status':'','Sales Order\u0001Fiscal Year':''}",
- "doc_type": "Sales Order Item",
- "name": "__common__",
- "add_cond": "`tabSales Order`.status != 'Stopped'\n`tabSales Order`.order_type='Maintenance'",
- "doctype": "Search Criteria",
- "sort_by": "`tabSales Order`.`name`",
- "page_len": 50,
- "criteria_name": "Maintenance Orderwise Pending Amount To Bill",
- "columns": "Sales Order\u0001ID,Sales Order\u0001Customer,Sales Order\u0001Customer Name,Sales Order\u0001Customer Address,Sales Order\u0001Status,Sales Order\u0001% Billed,Sales Order\u0001Sales Order Date"
- },
- {
- "name": "maintenance_orderwise_pending_amount_to_bill",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/support/search_criteria/maintenance_schedule_details/__init__.py b/support/search_criteria/maintenance_schedule_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/maintenance_schedule_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js b/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js
deleted file mode 100644
index c4800ea..0000000
--- a/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.js
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
-
- this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'From Scheduled Date'].df.in_first_page = 1;
- this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'To Scheduled Date'].df.in_first_page = 1;
- this.filter_fields_dict['Maintenance Schedule Detail'+FILTER_SEP +'Incharge Name'].df.in_first_page = 1;
- this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer'].df.in_first_page = 1;
- this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
- this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Sales Order No'].df.in_first_page = 1;
- //this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Status'].df.in_first_page = 0;
- this.filter_fields_dict['Maintenance Schedule'+FILTER_SEP +'Company'].df['report_default'] = sys_defaults.company;
-}
-
-this.mytabs.items['Select Columns'].hide()
\ No newline at end of file
diff --git a/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt b/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
deleted file mode 100644
index f8a5882..0000000
--- a/support/search_criteria/maintenance_schedule_details/maintenance_schedule_details.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-[
- {
- "owner": "nabin@webnotestech.com",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:51",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:51"
- },
- {
- "parent_doc_type": "Maintenance Schedule",
- "module": "Support",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Maintenance Schedule\u0001Submitted':1,'Maintenance Schedule\u0001Status':''}",
- "doc_type": "Maintenance Schedule Detail",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "`tabMaintenance Schedule Detail`.`item_code`",
- "page_len": 50,
- "criteria_name": "Maintenance Schedule Details",
- "columns": "Maintenance Schedule Detail\u0001Item Code,Maintenance Schedule Detail\u0001Item Name,Maintenance Schedule Detail\u0001Serial No,Maintenance Schedule Detail\u0001Incharge Name,Maintenance Schedule Detail\u0001Scheduled Date,Maintenance Schedule\u0001Customer Name,Maintenance Schedule\u0001Address,Maintenance Schedule\u0001Sales Order No"
- },
- {
- "name": "maintenance_schedule_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/support/search_criteria/warranty_amc_expiry_details/__init__.py b/support/search_criteria/warranty_amc_expiry_details/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/warranty_amc_expiry_details/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js b/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js
deleted file mode 100644
index ad5ce26..0000000
--- a/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.js
+++ /dev/null
@@ -1,25 +0,0 @@
-// 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/>.
-
-//this.mytabs.items['Select Columns'].hide();
-
-report.customize_filters = function() {
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Status'].df.in_first_page = 0;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer'].df.in_first_page = 1;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Customer Name'].df.in_first_page = 1;
- this.filter_fields_dict['Serial No'+FILTER_SEP +'Maintenance Status'].df.in_first_page = 1;
-
-}
\ No newline at end of file
diff --git a/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt b/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
deleted file mode 100644
index bad5c9f..0000000
--- a/support/search_criteria/warranty_amc_expiry_details/warranty_amc_expiry_details.txt
+++ /dev/null
@@ -1,26 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "module": "Support",
- "standard": "Yes",
- "sort_order": "DESC",
- "filters": "{'Serial No\u0001Saved':1,'Serial No\u0001Status':'','Serial No\u0001Maintenance Status':''}",
- "doctype": "Search Criteria",
- "doc_type": "Serial No",
- "name": "__common__",
- "sort_by": "`tabSerial No`.`name`",
- "page_len": 50,
- "criteria_name": "Warranty/AMC Expiry Details",
- "columns": "Serial No\u0001ID,Serial No\u0001Item Code,Serial No\u0001Description,Serial No\u0001Status,Serial No\u0001Item Group,Serial No\u0001Purchase Receipt No,Serial No\u0001Delivery Note No,Serial No\u0001Customer,Serial No\u0001Customer Name,Serial No\u0001AMC Expiry Date,Serial No\u0001Warranty Expiry Date"
- },
- {
- "name": "warranty-amc_expiry_details",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/support/search_criteria/warranty_amc_summary/__init__.py b/support/search_criteria/warranty_amc_summary/__init__.py
deleted file mode 100644
index baffc48..0000000
--- a/support/search_criteria/warranty_amc_summary/__init__.py
+++ /dev/null
@@ -1 +0,0 @@
-from __future__ import unicode_literals
diff --git a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.js b/support/search_criteria/warranty_amc_summary/warranty_amc_summary.js
deleted file mode 100644
index 4ad5a76..0000000
--- a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.js
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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/>.
-
-report.customize_filters = function() {
- this.hide_all_filters();
- this.mytabs.items['Select Columns'].hide();
- this.mytabs.items['More Filters'].hide();
- this.add_filter({fieldname:'based_on', label:'Based On', fieldtype:'Select', options:'Territory'+NEWLINE+'Item Group',ignore:1,parent:'Serial No',in_first_page:1, report_default:'Item Group'});
-}
-
-report.aftertableprint = function(t) {
- $yt(t,'*',1,{whiteSpace:'pre'});
-}
\ No newline at end of file
diff --git a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py b/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py
deleted file mode 100644
index 8c102c3..0000000
--- a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# 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
-opt = filter_values.get('based_on')
-opt_dict = {'Territory':'territory', 'Item Group':'item_group'}
-
-# ADD NEW COLUMNS
-row_list = [[opt,'Data','150px',''],
- ['Out of AMC','Int','150px',''],
- ['Under AMC','Int','150px',''],
- ['Out of Warranty','Int','150px',''],
- ['Under Warranty','Int','150px',''],
- ['Total','Int','150px','']]
-
-for r in row_list:
- colnames.append(r[0])
- coltypes.append(r[1])
- colwidths.append(r[2])
- coloptions.append(r[3])
- col_idx[r[0]] = len(colnames)-1
-
-
-#ADD VALUES TO THE COLUMN
-out=[]
-oa,ua,ow,uw,sum=0,0,0,0,0
-nowdate = nowdate()
-for r in res:
- lft_rgt = sql("select lft, rgt from `tab%s` where name = '%s'" % (opt,r[col_idx[opt]].strip()))
-
-
- det = sql("select COUNT(CASE WHEN t1.amc_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.amc_expiry_date >= '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date < '%s' THEN t1.name ELSE NULL END), COUNT(CASE WHEN t1.warranty_expiry_date >= '%s' THEN t1.name ELSE NULL END) from `tabSerial No` t1, `tab%s` t2 where t1.%s = t2.name and t2.lft>= '%s' and t2. rgt <= '%s' and t1.status = 'Delivered' and ifnull(item_group,'')!='' and ifnull(territory,'')!=''" %(nowdate,nowdate,nowdate,nowdate,opt, opt_dict[opt], lft_rgt[0][0], lft_rgt[0][1]))
-
- r.append(cint(det[0][0]))
- r.append(cint(det[0][1]))
- r.append(cint(det[0][2]))
- r.append(cint(det[0][3]))
- tot = cint(det[0][0]) + cint(det[0][1]) + cint(det[0][2]) + cint(det[0][3])
- r.append(tot)
- out.append(r)
diff --git a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.sql b/support/search_criteria/warranty_amc_summary/warranty_amc_summary.sql
deleted file mode 100644
index ebd7ae8..0000000
--- a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.sql
+++ /dev/null
@@ -1 +0,0 @@
-SELECT CONCAT(REPEAT(' ', COUNT(parent.name) - 1), node.name) AS name FROM `tab%(based_on)s` AS node,`tab%(based_on)s` AS parent WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.docstatus !=2 GROUP BY node.name ORDER BY node.lft
\ No newline at end of file
diff --git a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt b/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
deleted file mode 100644
index 098b5d6..0000000
--- a/support/search_criteria/warranty_amc_summary/warranty_amc_summary.txt
+++ /dev/null
@@ -1,25 +0,0 @@
-[
- {
- "owner": "Administrator",
- "docstatus": 0,
- "creation": "2012-04-03 12:49:53",
- "modified_by": "Administrator",
- "modified": "2012-04-03 12:49:53"
- },
- {
- "module": "Support",
- "sort_order": "DESC",
- "filters": "{'Serial No\u0001Saved':1,'Serial No\u0001Status':''}",
- "standard": "Yes",
- "doc_type": "Serial No",
- "name": "__common__",
- "doctype": "Search Criteria",
- "sort_by": "name",
- "page_len": 50,
- "criteria_name": "Warranty/AMC Summary"
- },
- {
- "name": "warranty-amc_summary",
- "doctype": "Search Criteria"
- }
-]
\ No newline at end of file
diff --git a/utilities/cleanup_data.py b/utilities/cleanup_data.py
index ed04a94..df7f4be 100644
--- a/utilities/cleanup_data.py
+++ b/utilities/cleanup_data.py
@@ -20,14 +20,16 @@
def delete_transactions():
print "Deleting transactions..."
- trans = ['Timesheet', 'Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry',
+ trans = ['Task', 'Support Ticket', 'Stock Reconciliation', 'Stock Ledger Entry',
'Stock Entry', 'Sales Order', 'Salary Slip','Sales Invoice', 'Quotation',
'Quality Inspection', 'Purchase Receipt', 'Purchase Order', 'Production Order',
'POS Setting', 'Period Closing Voucher', 'Purchase Invoice', 'Maintenance Visit',
'Maintenance Schedule', 'Leave Application', 'Leave Allocation', 'Lead', 'Journal Voucher',
'Installation Note', 'Material Request', 'GL Entry', 'Expense Claim', 'Opportunity',
'Delivery Note', 'Customer Issue', 'Bin', 'Authorization Rule', 'Attendance', 'C-Form',
- 'Appraisal', 'Installation Note', 'Communication']
+ 'Appraisal', 'Installation Note', 'Communication', "Supplier Quotation", "Newsletter",
+ "Job Applicant", "Web Page", "Website Slideshow", "Blog Post", "Blog Category", "Blogger",
+ "Time Log", "Time Log Batch", "Workflow"]
for d in trans:
for t in webnotes.conn.sql("select options from tabDocField where parent='%s' and fieldtype='Table'" % d):
webnotes.conn.sql("delete from `tab%s`" % (t))
@@ -66,6 +68,7 @@
'Item Group': ['All Item Groups', 'Default'],
'Item': '',
'Holiday List': '',
+ 'Activity Type': '',
'Grade': '',
'Feed': '',
'Expense Claim Type': ['Travel', 'Medical', 'Calls', 'Food', 'Others'],
diff --git a/utilities/doctype/address/address.py b/utilities/doctype/address/address.py
index 243bbdd..cfcbea5 100644
--- a/utilities/doctype/address/address.py
+++ b/utilities/doctype/address/address.py
@@ -18,6 +18,7 @@
import webnotes
from webnotes import msgprint
+from webnotes.utils import cstr
class DocType:
def __init__(self, doc, doclist=[]):
@@ -29,7 +30,7 @@
self.doc.address_title = self.doc.customer or self.doc.supplier or self.doc.sales_partner
if self.doc.address_title:
- self.doc.name = self.doc.address_title + "-" + self.doc.address_type
+ self.doc.name = cstr(self.doc.address_title).strip() + "-" + cstr(self.doc.address_type).strip()
else:
webnotes.msgprint("""Address Title is mandatory.""", raise_exception=True)
diff --git a/utilities/doctype/address/test_address.py b/utilities/doctype/address/test_address.py
new file mode 100644
index 0000000..eddd9c7
--- /dev/null
+++ b/utilities/doctype/address/test_address.py
@@ -0,0 +1,14 @@
+test_records = [
+ [{
+ "doctype": "Address",
+ "customer": "_Test Customer",
+ "customer_name": "_Test Customer",
+ "address_type": "Office",
+ "address_title": "_Test Address",
+ "address_line1": "_Test Address Line 1",
+ "city": "_Test City",
+ "country": "India",
+ "phone": "+91 0000000000",
+ "is_primary_address": 1
+ }],
+]
\ No newline at end of file
diff --git a/utilities/doctype/contact/contact.py b/utilities/doctype/contact/contact.py
index bceee7d..a19501f 100644
--- a/utilities/doctype/contact/contact.py
+++ b/utilities/doctype/contact/contact.py
@@ -16,7 +16,7 @@
from __future__ import unicode_literals
import webnotes
-
+from webnotes.utils import cstr
from utilities.transaction_base import TransactionBase
@@ -32,15 +32,16 @@
webnotes.conn.set(self.doc, 'status', 'Replied')
def autoname(self):
- if self.doc.customer:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.customer
- elif self.doc.supplier:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.supplier
- elif self.doc.sales_partner:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '') + '-' + self.doc.sales_partner
- else:
- self.doc.name = self.doc.first_name + (self.doc.last_name and ' ' + self.doc.last_name or '')
-
+ # concat first and last name
+ self.doc.name = " ".join(filter(None,
+ [cstr(self.doc.fields.get(f)).strip() for f in ["first_name", "last_name"]]))
+
+ # concat party name if reqd
+ for fieldname in ("customer", "supplier", "sales_partner"):
+ if self.doc.fields.get(fieldname):
+ self.doc.name = self.doc.name + "-" + cstr(self.doc.fields.get(fieldname)).strip()
+ break
+
def validate(self):
self.validate_primary_contact()
diff --git a/utilities/doctype/question/question.txt b/utilities/doctype/question/question.txt
index b064e33..fbd7b75 100644
--- a/utilities/doctype/question/question.txt
+++ b/utilities/doctype/question/question.txt
@@ -1,75 +1,76 @@
[
{
- "owner": "Administrator",
+ "creation": "2013-01-02 17:08:46",
"docstatus": 0,
- "creation": "2012-07-03 13:30:42",
+ "modified": "2013-01-01 18:58:55",
"modified_by": "Administrator",
- "modified": "2013-01-01 18:58:55"
+ "owner": "Administrator"
},
{
- "read_only": 1,
- "in_create": 1,
+ "allow_attach": 0,
"autoname": "QUES.#######",
- "name": "__common__",
- "module": "Utilities",
"doctype": "DocType",
- "allow_attach": 0
+ "in_create": 1,
+ "module": "Utilities",
+ "name": "__common__",
+ "read_only": 1
},
{
- "name": "__common__",
- "parent": "Question",
"doctype": "DocField",
+ "name": "__common__",
+ "parent": "Question",
+ "parentfield": "fields",
"parenttype": "DocType",
- "permlevel": 0,
- "parentfield": "fields"
+ "permlevel": 0
},
{
- "parent": "Question",
- "read": 1,
- "report": 1,
"cancel": 1,
- "name": "__common__",
"create": 1,
"doctype": "DocPerm",
- "write": 1,
+ "name": "__common__",
+ "parent": "Question",
+ "parentfield": "permissions",
"parenttype": "DocType",
- "role": "All",
"permlevel": 0,
- "parentfield": "permissions"
+ "read": 1,
+ "report": 1,
+ "role": "All",
+ "submit": 0,
+ "write": 1
},
{
- "name": "Question",
- "doctype": "DocType"
+ "doctype": "DocType",
+ "name": "Question"
},
{
- "oldfieldtype": "Text",
"doctype": "DocField",
+ "fieldname": "question",
+ "fieldtype": "Text",
"label": "Question",
"oldfieldname": "question",
- "fieldname": "question",
- "fieldtype": "Text"
+ "oldfieldtype": "Text"
},
{
"doctype": "DocField",
- "label": "Points",
"fieldname": "points",
"fieldtype": "Int",
- "hidden": 1
+ "hidden": 1,
+ "label": "Points"
},
{
- "oldfieldtype": "Text Editor",
"doctype": "DocField",
+ "fieldname": "answer",
+ "fieldtype": "Text Editor",
"label": "Answer",
"oldfieldname": "answer",
- "fieldname": "answer",
- "fieldtype": "Text Editor"
+ "oldfieldtype": "Text Editor"
},
{
"doctype": "DocField",
- "label": "User Tags",
"fieldname": "_user_tags",
"fieldtype": "Data",
- "hidden": 1
+ "hidden": 1,
+ "label": "User Tags"
},
{
"doctype": "DocField",
@@ -78,15 +79,6 @@
"label": "Users Voted"
},
{
- "oldfieldtype": "Text",
- "doctype": "DocField",
- "label": "File List",
- "oldfieldname": "file_list",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1
- },
- {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/utilities/doctype/rename_tool/rename_tool.py b/utilities/doctype/rename_tool/rename_tool.py
index 2e368ce..5accf3c 100644
--- a/utilities/doctype/rename_tool/rename_tool.py
+++ b/utilities/doctype/rename_tool/rename_tool.py
@@ -34,7 +34,8 @@
rename_log = []
for row in rows:
- if len(row) > 2:
+ # if row has some content
+ if len(row) > 1 and row[0] and row[1]:
try:
if rename_doc(select_doctype, row[0], row[1]):
rename_log.append(_("Successful: ") + row[0] + " -> " + row[1])
@@ -45,5 +46,5 @@
rename_log.append("<span style='color: RED'>" + \
_("Failed: ") + row[0] + " -> " + row[1] + "</span>")
rename_log.append("<span style='margin-left: 20px;'>" + repr(e) + "</span>")
-
+
return rename_log
\ No newline at end of file
diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py
index 4b34ba1..0332185 100644
--- a/utilities/transaction_base.py
+++ b/utilities/transaction_base.py
@@ -22,6 +22,23 @@
from webnotes.model.controller import DocListController
class TransactionBase(DocListController):
+ def get_default_address_and_contact(self, party_type):
+ """get a dict of default field values of address and contact for a given party type
+ party_type can be one of: customer, supplier"""
+ ret = {}
+
+ # {customer: self.doc.fields.get("customer")}
+ args = {party_type: self.doc.fields.get(party_type)}
+
+ address_text, address_name = self.get_address_text(**args)
+ ret.update({
+ # customer_address
+ (party_type + "_address"): address_name,
+ "address_display": address_text
+ })
+ ret.update(self.get_contact_text(**args))
+ return ret
+
# Get Customer Default Primary Address - first load
def get_default_customer_address(self, args=''):
address_text, address_name = self.get_address_text(customer=self.doc.customer)
@@ -73,7 +90,7 @@
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_shipping_address desc, is_primary_address desc limit 1" % cond, as_dict = 1)
else:
details = webnotes.conn.sql("select name, address_line1, address_line2, city, country, pincode, state, phone, fax from `tabAddress` where %s and docstatus != 2 order by is_primary_address desc limit 1" % cond, as_dict = 1)
-
+
extract = lambda x: details and details[0] and details[0].get(x,'') or ''
address_fields = [('','address_line1'),('\n','address_line2'),('\n','city'),('\n','state'),(' ','pincode'),('\n','country'),('\nPhone: ','phone'),('\nFax: ', 'fax')]
address_display = ''.join([a[0]+extract(a[1]) for a in address_fields if extract(a[1])])
@@ -251,4 +268,43 @@
def validate_posting_time(self):
if not self.doc.posting_time:
self.doc.posting_time = now_datetime().strftime('%H:%M:%S')
-
\ No newline at end of file
+
+ def add_calendar_event(self, opts, force=False):
+ if self.doc.contact_by != cstr(self._prev.contact_by) or \
+ self.doc.contact_date != cstr(self._prev.contact_date) or force:
+
+ self.delete_events()
+ self._add_calendar_event(opts)
+
+ def delete_events(self):
+ webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
+ where ref_type=%s and ref_name=%s""", (self.doc.doctype, self.doc.name)))
+
+ def _add_calendar_event(self, opts):
+ opts = webnotes._dict(opts)
+
+ if self.doc.contact_date:
+ event_doclist = [{
+ "doctype": "Event",
+ "owner": opts.owner or self.doc.owner,
+ "subject": opts.subject,
+ "description": opts.description,
+ "starts_on": self.doc.contact_date + " 10:00:00",
+ "event_type": "Private",
+ "ref_type": self.doc.doctype,
+ "ref_name": self.doc.name
+ }]
+
+ if webnotes.conn.exists("Profile", self.doc.contact_by):
+ event_doclist.append({
+ "doctype": "Event User",
+ "parentfield": "event_individuals",
+ "person": self.doc.contact_by
+ })
+
+ webnotes.bean(event_doclist).insert()
+
+
+def delete_events(ref_type, ref_name):
+ webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent`
+ where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True)
\ No newline at end of file
diff --git a/website/doctype/about_us_settings/about_us_settings.txt b/website/doctype/about_us_settings/about_us_settings.txt
index b846d2b..baf9cc0 100644
--- a/website/doctype/about_us_settings/about_us_settings.txt
+++ b/website/doctype/about_us_settings/about_us_settings.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-07 15:53:15",
+ "creation": "2013-03-19 12:02:15",
"docstatus": 0,
- "modified": "2013-03-12 14:48:34",
+ "modified": "2013-05-03 11:01:30",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -10,7 +10,7 @@
"allow_attach": 1,
"description": "Settings for the About Us Page",
"doctype": "DocType",
- "document_type": "Master",
+ "document_type": "Other",
"issingle": 1,
"module": "Website",
"name": "__common__"
@@ -21,7 +21,8 @@
"parent": "About Us Settings",
"parentfield": "fields",
"parenttype": "DocType",
- "permlevel": 0
+ "permlevel": 0,
+ "read_only": 0
},
{
"create": 1,
@@ -103,15 +104,6 @@
"label": "Footer"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"doctype": "DocPerm"
}
]
\ No newline at end of file
diff --git a/website/doctype/blog_post/blog_post.py b/website/doctype/blog_post/blog_post.py
index 05236a1..62cc910 100644
--- a/website/doctype/blog_post/blog_post.py
+++ b/website/doctype/blog_post/blog_post.py
@@ -76,10 +76,12 @@
self.doc.full_name = get_fullname(self.doc.owner)
self.doc.updated = global_date_format(self.doc.published_on)
self.doc.content_html = self.doc.content
+
if self.doc.blogger:
self.doc.blogger_info = webnotes.doc("Blogger", self.doc.blogger).fields
self.doc.description = self.doc.blog_intro or self.doc.content[:140]
+ self.doc.meta_description = self.doc.description
self.doc.categories = webnotes.conn.sql_list("select name from `tabBlog Category` order by name")
diff --git a/website/doctype/blog_post/blog_post.txt b/website/doctype/blog_post/blog_post.txt
index 4144e40..07c5392 100644
--- a/website/doctype/blog_post/blog_post.txt
+++ b/website/doctype/blog_post/blog_post.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-03-08 11:36:50",
+ "creation": "2013-03-28 10:35:30",
"docstatus": 0,
"modified": "2013-03-18 13:55:53",
"modified_by": "Administrator",
@@ -115,15 +115,6 @@
"label": "Email Sent"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"create": 1,
"doctype": "DocPerm",
"role": "Website Manager",
diff --git a/website/doctype/blogger/blogger.txt b/website/doctype/blogger/blogger.txt
index f56df1f..da065c5 100644
--- a/website/doctype/blogger/blogger.txt
+++ b/website/doctype/blogger/blogger.txt
@@ -83,15 +83,6 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"create": 1,
"doctype": "DocPerm",
"role": "Website Manager"
diff --git a/website/doctype/style_settings/style_settings.txt b/website/doctype/style_settings/style_settings.txt
index df266a5..e31713a 100644
--- a/website/doctype/style_settings/style_settings.txt
+++ b/website/doctype/style_settings/style_settings.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-03-08 11:36:53",
+ "creation": "2013-03-25 16:01:33",
"docstatus": 0,
"modified": "2013-03-14 11:57:20",
"modified_by": "Administrator",
@@ -185,15 +185,6 @@
"read_only": 1
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
diff --git a/website/doctype/web_page/web_page.py b/website/doctype/web_page/web_page.py
index d43bcb4..6d0cafa 100644
--- a/website/doctype/web_page/web_page.py
+++ b/website/doctype/web_page/web_page.py
@@ -44,3 +44,5 @@
if self.doc.slideshow:
from website.helpers.slideshow import get_slideshow
get_slideshow(self)
+
+ self.doc.meta_description = self.doc.description
diff --git a/website/doctype/web_page/web_page.txt b/website/doctype/web_page/web_page.txt
index eed7d2b..effe064 100644
--- a/website/doctype/web_page/web_page.txt
+++ b/website/doctype/web_page/web_page.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-02-12 13:19:11",
+ "creation": "2013-03-28 10:35:30",
"docstatus": 0,
"modified": "2013-03-11 17:41:11",
"modified_by": "Administrator",
@@ -24,14 +24,12 @@
"permlevel": 0
},
{
- "amend": 0,
"doctype": "DocPerm",
"name": "__common__",
"parent": "Web Page",
"parentfield": "permissions",
"parenttype": "DocType",
"read": 1,
- "report": 1,
"role": "Website Manager",
"submit": 0
},
@@ -139,26 +137,18 @@
"options": "CSS"
},
{
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
- },
- {
- "cancel": 1,
"create": 1,
"doctype": "DocPerm",
"permlevel": 0,
+ "report": 1,
"write": 1
},
{
+ "amend": 0,
"cancel": 0,
"create": 0,
"doctype": "DocPerm",
- "permlevel": 1,
- "write": 0
+ "match": "",
+ "permlevel": 1
}
]
\ No newline at end of file
diff --git a/website/doctype/website_settings/website_settings.txt b/website/doctype/website_settings/website_settings.txt
index 0ebc75b..9c15480 100644
--- a/website/doctype/website_settings/website_settings.txt
+++ b/website/doctype/website_settings/website_settings.txt
@@ -1,8 +1,8 @@
[
{
- "creation": "2013-03-26 06:51:18",
+ "creation": "2013-04-30 12:58:46",
"docstatus": 0,
- "modified": "2013-04-17 11:51:24",
+ "modified": "2013-05-02 15:51:14",
"modified_by": "Administrator",
"owner": "Administrator"
},
@@ -219,22 +219,16 @@
"reqd": 0
},
{
- "description": "Enter domain names associated to this website, each on a new line",
"doctype": "DocField",
- "fieldname": "domain_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "Domain List",
- "reqd": 0
+ "fieldname": "column_break_28",
+ "fieldtype": "Column Break"
},
{
+ "description": "Disable Customer Signup link in Login page",
"doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
+ "fieldname": "disable_signup",
+ "fieldtype": "Check",
+ "label": "Disable Signup"
},
{
"create": 1,
diff --git a/website/doctype/website_slideshow/website_slideshow.py b/website/doctype/website_slideshow/website_slideshow.py
index 928aa9f..86bd2a0 100644
--- a/website/doctype/website_slideshow/website_slideshow.py
+++ b/website/doctype/website_slideshow/website_slideshow.py
@@ -5,4 +5,9 @@
class DocType:
def __init__(self, d, dl):
- self.doc, self.doclist = d, dl
\ No newline at end of file
+ self.doc, self.doclist = d, dl
+
+ def on_update(self):
+ # a slide show can be in use and any change in it should get reflected
+ from webnotes.webutils import clear_cache
+ clear_cache()
\ No newline at end of file
diff --git a/website/doctype/website_slideshow/website_slideshow.txt b/website/doctype/website_slideshow/website_slideshow.txt
index 4caa617..2887d4b 100644
--- a/website/doctype/website_slideshow/website_slideshow.txt
+++ b/website/doctype/website_slideshow/website_slideshow.txt
@@ -1,84 +1,78 @@
[
{
- "owner": "Administrator",
+ "creation": "2013-03-07 14:48:40",
"docstatus": 0,
- "creation": "2012-12-25 16:47:53",
+ "modified": "2012-12-25 16:56:34",
"modified_by": "Administrator",
- "modified": "2012-12-25 16:56:34"
+ "owner": "Administrator"
},
{
"allow_attach": 1,
"autoname": "field:slideshow_name",
- "name": "__common__",
- "module": "Website",
+ "description": "Slideshow like display for the website",
"doctype": "DocType",
- "max_attachments": 10,
"document_type": "Transaction",
- "description": "Slideshow like display for the website"
+ "max_attachments": 10,
+ "module": "Website",
+ "name": "__common__"
},
{
- "name": "__common__",
- "parent": "Website Slideshow",
"doctype": "DocField",
+ "name": "__common__",
+ "parent": "Website Slideshow",
+ "parentfield": "fields",
"parenttype": "DocType",
- "permlevel": 0,
- "parentfield": "fields"
+ "permlevel": 0
},
{
- "parent": "Website Slideshow",
- "read": 1,
- "report": 1,
"cancel": 1,
- "name": "__common__",
"create": 1,
"doctype": "DocPerm",
- "write": 1,
+ "name": "__common__",
+ "parent": "Website Slideshow",
+ "parentfield": "permissions",
"parenttype": "DocType",
- "role": "Website Manager",
"permlevel": 0,
- "parentfield": "permissions"
+ "read": 1,
+ "report": 1,
+ "role": "Website Manager",
+ "submit": 0,
+ "write": 1
},
{
- "name": "Website Slideshow",
- "doctype": "DocType"
+ "doctype": "DocType",
+ "name": "Website Slideshow"
},
{
- "read_only": 0,
"doctype": "DocField",
- "label": "Slideshow Name",
"fieldname": "slideshow_name",
"fieldtype": "Data",
+ "label": "Slideshow Name",
+ "read_only": 0,
"reqd": 1
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
- "label": "Slideshow Items",
"fieldname": "sb0",
- "fieldtype": "Section Break"
+ "fieldtype": "Section Break",
+ "label": "Slideshow Items"
},
{
"depends_on": "eval:!doc.__islocal",
"doctype": "DocField",
- "label": "Slideshow Items",
"fieldname": "slideshow_items",
"fieldtype": "Table",
+ "label": "Slideshow Items",
"options": "Website Slideshow Item"
},
{
- "description": "This goes above the slideshow.",
"depends_on": "eval:!doc.__islocal",
+ "description": "This goes above the slideshow.",
"doctype": "DocField",
- "label": "Header",
"fieldname": "header",
- "fieldtype": "Text Editor"
- },
- {
- "doctype": "DocField",
- "label": "File List",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1
+ "fieldtype": "Text Editor",
+ "label": "Header"
},
{
"doctype": "DocPerm"
diff --git a/website/doctype/website_slideshow_item/website_slideshow_item.txt b/website/doctype/website_slideshow_item/website_slideshow_item.txt
index aa98745..53aa628 100644
--- a/website/doctype/website_slideshow_item/website_slideshow_item.txt
+++ b/website/doctype/website_slideshow_item/website_slideshow_item.txt
@@ -1,6 +1,6 @@
[
{
- "creation": "2013-02-22 01:28:09",
+ "creation": "2013-03-07 12:26:33",
"docstatus": 0,
"modified": "2013-03-07 07:03:34",
"modified_by": "Administrator",
@@ -48,14 +48,5 @@
"label": "Description",
"print_width": "200px",
"width": "200px"
- },
- {
- "doctype": "DocField",
- "fieldname": "file_list",
- "fieldtype": "Text",
- "hidden": 1,
- "label": "File List",
- "no_copy": 1,
- "print_hide": 1
}
]
\ No newline at end of file
diff --git a/website/helpers/blog_feed.py b/website/helpers/blog_feed.py
index 41c203e..c79c5cc 100644
--- a/website/helpers/blog_feed.py
+++ b/website/helpers/blog_feed.py
@@ -49,9 +49,10 @@
def generate():
"""generate rss feed"""
- import webnotes, os
+ import os, urllib
+ import webnotes
from webnotes.model.doc import Document
- from website.helpers.blog import get_blog_content
+ from webnotes.utils import escape_html
host = (os.environ.get('HTTPS') and 'https://' or 'http://') + os.environ.get('HTTP_HOST')
@@ -62,7 +63,8 @@
order by published_on desc limit 20""", as_dict=1)
for blog in blog_list:
- blog.link = host + '/' + blog.name + '.html'
+ blog.link = urllib.quote(host + '/' + blog.name + '.html')
+ blog.content = escape_html(blog.content or "")
items += rss_item % blog
diff --git a/website/helpers/product.py b/website/helpers/product.py
index d6f16fb..a107d9b 100644
--- a/website/helpers/product.py
+++ b/website/helpers/product.py
@@ -4,10 +4,9 @@
from __future__ import unicode_literals
import webnotes
-from webnotes.utils import cstr
+from webnotes.utils import cstr, cint
from webnotes.webutils import build_html, delete_page_cache
-
@webnotes.whitelist(allow_guest=True)
def get_product_info(item_code):
"""get product price / stock info"""
@@ -20,10 +19,20 @@
in_stock = in_stock[0][0] > 0 and 1 or 0
else:
in_stock = -1
+
+ price = price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
+ `tabItem Price` where parent=%s and price_list_name=%s""",
+ (item_code, price_list), as_dict=1) or []
+
+ price = price and price[0] or None
+
+ if price:
+ price["ref_currency"] = not cint(webnotes.conn.get_default("hide_currency_symbol")) \
+ and (webnotes.conn.get_value("Currency", price.ref_currency, "symbol") or price.ref_currency) \
+ or ""
+
return {
- "price": price_list and webnotes.conn.sql("""select ref_rate, ref_currency from
- `tabItem Price` where parent=%s and price_list_name=%s""",
- (item_code, price_list), as_dict=1) or [],
+ "price": price,
"stock": in_stock
}
diff --git a/website/helpers/sitemap.py b/website/helpers/sitemap.py
index c8b6fd0..3956da1 100644
--- a/website/helpers/sitemap.py
+++ b/website/helpers/sitemap.py
@@ -2,6 +2,7 @@
# License: GNU General Public License (v3). For more information see license.txt
from __future__ import unicode_literals
+
frame_xml = """<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">%s
</urlset>"""
@@ -32,10 +33,11 @@
for p in pages:
if count >= max_items: break
- page_url = os.path.join(domain, urllib.quote(p[0]))
- modified = p[1].strftime('%Y-%m-%d')
- site_map += link_xml % (page_url, modified)
- count += 1
+ if p[0]:
+ page_url = os.path.join(domain, urllib.quote(p[0]))
+ modified = p[1].strftime('%Y-%m-%d')
+ site_map += link_xml % (page_url, modified)
+ count += 1
if count >= max_items: break
diff --git a/website/templates/css/product_page.css b/website/templates/css/product_page.css
index 566b6b5..71be9ee 100644
--- a/website/templates/css/product_page.css
+++ b/website/templates/css/product_page.css
@@ -7,4 +7,7 @@
font-size: 18px;
line-height: 200%;
}
+ .item-price {
+ margin-top: 20px;
+ }
</style>
\ No newline at end of file
diff --git a/website/templates/html/product_group.html b/website/templates/html/product_group.html
index b3c8511..0ad4048 100644
--- a/website/templates/html/product_group.html
+++ b/website/templates/html/product_group.html
@@ -1,8 +1,6 @@
{% extends "app/website/templates/html/page.html" %}
{% block content %}
-{% include 'app/website/templates/html/product_search_box.html' %}
-{% include 'app/website/templates/html/product_breadcrumbs.html' %}
<div class="span12">
{% if slideshow %}<!-- slideshow -->
{% include "app/website/templates/html/slideshow.html" %}
@@ -12,6 +10,10 @@
{% else %}
<h3>{{ name }}</h3>
{% endif %}
+</div>
+{% include 'app/website/templates/html/product_search_box.html' %}
+{% include 'app/website/templates/html/product_breadcrumbs.html' %}
+<div class="span12">
{% if sub_groups %}
<hr />
<div class="row">
diff --git a/website/templates/html/product_page.html b/website/templates/html/product_page.html
index 23091ad..3fda8cd 100644
--- a/website/templates/html/product_page.html
+++ b/website/templates/html/product_page.html
@@ -35,23 +35,25 @@
{{ web_long_description or web_short_description or
"[No description given]" }}
</div>
- {% if obj.doclist.get({"doctype":"Item Website Specification"}) %}
+ <div class="item-price hide"></div>
+ <div class="item-stock"></div>
+ </div>
+ </div>
+ {% if obj.doclist.get({"doctype":"Item Website Specification"}) -%}
+ <div class="row" style="margin-top: 20px">
+ <div class="span12">
<h4>Specifications</h4>
<table class="table table-bordered" style="width: 100%">
{% for d in obj.doclist.get(
- {"doctype":"Item Website Specification"}) %}
+ {"doctype":"Item Website Specification"}) -%}
<tr>
<td style="width: 30%;">{{ d.label }}</td>
<td>{{ d.description }}</td>
</tr>
- {% endfor %}
+ {%- endfor %}
</table>
- {% endif %}
- <div class="item-price hide">
- <p>Price:</p>
- </div>
- <div class="item-stock"></div>
</div>
</div>
+ {%- endif %}
</div>
{% endblock %}
\ No newline at end of file
diff --git a/website/templates/html/slideshow.html b/website/templates/html/slideshow.html
index e0e9038..b26338c 100644
--- a/website/templates/html/slideshow.html
+++ b/website/templates/html/slideshow.html
@@ -8,7 +8,7 @@
{% if slide.heading or slide.description %}
<div class="carousel-caption">
{% if slide.heading %}<h4>{{ slide.heading }}</h4>{% endif %}
- {% if slide.heading %}<p>{{ slide.description }}</p>{% endif %}
+ {% if slide.description %}<p>{{ slide.description }}</p>{% endif %}
</div>
{% endif %}
</div>
diff --git a/website/templates/js/product_page.js b/website/templates/js/product_page.js
index 653cfa3..69e9cd5 100644
--- a/website/templates/js/product_page.js
+++ b/website/templates/js/product_page.js
@@ -26,8 +26,8 @@
success: function(data) {
if(data.message) {
if(data.message.price) {
- $("<h4>").html(data.message.price[0].ref_currency + " "
- + data.message.price[0].ref_rate).appendTo(".item-price");
+ $("<h4>").html(data.message.price.ref_currency + " "
+ + data.message.price.ref_rate).appendTo(".item-price");
$(".item-price").toggle(true);
}
if(data.message.stock==0) {