[merge] merge with master
This commit is contained in:
commit
126f2c62f2
@ -187,7 +187,7 @@ class DocType:
|
||||
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(" - ")
|
||||
|
||||
|
@ -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"""
|
||||
|
@ -29,7 +29,7 @@ class DocType(DocTypeNestedSet):
|
||||
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:
|
||||
@ -87,7 +87,7 @@ class DocType(DocTypeNestedSet):
|
||||
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(" - ")
|
||||
|
||||
|
@ -34,11 +34,6 @@ class DocType(AccountsController):
|
||||
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'
|
||||
|
@ -122,119 +122,4 @@ test_records = [
|
||||
"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)
|
||||
]
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-04-30 12:58:25",
|
||||
"creation": "2013-05-09 13:16:11",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-03 14:36:24",
|
||||
"modified": "2013-05-23 12:52:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -213,6 +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",
|
||||
|
@ -464,15 +464,17 @@ class DocType(BuyingController):
|
||||
# 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, self.precision.item.amount) +
|
||||
flt(item.item_tax_amount, self.precision.item.item_tax_amount) +
|
||||
flt(item.rm_supp_cost, self.precision.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"
|
||||
})
|
||||
)
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-04-09 10:18:10",
|
||||
"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"
|
||||
},
|
||||
@ -30,7 +30,9 @@
|
||||
"parent": "Purchase Invoice",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"read": 1
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
@ -41,6 +43,7 @@
|
||||
"fieldname": "column_break0",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
@ -54,6 +57,7 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "BILL\nBILLJ",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
@ -68,6 +72,7 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -80,7 +85,8 @@
|
||||
"oldfieldname": "supplier",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Supplier",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -131,6 +137,7 @@
|
||||
"fieldname": "column_break1",
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
@ -146,6 +153,7 @@
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -159,6 +167,7 @@
|
||||
"oldfieldname": "bill_no",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -171,6 +180,7 @@
|
||||
"oldfieldname": "bill_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
@ -179,7 +189,8 @@
|
||||
"fieldname": "items",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Items",
|
||||
"oldfieldtype": "Section Break"
|
||||
"oldfieldtype": "Section Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
@ -189,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",
|
||||
@ -218,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",
|
||||
@ -229,7 +245,8 @@
|
||||
"oldfieldname": "purchase_receipt_main",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Purchase Receipt",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -237,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",
|
||||
@ -253,7 +272,8 @@
|
||||
"oldfieldname": "currency",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "Currency",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
@ -264,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)",
|
||||
@ -278,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",
|
||||
@ -287,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",
|
||||
@ -295,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",
|
||||
@ -303,7 +328,8 @@
|
||||
"fieldname": "taxes",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Taxes",
|
||||
"oldfieldtype": "Section Break"
|
||||
"oldfieldtype": "Section Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -313,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",
|
||||
@ -322,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",
|
||||
@ -331,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",
|
||||
@ -339,7 +368,8 @@
|
||||
"fieldtype": "Button",
|
||||
"label": "Calculate Tax",
|
||||
"oldfieldtype": "Button",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -347,7 +377,8 @@
|
||||
"fieldtype": "HTML",
|
||||
"label": "Tax Calculation",
|
||||
"oldfieldtype": "HTML",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -364,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",
|
||||
@ -372,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%"
|
||||
},
|
||||
{
|
||||
@ -387,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",
|
||||
@ -497,6 +533,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"oldfieldtype": "Column Break",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
@ -562,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",
|
||||
@ -572,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",
|
||||
@ -581,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",
|
||||
@ -594,6 +634,7 @@
|
||||
"oldfieldname": "against_expense_account",
|
||||
"oldfieldtype": "Small Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 0
|
||||
},
|
||||
{
|
||||
@ -602,7 +643,8 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Advances",
|
||||
"oldfieldtype": "Section Break",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -611,7 +653,8 @@
|
||||
"label": "Get Advances Paid",
|
||||
"oldfieldtype": "Button",
|
||||
"options": "get_advances",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -622,7 +665,8 @@
|
||||
"oldfieldname": "advance_allocation_details",
|
||||
"oldfieldtype": "Table",
|
||||
"options": "Purchase Invoice Advance",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -630,7 +674,8 @@
|
||||
"fieldtype": "Section Break",
|
||||
"label": "More Info",
|
||||
"oldfieldtype": "Section Break",
|
||||
"print_hide": 1
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"default": "No",
|
||||
@ -644,6 +689,7 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "No\nYes",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@ -655,6 +701,7 @@
|
||||
"oldfieldname": "aging_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
@ -680,6 +727,7 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Print Heading",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"report_hide": 1
|
||||
},
|
||||
{
|
||||
@ -692,6 +740,7 @@
|
||||
"oldfieldname": "due_date",
|
||||
"oldfieldtype": "Date",
|
||||
"print_hide": 0,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@ -701,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",
|
||||
@ -718,6 +769,7 @@
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Company",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@ -730,6 +782,7 @@
|
||||
"oldfieldtype": "Select",
|
||||
"options": "link:Fiscal Year",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
@ -753,81 +806,53 @@
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Text",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Accounts User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 1,
|
||||
"role": "Purchase User",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"match": "",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Purchase User",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"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",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"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
|
||||
}
|
||||
]
|
@ -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,
|
||||
|
@ -30,7 +30,6 @@ from webnotes import _, msgprint
|
||||
|
||||
month_map = {'Monthly': 1, 'Quarterly': 3, 'Half-yearly': 6, 'Yearly': 12}
|
||||
|
||||
|
||||
from controllers.selling_controller import SellingController
|
||||
|
||||
class DocType(SellingController):
|
||||
@ -40,9 +39,6 @@ class DocType(SellingController):
|
||||
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()
|
||||
@ -78,9 +74,11 @@ class DocType(SellingController):
|
||||
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:
|
||||
@ -195,11 +193,11 @@ class DocType(SellingController):
|
||||
self.doc.fields[fieldname] = pos.get(fieldname)
|
||||
|
||||
# set pos values in items
|
||||
for doc in self.doclist.get({"parentfield": "entries"}):
|
||||
if doc.fields.get('item_code'):
|
||||
for fieldname, val in self.apply_pos_settings(doc.fields).items():
|
||||
if (not for_validate) or (for_validate and not self.doc.fields.get(fieldname)):
|
||||
doc.fields[fieldname] = val
|
||||
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 and not self.doc.terms:
|
||||
@ -217,8 +215,9 @@ class DocType(SellingController):
|
||||
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]
|
||||
@ -555,6 +554,21 @@ class DocType(SellingController):
|
||||
|
||||
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'):
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-04-10 08:35:44",
|
||||
"creation": "2013-04-19 11:00:07",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-17 14:05:20",
|
||||
"modified": "2013-05-22 12:06:15",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -305,6 +305,7 @@
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Sales Order",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "sales_order",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Sales Order",
|
||||
@ -319,6 +320,7 @@
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "SO Detail ",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "so_detail",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
@ -331,6 +333,7 @@
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"label": "Delivery Note",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "delivery_note",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Delivery Note",
|
||||
@ -345,6 +348,7 @@
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"label": "DN Detail",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "dn_detail",
|
||||
"oldfieldtype": "Data",
|
||||
"print_hide": 1,
|
||||
|
@ -36,7 +36,7 @@ def execute(filters=None):
|
||||
# invoice details
|
||||
sales_order = ", ".join(invoice_so_dn_map.get(inv.name, {}).get("sales_order", []))
|
||||
delivery_note = ", ".join(invoice_so_dn_map.get(inv.name, {}).get("delivery_note", []))
|
||||
# webnotes.errprint(customer_map.get(inv.customer, []))
|
||||
|
||||
row = [inv.name, inv.posting_date, inv.customer, inv.debit_to,
|
||||
account_map.get(inv.debit_to), customer_map.get(inv.customer), inv.project_name,
|
||||
inv.remarks, sales_order, delivery_note]
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -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 @@ class DocType:
|
||||
|
||||
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))
|
||||
|
@ -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",
|
||||
|
@ -168,7 +168,7 @@ class DocType(TransactionBase):
|
||||
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 +186,7 @@ class DocType(TransactionBase):
|
||||
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,
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -111,6 +111,10 @@ wn.module_page["Buying"] = [
|
||||
"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",
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
@ -115,7 +115,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"
|
||||
@ -123,6 +123,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": {
|
||||
|
@ -367,9 +367,13 @@ class BuyingController(StockController):
|
||||
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
|
||||
|
||||
|
@ -1,4 +1,6 @@
|
||||
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",
|
||||
|
@ -18,7 +18,6 @@ from __future__ import unicode_literals
|
||||
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 @@ class DocType:
|
||||
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",
|
||||
|
@ -36,7 +36,7 @@ class DocType:
|
||||
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 @@ class DocType:
|
||||
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)
|
||||
|
||||
|
@ -335,15 +335,22 @@ def add_holidays(events, start, end, employee, company):
|
||||
def query_for_permitted_employees(doctype, txt, searchfield, start, page_len, filters):
|
||||
txt = "%" + cstr(txt) + "%"
|
||||
|
||||
return webnotes.conn.sql("""select name, employee_name from `tabEmployee` emp
|
||||
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) and
|
||||
(exists(select ela.name from `tabEmployee Leave Approver` ela
|
||||
where ela.parent=emp.name and ela.leave_approver=%s) or
|
||||
not exists(select ela.name from `tabEmployee Leave Approver` ela where ela.parent=emp.name)
|
||||
or user_id = %s)
|
||||
(`%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"]*8),
|
||||
(txt, txt, webnotes.session.user, webnotes.session.user, txt, txt, start, page_len))
|
||||
name limit %s, %s""" % tuple([searchfield] + ["%s"]*2 + [condition] + ["%s"]*4),
|
||||
(txt, txt, txt, txt, start, page_len))
|
||||
|
@ -75,7 +75,6 @@ erpnext.hr.AttendanceControlPanel = wn.ui.form.Controller.extend({
|
||||
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);
|
||||
|
@ -100,7 +100,6 @@ def get_naming_series():
|
||||
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 @@ def upload():
|
||||
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 @@ def upload():
|
||||
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
|
||||
|
@ -177,6 +177,14 @@ wn.module_page["HR"] = [
|
||||
"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"
|
||||
},
|
||||
]
|
||||
}
|
||||
];
|
||||
|
0
hr/report/monthly_attendance_sheet/__init__.py
Normal file
0
hr/report/monthly_attendance_sheet/__init__.py
Normal file
@ -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
|
||||
}
|
||||
]
|
||||
}
|
107
hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
Normal file
107
hr/report/monthly_attendance_sheet/monthly_attendance_sheet.py
Normal file
@ -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
|
@ -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"
|
||||
}
|
||||
]
|
0
hr/report/monthly_salary_register/__init__.py
Normal file
0
hr/report/monthly_salary_register/__init__.py
Normal file
32
hr/report/monthly_salary_register/monthly_salary_register.js
Normal file
32
hr/report/monthly_salary_register/monthly_salary_register.js
Normal file
@ -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
|
||||
}
|
||||
]
|
||||
}
|
119
hr/report/monthly_salary_register/monthly_salary_register.py
Normal file
119
hr/report/monthly_salary_register/monthly_salary_register.py
Normal file
@ -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
|
@ -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"
|
||||
}
|
||||
]
|
@ -34,7 +34,8 @@ class DocType:
|
||||
last_name = sql("""select max(name) from `tabBOM`
|
||||
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)
|
||||
|
@ -18,9 +18,6 @@ from __future__ import unicode_literals
|
||||
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
|
||||
|
||||
|
@ -9,10 +9,9 @@ def execute():
|
||||
|
||||
for doctype in webnotes.conn.sql_list("""select parent from tabDocField where
|
||||
fieldname='file_list'"""):
|
||||
update_file_list(doctype, singles)
|
||||
|
||||
webnotes.conn.sql("""delete from tabDocField where fieldname='file_list'
|
||||
and parent=%s""", doctype)
|
||||
# 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]])
|
||||
|
||||
|
@ -13,6 +13,4 @@ def execute():
|
||||
|
||||
webnotes.conn.sql("""delete from `tabCustom Field` where fieldname='file_list'
|
||||
and parent=%s""", doctype)
|
||||
webnotes.conn.sql("""delete from `tabDocField` where fieldname='file_list'
|
||||
and parent=%s""", doctype)
|
||||
|
@ -31,5 +31,4 @@ def execute():
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('core', 'profile')
|
||||
webnotes.reload_doc('core', 'doctype', 'profile')
|
@ -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()
|
@ -1,4 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
def execute():
|
||||
from webnotes.modules import reload_doc
|
||||
reload_doc("buying", "report", "supplier_quotations")
|
@ -23,3 +23,7 @@ def execute():
|
||||
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)
|
||||
|
@ -6,7 +6,6 @@ def execute():
|
||||
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()
|
@ -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()
|
@ -12,8 +12,6 @@ def execute():
|
||||
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()
|
@ -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')
|
||||
|
@ -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()
|
||||
|
||||
|
@ -2,11 +2,9 @@ from __future__ import unicode_literals
|
||||
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")
|
@ -8,8 +8,7 @@ def execute():
|
||||
|
||||
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', 'search_criteria')
|
||||
webnotes.reload_doc('core', 'doctype', 'report')
|
||||
|
||||
webnotes.conn.begin()
|
@ -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")
|
@ -4,9 +4,8 @@ def execute():
|
||||
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',
|
||||
|
@ -12,8 +12,7 @@ def execute():
|
||||
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("""\
|
||||
|
@ -94,8 +94,7 @@ from webnotes.model.code import get_obj
|
||||
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]))
|
||||
|
@ -25,5 +25,4 @@ def execute():
|
||||
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('setup', 'notification_control')
|
||||
webnotes.reload_doc('setup', 'doctype', 'notification_control')
|
@ -27,5 +27,4 @@ def execute():
|
||||
doc.save()
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('core', 'custom_script')
|
||||
webnotes.reload_doc('core', 'doctype', 'custom_script')
|
@ -19,5 +19,4 @@ def execute():
|
||||
doc.save()
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('core', 'profile')
|
||||
webnotes.reload_doc('core', 'doctype', 'profile')
|
@ -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()
|
||||
|
||||
|
@ -27,5 +27,4 @@ def execute():
|
||||
doc.save()
|
||||
webnotes.conn.commit()
|
||||
webnotes.conn.begin()
|
||||
import webnotes.model.sync
|
||||
webnotes.model.sync.sync('core', 'print_format')
|
||||
webnotes.reload_doc('core', 'doctype', 'print_format')
|
0
patches/may_2013/__init__.py
Normal file
0
patches/may_2013/__init__.py
Normal file
26
patches/may_2013/p01_conversion_factor_and_aii.py
Normal file
26
patches/may_2013/p01_conversion_factor_and_aii.py
Normal file
@ -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
|
||||
|
||||
|
47
patches/may_2013/p02_update_valuation_rate.py
Normal file
47
patches/may_2013/p02_update_valuation_rate.py
Normal file
@ -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
|
27
patches/may_2013/p03_update_support_ticket.py
Normal file
27
patches/may_2013/p03_update_support_ticket.py
Normal file
@ -0,0 +1,27 @@
|
||||
# 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():
|
||||
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))
|
@ -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')
|
||||
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)
|
29
patches/may_2013/p05_update_cancelled_gl_entries.py
Normal file
29
patches/may_2013/p05_update_cancelled_gl_entries.py
Normal file
@ -0,0 +1,29 @@
|
||||
# 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 cint
|
||||
|
||||
def execute():
|
||||
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)""")
|
34
patches/may_2013/repost_stock_for_no_posting_time.py
Normal file
34
patches/may_2013/repost_stock_for_no_posting_time.py
Normal file
@ -0,0 +1,34 @@
|
||||
# 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
|
||||
def execute():
|
||||
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")
|
@ -74,15 +74,12 @@ patch_list = [
|
||||
"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",
|
||||
@ -93,7 +90,6 @@ patch_list = [
|
||||
"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",
|
||||
@ -250,4 +246,10 @@ patch_list = [
|
||||
"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",
|
||||
]
|
@ -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);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
cur_frm.cscript = new erpnext.projects.TimeLog({frm: cur_frm});
|
@ -5,4 +5,25 @@ import webnotes
|
||||
|
||||
@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"])
|
||||
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))
|
@ -40,7 +40,7 @@ $.extend(erpnext.complete_setup, {
|
||||
{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 @@ $.extend(erpnext.complete_setup, {
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
})
|
||||
|
||||
@ -82,19 +88,15 @@ $.extend(erpnext.complete_setup, {
|
||||
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 +129,5 @@ $.extend(erpnext.complete_setup, {
|
||||
'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'],
|
||||
});
|
@ -160,4 +160,8 @@ erpnext.queries.bom = function(opts) {
|
||||
: "")
|
||||
+ " LIMIT 50"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
erpnext.queries.task = function() {
|
||||
return { query: "projects.utils.query_task" };
|
||||
};
|
@ -216,7 +216,7 @@ class DocType(TransactionBase):
|
||||
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 = [
|
||||
@ -244,7 +244,7 @@ class DocType(TransactionBase):
|
||||
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,
|
||||
|
@ -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 @@ test_records = [
|
||||
"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"
|
||||
}]
|
||||
]
|
@ -18,9 +18,7 @@ from __future__ import unicode_literals
|
||||
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 @@ class DocType(TransactionBase):
|
||||
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()
|
||||
|
@ -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"
|
||||
}
|
||||
]
|
@ -104,7 +104,17 @@ cur_frm.cscript['Create Customer'] = function(){
|
||||
'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);
|
||||
});
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -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,28 +868,23 @@
|
||||
"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,
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -217,7 +217,10 @@ class DocType(SellingController):
|
||||
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)
|
||||
|
@ -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
|
||||
},
|
||||
{
|
||||
|
@ -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
|
||||
@ -287,7 +288,10 @@ class DocType:
|
||||
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))
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-04-01 15:05:24",
|
||||
"creation": "2013-05-02 17:53:24",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-02 15:05:21",
|
||||
"modified": "2013-05-22 15:57:26",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -27,6 +27,8 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
@ -170,7 +172,8 @@
|
||||
"fieldname": "item_naming_by",
|
||||
"fieldtype": "Select",
|
||||
"label": "Item Naming By",
|
||||
"options": "Item Code\nNaming Series"
|
||||
"options": "Item Code\nNaming Series",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
@ -212,14 +215,6 @@
|
||||
"label": "Allow Negative Stock",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "default_warehouse_type",
|
||||
"fieldtype": "Link",
|
||||
"label": "Default Warehouse Type",
|
||||
"options": "Warehouse Type",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "auto_indent",
|
||||
@ -227,6 +222,21 @@
|
||||
"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",
|
||||
@ -235,6 +245,14 @@
|
||||
"read_only": 0,
|
||||
"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",
|
||||
@ -274,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",
|
||||
@ -507,11 +526,6 @@
|
||||
"label": "SMS Sender Name",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"doctype": "DocPerm"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm"
|
||||
}
|
||||
|
@ -81,3 +81,4 @@ class DocType(DocTypeNestedSet):
|
||||
if self.doc.slideshow:
|
||||
from website.helpers.slideshow import get_slideshow
|
||||
get_slideshow(self)
|
||||
|
@ -33,3 +33,6 @@ class DocType:
|
||||
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)
|
@ -193,21 +193,8 @@ wn.module_page["Setup"] = [
|
||||
]
|
||||
},
|
||||
{
|
||||
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: [
|
||||
{
|
||||
@ -215,6 +202,18 @@ wn.module_page["Setup"] = [
|
||||
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")
|
||||
},
|
||||
]
|
||||
},
|
||||
]
|
||||
|
@ -55,6 +55,10 @@ def execute_daily():
|
||||
from setup.doctype.backup_manager.backup_manager import take_backups_daily
|
||||
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()
|
||||
|
@ -1,5 +1,5 @@
|
||||
import webnotes, conf, os
|
||||
from webnotes.utils import cint, cstr
|
||||
from webnotes.utils import cint, cstr, encode
|
||||
|
||||
def get_templates_path():
|
||||
return os.path.join(os.path.dirname(conf.__file__), "app", "website", "templates")
|
||||
@ -72,7 +72,7 @@ def update_template_args(page_name, args):
|
||||
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
|
||||
|
@ -77,10 +77,6 @@ class DocType:
|
||||
|
||||
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"), args.get("company"))
|
||||
|
||||
def get_first_sle(self):
|
||||
sle = sql("""
|
||||
select * from `tabStock Ledger Entry`
|
||||
@ -90,82 +86,4 @@ class DocType:
|
||||
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, company):
|
||||
""" 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,
|
||||
company, material_request_type)
|
||||
|
||||
def create_material_request(self, doc_type, doc_name, reorder_level, reorder_qty, company,
|
||||
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": company or 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
|
@ -419,4 +419,4 @@ class DocType(SellingController):
|
||||
|
||||
if gl_entries:
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
make_gl_entries(gl_entries)
|
||||
make_gl_entries(gl_entries, cancel=(self.doc.docstatus == 2))
|
@ -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,
|
||||
|
@ -51,6 +51,7 @@ class DocType(DocListController):
|
||||
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')
|
||||
@ -201,6 +202,13 @@ class DocType(DocListController):
|
||||
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`
|
||||
@ -272,7 +280,7 @@ class DocType(DocListController):
|
||||
from webnotes.webutils import clear_cache
|
||||
clear_cache(self.doc.page_name)
|
||||
|
||||
def on_rename(self,newdn,olddn):
|
||||
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
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-03 10:45:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-07 15:58:58",
|
||||
"modified": "2013-05-22 15:48:27",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -363,21 +363,6 @@
|
||||
"label": "Re-Order Qty",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break_31",
|
||||
"fieldtype": "Column Break",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"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",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "section_break_31",
|
||||
|
@ -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
|
||||
}
|
||||
]
|
@ -19,7 +19,7 @@ import webnotes
|
||||
|
||||
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 @@ class DocType(StockController):
|
||||
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 @@ class DocType(StockController):
|
||||
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)
|
@ -57,6 +57,7 @@ class DocType(StockController):
|
||||
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 @@ class DocType(StockController):
|
||||
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
|
||||
@ -220,7 +224,7 @@ class DocType(StockController):
|
||||
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
|
||||
|
@ -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"
|
||||
},
|
||||
@ -518,6 +518,14 @@
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amount",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "project_name",
|
||||
@ -558,6 +566,14 @@
|
||||
"read_only": 0,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "col5",
|
||||
"fieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
@ -576,14 +592,6 @@
|
||||
"reqd": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "col5",
|
||||
"fieldtype": "Column Break",
|
||||
"print_width": "50%",
|
||||
"read_only": 0,
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
|
@ -201,6 +201,10 @@ wn.module_page["Stock"] = [
|
||||
"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",
|
||||
},
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -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-13 16:11:27",
|
||||
"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`.`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"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user