Skip to content

Commit

Permalink
Merge c1acab9 into 35c601a
Browse files Browse the repository at this point in the history
  • Loading branch information
nmimsnikhil committed Sep 3, 2020
2 parents 35c601a + c1acab9 commit 99fac46
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
20 changes: 20 additions & 0 deletions erpnext/crm/doctype/opportunity/opportunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ frappe.ui.form.on("Opportunity", {

with_items: function(frm) {
frm.trigger('toggle_mandatory');
frm.toggle_display('service_fee', !frm.doc.with_items);
frm.toggle_display('software_fee', !frm.doc.with_items);
if (frm.doc.with_items == 1) {
frm.trigger("calculate_amount");
} else {
frm.trigger("calculate_opportunity_cost");
}
},

customer_address: function(frm, cdt, cdn) {
Expand Down Expand Up @@ -116,6 +123,19 @@ frappe.ui.form.on("Opportunity", {
}
},

service_fee: function (frm) {
frm.trigger("calculate_opportunity_cost");
},

software_fee: function (frm) {
frm.trigger("calculate_opportunity_cost");
},

calculate_opportunity_cost: function (frm) {
let amount = flt(frm.doc.service_fee) + flt(frm.doc.software_fee);
frm.set_value("opportunity_amount", amount);
},

set_contact_link: function(frm) {
if(frm.doc.opportunity_from == "Customer" && frm.doc.party_name) {
frappe.dynamic_link = {doc: frm.doc, fieldname: 'party_name', doctype: 'Customer'}
Expand Down
18 changes: 17 additions & 1 deletion erpnext/crm/doctype/opportunity/opportunity.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"with_items",
"column_break_17",
"probability",
"service_fee",
"software_fee",
"items_section",
"items",
"contact_info",
Expand Down Expand Up @@ -409,11 +411,25 @@
"fieldtype": "Link",
"label": "Converted By",
"options": "User"
},
{
"default": "0",
"fieldname": "service_fee",
"fieldtype": "Currency",
"label": "Service Fee",
"options": "currency"
},
{
"default": "0",
"fieldname": "software_fee",
"fieldtype": "Currency",
"label": "Software Fee",
"options": "currency"
}
],
"icon": "fa fa-info-sign",
"idx": 195,
"modified": "2020-08-17 12:51:30.774480",
"modified": "2020-09-02 23:11:52.248057",
"modified_by": "Administrator",
"module": "CRM",
"name": "Opportunity",
Expand Down

0 comments on commit 99fac46

Please sign in to comment.