Merge branch 'responsive' of github.com:webnotes/erpnext into responsive
Conflicts: selling/doctype/quotation/quotation.py utilities/transaction_base.py
This commit is contained in:
commit
63d844b2d2
@ -124,6 +124,7 @@ cur_frm.cscript.convert_to_group = function(doc, cdt, cdn) {
|
||||
cur_frm.fields_dict['master_name'].get_query = function(doc) {
|
||||
if (doc.master_type) {
|
||||
return {
|
||||
doctype: doc.master_type,
|
||||
query: "accounts.doctype.account.account.get_master_name",
|
||||
filters: { "master_type": doc.master_type }
|
||||
}
|
||||
@ -132,7 +133,9 @@ cur_frm.fields_dict['master_name'].get_query = function(doc) {
|
||||
|
||||
cur_frm.fields_dict['parent_account'].get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.doctype.account.account.get_parent_account",
|
||||
filters: { "company": doc.company}
|
||||
filters: {
|
||||
"group_or_ledger": "Group",
|
||||
"company": doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:37",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 11:05:59",
|
||||
"modified": "2013-07-10 14:54:03",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_id",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher ID",
|
||||
"oldfieldname": "voucher_id",
|
||||
"oldfieldtype": "Link",
|
||||
@ -39,6 +40,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_account",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Against Account",
|
||||
"oldfieldname": "against_account",
|
||||
"oldfieldtype": "Data",
|
||||
@ -49,6 +51,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"oldfieldname": "posting_date",
|
||||
"oldfieldtype": "Date",
|
||||
@ -58,6 +61,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "clearance_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Clearance Date",
|
||||
"oldfieldname": "clearance_date",
|
||||
"oldfieldtype": "Date"
|
||||
@ -66,6 +70,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_number",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Cheque Number",
|
||||
"oldfieldname": "cheque_number",
|
||||
"oldfieldtype": "Data",
|
||||
@ -75,6 +80,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cheque_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Cheque Date",
|
||||
"oldfieldname": "cheque_date",
|
||||
"oldfieldtype": "Date",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2012-03-27 14:35:41",
|
||||
"docstatus": 0,
|
||||
"modified": "2012-03-27 14:35:41",
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "nabin@webnotestech.com"
|
||||
},
|
||||
@ -10,10 +10,7 @@
|
||||
"doctype": "DocType",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"section_style": "Simple",
|
||||
"show_in_menu": 0,
|
||||
"version": 23
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:55:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 14:44:37",
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Budget Detail",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:19",
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Budget Distribution Detail",
|
||||
"parentfield": "fields",
|
||||
|
@ -18,10 +18,12 @@
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict.invoice_details.grid.get_field("invoice_no").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.doctype.c_form.c_form.get_invoice_nos",
|
||||
filters: {
|
||||
customer: doc.customer,
|
||||
company: doc.company
|
||||
"docstatus": 1,
|
||||
"customer": doc.customer,
|
||||
"company": doc.company,
|
||||
"c_form_applicable": 'Yes',
|
||||
"c_form_no": ''
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:19",
|
||||
"modified": "2013-07-10 14:54:06",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "C-Form Invoice Detail",
|
||||
"parentfield": "fields",
|
||||
|
@ -36,11 +36,25 @@ cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
//Account filtering for cost center
|
||||
cur_frm.fields_dict['budget_details'].grid.get_field('account').get_query = function(doc) {
|
||||
var mydoc = locals[this.doctype][this.docname];
|
||||
return 'SELECT DISTINCT `tabAccount`.`name`,`tabAccount`.debit_or_credit,`tabAccount`.group_or_ledger FROM `tabAccount` WHERE `tabAccount`.`company` = "' + doc.company + '" AND `tabAccount`.docstatus != 2 AND `tabAccount`.`is_pl_account` = "Yes" AND `tabAccount`.debit_or_credit = "Debit" AND `tabAccount`.`group_or_ledger` != "Group" AND `tabAccount`.`group_or_ledger` is not NULL AND `tabAccount`.`name` LIKE "%s" ORDER BY `tabAccount`.`name` LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Account', 'company', '=', doc.company_name],
|
||||
['Account', 'is_pl_account', '=', 'Yes'],
|
||||
['Account', 'debit_or_credit', '=', 'Debit'],
|
||||
['Account', 'group_or_ledger', '!=', 'Group'],
|
||||
['Account', 'group_or_ledger', 'is not', 'NULL']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['parent_cost_center'].get_query = function(doc){
|
||||
return 'SELECT DISTINCT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Group" AND `tabCost Center`.docstatus != 2 AND `tabCost Center`.company="'+ doc.company+'" AND `tabCost Center`.company is not NULL AND `tabCost Center`.name LIKE "%s" ORDER BY `tabCost Center`.name LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Cost Center', 'group_or_ledger', '=', 'Group'],
|
||||
['Cost Center', 'company', '=', doc.company_name],
|
||||
['Cost Center', 'company_name', 'is not', 'NULL']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
//parent cost center
|
||||
|
@ -196,24 +196,32 @@ cur_frm.fields_dict['entries'].grid.get_field('account').get_query = function(do
|
||||
|
||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.utils.get_cost_center_list",
|
||||
filters: { company: doc.company}
|
||||
filters: {
|
||||
'company_name': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field('against_voucher').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return {
|
||||
query: "accounts.doctype.journal_voucher.journal_voucher.get_against_purchase_invoice",
|
||||
filters: { account: d.account }
|
||||
filters: [
|
||||
['Purchase Invoice', 'credit_to', '=', d.account],
|
||||
['Purchase Invoice', 'docstatus', '=', 1],
|
||||
['Purchase Invoice', 'outstanding_amount', '>', 0]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field('against_invoice').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
return {
|
||||
query: "accounts.doctype.journal_voucher.journal_voucher.get_against_sales_invoice",
|
||||
filters: { account: d.account }
|
||||
filters: [
|
||||
['Sales Invoice', 'debit_to', '=', d.account],
|
||||
['Sales Invoice', 'docstatus', '=', 1],
|
||||
['Sales Invoice', 'outstanding_amount', '>', 0]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-01 13:53:33",
|
||||
"modified": "2013-07-10 14:56:33",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Account",
|
||||
"oldfieldname": "account",
|
||||
"oldfieldtype": "Link",
|
||||
@ -39,30 +40,14 @@
|
||||
"search_index": 1,
|
||||
"width": "250px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Debit",
|
||||
"oldfieldname": "debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"label": "Credit",
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"default": ":Company",
|
||||
"description": "If Income or Expense",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
@ -71,10 +56,31 @@
|
||||
"search_index": 0,
|
||||
"width": "180px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "debit",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Debit",
|
||||
"oldfieldname": "debit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Credit",
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "balance",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Account Balance",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "balance",
|
||||
@ -87,6 +93,7 @@
|
||||
"fieldname": "against_voucher",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Against Purchase Invoice",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "against_voucher",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2012-03-27 14:35:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2012-03-27 14:35:49",
|
||||
"modified": "2013-07-10 14:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -10,10 +10,7 @@
|
||||
"doctype": "DocType",
|
||||
"issingle": 1,
|
||||
"module": "Accounts",
|
||||
"name": "__common__",
|
||||
"section_style": "Simple",
|
||||
"show_in_menu": 0,
|
||||
"version": 120
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
|
@ -15,8 +15,11 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.set_query("default_account", function(doc) {
|
||||
return erpnext.queries.account({
|
||||
account_type: "Bank or Cash",
|
||||
company: doc.company
|
||||
});
|
||||
return{
|
||||
query: "controllers.queries.account_query",
|
||||
filters: {
|
||||
'account_type': "Bank or Cash",
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
});
|
@ -36,25 +36,15 @@ cur_frm.fields_dict.voucher_no.get_query = function(doc) {
|
||||
// TO-do: check for pos, it should not come
|
||||
if (!doc.account) msgprint("Please select Account first");
|
||||
else {
|
||||
return repl("select gle.voucher_no, gle.posting_date, gle.%(account_type)s \
|
||||
from `tabGL Entry` gle \
|
||||
where gle.account = '%(acc)s' \
|
||||
and gle.voucher_type = '%(dt)s' \
|
||||
and gle.voucher_no like '%s' \
|
||||
and ifnull(gle.is_cancelled, 'No') = 'No' \
|
||||
and (ifnull(gle.against_voucher, '') = '' \
|
||||
or ifnull(gle.against_voucher, '') = gle.voucher_no ) \
|
||||
and ifnull(gle.%(account_type)s, 0) > 0 \
|
||||
and (select ifnull(abs(sum(ifnull(debit, 0)) - sum(ifnull(credit, 0))), 0) \
|
||||
from `tabGL Entry` \
|
||||
where against_voucher_type = '%(dt)s' \
|
||||
and against_voucher = gle.voucher_no \
|
||||
and voucher_no != gle.voucher_no \
|
||||
and account = gle.account \
|
||||
and ifnull(is_cancelled, 'No') = 'No') != \
|
||||
abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)) \
|
||||
ORDER BY gle.posting_date DESC, gle.voucher_no DESC LIMIT 50",
|
||||
{dt:doc.voucher_type, acc:doc.account, account_type: doc.account_type});
|
||||
return {
|
||||
doctype: doc.voucher_type,
|
||||
query: "accounts.doctype.payment_to_invoice_matching_tool.payment_to_invoice_matching_tool.gl_entry_details",
|
||||
filters: {
|
||||
"dt": doc.voucher_type,
|
||||
"acc": doc.account,
|
||||
"account_type": doc.account_type
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -139,3 +139,30 @@ class DocType:
|
||||
msgprint("Successfully allocated.")
|
||||
else:
|
||||
msgprint("No amount allocated.", raise_exception=1)
|
||||
|
||||
def gl_entry_details(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
return webnotes.conn.sql("""select gle.voucher_no, gle.posting_date,
|
||||
gle.%(account_type)s from `tabGL Entry` gle
|
||||
where gle.account = '%(acc)s'
|
||||
and gle.voucher_type = '%(dt)s'
|
||||
and gle.voucher_no like '%(txt)s'
|
||||
and ifnull(gle.is_cancelled, 'No') = 'No'
|
||||
and (ifnull(gle.against_voucher, '') = ''
|
||||
or ifnull(gle.against_voucher, '') = gle.voucher_no )
|
||||
and ifnull(gle.%(account_type)s, 0) > 0
|
||||
and (select ifnull(abs(sum(ifnull(debit, 0))
|
||||
- sum(ifnull(credit, 0))), 0)
|
||||
from `tabGL Entry`
|
||||
where against_voucher_type = '%(dt)s'
|
||||
and against_voucher = gle.voucher_no
|
||||
and voucher_no != gle.voucher_no
|
||||
and ifnull(is_cancelled, 'No') = 'No')
|
||||
!= abs(ifnull(gle.debit, 0) - ifnull(gle.credit, 0)
|
||||
)
|
||||
%(mcond)s
|
||||
ORDER BY gle.posting_date desc, gle.voucher_no desc
|
||||
limit %(start)s, %(page_len)s""" % {dt:filters["dt"], acc:filters["acc"],
|
||||
account_type: filters['account_type'], 'mcond':get_match_cond(doctype, searchfield)
|
||||
'txt': "%%%s%%" % txt,"start": start, "page_len": page_len})
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:26",
|
||||
"modified": "2013-07-10 14:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -28,6 +28,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "voucher_no",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher No",
|
||||
"options": "Journal Voucher",
|
||||
"print_width": "140px",
|
||||
@ -39,6 +40,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_due",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Unmatched Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
@ -47,6 +49,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amt_to_be_reconciled",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Allocated Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"reqd": 1
|
||||
@ -55,6 +58,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "posting_date",
|
||||
"fieldtype": "Date",
|
||||
"in_list_view": 1,
|
||||
"label": "Posting Date",
|
||||
"read_only": 1
|
||||
},
|
||||
@ -62,6 +66,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "total_amt",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Total Amount",
|
||||
"options": "Company:company:default_currency",
|
||||
"read_only": 1
|
||||
@ -70,6 +75,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "against_account",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Against Account",
|
||||
"read_only": 1
|
||||
},
|
||||
|
@ -23,5 +23,13 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
|
||||
// ***************** Get Account Head *****************
|
||||
cur_frm.fields_dict['closing_account_head'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabAccount`.name FROM `tabAccount` WHERE `tabAccount`.is_pl_account = "No" AND `tabAccount`.debit_or_credit = "Credit" AND `tabAccount`.company = "'+ cstr(doc.company) +'" AND ifnull(`tabAccount`.freeze_account, "No") = "No" AND `tabAccount`.group_or_ledger = "Ledger" AND `tabAccount`.%(key)s LIKE "%s" ORDER BY `tabAccount`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:{
|
||||
'is_pl_account': "No",
|
||||
"debit_or_credit": "Credit",
|
||||
"company": doc.company,
|
||||
"freeze_account": "No",
|
||||
"group_or_ledger": "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,43 +25,72 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
//cash bank account
|
||||
//------------------------------------
|
||||
cur_frm.fields_dict['cash_bank_account'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': "Debit",
|
||||
'is_pl_account': "No",
|
||||
'group_or_ledger': "Ledger",
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Income Account
|
||||
// --------------------------------
|
||||
cur_frm.fields_dict['income_account'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.account_type ="Income Account" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': "Credit",
|
||||
'group_or_ledger': "Ledger",
|
||||
'company': doc.company,
|
||||
'account_type': "Income Account"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Cost Center
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict['cost_center'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
filters:{
|
||||
'company_name': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get query select Territory
|
||||
//=================================================================
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
filters:{
|
||||
'is_group': "No"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ------------------ Get Print Heading ------------------------------------
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict["expense_account"].get_query = function(doc) {
|
||||
return {
|
||||
"query": "accounts.utils.get_account_list",
|
||||
"filters": {
|
||||
filters: {
|
||||
"is_pl_account": "Yes",
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.company
|
||||
"company": doc.company,
|
||||
"group_or_ledger": "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.user.get_query = erpnext.utils.profile_query;
|
||||
cur_frm.fields_dict.user.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.profile_query"}
|
||||
}
|
||||
|
@ -152,30 +152,55 @@ cur_frm.cscript.make_bank_voucher = function() {
|
||||
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return{
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field("item_code").get_query = function(doc, cdt, cdn) {
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_purchase_item, "No")': 'Yes'
|
||||
})
|
||||
return {
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{
|
||||
'is_purchase_item': 'Yes'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['credit_to'].get_query = function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Credit" AND tabAccount.is_pl_account="No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': 'Credit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Get Print Heading
|
||||
cur_frm.fields_dict['select_print_heading'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabPrint Heading`.name FROM `tabPrint Heading` WHERE `tabPrint Heading`.docstatus !=2 AND `tabPrint Heading`.name LIKE "%s" ORDER BY `tabPrint Heading`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Print Heading', 'docstatus', '!=', 2]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field("expense_head").get_query = function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Debit" OR tabAccount.account_type = "Expense Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit':'Debit',
|
||||
'account_type': 'Expense Account',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
||||
var d = locals[cdt][cdn];
|
||||
@ -190,8 +215,11 @@ cur_frm.cscript.expense_head = function(doc, cdt, cdn){
|
||||
|
||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.utils.get_cost_center_list",
|
||||
filters: { company: doc.company}
|
||||
filters: {
|
||||
'company_name': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,9 +260,11 @@ cur_frm.cscript.make_jv = function(doc, dt, dn, bank_account) {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['entries'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-08 15:36:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-20 16:52:12",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "journal_voucher",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Journal Voucher",
|
||||
"oldfieldname": "journal_voucher",
|
||||
"oldfieldtype": "Link",
|
||||
@ -42,6 +43,7 @@
|
||||
"fieldname": "jv_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Journal Voucher Detail No",
|
||||
"oldfieldname": "jv_detail_no",
|
||||
"oldfieldtype": "Date",
|
||||
@ -54,6 +56,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "advance_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Advance Amount",
|
||||
"oldfieldname": "advance_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -66,6 +69,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "allocated_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Allocated Amount",
|
||||
"oldfieldname": "allocated_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -77,6 +81,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Remarks",
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-22 12:43:10",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 12:21:47",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -44,6 +45,7 @@
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -55,6 +57,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
@ -62,10 +65,18 @@
|
||||
"read_only": 0,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -77,6 +88,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"options": "UOM",
|
||||
"print_hide": 1,
|
||||
@ -86,6 +98,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
@ -95,6 +108,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "discount_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount %",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
@ -103,6 +117,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate ",
|
||||
"oldfieldname": "import_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -115,6 +130,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "import_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -126,6 +142,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
@ -135,6 +152,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Rate (Company Currency)",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -147,6 +165,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -155,10 +174,18 @@
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "accounting",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Accounting"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "expense_head",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Expense Head",
|
||||
"oldfieldname": "expense_head",
|
||||
"oldfieldtype": "Link",
|
||||
@ -174,6 +201,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
@ -183,11 +211,19 @@
|
||||
"read_only": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Project Name",
|
||||
"options": "Project",
|
||||
"print_hide": 1,
|
||||
@ -198,6 +234,7 @@
|
||||
"fieldname": "brand",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Data",
|
||||
@ -210,6 +247,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
@ -223,6 +261,7 @@
|
||||
"fieldname": "purchase_order",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Order",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "purchase_order",
|
||||
@ -238,6 +277,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Order Item",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "po_detail",
|
||||
@ -251,6 +291,7 @@
|
||||
"fieldname": "purchase_receipt",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Purchase Receipt",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "purchase_receipt",
|
||||
@ -266,6 +307,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "PR Detail",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "pr_detail",
|
||||
@ -280,6 +322,7 @@
|
||||
"fieldname": "item_tax_rate",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -292,6 +335,7 @@
|
||||
"fieldname": "item_tax_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Amount",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
@ -306,6 +350,7 @@
|
||||
"fieldname": "valuation_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Valuation Rate",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
@ -316,6 +361,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Conversion Factor",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
@ -325,6 +371,7 @@
|
||||
"fieldname": "rm_supp_cost",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Raw Materials Supplied Cost",
|
||||
"no_copy": 1,
|
||||
"options": "Company:company:default_currency",
|
||||
@ -336,6 +383,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "page_break",
|
||||
"fieldtype": "Check",
|
||||
"in_list_view": 0,
|
||||
"label": "Page Break",
|
||||
"no_copy": 1,
|
||||
"print_hide": 1,
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-21 16:16:04",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-28 12:02:02",
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -31,6 +31,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "category",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Consider Tax or Charge for",
|
||||
"oldfieldname": "category",
|
||||
"oldfieldtype": "Select",
|
||||
@ -42,6 +43,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "charge_type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"oldfieldname": "charge_type",
|
||||
"oldfieldtype": "Select",
|
||||
@ -53,6 +55,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_head",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Account Head",
|
||||
"oldfieldname": "account_head",
|
||||
"oldfieldtype": "Link",
|
||||
@ -65,6 +68,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
@ -75,6 +79,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -87,6 +92,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -127,18 +127,28 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
refresh_field('row_id',d.name,'purchase_tax_details');
|
||||
}
|
||||
|
||||
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
|
||||
|
||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND (tabAccount.account_type in ("Tax", "Chargeable", "Expense Account") or (tabAccount.is_pl_account = "Yes" and tabAccount.debit_or_credit = "Debit")) AND tabAccount.company = "' + doc.company + '" AND tabAccount.name LIKE "%s"'
|
||||
}
|
||||
|
||||
cur_frm.set_query("account_head", "purchase_tax_details", function() {
|
||||
return {
|
||||
filters: [
|
||||
["Account", "group_or_ledger", "=", "Ledger"],
|
||||
["Account", "docstatus", "!=", 2],
|
||||
["Account", "account_type", "in", "Tax, Chargeable, Expense Account"],
|
||||
["Account", "is_pl_account", "=", "Yes"],
|
||||
["Account", "debit_or_credit", "=", "Debit"],
|
||||
["Account", "company", "=", doc.company]
|
||||
]
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.fields_dict['purchase_tax_details'].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||
return {
|
||||
filters: {
|
||||
'company_name': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.cscript.account_head = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
if(!d.charge_type && d.account_head){
|
||||
|
@ -249,55 +249,84 @@ cur_frm.cscript.make_bank_voucher = function() {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.debit_to.get_query = function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters: {
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.cash_bank_account.get_query = function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "No" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters: {
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'No',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.write_off_account.get_query = function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.debit_or_credit="Debit" AND tabAccount.is_pl_account = "Yes" AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters:{
|
||||
'debit_or_credit': 'Debit',
|
||||
'is_pl_account': 'Yes',
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Write off cost center
|
||||
//-----------------------
|
||||
cur_frm.fields_dict.write_off_cost_center.get_query = function(doc) {
|
||||
return 'SELECT `tabCost Center`.name FROM `tabCost Center` WHERE `tabCost Center`.group_or_ledger="Ledger" AND `tabCost Center`.docstatus!=2 AND `tabCost Center`.company="'+doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s"'
|
||||
return{
|
||||
filters:{
|
||||
'group_or_ledger': 'Ledger',
|
||||
'company_name': doc.company
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//project name
|
||||
//--------------------------
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, cdt, cdn) {
|
||||
var cond = '';
|
||||
if(doc.customer) cond = '(`tabProject`.customer = "'+doc.customer+'" OR IFNULL(`tabProject`.customer,"")="") AND';
|
||||
return repl('SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND %(cond)s `tabProject`.name LIKE "%s" \
|
||||
ORDER BY `tabProject`.name ASC LIMIT 50', {cond:cond});
|
||||
return{
|
||||
query: "controllers.queries.get_project_name",
|
||||
filters: {'customer': doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
//Territory
|
||||
//-----------------------------
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
filters: {'is_group': 'NO'}
|
||||
}
|
||||
}
|
||||
|
||||
// Income Account in Details Table
|
||||
// --------------------------------
|
||||
cur_frm.set_query("income_account", "entries", function(doc) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE (tabAccount.debit_or_credit="Credit" OR tabAccount.account_type = "Income Account") AND tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus!=2 AND tabAccount.company="'+doc.company+'" AND tabAccount.%(key)s LIKE "%s"';
|
||||
})
|
||||
return{
|
||||
query: "accounts.doctype.sales_invoice.sales_invoice.get_income_account",
|
||||
filters: {'company': doc.company}
|
||||
}
|
||||
});
|
||||
|
||||
// expense account
|
||||
if (sys_defaults.auto_inventory_accounting) {
|
||||
cur_frm.fields_dict['entries'].grid.get_field('expense_account').get_query = function(doc) {
|
||||
return {
|
||||
"query": "accounts.utils.get_account_list",
|
||||
"filters": {
|
||||
"is_pl_account": "Yes",
|
||||
"debit_or_credit": "Debit",
|
||||
"company": doc.company
|
||||
filters: {
|
||||
'is_pl_account': 'Yes',
|
||||
'debit_or_credit': 'Debit',
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -307,15 +336,22 @@ if (sys_defaults.auto_inventory_accounting) {
|
||||
//----------------------------
|
||||
cur_frm.fields_dict['entries'].grid.get_field('warehouse').get_query= function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return "SELECT `tabBin`.`warehouse`, `tabBin`.`actual_qty` FROM `tabBin` WHERE `tabBin`.`item_code` = '"+ d.item_code +"' AND ifnull(`tabBin`.`actual_qty`,0) > 0 AND `tabBin`.`warehouse` like '%s' ORDER BY `tabBin`.`warehouse` DESC LIMIT 50";
|
||||
return{
|
||||
filters:[
|
||||
['Bin', 'item_code', '=', d.item_code],
|
||||
['Bin', 'actual_qty', '>', 0]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
// Cost Center in Details Table
|
||||
// -----------------------------
|
||||
cur_frm.fields_dict["entries"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.utils.get_cost_center_list",
|
||||
filters: { company: doc.company}
|
||||
filters: {
|
||||
'company': doc.company,
|
||||
'group_or_ledger': 'Ledger'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -984,3 +984,16 @@ def get_bank_cash_account(mode_of_payment):
|
||||
return {
|
||||
"cash_bank_account": val
|
||||
}
|
||||
|
||||
def get_income_account(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
return webnotes.conn.sql("""select tabAccount.name from `tabAccount`
|
||||
where (tabAccount.debit_or_credit="Credit"
|
||||
or tabAccount.account_type = "Income Account")
|
||||
and tabAccount.group_or_ledger="Ledger"
|
||||
and tabAccount.docstatus!=2
|
||||
and tabAccount.company = '%(company)s'
|
||||
and tabAccount.%(key)s LIKE '%(txt)s'
|
||||
%(mcond)s""" % {'company': filters['company'], 'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield)})
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:41",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:30",
|
||||
"modified": "2013-07-10 14:54:19",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "journal_voucher",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Journal Voucher",
|
||||
"oldfieldname": "journal_voucher",
|
||||
"oldfieldtype": "Link",
|
||||
@ -42,6 +43,7 @@
|
||||
"fieldname": "jv_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Journal Voucher Detail No",
|
||||
"oldfieldname": "jv_detail_no",
|
||||
"oldfieldtype": "Data",
|
||||
@ -54,6 +56,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "advance_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Advance amount",
|
||||
"oldfieldname": "advance_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -66,6 +69,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "allocated_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Allocated amount",
|
||||
"oldfieldname": "allocated_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -77,6 +81,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "remarks",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Remarks",
|
||||
"oldfieldname": "remarks",
|
||||
"oldfieldtype": "Small Text",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-04 11:02:19",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 12:46:12",
|
||||
"modified": "2013-07-10 14:54:19",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "barcode",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "Barcode",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
@ -38,6 +39,7 @@
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -52,6 +54,7 @@
|
||||
"fieldname": "customer_item_code",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Customer's Item Code",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@ -61,6 +64,7 @@
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -73,6 +77,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
@ -81,10 +86,18 @@
|
||||
"reqd": 1,
|
||||
"width": "200px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Quantity",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -95,6 +108,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"read_only": 1
|
||||
},
|
||||
@ -102,6 +116,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"oldfieldname": "ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -114,6 +129,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "adj_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount (%)",
|
||||
"oldfieldname": "adj_rate",
|
||||
"oldfieldtype": "Float",
|
||||
@ -124,6 +140,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "export_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Basic Rate",
|
||||
"oldfieldname": "export_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -135,6 +152,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "export_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "export_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -146,6 +164,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "base_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"oldfieldname": "base_ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -158,6 +177,7 @@
|
||||
"fieldname": "basic_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Basic Rate (Company Currency)",
|
||||
"oldfieldname": "basic_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -171,6 +191,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -181,21 +202,17 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"label": "Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
"fieldname": "accounting",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Accounting"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "income_account",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Income Account",
|
||||
"oldfieldname": "income_account",
|
||||
"oldfieldtype": "Link",
|
||||
@ -212,6 +229,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Expense Account",
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
@ -224,6 +242,7 @@
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center",
|
||||
"oldfieldtype": "Link",
|
||||
@ -234,11 +253,32 @@
|
||||
"reqd": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse_and_reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse and Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"print_hide": 1,
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "serial_no",
|
||||
"fieldtype": "Small Text",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Serial No",
|
||||
"oldfieldname": "serial_no",
|
||||
"oldfieldtype": "Small Text",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-24 11:39:32",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-05-28 11:59:02",
|
||||
"modified": "2013-07-10 14:54:21",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "charge_type",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Type",
|
||||
"oldfieldname": "charge_type",
|
||||
"oldfieldtype": "Select",
|
||||
@ -40,6 +41,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "account_head",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Account Head",
|
||||
"oldfieldname": "account_head",
|
||||
"oldfieldtype": "Link",
|
||||
@ -52,6 +54,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Cost Center",
|
||||
"oldfieldname": "cost_center_other_charges",
|
||||
"oldfieldtype": "Link",
|
||||
@ -61,6 +64,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -72,6 +76,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -81,6 +86,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "tax_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "tax_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -137,11 +137,20 @@ cur_frm.cscript.row_id = function(doc, cdt, cdn) {
|
||||
/*---------------------- Get rate if account_head has account_type as TAX or CHARGEABLE-------------------------------------*/
|
||||
|
||||
cur_frm.fields_dict['other_charges'].grid.get_field("account_head").get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT tabAccount.name FROM tabAccount WHERE tabAccount.group_or_ledger="Ledger" AND tabAccount.docstatus != 2 AND tabAccount.account_type in ("Tax", "Chargeable", "Income Account") AND tabAccount.company = "'+doc.company+'" AND tabAccount.name LIKE "%s"'
|
||||
return{
|
||||
filters:[
|
||||
['Account', 'group_or_ledger', '=', 'Ledger'],
|
||||
['Account', 'account_type', 'in', 'Tax, Chargeable, Income Account'],
|
||||
['Account', 'company', '=', doc.company]
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['other_charges'].grid.get_field("cost_center").get_query = function(doc) {
|
||||
return 'SELECT `tabCost Center`.`name` FROM `tabCost Center` WHERE `tabCost Center`.`company` = "' +doc.company+'" AND `tabCost Center`.%(key)s LIKE "%s" AND `tabCost Center`.`group_or_ledger` = "Ledger" AND `tabCost Center`.`docstatus`!= 2 ORDER BY `tabCost Center`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
'company_name': doc.company,
|
||||
'group_or_ledger': "Ledger"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-06-25 11:54:50",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-25 11:58:04",
|
||||
"modified": "2013-07-10 14:54:22",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Shipping Rule Condition",
|
||||
"parentfield": "fields",
|
||||
|
@ -52,6 +52,22 @@ wn.module_page["Accounts"] = [
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Setup"),
|
||||
icon: "icon-wrench",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Company"),
|
||||
description: wn._("Company Master."),
|
||||
doctype:"Company"
|
||||
},
|
||||
{
|
||||
label: wn._("Fiscal Year"),
|
||||
description: wn._("Accounting Year."),
|
||||
doctype:"Fiscal Year"
|
||||
},
|
||||
]
|
||||
},
|
||||
{
|
||||
title: wn._("Tools"),
|
||||
icon: "icon-wrench",
|
||||
|
@ -28,27 +28,37 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
|
||||
if(this.frm.fields_dict.price_list_name) {
|
||||
this.frm.set_query("price_list_name", function() {
|
||||
return repl("select name, currency from `tabPrice List` \
|
||||
where buying_or_selling = 'Buying' and name like \"%s%%\"");
|
||||
return{
|
||||
filters: { 'buying_or_selling': "Buying" }
|
||||
}
|
||||
});
|
||||
|
||||
this.frm.set_query("price_list_currency", function() {
|
||||
return repl("select distinct ref_currency from `tabItem Price` \
|
||||
where price_list_name=\"%(price_list_name)s\" and buying_or_selling = 'Buying' \
|
||||
and ref_currency like \"%s%%\"",
|
||||
{price_list_name: me.frm.doc.price_list_name});
|
||||
return{
|
||||
filters: {
|
||||
'price_list_name': me.frm.doc.price_list_name,
|
||||
'buying_or_selling': "Buying"
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if(this.frm.fields_dict.supplier) {
|
||||
this.frm.set_query("supplier", erpnext.utils.supplier_query);
|
||||
this.frm.set_query("supplier", function() {
|
||||
return{ query:"controllers.queries.supplier_query" }});
|
||||
}
|
||||
|
||||
this.frm.set_query("item_code", this.frm.cscript.fname, function() {
|
||||
if(me.frm.doc.is_subcontracted == "Yes") {
|
||||
return erpnext.queries.item({'ifnull(tabItem.is_sub_contracted_item, "No")': "Yes"});
|
||||
return{
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{ 'is_sub_contracted_item': 'Yes' }
|
||||
}
|
||||
} else {
|
||||
return erpnext.queries.item({'ifnull(tabItem.is_purchase_item, "No")': "Yes"});
|
||||
return{
|
||||
query: "controllers.queries.item_query",
|
||||
filters: { 'is_purchase_item': 'Yes' }
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
@ -191,7 +201,7 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
|
||||
var item = wn.model.get_doc(cdt, cdn);
|
||||
if(item.item_code && item.warehouse) {
|
||||
this.frm.call({
|
||||
method: "buying.utils.get_conversion_factor",
|
||||
method: "buying.utils.get_projected_qty",
|
||||
child: item,
|
||||
args: {
|
||||
item_code: item.item_code,
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2012-03-27 14:35:51",
|
||||
"docstatus": 0,
|
||||
"modified": "2012-03-27 14:35:51",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -10,10 +10,7 @@
|
||||
"doctype": "DocType",
|
||||
"issingle": 1,
|
||||
"module": "Buying",
|
||||
"name": "__common__",
|
||||
"section_style": "Simple",
|
||||
"show_in_menu": 0,
|
||||
"version": 187
|
||||
"name": "__common__"
|
||||
},
|
||||
{
|
||||
"doctype": "DocType",
|
||||
|
@ -110,17 +110,23 @@ cur_frm.cscript.supplier_address = cur_frm.cscript.contact_person = function(doc
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return {
|
||||
filters: {'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE supplier = "'+ doc.supplier +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return {
|
||||
filters: {'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['po_details'].grid.get_field('project_name').get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return {
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_last_purchase_rate = function(doc, cdt, cdn){
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-24 19:29:06",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 11:45:00",
|
||||
"modified": "2013-07-10 14:54:14",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -45,6 +46,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Reqd By Date",
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "schedule_date",
|
||||
@ -60,6 +62,7 @@
|
||||
"fieldname": "supplier_part_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Supplier Part Number",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@ -70,6 +73,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -78,10 +82,18 @@
|
||||
"reqd": 1,
|
||||
"search_index": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -95,6 +107,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Quantity",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -107,6 +120,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"oldfieldname": "uom",
|
||||
"oldfieldtype": "Link",
|
||||
@ -121,6 +135,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
@ -130,6 +145,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "discount_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount %",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
@ -139,6 +155,7 @@
|
||||
"fieldname": "import_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Rate ",
|
||||
"oldfieldname": "import_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -150,6 +167,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "import_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -160,6 +178,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
@ -170,6 +189,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Rate (Company Currency)",
|
||||
"oldfieldname": "purchase_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -185,6 +205,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -193,11 +214,19 @@
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse_and_reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse and Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
@ -211,6 +240,7 @@
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Project Name",
|
||||
"options": "Project",
|
||||
"print_hide": 1,
|
||||
@ -222,6 +252,7 @@
|
||||
"fieldname": "conversion_factor",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "UOM Conversion Factor",
|
||||
"oldfieldname": "conversion_factor",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -236,6 +267,7 @@
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Stock UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
@ -250,6 +282,7 @@
|
||||
"fieldname": "prevdoc_doctype",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Prevdoc DocType",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_doctype",
|
||||
@ -263,6 +296,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
@ -280,6 +314,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_date",
|
||||
@ -294,6 +329,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request Detail No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_detail_docname",
|
||||
@ -308,6 +344,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Supplier Quotation",
|
||||
"no_copy": 1,
|
||||
"options": "Supplier Quotation",
|
||||
@ -319,6 +356,7 @@
|
||||
"fieldname": "supplier_quotation_item",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Supplier Quotation Item",
|
||||
"no_copy": 1,
|
||||
"options": "Supplier Quotation Item",
|
||||
@ -329,6 +367,7 @@
|
||||
"fieldname": "brand",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Link",
|
||||
@ -342,6 +381,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
@ -355,6 +395,7 @@
|
||||
"fieldname": "stock_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Stock Qty",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "stock_qty",
|
||||
@ -369,6 +410,7 @@
|
||||
"fieldname": "received_qty",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Received Qty",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "received_qty",
|
||||
@ -380,6 +422,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "billed_amt",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Billed Amt",
|
||||
"no_copy": 1,
|
||||
"options": "currency",
|
||||
@ -392,6 +435,7 @@
|
||||
"fieldname": "item_tax_rate",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -405,6 +449,7 @@
|
||||
"fieldname": "page_break",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Page Break",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "page_break",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:42",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:28",
|
||||
"modified": "2013-07-10 14:54:15",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "dhanalekshmi@webnotestech.com"
|
||||
},
|
||||
@ -31,6 +31,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Reference Name",
|
||||
"oldfieldname": "reference_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -41,6 +42,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bom_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "BOM Detail No",
|
||||
"oldfieldname": "bom_detail_no",
|
||||
"oldfieldtype": "Data",
|
||||
@ -50,6 +52,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "main_item_code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "main_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
@ -59,6 +62,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rm_item_code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Raw Material Item Code",
|
||||
"oldfieldname": "rm_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
@ -68,6 +72,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "required_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Required Qty",
|
||||
"oldfieldname": "required_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -77,6 +82,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "rate",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:42",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:28",
|
||||
"modified": "2013-07-10 14:54:17",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "wasim@webnotestech.com"
|
||||
},
|
||||
@ -31,6 +31,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Reference Name",
|
||||
"oldfieldname": "reference_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -41,6 +42,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bom_detail_no",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "BOM Detail No",
|
||||
"oldfieldname": "bom_detail_no",
|
||||
"oldfieldtype": "Data",
|
||||
@ -50,6 +52,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "main_item_code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "main_item_code",
|
||||
"oldfieldtype": "Data",
|
||||
@ -59,6 +62,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rm_item_code",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Raw Material Item Code",
|
||||
"oldfieldname": "rm_item_code",
|
||||
"oldfieldtype": "Data"
|
||||
@ -67,6 +71,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Data",
|
||||
@ -78,6 +83,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "required_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Required Qty",
|
||||
"oldfieldname": "required_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -43,18 +43,26 @@ cur_frm.cscript.refresh = cur_frm.cscript.inspection_type;
|
||||
|
||||
// item code based on GRN/DN
|
||||
cur_frm.fields_dict['item_code'].get_query = function(doc, cdt, cdn) {
|
||||
if (doc.purchase_receipt_no)
|
||||
return 'SELECT item_code, item_name, description FROM `tabPurchase Receipt Item` WHERE parent = "'+ doc.purchase_receipt_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
|
||||
else if (doc.delivery_note_no)
|
||||
return 'SELECT item_code, item_name, description FROM `tabDelivery Note Item` WHERE parent = "'+ doc.delivery_note_no +'" and docstatus != 2 AND item_code LIKE "%s" ORDER BY item_code ASC LIMIT 50';
|
||||
else
|
||||
return 'SELECT name, item_name, description FROM tabItem WHERE docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
var filter = {};
|
||||
if (doc.purchase_receipt_no) filter['parent'] = doc.purchase_receipt_no;
|
||||
|
||||
else if (doc.delivery_note_no) filter['parent'] = doc.delivery_note_no;
|
||||
|
||||
return{
|
||||
filters: filter
|
||||
}
|
||||
}
|
||||
|
||||
// Serial No based on item_code
|
||||
cur_frm.fields_dict['item_serial_no'].get_query = function(doc, cdt, cdn) {
|
||||
var filter = {};
|
||||
if (doc.item_code)
|
||||
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND item_code = "' + doc.item_code +'" AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
filter:{
|
||||
'item_code': doc.item_code,
|
||||
'status': "In Store"
|
||||
}
|
||||
else
|
||||
return 'SELECT name, item_code, warehouse FROM `tabSerial No` WHERE docstatus != 2 AND status = "In Store" AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
}
|
||||
filter: { 'status': "In Store" }
|
||||
|
||||
return { filters: filter }
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:43",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:29",
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "specification",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Parameter",
|
||||
"oldfieldname": "specification",
|
||||
"oldfieldtype": "Data",
|
||||
@ -38,6 +39,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "value",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Acceptance Criteria",
|
||||
"oldfieldname": "value",
|
||||
"oldfieldtype": "Data"
|
||||
@ -46,6 +48,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reading_1",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading 1",
|
||||
"oldfieldname": "reading_1",
|
||||
"oldfieldtype": "Data"
|
||||
@ -54,6 +57,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reading_2",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading 2",
|
||||
"oldfieldname": "reading_2",
|
||||
"oldfieldtype": "Data"
|
||||
@ -62,6 +66,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reading_3",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading 3",
|
||||
"oldfieldname": "reading_3",
|
||||
"oldfieldtype": "Data"
|
||||
@ -70,6 +75,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reading_4",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Reading 4",
|
||||
"oldfieldname": "reading_4",
|
||||
"oldfieldtype": "Data"
|
||||
|
@ -196,7 +196,7 @@ class DocType(TransactionBase):
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_dashboard_info(supplier):
|
||||
if not webnotes.has_permission("Supplier", supplier):
|
||||
if not webnotes.has_permission("Supplier", "read", supplier):
|
||||
webnotes.msgprint("No Permission", raise_exception=True)
|
||||
|
||||
out = {}
|
||||
|
@ -65,10 +65,11 @@ cur_frm.cscript.uom = function(doc, cdt, cdn) {
|
||||
|
||||
cur_frm.fields_dict['quotation_items'].grid.get_field('project_name').get_query =
|
||||
function(doc, cdt, cdn) {
|
||||
return "select `tabProject`.name from `tabProject` \
|
||||
where `tabProject`.status not in (\"Completed\", \"Cancelled\") \
|
||||
and `tabProject`.name like \"%s\" \
|
||||
order by `tabProject`.name ASC LIMIT 50";
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.supplier_address = function(doc, dt, dn) {
|
||||
@ -80,12 +81,13 @@ cur_frm.cscript.supplier_address = function(doc, dt, dn) {
|
||||
cur_frm.cscript.contact_person = cur_frm.cscript.supplier_address;
|
||||
|
||||
cur_frm.fields_dict['supplier_address'].get_query = function(doc, cdt, cdn) {
|
||||
return "SELECT name, address_line1, city FROM tabAddress WHERE supplier = \"" + doc.supplier
|
||||
+ "\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50";
|
||||
return {
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return "SELECT name, CONCAT(first_name, \" \", ifnull(last_name,\"\")) As FullName, \
|
||||
department, designation FROM tabContact WHERE supplier = \"" + doc.supplier
|
||||
+"\" AND docstatus != 2 AND name LIKE \"%s\" ORDER BY name ASC LIMIT 50";
|
||||
}
|
||||
return {
|
||||
filters:{'supplier': doc.supplier}
|
||||
}
|
||||
}
|
@ -94,14 +94,15 @@ def make_purchase_order(source_name, target_doclist=None):
|
||||
},
|
||||
"Supplier Quotation Item": {
|
||||
"doctype": "Purchase Order Item",
|
||||
"field_map": {
|
||||
"name": "supplier_quotation_item",
|
||||
"parent": "supplier_quotation",
|
||||
"uom": "stock_uom",
|
||||
"prevdoc_detail_docname": "prevdoc_detail_docname",
|
||||
"prevdoc_doctype": "prevdoc_doctype",
|
||||
"prevdoc_docname": "prevdoc_docname",
|
||||
},
|
||||
"field_map": [
|
||||
["name", "supplier_quotation_item"],
|
||||
["parent", "supplier_quotation"],
|
||||
["uom", "stock_uom"],
|
||||
["uom", "uom"],
|
||||
["prevdoc_detail_docname", "prevdoc_detail_docname"],
|
||||
["prevdoc_doctype", "prevdoc_doctype"],
|
||||
["prevdoc_docname", "prevdoc_docname"]
|
||||
],
|
||||
"postprocess": update_item
|
||||
},
|
||||
"Purchase Taxes and Charges": {
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-22 12:43:10",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 12:15:15",
|
||||
"modified": "2013-07-10 14:54:23",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -30,6 +30,7 @@
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -45,6 +46,7 @@
|
||||
"fieldname": "supplier_part_no",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Supplier Part Number",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@ -55,6 +57,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -67,6 +70,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -75,11 +79,19 @@
|
||||
"reqd": 1,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Quantity",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -92,6 +104,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"oldfieldname": "uom",
|
||||
"oldfieldtype": "Link",
|
||||
@ -106,6 +119,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"options": "currency",
|
||||
"print_hide": 1,
|
||||
@ -115,6 +129,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "discount_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount %",
|
||||
"print_hide": 0,
|
||||
"read_only": 0
|
||||
@ -124,6 +139,7 @@
|
||||
"fieldname": "import_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Rate ",
|
||||
"oldfieldname": "import_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -135,6 +151,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "import_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "import_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -145,6 +162,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1,
|
||||
@ -155,6 +173,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "purchase_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Rate (Company Currency)",
|
||||
"oldfieldname": "purchase_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -170,6 +189,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -178,11 +198,19 @@
|
||||
"read_only": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse_and_reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse and Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse",
|
||||
"oldfieldname": "warehouse",
|
||||
"oldfieldtype": "Link",
|
||||
@ -196,6 +224,7 @@
|
||||
"fieldname": "project_name",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Project Name",
|
||||
"options": "Project",
|
||||
"print_hide": 1,
|
||||
@ -207,6 +236,7 @@
|
||||
"fieldname": "prevdoc_doctype",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Prevdoc DocType",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_doctype",
|
||||
@ -220,6 +250,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
@ -237,6 +268,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request Date",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_date",
|
||||
@ -251,6 +283,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Material Request Detail No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_detail_docname",
|
||||
@ -264,6 +297,7 @@
|
||||
"fieldname": "brand",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Link",
|
||||
@ -277,6 +311,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
@ -291,6 +326,7 @@
|
||||
"fieldname": "item_tax_rate",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -304,6 +340,7 @@
|
||||
"fieldname": "page_break",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Page Break",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "page_break",
|
||||
|
221
controllers/queries.py
Normal file
221
controllers/queries.py
Normal file
@ -0,0 +1,221 @@
|
||||
# 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
|
||||
|
||||
def get_filters_cond(doctype, filters, conditions):
|
||||
if filters:
|
||||
if isinstance(filters, dict):
|
||||
filters = filters.items()
|
||||
flt = []
|
||||
for f in filters:
|
||||
if f[1][0] == '!':
|
||||
flt.append([doctype, f[0], '!=', f[1][1:]])
|
||||
else:
|
||||
flt.append([doctype, f[0], '=', f[1]])
|
||||
|
||||
from webnotes.widgets.reportview import build_filter_conditions
|
||||
build_filter_conditions(flt, conditions)
|
||||
cond = ' and ' + ' and '.join(conditions)
|
||||
else:
|
||||
cond = ''
|
||||
return cond
|
||||
|
||||
def get_match_cond(doctype, searchfield = 'name'):
|
||||
meta = webnotes.get_doctype(doctype)
|
||||
from webnotes.widgets.search import get_std_fields_list
|
||||
fields = get_std_fields_list(meta, searchfield)
|
||||
|
||||
from webnotes.widgets.reportview import build_match_conditions
|
||||
cond = build_match_conditions(doctype, fields)
|
||||
|
||||
if cond:
|
||||
cond = ' and ' + cond
|
||||
else:
|
||||
cond = ''
|
||||
return cond
|
||||
|
||||
# searches for enabled profiles
|
||||
def profile_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, concat_ws(' ', first_name, middle_name, last_name)
|
||||
from `tabProfile`
|
||||
where ifnull(enabled, 0)=1
|
||||
and docstatus < 2
|
||||
and name not in ('Administrator', 'Guest')
|
||||
and (%(key)s like "%(txt)s"
|
||||
or concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s")
|
||||
%(mcond)s
|
||||
order by
|
||||
case when name like "%(txt)s" then 0 else 1 end,
|
||||
case when concat_ws(' ', first_name, middle_name, last_name) like "%(txt)s"
|
||||
then 0 else 1 end,
|
||||
name asc
|
||||
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
# searches for active employees
|
||||
def employee_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, employee_name from `tabEmployee`
|
||||
where status = 'Active'
|
||||
and docstatus < 2
|
||||
and (%(key)s like "%(txt)s"
|
||||
or employee_name like "%(txt)s")
|
||||
%(mcond)s
|
||||
order by
|
||||
case when name like "%(txt)s" then 0 else 1 end,
|
||||
case when employee_name like "%(txt)s" then 0 else 1 end,
|
||||
name
|
||||
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
# searches for leads which are not converted
|
||||
def lead_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select name, lead_name, company_name from `tabLead`
|
||||
where docstatus < 2
|
||||
and ifnull(status, '') != 'Converted'
|
||||
and (%(key)s like "%(txt)s"
|
||||
or lead_name like "%(txt)s"
|
||||
or company_name like "%(txt)s")
|
||||
%(mcond)s
|
||||
order by
|
||||
case when name like "%(txt)s" then 0 else 1 end,
|
||||
case when lead_name like "%(txt)s" then 0 else 1 end,
|
||||
case when company_name like "%(txt)s" then 0 else 1 end,
|
||||
lead_name asc
|
||||
limit %(start)s, %(page_len)s""" % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
# searches for customer
|
||||
def customer_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
cust_master_name = webnotes.defaults.get_user_default("cust_master_name")
|
||||
|
||||
if cust_master_name == "Customer Name":
|
||||
fields = ["name", "customer_group", "territory"]
|
||||
else:
|
||||
fields = ["name", "customer_name", "customer_group", "territory"]
|
||||
|
||||
fields = ", ".join(fields)
|
||||
|
||||
return webnotes.conn.sql("""select %(field)s from `tabCustomer`
|
||||
where docstatus < 2
|
||||
and (%(key)s like "%(txt)s"
|
||||
or customer_name like "%(txt)s")
|
||||
%(mcond)s
|
||||
order by
|
||||
case when name like "%(txt)s" then 0 else 1 end,
|
||||
case when customer_name like "%(txt)s" then 0 else 1 end,
|
||||
name, customer_name
|
||||
limit %(start)s, %(page_len)s""" % {'field': fields,'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
|
||||
'start': start, 'page_len': page_len})
|
||||
|
||||
# searches for supplier
|
||||
def supplier_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
supp_master_name = webnotes.defaults.get_user_default("supp_master_name")
|
||||
if supp_master_name == "Supplier Name":
|
||||
fields = ["name", "supplier_type"]
|
||||
else:
|
||||
fields = ["name", "supplier_name", "supplier_type"]
|
||||
fields = ", ".join(fields)
|
||||
|
||||
return webnotes.conn.sql("""select %(field)s from `tabSupplier`
|
||||
where docstatus < 2
|
||||
and (%(key)s like "%(txt)s"
|
||||
or supplier_name like "%(txt)s")
|
||||
%(mcond)s
|
||||
order by
|
||||
case when name like "%(txt)s" then 0 else 1 end,
|
||||
case when supplier_name like "%(txt)s" then 0 else 1 end,
|
||||
name, supplier_name
|
||||
limit %(start)s, %(page_len)s """ % {'field': fields,'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield), 'start': start,
|
||||
'page_len': page_len})
|
||||
|
||||
def item_std(doctype, txt, searchfield, start, page_len, filters):
|
||||
return webnotes.conn.sql("""select tabItem.name,
|
||||
if(length(tabItem.item_name) > 40,
|
||||
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
|
||||
if(length(tabItem.description) > 40,
|
||||
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
|
||||
FROM tabItem
|
||||
WHERE tabItem.docstatus!=2
|
||||
and tabItem.%(key)s LIKE "%(txt)s"
|
||||
%(mcond)s
|
||||
limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start,
|
||||
'page_len': page_len})
|
||||
|
||||
def account_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
conditions = []
|
||||
if not filters:
|
||||
filters = {}
|
||||
if not filters.group_or_ledger:
|
||||
filters.group_or_ledger = "Ledger"
|
||||
|
||||
return webnotes.conn.sql("""select tabAccount.name, tabAccount.parent_account,
|
||||
tabAccount.debit_or_credit from tabAccount
|
||||
where tabAccount.docstatus!=2
|
||||
and tabAccount.%(key)s LIKE "%(txt)s"
|
||||
%(fcond)s %(mcond)s
|
||||
limit %(start)s, %(page_len)s""" % {'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'fcond': get_filters_cond(doctype, filters, conditions),
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
def item_query(doctype, txt, searchfield, start, page_len, filters):
|
||||
conditions = []
|
||||
|
||||
return webnotes.conn.sql("""select tabItem.name,
|
||||
if(length(tabItem.item_name) > 40,
|
||||
concat(substr(tabItem.item_name, 1, 40), "..."), item_name) as item_name,
|
||||
if(length(tabItem.description) > 40, \
|
||||
concat(substr(tabItem.description, 1, 40), "..."), description) as decription
|
||||
from tabItem
|
||||
where tabItem.docstatus!=2
|
||||
and (ifnull(`tabItem`.`end_of_life`,"") in ("", "0000-00-00")
|
||||
or `tabItem`.`end_of_life` > NOW())
|
||||
and (tabItem.%(key)s LIKE "%(txt)s"
|
||||
or tabItem.item_name LIKE "%(txt)s")
|
||||
%(fcond)s %(mcond)s
|
||||
limit %(start)s,%(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'fcond': get_filters_cond(doctype, filters, conditions),
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
def bom(doctype, txt, searchfield, start, page_len, filters):
|
||||
conditions = []
|
||||
|
||||
return webnotes.conn.sql("""select tabBOM.name, tabBOM.item
|
||||
from tabBOM
|
||||
where tabBOM.docstatus=1
|
||||
and tabBOM.is_active=1
|
||||
and tabBOM.%(key)s like "%s"
|
||||
%(fcond)s %(mcond)s
|
||||
limit %(start)s, %(page_len)s """ % {'key': searchfield, 'txt': "%%%s%%" % txt,
|
||||
'fcond': get_filters_cond(doctype, filters, conditions),
|
||||
'mcond':get_match_cond(doctype, searchfield), 'start': start, 'page_len': page_len})
|
||||
|
||||
def get_project_name(doctype, txt, searchfield, start, page_len, filters):
|
||||
cond = ''
|
||||
if filters['customer']:
|
||||
cond = '(`tabProject`.customer = "' + filters['customer'] + '" or ifnull(`tabProject`.customer,"")="") and'
|
||||
|
||||
return webnotes.conn.sql("""select `tabProject`.name from `tabProject`
|
||||
where `tabProject`.status not in ("Completed", "Cancelled")
|
||||
and %(cond)s `tabProject`.name like "%(txt)s" %(mcond)s
|
||||
order by `tabProject`.name asc
|
||||
limit %(start)s, %(page_len)s """ % {'cond': cond,'txt': "%%%s%%" % txt,
|
||||
'mcond':get_match_cond(doctype, searchfield),'start': start, 'page_len': page_len})
|
@ -21,7 +21,7 @@ wn.pages['latest-updates'].onload = function(wrapper) {
|
||||
var $tbody = $('<table class="table table-bordered"><tbody></tbody></table>')
|
||||
.appendTo(parent).find("tbody");
|
||||
$.each(r.message, function(i, log) {
|
||||
if(log.message.indexOf("[")!==-1) {
|
||||
if(log.message.indexOf("minor")===1 && log.message.indexOf("[")!==-1) {
|
||||
log.message = log.message.replace(/(\[[^\]]*\])/g,
|
||||
function(match, p1, offset, string) {
|
||||
match = match.toLowerCase();
|
||||
|
@ -83,4 +83,6 @@ cur_frm.cscript.calculate_total = function(doc,cdt,cdn){
|
||||
refresh_field('total_score');
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.employee_query" }
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:44",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:18",
|
||||
"modified": "2013-07-10 14:54:03",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "ashwini@webnotestech.com"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Appraisal Goal",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:44",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:18",
|
||||
"modified": "2013-07-10 14:54:03",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "ashwini@webnotestech.com"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Appraisal Template Goal",
|
||||
"parentfield": "fields",
|
||||
|
@ -14,12 +14,15 @@
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
cur_frm.add_fetch('employee', 'company', 'company');
|
||||
cur_frm.add_fetch('employee', 'company', 'company');
|
||||
cur_frm.add_fetch('employee', 'employee_name', 'employee_name');
|
||||
|
||||
//get employee's name based on employee id selected
|
||||
cur_frm.cscript.employee = function(doc,cdt,cdn){
|
||||
if(doc.employee) get_server_fields('get_emp_name', '', '', doc, cdt, cdn, 1);
|
||||
refresh_field('employee_name');
|
||||
cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) cur_frm.set_value("att_date", get_today());
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.employee_query"
|
||||
}
|
||||
}
|
||||
|
@ -26,12 +26,6 @@ class DocType:
|
||||
def __init__(self, doc, doclist=[]):
|
||||
self.doc = doc
|
||||
self.doclist = doclist
|
||||
|
||||
def get_emp_name(self):
|
||||
return {
|
||||
"employee_name": webnotes.conn.get_value("Employee",
|
||||
self.doc.employee_name, "employee_name")
|
||||
}
|
||||
|
||||
def validate_duplicate_record(self):
|
||||
res = sql("""select name from `tabAttendance` where employee = %s and att_date = %s
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-01-10 16:34:13",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:25:19",
|
||||
"modified": "2013-07-10 17:39:22",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "ashwini@webnotestech.com"
|
||||
},
|
||||
@ -25,6 +25,7 @@
|
||||
"permlevel": 0
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"name": "__common__",
|
||||
@ -33,6 +34,8 @@
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
@ -80,6 +83,7 @@
|
||||
"oldfieldtype": "Data"
|
||||
},
|
||||
{
|
||||
"default": "Present",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "status",
|
||||
"fieldtype": "Select",
|
||||
@ -157,15 +161,15 @@
|
||||
"read_only": 1
|
||||
},
|
||||
{
|
||||
"cancel": 1,
|
||||
"doctype": "DocPerm",
|
||||
"report": 1,
|
||||
"role": "HR User",
|
||||
"submit": 1
|
||||
"role": "System Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "owner",
|
||||
"role": "Employee"
|
||||
"role": "HR User"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "HR Manager"
|
||||
}
|
||||
]
|
@ -18,8 +18,10 @@ wn.provide("erpnext.hr");
|
||||
erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
setup: function() {
|
||||
this.setup_leave_approver_select();
|
||||
this.frm.fields_dict.user_id.get_query = erpnext.utils.profile_query;
|
||||
this.frm.fields_dict.reports_to.get_query = erpnext.utils.employee_query;
|
||||
this.frm.fields_dict.user_id.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.profile_query"} }
|
||||
this.frm.fields_dict.reports_to.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.employee_query"} }
|
||||
},
|
||||
|
||||
onload: function() {
|
||||
@ -30,13 +32,9 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
refresh: function() {
|
||||
var me = this;
|
||||
erpnext.hide_naming_series();
|
||||
if(!this.frm.doc.__islocal) {
|
||||
cur_frm.add_custom_button('View Active Salary Structure', function() {
|
||||
me.view_active_salary_structure(this); });
|
||||
|
||||
if(!this.frm.doc.__islocal) {
|
||||
cur_frm.add_custom_button('Make Salary Structure', function() {
|
||||
me.make_salary_structure(this); });
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -45,7 +43,8 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
this.frm.call({
|
||||
method:"hr.utils.get_leave_approver_list",
|
||||
callback: function(r) {
|
||||
me.frm.fields_dict.employee_leave_approvers.grid.get_field("leave_approver").df.options =
|
||||
me.frm.fields_dict.employee_leave_approvers.grid
|
||||
.get_field("leave_approver").df.options =
|
||||
$.map(r.message, function(profile) {
|
||||
return {value: profile, label: wn.user_info(profile).fullname};
|
||||
});
|
||||
@ -75,9 +74,9 @@ erpnext.hr.EmployeeController = wn.ui.form.Controller.extend({
|
||||
if(r.message) {
|
||||
msgprint(wn._("Employee") + ' "' + me.frm.doc.name + '": '
|
||||
+ wn._("An active Salary Structure already exists. \
|
||||
If you want to create new one, please ensure that no active Salary Structure \
|
||||
exists for this Employee. Go to the active Salary Structure and set \
|
||||
\"Is Active\" = \"No\""));
|
||||
If you want to create new one, please ensure that no active \
|
||||
Salary Structure exists for this Employee. \
|
||||
Go to the active Salary Structure and set \"Is Active\" = \"No\""));
|
||||
} else if(!r.exc) {
|
||||
wn.model.map({
|
||||
source: wn.model.get_doclist(me.frm.doc.doctype, me.frm.doc.name),
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 09:04:18",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-05 14:36:19",
|
||||
"modified": "2013-07-10 12:52:17",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -31,7 +31,9 @@
|
||||
"parent": "Employee",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
@ -55,7 +57,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "image_view",
|
||||
"fieldtype": "Image",
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Image View",
|
||||
"options": "image"
|
||||
},
|
||||
@ -562,6 +564,12 @@
|
||||
"fieldtype": "Data",
|
||||
"label": "Place of Issue"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break6",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "marital_status",
|
||||
@ -576,12 +584,6 @@
|
||||
"label": "Blood Group",
|
||||
"options": "\nA+\nA-\nB+\nB-\nAB+\nAB-\nO+\nO-"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "column_break6",
|
||||
"fieldtype": "Column Break",
|
||||
"width": "50%"
|
||||
},
|
||||
{
|
||||
"description": "Here you can maintain family details like name and occupation of parent, spouse and children",
|
||||
"doctype": "DocField",
|
||||
@ -748,17 +750,6 @@
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "employee",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "Employee",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "Employee",
|
||||
"write": 0
|
||||
},
|
||||
@ -767,8 +758,6 @@
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"match": "company",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "HR User",
|
||||
"write": 1
|
||||
},
|
||||
@ -776,27 +765,7 @@
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"report": 1,
|
||||
"role": "HR Manager",
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "HR User",
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1,
|
||||
"report": 0,
|
||||
"role": "HR Manager",
|
||||
"write": 0
|
||||
}
|
||||
]
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:45",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:08",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Employee Education",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:45",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:08",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Employee External Work History",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:45",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:08",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Employee Internal Work History",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-04-12 06:56:15",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-04-12 07:53:33",
|
||||
"modified": "2013-07-10 14:54:08",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -19,6 +19,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "leave_approver",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 0,
|
||||
"label": "Leave Approver",
|
||||
"name": "__common__",
|
||||
"parent": "Employee Leave Approver",
|
||||
|
@ -35,7 +35,11 @@ cur_frm.cscript.onload = function(doc,cdt,cdn){
|
||||
}
|
||||
});
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.employee_query"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.clear_sanctioned = function(doc) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "harshada@webnotestech.com"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Expense Claim Detail",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:46",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Holiday",
|
||||
"parentfield": "fields",
|
||||
|
@ -79,4 +79,8 @@ calculate_total_leaves_allocated = function(doc, dt, dn) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.employee_query"
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:47",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:23",
|
||||
"modified": "2013-07-10 14:54:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -16,6 +16,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "allow_user",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Allow User",
|
||||
"name": "__common__",
|
||||
"options": "Profile",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:47",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:23",
|
||||
"modified": "2013-07-10 14:54:10",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Leave Block List Date",
|
||||
"parentfield": "fields",
|
||||
|
@ -20,13 +20,14 @@ cur_frm.add_fetch('employee', 'company', 'company');
|
||||
// -------------------------------------------------------------------
|
||||
cur_frm.cscript.onload = function(doc,dt,dn){
|
||||
if((cint(doc.__islocal) == 1) && !doc.amended_from){
|
||||
var today=new Date();
|
||||
month = (today.getMonth()+01).toString();
|
||||
if(month.length>1) doc.month = month;
|
||||
else doc.month = '0'+month;
|
||||
doc.fiscal_year = sys_defaults['fiscal_year'];
|
||||
if(!doc.month) {
|
||||
var today=new Date();
|
||||
month = (today.getMonth()+01).toString();
|
||||
if(month.length>1) doc.month = month;
|
||||
else doc.month = '0'+month;
|
||||
}
|
||||
if(!doc.fiscal_year) doc.fiscal_year = sys_defaults['fiscal_year'];
|
||||
refresh_many(['month', 'fiscal_year']);
|
||||
cur_frm.cscript.fiscal_year(doc, dt, dn);
|
||||
}
|
||||
}
|
||||
|
||||
@ -42,8 +43,6 @@ cur_frm.cscript.fiscal_year = function(doc,dt,dn){
|
||||
|
||||
cur_frm.cscript.month = cur_frm.cscript.employee = cur_frm.cscript.fiscal_year;
|
||||
|
||||
// Calculate total if lwp exists
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
if (doc.employee && doc.fiscal_year && doc.month) {
|
||||
$c_obj(make_doclist(doc.doctype,doc.name), 'get_leave_details',doc.leave_without_pay,function(r, rt) {
|
||||
@ -54,16 +53,12 @@ cur_frm.cscript.leave_without_pay = function(doc,dt,dn){
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate all
|
||||
// ------------------------------------------------------------------------
|
||||
var calculate_all = function(doc, dt, dn) {
|
||||
calculate_earning_total(doc, dt, dn);
|
||||
calculate_ded_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
}
|
||||
|
||||
// Trigger on earning modified amount and depends on lwp
|
||||
// ------------------------------------------------------------------------
|
||||
cur_frm.cscript.e_modified_amount = function(doc,dt,dn){
|
||||
calculate_earning_total(doc, dt, dn);
|
||||
calculate_net_pay(doc, dt, dn);
|
||||
@ -139,4 +134,8 @@ cur_frm.cscript.validate = function(doc, dt, dn) {
|
||||
calculate_all(doc, dt, dn);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.employee_query"
|
||||
}
|
||||
}
|
||||
|
@ -17,11 +17,11 @@
|
||||
from __future__ import unicode_literals
|
||||
import webnotes
|
||||
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate
|
||||
from webnotes.utils import add_days, cint, cstr, flt, getdate, nowdate
|
||||
from webnotes.model.doc import make_autoname
|
||||
from webnotes.model.bean import getlist
|
||||
from webnotes.model.code import get_obj
|
||||
from webnotes import msgprint
|
||||
from webnotes import msgprint, _
|
||||
from setup.utils import get_company_currency
|
||||
|
||||
sql = webnotes.conn.sql
|
||||
@ -40,9 +40,7 @@ class DocType(TransactionBase):
|
||||
|
||||
def get_emp_and_leave_details(self):
|
||||
if self.doc.employee:
|
||||
# Get payment days
|
||||
if self.doc.fiscal_year and self.doc.month:
|
||||
self.get_leave_details()
|
||||
self.get_leave_details()
|
||||
|
||||
# check sal structure
|
||||
struct = self.check_sal_struct()
|
||||
@ -59,20 +57,24 @@ class DocType(TransactionBase):
|
||||
|
||||
|
||||
def pull_sal_struct(self, struct):
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'earning_details')
|
||||
self.doclist = self.doc.clear_table(self.doclist, 'deduction_details')
|
||||
|
||||
from hr.doctype.salary_structure.salary_structure import make_salary_slip
|
||||
make_salary_slip(struct, self.doclist)
|
||||
|
||||
basic_info = sql("select bank_name, bank_ac_no, esic_card_no, pf_number from `tabEmployee` where name ='%s'" % self.doc.employee)
|
||||
self.doc.bank_name = basic_info[0][0]
|
||||
self.doc.bank_account_no = basic_info[0][1]
|
||||
self.doc.esic_no = basic_info[0][2]
|
||||
self.doc.pf_no = basic_info[0][3]
|
||||
|
||||
self.doclist = make_salary_slip(struct, self.doclist)
|
||||
|
||||
def pull_emp_details(self):
|
||||
emp = webnotes.conn.get_value("Employee", self.doc.employee,
|
||||
["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1)
|
||||
if emp:
|
||||
self.doc.bank_name = emp.bank_name
|
||||
self.doc.bank_ac_no = emp.bank_ac_no
|
||||
self.doc.esic_no = emp.esic_card_no
|
||||
self.doc.pf_no = emp.pf_number
|
||||
|
||||
def get_leave_details(self, lwp=None):
|
||||
if not self.doc.fiscal_year:
|
||||
self.doc.fiscal_year = webnotes.get_default("fiscal_year")
|
||||
if not self.doc.month:
|
||||
self.doc.month = "%02d" % getdate(nowdate()).month
|
||||
|
||||
m = get_obj('Salary Manager').get_month_details(self.doc.fiscal_year, self.doc.month)
|
||||
|
||||
if not lwp:
|
||||
@ -92,7 +94,9 @@ class DocType(TransactionBase):
|
||||
if getdate(emp['relieving_date']) > m['month_start_date'] and getdate(emp['relieving_date']) < m['month_end_date']:
|
||||
payment_days = getdate(emp['relieving_date']).day
|
||||
elif getdate(emp['relieving_date']) < m['month_start_date']:
|
||||
payment_days = 0
|
||||
webnotes.msgprint(_("Relieving Date of employee is ") + cstr(emp['relieving_date']
|
||||
+ _(". Please set status of the employee as 'Left'")), raise_exception=1)
|
||||
|
||||
|
||||
if emp['date_of_joining']:
|
||||
if getdate(emp['date_of_joining']) > m['month_start_date'] and getdate(emp['date_of_joining']) < m['month_end_date']:
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:30",
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Salary Slip Deduction",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:30",
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Salary Slip Earning",
|
||||
"parentfield": "fields",
|
||||
|
@ -72,4 +72,6 @@ cur_frm.cscript.validate = function(doc, cdt, cdn) {
|
||||
calculate_totals(doc, cdt, cdn);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.employee.get_query = erpnext.utils.employee_query;
|
||||
cur_frm.fields_dict.employee.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.employee_query" }
|
||||
}
|
@ -99,14 +99,11 @@ def make_salary_slip(source_name, target_doclist=None):
|
||||
from webnotes.model.mapper import get_mapped_doclist
|
||||
|
||||
def postprocess(source, target):
|
||||
emp = webnotes.conn.get_value("Employee", source.doc.employee,
|
||||
["bank_name", "bank_ac_no", "esic_card_no", "pf_number"], as_dict=1)
|
||||
if emp:
|
||||
target[0].bank_name = emp.bank_name
|
||||
target[0].bank_ac_no = emp.bank_ac_no
|
||||
target[0].esic_no = emp.esic_card_no
|
||||
target[0].pf_no = emp.pf_number
|
||||
|
||||
sal_slip = webnotes.bean(target)
|
||||
sal_slip.run_method("pull_emp_details")
|
||||
sal_slip.run_method("get_leave_details")
|
||||
sal_slip.run_method("calculate_net_pay")
|
||||
|
||||
doclist = get_mapped_doclist("Salary Structure", source_name, {
|
||||
"Salary Structure": {
|
||||
"doctype": "Salary Slip",
|
||||
@ -116,16 +113,19 @@ def make_salary_slip(source_name, target_doclist=None):
|
||||
},
|
||||
"Salary Structure Deduction": {
|
||||
"doctype": "Salary Slip Deduction",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "d_depends_on_lwp"
|
||||
}
|
||||
"field_map": [
|
||||
["depend_on_lwp", "d_depends_on_lwp"],
|
||||
["d_modified_amt", "d_amount"],
|
||||
["d_modified_amt", "d_modified_amount"]
|
||||
]
|
||||
},
|
||||
"Salary Structure Earning": {
|
||||
"doctype": "Salary Slip Earning",
|
||||
"field_map": {
|
||||
"depend_on_lwp": "e_depends_on_lwp",
|
||||
"modified_value": "e_modified_amount"
|
||||
}
|
||||
"field_map": [
|
||||
["depend_on_lwp", "e_depends_on_lwp"],
|
||||
["modified_value", "e_modified_amount"],
|
||||
["modified_value", "e_amount"]
|
||||
]
|
||||
}
|
||||
}, target_doclist, postprocess)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:30",
|
||||
"modified": "2013-07-10 14:54:19",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Salary Structure Deduction",
|
||||
"parentfield": "fields",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:48",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:30",
|
||||
"modified": "2013-07-10 14:54:19",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -16,6 +16,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Salary Structure Earning",
|
||||
"parentfield": "fields",
|
||||
|
@ -23,9 +23,14 @@ wn.module_page["HR"] = [
|
||||
doctype:"Expense Claim"
|
||||
},
|
||||
{
|
||||
label: wn._("Job Applicant"),
|
||||
description: wn._("Applicant for a Job."),
|
||||
doctype:"Job Applicant"
|
||||
label: wn._("Salary Slip"),
|
||||
description: wn._("Monthly salary statement."),
|
||||
doctype:"Salary Slip"
|
||||
},
|
||||
{
|
||||
label: wn._("Attendance"),
|
||||
description: wn._("Attendance record."),
|
||||
doctype:"Attendance"
|
||||
},
|
||||
]
|
||||
},
|
||||
@ -34,14 +39,9 @@ wn.module_page["HR"] = [
|
||||
icon: "icon-copy",
|
||||
items: [
|
||||
{
|
||||
label: wn._("Attendance"),
|
||||
description: wn._("Attendance record."),
|
||||
doctype:"Attendance"
|
||||
},
|
||||
{
|
||||
label: wn._("Salary Slip"),
|
||||
description: wn._("Monthly salary statement."),
|
||||
doctype:"Salary Slip"
|
||||
label: wn._("Job Applicant"),
|
||||
description: wn._("Applicant for a Job."),
|
||||
doctype:"Job Applicant"
|
||||
},
|
||||
{
|
||||
label: wn._("Appraisal"),
|
||||
|
@ -169,30 +169,37 @@ var calculate_total = function(doc) {
|
||||
|
||||
|
||||
cur_frm.fields_dict['item'].get_query = function(doc) {
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_manufactured_item, "No")': 'Yes',
|
||||
})
|
||||
return{
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{
|
||||
'has_serial_no': 'Yes'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('item_code').get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.description FROM `tabItem` \
|
||||
WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" \
|
||||
OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.`%(key)s` like "%s" \
|
||||
ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
return{
|
||||
query:"controllers.queries.item_query"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['bom_materials'].grid.get_field('bom_no').get_query = function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return 'SELECT DISTINCT `tabBOM`.`name`, `tabBOM`.`remarks` FROM `tabBOM` \
|
||||
WHERE `tabBOM`.`item` = "' + d.item_code + '" AND `tabBOM`.`is_active` = 1 AND \
|
||||
`tabBOM`.docstatus = 1 AND `tabBOM`.`name` like "%s" \
|
||||
ORDER BY `tabBOM`.`name` LIMIT 50';
|
||||
return{
|
||||
filters:{
|
||||
'item': d.item_code,
|
||||
'is_active': 1,
|
||||
'docstatus': 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.validate = function(doc, dt, dn) {
|
||||
|
@ -85,10 +85,10 @@ class DocType:
|
||||
msgprint("Item %s does not exist in system" % item[0]['item_code'], raise_exception = 1)
|
||||
|
||||
def set_bom_material_details(self):
|
||||
for item in self.doclist.get({"parentfield": "bom_materials"}):
|
||||
ret = self.get_bom_material_detail({ "item_code": item.item_code, "bom_no": item.bom_no,
|
||||
"qty": item.qty })
|
||||
|
||||
for item in self.doclist.get({"parentfield": "bom_materials"}):
|
||||
ret = self.get_bom_material_detail({"item_code": item.item_code, "bom_no": item.bom_no,
|
||||
"qty": item.qty})
|
||||
|
||||
for r in ret:
|
||||
if not item.fields.get(r):
|
||||
item.fields[r] = ret[r]
|
||||
@ -100,7 +100,7 @@ class DocType:
|
||||
args = webnotes.form_dict.get('args')
|
||||
import json
|
||||
args = json.loads(args)
|
||||
|
||||
|
||||
item = self.get_item_det(args['item_code'])
|
||||
self.validate_rm_item(item)
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:42:57",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-04 13:13:28",
|
||||
"modified": "2013-07-10 14:54:04",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -32,6 +32,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -41,6 +42,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
@ -51,6 +53,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency"
|
||||
@ -59,6 +62,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "standard_rate",
|
||||
"oldfieldtype": "Currency"
|
||||
@ -67,6 +71,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "amount_as_per_sr",
|
||||
"oldfieldtype": "Currency"
|
||||
@ -75,6 +80,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "Stock UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Link",
|
||||
@ -85,6 +91,7 @@
|
||||
"fieldname": "qty_consumed_per_unit",
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Qty Consumed Per Unit",
|
||||
"no_copy": 0
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-27 11:30:07",
|
||||
"modified": "2013-07-10 14:54:05",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -41,6 +41,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "operation_no",
|
||||
"fieldtype": "Select",
|
||||
"in_list_view": 1,
|
||||
"label": "Operation No",
|
||||
"oldfieldname": "operation_no",
|
||||
"oldfieldtype": "Data",
|
||||
@ -51,6 +52,7 @@
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -63,6 +65,7 @@
|
||||
"fieldname": "bom_no",
|
||||
"fieldtype": "Link",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "BOM No",
|
||||
"oldfieldname": "bom_no",
|
||||
"oldfieldtype": "Link",
|
||||
@ -76,6 +79,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -85,6 +89,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "Stock UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
@ -96,12 +101,14 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "amount_as_per_mar",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:19",
|
||||
"modified": "2013-07-10 14:54:05",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "BOM Operation",
|
||||
"parentfield": "fields",
|
||||
|
@ -20,10 +20,16 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
}
|
||||
|
||||
cur_frm.set_query("current_bom", function(doc) {
|
||||
return erpnext.queries.bom({name: "!" + doc.new_bom});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {name: "!" + doc.new_bom}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
cur_frm.set_query("new_bom", function(doc) {
|
||||
return erpnext.queries.bom({name: "!" + doc.current_bom});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {name: "!" + doc.current_bom}
|
||||
}
|
||||
});
|
@ -101,18 +101,27 @@ cur_frm.cscript.make_se = function(doc, purpose) {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['production_item'].get_query = function(doc) {
|
||||
return 'SELECT DISTINCT `tabItem`.`name`, `tabItem`.`description` FROM `tabItem` WHERE (IFNULL(`tabItem`.`end_of_life`,"") = "" OR `tabItem`.`end_of_life` = "0000-00-00" OR `tabItem`.`end_of_life` > NOW()) AND `tabItem`.docstatus != 2 AND `tabItem`.is_pro_applicable = "Yes" AND `tabItem`.%(key)s LIKE "%s" ORDER BY `tabItem`.`name` LIMIT 50';
|
||||
return {
|
||||
filters:[
|
||||
['Item', 'is_pro_applicable', '=', 'Yes']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['project_name'].get_query = function(doc, dt, dn) {
|
||||
return 'SELECT `tabProject`.name FROM `tabProject` \
|
||||
WHERE `tabProject`.status not in ("Completed", "Cancelled") \
|
||||
AND `tabProject`.name LIKE "%s" ORDER BY `tabProject`.name ASC LIMIT 50';
|
||||
return{
|
||||
filters:[
|
||||
['Project', 'status', 'not in', 'Completed, Cancelled']
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.set_query("bom_no", function(doc) {
|
||||
if (doc.production_item) {
|
||||
return erpnext.queries.bom({item: cstr(doc.production_item)});
|
||||
return{
|
||||
query:"controllers.queries.bom",
|
||||
filters: {item: cstr(doc.production_item)}
|
||||
}
|
||||
} else msgprint(" Please enter Production Item first");
|
||||
});
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:26",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -41,6 +42,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "bom_no",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "BOM No",
|
||||
"oldfieldname": "bom_no",
|
||||
"oldfieldtype": "Link",
|
||||
@ -54,6 +56,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "planned_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Planned Qty",
|
||||
"oldfieldname": "planned_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -65,6 +68,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "sales_order",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Sales Order",
|
||||
"oldfieldname": "source_docname",
|
||||
"oldfieldtype": "Data",
|
||||
@ -76,6 +80,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "so_pending_qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "SO Pending Qty",
|
||||
"oldfieldname": "prevdoc_reqd_qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -88,6 +93,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
@ -100,6 +106,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:49",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:26",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -15,6 +15,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Production Plan Sales Order",
|
||||
"parentfield": "fields",
|
||||
|
@ -53,11 +53,18 @@ cur_frm.fields_dict['pp_details'].grid.get_field('item_code').get_query = functi
|
||||
cur_frm.fields_dict['pp_details'].grid.get_field('bom_no').get_query = function(doc) {
|
||||
var d = locals[this.doctype][this.docname];
|
||||
if (d.item_code) {
|
||||
return erpnext.queries.bom({item: cstr(d.item_code)});
|
||||
return {
|
||||
query:"controllers.queries.bom",
|
||||
filters:{'item': cstr(d.item_code)}
|
||||
}
|
||||
} else msgprint(" Please enter Item first");
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.customer_query"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.pp_so_details.grid.get_field("customer").get_query =
|
||||
erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query;
|
@ -20,6 +20,7 @@ patch_list = [
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'docperm') # 2013-04-07",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'report')",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'doctype') # 2013-07-08",
|
||||
"execute:webnotes.reload_doc('core', 'doctype', 'page') # 2013-06-24",
|
||||
"patches.mar_2012.clean_property_setter",
|
||||
"patches.april_2012.naming_series_patch",
|
||||
"patches.mar_2012.cleanup_control_panel",
|
||||
|
@ -28,4 +28,8 @@ cur_frm.cscript.refresh = function(doc) {
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.customer_query"
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:50",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:26",
|
||||
"modified": "2013-07-10 14:54:12",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Project Milestone",
|
||||
"parentfield": "fields",
|
||||
|
@ -21,9 +21,9 @@ cur_frm.add_fetch("project", "company", "company");
|
||||
erpnext.projects.Task = wn.ui.form.Controller.extend({
|
||||
setup: function() {
|
||||
this.frm.fields_dict.project.get_query = function() {
|
||||
return "select name from `tabProject` \
|
||||
where %(key)s like \"%s\" \
|
||||
order by name asc limit 50";
|
||||
return {
|
||||
query: "projects.doctype.task.task.get_project"
|
||||
}
|
||||
};
|
||||
},
|
||||
|
||||
|
@ -92,3 +92,13 @@ def get_events(start, end, filters=None):
|
||||
}, as_dict=True, update={"allDay": 0})
|
||||
|
||||
return data
|
||||
|
||||
def get_project(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
return webnotes.conn.sql(""" select name from `tabProject`
|
||||
where %(key)s like "%(txt)s"
|
||||
%(mcond)s
|
||||
order by name
|
||||
limit %(start)s, %(page_len)s """ % {'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
|
||||
'start': start, 'page_len': page_len})
|
@ -2,8 +2,8 @@ wn.provide("erpnext.projects");
|
||||
|
||||
erpnext.projects.TimeLog = wn.ui.form.Controller.extend({
|
||||
setup: function() {
|
||||
this.frm.set_query("task", erpnext.queries.task);
|
||||
}
|
||||
});
|
||||
this.frm.set_query("task", function() {
|
||||
return { query: "projects.utils.query_task" }
|
||||
});
|
||||
|
||||
cur_frm.cscript = new erpnext.projects.TimeLog({frm: cur_frm});
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-05 09:11:06",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:34",
|
||||
"modified": "2013-07-10 14:54:25",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -14,6 +14,7 @@
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"in_list_view": 1,
|
||||
"name": "__common__",
|
||||
"parent": "Time Log Batch Detail",
|
||||
"parentfield": "fields",
|
||||
|
@ -44,7 +44,7 @@ $.extend(erpnext.complete_setup, {
|
||||
{fieldname:'timezone', label: 'Time Zone', reqd:1,
|
||||
options: "", fieldtype: 'Select'},
|
||||
{fieldname:'industry', label: 'Industry', reqd:1,
|
||||
options: erpnext.complete_setup.industry_list.join('\n'), fieldtype: 'Select'},
|
||||
options: erpnext.complete_setup.domains.join('\n'), fieldtype: 'Select'},
|
||||
{fieldname:'update', label:'Setup',fieldtype:'Button'},
|
||||
],
|
||||
});
|
||||
@ -75,6 +75,7 @@ $.extend(erpnext.complete_setup, {
|
||||
if(!data) return;
|
||||
$(this).set_working();
|
||||
$c_obj('Setup Control','setup_account',data,function(r, rt){
|
||||
$(this).done_working();
|
||||
if(!r.exc) {
|
||||
sys_defaults = r.message;
|
||||
user_fullname = r.message.user_fullname;
|
||||
@ -84,12 +85,16 @@ $.extend(erpnext.complete_setup, {
|
||||
wn.container.wntoolbar.set_user_name();
|
||||
|
||||
setTimeout(function() { window.location.reload(); }, 3000);
|
||||
} else {
|
||||
$(this).done_working();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
d.fields_dict.company_name.input.onchange = function() {
|
||||
var parts = d.get_input("company_name").val().split(" ");
|
||||
var abbr = $.map(parts, function(p) { return p ? p.substr(0,1) : null }).join("");
|
||||
d.get_input("company_abbr").val(abbr.toUpperCase());
|
||||
}
|
||||
|
||||
d.fields_dict.country.input.onchange = function() {
|
||||
var country = d.fields_dict.country.input.value;
|
||||
var $timezone = $(d.fields_dict.timezone.input);
|
||||
@ -129,11 +134,5 @@ $.extend(erpnext.complete_setup, {
|
||||
|
||||
fy_start_list: ['', '1st Jan', '1st Apr', '1st Jul', '1st Oct'],
|
||||
|
||||
industry_list: ['', 'Aerospace and Defence', 'Agriculture', 'Apparel', 'Automobile',
|
||||
'Banking', 'Biotechnology', 'Chemical', 'Communications', 'Consulting', 'Customer Service',
|
||||
'Education', 'Electronics', 'Energy', 'Engineering', 'Entertainment', 'Environmental',
|
||||
'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'],
|
||||
domains: ['', "Manufacturing", "Retail", "Distribution", "Services"],
|
||||
});
|
@ -122,8 +122,14 @@ cur_frm.cscript.make_contact = function() {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_group'].get_query = function(doc,dt,dn) {
|
||||
return 'SELECT `tabCustomer Group`.`name`, `tabCustomer Group`.`parent_customer_group` FROM `tabCustomer Group` WHERE `tabCustomer Group`.`is_group` = "No" AND `tabCustomer Group`.`docstatus`!= 2 AND `tabCustomer Group`.%(key)s LIKE "%s" ORDER BY `tabCustomer Group`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
filters:{'is_group': 'No'}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict.lead_name.get_query = erpnext.utils.lead_query;
|
||||
cur_frm.fields_dict.lead_name.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.lead_query"
|
||||
}
|
||||
}
|
@ -184,7 +184,7 @@ class DocType(TransactionBase):
|
||||
|
||||
@webnotes.whitelist()
|
||||
def get_dashboard_info(customer):
|
||||
if not webnotes.has_permission("Customer", customer):
|
||||
if not webnotes.has_permission("Customer", "read", customer):
|
||||
webnotes.msgprint("No Permission", raise_exception=True)
|
||||
|
||||
out = {}
|
||||
|
@ -62,16 +62,20 @@ cur_frm.cscript.onload = function(doc, dt, dn) {
|
||||
|
||||
cur_frm.fields_dict['delivery_note_no'].get_query = function(doc) {
|
||||
doc = locals[this.doctype][this.docname];
|
||||
var cond = '';
|
||||
if(doc.customer) {
|
||||
cond = '`tabDelivery Note`.customer = "'+doc.customer+'" AND';
|
||||
}
|
||||
return repl('SELECT DISTINCT `tabDelivery Note`.name, `tabDelivery Note`.customer_name FROM `tabDelivery Note`, `tabDelivery Note Item` WHERE `tabDelivery Note`.company = "%(company)s" AND `tabDelivery Note`.docstatus = 1 AND ifnull(`tabDelivery Note`.per_installed,0) < 99.99 AND %(cond)s `tabDelivery Note`.name LIKE "%s" ORDER BY `tabDelivery Note`.name DESC LIMIT 50', {company:doc.company, cond:cond});
|
||||
|
||||
var filter = {
|
||||
'company': doc.company,
|
||||
'docstatus': 1,
|
||||
'per_installed': 99.99
|
||||
};
|
||||
if(doc.customer) filter['customer'] = doc.customer;
|
||||
return { filters: filter }
|
||||
}
|
||||
|
||||
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';
|
||||
return{
|
||||
filters: { 'is_group': "No" }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc,dt,dn) {
|
||||
@ -79,11 +83,19 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,address_line1,city FROM tabAddress WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return{
|
||||
filters: { 'customer': doc.customer }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name,CONCAT(first_name," ",ifnull(last_name,"")) As FullName,department,designation FROM tabContact WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND name LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return{
|
||||
filters: { 'customer': doc.customer }
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return{
|
||||
query:"controllers.queries.customer_query"
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:51",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:21",
|
||||
"modified": "2013-07-10 14:54:09",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -29,6 +29,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -39,6 +40,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Data",
|
||||
@ -51,6 +53,7 @@
|
||||
"fieldname": "prevdoc_date",
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Delivery Date",
|
||||
"oldfieldname": "prevdoc_date",
|
||||
"oldfieldtype": "Date",
|
||||
@ -61,6 +64,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "serial_no",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Serial No",
|
||||
"oldfieldname": "serial_no",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -72,6 +76,7 @@
|
||||
"fieldname": "prevdoc_detail_docname",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Against Document Detail No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_detail_docname",
|
||||
@ -87,6 +92,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Against Document No",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
@ -103,6 +109,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Document Type",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_doctype",
|
||||
@ -117,6 +124,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Installed Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
|
@ -20,16 +20,19 @@ wn.require('app/setup/doctype/contact_control/contact_control.js');
|
||||
wn.provide("erpnext");
|
||||
erpnext.LeadController = wn.ui.form.Controller.extend({
|
||||
setup: function() {
|
||||
this.frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
this.frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.customer_query" } }
|
||||
},
|
||||
|
||||
onload: function() {
|
||||
if(cur_frm.fields_dict.lead_owner.df.options.match(/^Profile/)) {
|
||||
cur_frm.fields_dict.lead_owner.get_query = erpnext.utils.profile_query;
|
||||
cur_frm.fields_dict.lead_owner.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.profile_query" } }
|
||||
}
|
||||
|
||||
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
|
||||
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
|
||||
cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.profile_query" } }
|
||||
}
|
||||
|
||||
if(in_list(user_roles,'System Manager')) {
|
||||
|
@ -109,7 +109,8 @@ cur_frm.cscript.onload = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
if(cur_frm.fields_dict.contact_by.df.options.match(/^Profile/)) {
|
||||
cur_frm.fields_dict.contact_by.get_query = erpnext.utils.profile_query;
|
||||
cur_frm.fields_dict.contact_by.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.profile_query" } }
|
||||
}
|
||||
|
||||
if(doc.customer && !doc.customer_name) cur_frm.cscript.customer(doc);
|
||||
@ -153,23 +154,23 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['customer_address'].get_query = function(doc, cdt, cdn) {
|
||||
return 'SELECT name, address_line1, city FROM tabAddress \
|
||||
WHERE customer = "'+ doc.customer +'" AND docstatus != 2 AND \
|
||||
%(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
return {
|
||||
filters:{'customer':doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
|
||||
if (!doc.customer) msgprint("Please select customer first");
|
||||
else {
|
||||
return 'SELECT name, CONCAT(first_name," ",ifnull(last_name,"")) As FullName, \
|
||||
department, designation FROM tabContact WHERE customer = "'+ doc.customer +
|
||||
'" AND docstatus != 2 AND %(key)s LIKE "%s" ORDER BY name ASC LIMIT 50';
|
||||
filters:{'customer':doc.customer}
|
||||
}
|
||||
}
|
||||
|
||||
// lead
|
||||
cur_frm.fields_dict['lead'].get_query = function(doc,cdt,cdn){
|
||||
return 'SELECT `tabLead`.name, `tabLead`.lead_name FROM `tabLead` WHERE `tabLead`.%(key)s LIKE "%s" ORDER BY `tabLead`.`name` ASC LIMIT 50';
|
||||
return {
|
||||
query: "selling.doctype.opportunity.opportunity.get_lead"
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
@ -185,14 +186,17 @@ cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
}
|
||||
|
||||
cur_frm.fields_dict['enquiry_details'].grid.get_field('item_code').get_query = function(doc, cdt, cdn) {
|
||||
if (doc.enquiry_type == 'Maintenance')
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_service_item, "No")': 'Yes'
|
||||
});
|
||||
else
|
||||
return erpnext.queries.item({
|
||||
'ifnull(tabItem.is_sales_item, "No")': 'Yes'
|
||||
});
|
||||
if (doc.enquiry_type == 'Maintenance') {
|
||||
return {
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{ 'is_service_item': 'Yes' }
|
||||
}
|
||||
} else {
|
||||
return {
|
||||
query:"controllers.queries.item_query",
|
||||
filters:{ 'is_sales_item': 'Yes' }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
||||
@ -229,8 +233,12 @@ cur_frm.cscript['Declare Opportunity Lost'] = function(){
|
||||
|
||||
//get query select Territory
|
||||
cur_frm.fields_dict['territory'].get_query = function(doc,cdt,cdn) {
|
||||
return 'SELECT `tabTerritory`.`name`,`tabTerritory`.`parent_territory` FROM `tabTerritory` WHERE `tabTerritory`.`is_group` = "No" AND `tabTerritory`.`docstatus`!= 2 AND `tabTerritory`.%(key)s LIKE "%s" ORDER BY `tabTerritory`.`name` ASC LIMIT 50';}
|
||||
return{
|
||||
filters:{'is_group': 'No'}
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query;
|
||||
cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.lead_query" } }
|
||||
|
||||
cur_frm.fields_dict.customer.get_query = erpnext.utils.customer_query;
|
||||
cur_frm.fields_dict.customer.get_query = function(doc,cdt,cdn) {
|
||||
return { query:"controllers.queries.customer_query" } }
|
@ -202,4 +202,14 @@ def make_quotation(source_name, target_doclist=None):
|
||||
}
|
||||
}, target_doclist)
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
return [d.fields for d in doclist]
|
||||
|
||||
def get_lead(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
return webnotes.conn.sql ("""select `tabLead`.name, `tabLead`.lead_name FROM `tabLead`
|
||||
where `tabLead`.%(key)s like "%(txt)s"
|
||||
%(mcond)s
|
||||
order by `tabLead`.`name` asc
|
||||
limit %(start)s, %(page_len)s """ % {'key': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond':get_match_cond(doctype, searchfield),
|
||||
'start': start, 'page_len': page_len})
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-02-22 01:27:51",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-07 07:03:26",
|
||||
"modified": "2013-07-10 14:54:11",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -28,6 +28,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_code",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -38,6 +39,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 1,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -47,6 +49,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Text",
|
||||
@ -59,6 +62,7 @@
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
@ -71,6 +75,7 @@
|
||||
"fieldname": "brand",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Link",
|
||||
@ -78,29 +83,39 @@
|
||||
"print_hide": 1,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 1,
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "basic_rate",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Basic Rate",
|
||||
"oldfieldname": "basic_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "Company:company:default_currency",
|
||||
"print_hide": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"label": "Qty",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "uom",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"oldfieldname": "uom",
|
||||
"oldfieldtype": "Link",
|
||||
|
@ -118,7 +118,8 @@ cur_frm.cscript.customer_address = cur_frm.cscript.contact_person = function(doc
|
||||
}),'', doc, dt, dn, 1);
|
||||
}
|
||||
|
||||
cur_frm.fields_dict.lead.get_query = erpnext.utils.lead_query;
|
||||
cur_frm.fields_dict.lead.get_query = function(doc,cdt,cdn) {
|
||||
return{ query:"controllers.queries.lead_query" } }
|
||||
|
||||
cur_frm.cscript.lead = function(doc, cdt, cdn) {
|
||||
if(doc.lead) {
|
||||
@ -186,45 +187,21 @@ cur_frm.fields_dict['quotation_details'].grid.get_field('item_code').get_query=
|
||||
if(doc.customer) {
|
||||
var export_rate_field = wn.meta.get_docfield(cdt, 'export_rate', cdn);
|
||||
var precision = (export_rate_field && export_rate_field.fieldtype) === 'Float' ? 6 : 2;
|
||||
return repl("\
|
||||
select \
|
||||
item.name, \
|
||||
( \
|
||||
select concat('Last Quote @ ', q.currency, ' ', \
|
||||
format(q_item.export_rate, %(precision)s)) \
|
||||
from `tabQuotation` q, `tabQuotation Item` q_item \
|
||||
where \
|
||||
q.name = q_item.parent \
|
||||
and q_item.item_code = item.name \
|
||||
and q.docstatus = 1 \
|
||||
and q.customer = \"%(cust)s\" \
|
||||
order by q.transaction_date desc \
|
||||
limit 1 \
|
||||
) as quote_rate, \
|
||||
( \
|
||||
select concat('Last Sale @ ', si.currency, ' ', \
|
||||
format(si_item.basic_rate, %(precision)s)) \
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item \
|
||||
where \
|
||||
si.name = si_item.parent \
|
||||
and si_item.item_code = item.name \
|
||||
and si.docstatus = 1 \
|
||||
and si.customer = \"%(cust)s\" \
|
||||
order by si.posting_date desc \
|
||||
limit 1 \
|
||||
) as sales_rate, \
|
||||
item.item_name, item.description \
|
||||
from `tabItem` item \
|
||||
where \
|
||||
item.%(key)s like \"%s\" \
|
||||
%(cond)s \
|
||||
limit 25", {
|
||||
cust: doc.customer,
|
||||
cond: cond,
|
||||
precision: precision
|
||||
});
|
||||
return {
|
||||
query: "selling.doctype.quotation.quotation.quotation_details",
|
||||
filters:{
|
||||
cust: doc.customer,
|
||||
cond: cond,
|
||||
precision: precision
|
||||
}
|
||||
}
|
||||
} else {
|
||||
return repl("SELECT name, item_name, description FROM `tabItem` item WHERE item.%(key)s LIKE '%s' %(cond)s ORDER BY item.item_code DESC LIMIT 50", {cond:cond});
|
||||
return {
|
||||
query: 'selling.doctype.quotation.quotation.quotation_details',
|
||||
filters:{
|
||||
cond: cond
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ def _make_sales_order(source_name, target_doclist=None, ignore_permissions=False
|
||||
# postprocess: fetch shipping address, set missing values
|
||||
|
||||
return [d.fields for d in doclist]
|
||||
|
||||
|
||||
def _make_customer(source_name, ignore_permissions=False):
|
||||
quotation = webnotes.conn.get_value("Quotation", source_name, ["lead", "order_type"])
|
||||
if quotation and quotation[0]:
|
||||
@ -295,4 +295,42 @@ def _make_customer(source_name, ignore_permissions=False):
|
||||
customer.insert()
|
||||
return customer
|
||||
else:
|
||||
raise e
|
||||
raise e
|
||||
|
||||
def quotation_details(doctype, txt, searchfield, start, page_len, filters):
|
||||
from controllers.queries import get_match_cond
|
||||
|
||||
if filters.has_key('cust') and filters.has_key('precision'):
|
||||
return webnotes.conn.sql("""select item.name,
|
||||
(select concat('Last Quote @ ', q.currency, ' ',
|
||||
format(q_item.export_rate, %(precision)s))
|
||||
from `tabQuotation` q, `tabQuotation Item` q_item
|
||||
where q.name = q_item.parent
|
||||
and q_item.item_code = item.name
|
||||
and q.docstatus = 1
|
||||
and q.customer = "%(cust)s"
|
||||
order by q.transaction_date desc
|
||||
limit 1) as quote_rate,
|
||||
(select concat('Last Sale @ ', si.currency, ' ',
|
||||
format(si_item.basic_rate, %(precision)s))
|
||||
from `tabSales Invoice` si, `tabSales Invoice Item` si_item
|
||||
where si.name = si_item.parent
|
||||
and si_item.item_code = item.name
|
||||
and si.docstatus = 1
|
||||
and si.customer ="%(cust)s"
|
||||
order by si.posting_date desc
|
||||
limit 1) as sales_rate,
|
||||
item.item_name, item.description
|
||||
from `tabItem` item
|
||||
where %(cond)s %(mcond)s
|
||||
and item.%(searchfield)s like '%(txt)s'
|
||||
order by item.name desc limit %(start)s, %(page_len)s """ % {'precision': filters["precision"],
|
||||
'cust': filters['cust'], 'cond': filters['cond'], 'searchfield': searchfield,
|
||||
'txt': "%%%s%%" % txt, 'mcond': get_match_cond(doctype, searchfield),
|
||||
'start': start, 'page_len': page_len})
|
||||
|
||||
else:
|
||||
return webnotes.conn.sql(""" select name, item_name, description from `tabItem` item
|
||||
where %s %s and %s like %s order by name desc limit %s, %s""" %
|
||||
("%s", get_match_cond(doctype, searchfield), searchfield, "%s", "%s", "%s"),
|
||||
(filters["cond"], "%%%s%%" % txt, start, page_len))
|
||||
|
@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-03-07 11:42:57",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-07-09 12:24:21",
|
||||
"modified": "2013-07-10 14:54:18",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@ -31,6 +31,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Item Code",
|
||||
"oldfieldname": "item_code",
|
||||
"oldfieldtype": "Link",
|
||||
@ -47,6 +48,7 @@
|
||||
"fieldname": "customer_item_code",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Customer's Item Code",
|
||||
"print_hide": 1,
|
||||
"read_only": 1
|
||||
@ -56,6 +58,7 @@
|
||||
"fieldname": "item_name",
|
||||
"fieldtype": "Data",
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Name",
|
||||
"oldfieldname": "item_name",
|
||||
"oldfieldtype": "Data",
|
||||
@ -70,6 +73,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "description",
|
||||
"fieldtype": "Small Text",
|
||||
"in_list_view": 1,
|
||||
"label": "Description",
|
||||
"oldfieldname": "description",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -79,12 +83,20 @@
|
||||
"reqd": 1,
|
||||
"width": "300px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "quantity_and_rate",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Quantity and Rate"
|
||||
},
|
||||
{
|
||||
"default": "0.00",
|
||||
"doctype": "DocField",
|
||||
"fieldname": "qty",
|
||||
"fieldtype": "Float",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Quantity",
|
||||
"oldfieldname": "qty",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -99,6 +111,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "stock_uom",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "UOM",
|
||||
"oldfieldname": "stock_uom",
|
||||
"oldfieldtype": "Data",
|
||||
@ -113,6 +126,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate",
|
||||
"oldfieldname": "ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -128,6 +142,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "adj_rate",
|
||||
"fieldtype": "Float",
|
||||
"in_list_view": 0,
|
||||
"label": "Discount (%)",
|
||||
"oldfieldname": "adj_rate",
|
||||
"oldfieldtype": "Float",
|
||||
@ -142,6 +157,7 @@
|
||||
"fieldname": "export_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Rate",
|
||||
"oldfieldname": "export_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -159,6 +175,7 @@
|
||||
"fieldname": "export_amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"oldfieldname": "export_amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -174,6 +191,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "base_ref_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_list_view": 0,
|
||||
"label": "Price List Rate (Company Currency)",
|
||||
"oldfieldname": "base_ref_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -189,6 +207,7 @@
|
||||
"fieldname": "basic_rate",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Basic Rate (Company Currency)",
|
||||
"oldfieldname": "basic_rate",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -206,6 +225,7 @@
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Amount (Company Currency)",
|
||||
"oldfieldname": "amount",
|
||||
"oldfieldtype": "Currency",
|
||||
@ -217,12 +237,20 @@
|
||||
"search_index": 0,
|
||||
"width": "100px"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "reference",
|
||||
"fieldtype": "Section Break",
|
||||
"in_list_view": 0,
|
||||
"label": "Reference"
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "item_group",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Group",
|
||||
"oldfieldname": "item_group",
|
||||
"oldfieldtype": "Link",
|
||||
@ -237,6 +265,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Brand",
|
||||
"oldfieldname": "brand",
|
||||
"oldfieldtype": "Link",
|
||||
@ -252,6 +281,7 @@
|
||||
"fieldname": "item_tax_rate",
|
||||
"fieldtype": "Small Text",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Item Tax Rate",
|
||||
"oldfieldname": "item_tax_rate",
|
||||
"oldfieldtype": "Small Text",
|
||||
@ -263,6 +293,7 @@
|
||||
"doctype": "DocField",
|
||||
"fieldname": "prevdoc_docname",
|
||||
"fieldtype": "Data",
|
||||
"in_list_view": 0,
|
||||
"label": "Against Docname",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_docname",
|
||||
@ -278,6 +309,7 @@
|
||||
"fieldname": "prevdoc_doctype",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Against Doctype",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "prevdoc_doctype",
|
||||
@ -294,6 +326,7 @@
|
||||
"fieldname": "page_break",
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Page Break",
|
||||
"no_copy": 1,
|
||||
"oldfieldname": "page_break",
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user