Merge branch 'develop' into opening-stock-entry-dev
This commit is contained in:
commit
4f549cc196
@ -9,12 +9,14 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
return{ query: "erpnext.controllers.queries.employee_query" }
|
return{ query: "erpnext.controllers.queries.employee_query" }
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onload: function(frm) {
|
|
||||||
|
onload: function(frm) {
|
||||||
if(!frm.doc.status) {
|
if(!frm.doc.status) {
|
||||||
frm.set_value('status', 'Draft');
|
frm.set_value('status', 'Draft');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
kra_template: function(frm) {
|
|
||||||
|
kra_template: function(frm) {
|
||||||
frm.doc.goals = [];
|
frm.doc.goals = [];
|
||||||
erpnext.utils.map_current_doc({
|
erpnext.utils.map_current_doc({
|
||||||
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
|
method: "erpnext.hr.doctype.appraisal.appraisal.fetch_appraisal_template",
|
||||||
@ -22,7 +24,8 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
frm: frm
|
frm: frm
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
calculate_total: function(frm) {
|
|
||||||
|
calculate_total: function(frm) {
|
||||||
let goals = frm.doc.goals || [];
|
let goals = frm.doc.goals || [];
|
||||||
let total =0;
|
let total =0;
|
||||||
for(let i = 0; i<goals.length; i++){
|
for(let i = 0; i<goals.length; i++){
|
||||||
@ -35,20 +38,17 @@ frappe.ui.form.on('Appraisal', {
|
|||||||
frappe.ui.form.on('Appraisal Goal', {
|
frappe.ui.form.on('Appraisal Goal', {
|
||||||
score: function(frm, cdt, cdn) {
|
score: function(frm, cdt, cdn) {
|
||||||
var d = locals[cdt][cdn];
|
var d = locals[cdt][cdn];
|
||||||
if (d.score){
|
if (d.score) {
|
||||||
if (flt(d.score) > 5) {
|
if (flt(d.score) > 5) {
|
||||||
frappe.msgprint(__("Score must be less than or equal to 5"));
|
frappe.msgprint(__("Score must be less than or equal to 5"));
|
||||||
d.score = 0;
|
d.score = 0;
|
||||||
refresh_field('score', d.name, 'goals');
|
refresh_field('score', d.name, 'goals');
|
||||||
}
|
}
|
||||||
var total = flt(d.per_weightage*d.score)/100;
|
d.score_earned = flt(d.per_weightage*d.score, precision("score_earned", d))/100;
|
||||||
d.score_earned = total.toPrecision(2);
|
} else {
|
||||||
refresh_field('score_earned', d.name, 'goals');
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
d.score_earned = 0;
|
d.score_earned = 0;
|
||||||
refresh_field('score_earned', d.name, 'goals');
|
|
||||||
}
|
}
|
||||||
frm.trigger('calculate_total');
|
refresh_field('score_earned', d.name, 'goals');
|
||||||
|
frm.trigger('calculate_total');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -756,7 +756,11 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
|
|
||||||
this.get_exchange_rate(transaction_date, this.frm.doc.currency, company_currency,
|
this.get_exchange_rate(transaction_date, this.frm.doc.currency, company_currency,
|
||||||
function(exchange_rate) {
|
function(exchange_rate) {
|
||||||
me.frm.set_value("conversion_rate", exchange_rate);
|
if(exchange_rate != me.frm.doc.conversion_rate) {
|
||||||
|
me.set_margin_amount_based_on_currency(exchange_rate);
|
||||||
|
me.set_actual_charges_based_on_currency(exchange_rate);
|
||||||
|
me.frm.set_value("conversion_rate", exchange_rate);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.conversion_rate();
|
this.conversion_rate();
|
||||||
@ -777,7 +781,6 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
if(this.frm.doc.ignore_pricing_rule) {
|
if(this.frm.doc.ignore_pricing_rule) {
|
||||||
this.calculate_taxes_and_totals();
|
this.calculate_taxes_and_totals();
|
||||||
} else if (!this.in_apply_price_list){
|
} else if (!this.in_apply_price_list){
|
||||||
this.set_actual_charges_based_on_currency();
|
|
||||||
this.apply_price_list();
|
this.apply_price_list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -804,12 +807,24 @@ erpnext.TransactionController = erpnext.taxes_and_totals.extend({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
set_actual_charges_based_on_currency: function() {
|
set_margin_amount_based_on_currency: function(exchange_rate) {
|
||||||
|
if (in_list(["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]), this.frm.doc.doctype) {
|
||||||
|
var me = this;
|
||||||
|
$.each(this.frm.doc.items || [], function(i, d) {
|
||||||
|
if(d.margin_type == "Amount") {
|
||||||
|
frappe.model.set_value(d.doctype, d.name, "margin_rate_or_amount",
|
||||||
|
flt(d.margin_rate_or_amount) / flt(exchange_rate));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
set_actual_charges_based_on_currency: function(exchange_rate) {
|
||||||
var me = this;
|
var me = this;
|
||||||
$.each(this.frm.doc.taxes || [], function(i, d) {
|
$.each(this.frm.doc.taxes || [], function(i, d) {
|
||||||
if(d.charge_type == "Actual") {
|
if(d.charge_type == "Actual") {
|
||||||
frappe.model.set_value(d.doctype, d.name, "tax_amount",
|
frappe.model.set_value(d.doctype, d.name, "tax_amount",
|
||||||
flt(d.tax_amount) / flt(me.frm.doc.conversion_rate));
|
flt(d.tax_amount) / flt(exchange_rate));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user