fiscal year auto fetch added to oppurtunity, quotation, material request, supplier quotation, expense claim doctypes + issues fixed

This commit is contained in:
Neil Trini Lasrado 2014-10-07 18:26:39 +05:30
parent e6b14a4bf6
commit 565d986198
9 changed files with 83 additions and 40 deletions

View File

@ -11,6 +11,8 @@ cur_frm.cscript.other_fname = "other_charges";
{% include 'accounts/doctype/purchase_taxes_and_charges_master/purchase_taxes_and_charges_master.js' %}
{% include 'accounts/doctype/sales_invoice/pos.js' %}
frappe.require("assets/erpnext/js/utils.js");
erpnext.buying.SupplierQuotationController = erpnext.buying.BuyingController.extend({
refresh: function() {
this._super();
@ -72,3 +74,11 @@ cur_frm.fields_dict['contact_person'].get_query = function(doc, cdt, cdn) {
filters:{'supplier': doc.supplier}
}
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}

View File

@ -2,6 +2,7 @@
// License: GNU General Public License v3. See license.txt
frappe.provide("erpnext.hr");
frappe.require("assets/erpnext/js/utils.js");
erpnext.hr.ExpenseClaimController = frappe.ui.form.Controller.extend({
make_bank_voucher: function() {
@ -154,3 +155,11 @@ cur_frm.cscript.on_submit = function(doc, cdt, cdn) {
cur_frm.email_doc(frappe.boot.notification_settings.expense_claim_message);
}
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}
cur_frm.cscript.posting_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.posting_date);
}

View File

@ -89,6 +89,16 @@
"options": "Simple",
"permlevel": 0
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"in_filter": 1,
"label": "Posting Date",
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "employee",
"fieldtype": "Link",
@ -114,17 +124,6 @@
"search_index": 0,
"width": "150px"
},
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_filter": 1,
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "company",
"fieldtype": "Link",
@ -136,21 +135,22 @@
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_filter": 1,
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"reqd": 1
},
{
"fieldname": "cb1",
"fieldtype": "Column Break",
"permlevel": 0
},
{
"fieldname": "posting_date",
"fieldtype": "Date",
"in_filter": 1,
"label": "Posting Date",
"oldfieldname": "posting_date",
"oldfieldtype": "Date",
"permlevel": 0,
"reqd": 1
},
{
"allow_on_submit": 0,
"fieldname": "remark",
@ -190,7 +190,7 @@
"icon": "icon-money",
"idx": 1,
"is_submittable": 1,
"modified": "2014-08-27 07:08:48.454580",
"modified": "2014-10-07 18:22:14.689567",
"modified_by": "Administrator",
"module": "HR",
"name": "Expense Claim",
@ -206,7 +206,6 @@
"read": 1,
"report": 1,
"role": "Employee",
"user_permission_doctypes": "[\"Company\",\"Employee\",\"Expense Claim\",\"Fiscal Year\"]",
"write": 1
},
{
@ -222,7 +221,6 @@
"report": 1,
"role": "Expense Approver",
"submit": 1,
"user_permission_doctypes": "[\"Expense Claim\",\"User\"]",
"write": 1
},
{
@ -238,7 +236,6 @@
"report": 1,
"role": "HR User",
"submit": 1,
"user_permission_doctypes": "[\"Company\",\"Expense Claim\",\"Fiscal Year\"]",
"write": 1
}
],

View File

@ -223,11 +223,11 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
this.frm.script_manager.trigger("currency");
this.apply_pricing_rule();
}
erpnext.get_fiscal_year(this.frm.doc);
erpnext.get_fiscal_year(this.frm.doc.company, this.frm.doc.posting_date);
},
posting_date: function() {
erpnext.get_fiscal_year(this.frm.doc);
erpnext.get_fiscal_year(this.frm.doc.company, this.frm.doc.posting_date);
},
get_company_currency: function() {

View File

@ -22,8 +22,7 @@ $.extend(erpnext, {
"verbose": '0'
},
callback: function(r) {
var arr = r.message
if (arr != null) cur_frm.set_value("fiscal_year",arr[0]);
if (r.message) cur_frm.set_value("fiscal_year", r.message[0]);
}
});
},

View File

@ -8,6 +8,7 @@ frappe.ui.form.on_change("Opportunity", "contact_person", erpnext.utils.get_cont
frappe.provide("erpnext.selling");
frappe.require("assets/erpnext/js/utils.js");
cur_frm.email_field = "contact_email";
// TODO commonify this code
@ -145,3 +146,10 @@ cur_frm.cscript.send_sms = function() {
var sms_man = new SMSManager(cur_frm.doc);
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}

View File

@ -272,13 +272,13 @@
"width": "50px"
},
{
"fieldname": "fiscal_year",
"fieldname": "company",
"fieldtype": "Link",
"in_filter": 1,
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
@ -307,13 +307,13 @@
"read_only": 0
},
{
"fieldname": "company",
"fieldname": "fiscal_year",
"fieldtype": "Link",
"in_filter": 1,
"label": "Company",
"oldfieldname": "company",
"oldfieldtype": "Link",
"options": "Company",
"label": "Fiscal Year",
"oldfieldname": "fiscal_year",
"oldfieldtype": "Select",
"options": "Fiscal Year",
"permlevel": 0,
"print_hide": 1,
"read_only": 0,
@ -388,7 +388,7 @@
"icon": "icon-info-sign",
"idx": 1,
"is_submittable": 1,
"modified": "2014-09-11 18:53:14.037512",
"modified": "2014-10-07 18:12:19.104820",
"modified_by": "Administrator",
"module": "Selling",
"name": "Opportunity",
@ -396,6 +396,7 @@
"permissions": [
{
"amend": 1,
"apply_user_permissions": 1,
"cancel": 1,
"create": 1,
"delete": 1,

View File

@ -12,6 +12,8 @@ cur_frm.cscript.sales_team_fname = "sales_team";
{% include 'accounts/doctype/sales_taxes_and_charges_master/sales_taxes_and_charges_master.js' %}
{% include 'accounts/doctype/sales_invoice/pos.js' %}
frappe.require("assets/erpnext/js/utils.js");
erpnext.selling.QuotationController = erpnext.selling.SellingController.extend({
onload: function(doc, dt, dn) {
var me = this;
@ -171,3 +173,10 @@ cur_frm.cscript.send_sms = function() {
var sms_man = new SMSManager(cur_frm.doc);
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}

View File

@ -6,6 +6,8 @@ cur_frm.cscript.fname = "indent_details";
{% include 'buying/doctype/purchase_common/purchase_common.js' %};
frappe.require("assets/erpnext/js/utils.js");
erpnext.buying.MaterialRequestController = erpnext.buying.BuyingController.extend({
onload: function(doc) {
this._super();
@ -195,3 +197,11 @@ cur_frm.cscript.send_sms = function() {
frappe.require("assets/erpnext/js/sms_manager.js");
var sms_man = new SMSManager(cur_frm.doc);
}
cur_frm.cscript.company = function(doc, cdt, cdn) {
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}
cur_frm.cscript.transaction_date = function(doc, cdt, cdn){
erpnext.get_fiscal_year(doc.company, doc.transaction_date);
}