Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- frappe.listview_settings['Opportunity'] = {
- add_fields: ["customer_name", "opportunity_type", "opportunity_from", "status"],
- get_indicator: function(doc) {
- var indicator = [__(doc.status), frappe.utils.guess_colour(doc.status), "status,=," + doc.status];
- if(doc.status=="Quotation") {
- indicator[1] = "green";
- }
- if(doc.status=="Design Requested") {
- indicator[1] = "blue";
- }
- if(doc.status=="Approved") {
- indicator[1] = "green";
- }
- if(doc.status=="ECL Updated"){
- indicator[1] = "blue";
- }
- return indicator;
- },
- onload: function(listview) {
- let roles = frappe.user_roles
- listview.page.add_actions_menu_item(__("Assign"), function() {
- Assign(listview)
- })
- },
- refresh:function(listview) {
- listview.page.actions.find('[data-label="Edit"]').parent().parent().remove()
- listview.page.actions.find('[data-label="Assign%20To"]').parent().parent().remove()
- listview.page.actions.find('[data-label="Design%20Request"]').parent().parent().remove()
- listview.page.actions.find('[data-label="Approve"]').parent().parent().remove()
- listview.page.actions.find('[data-label="Reject"]').parent().parent().remove()
- },
- hide_name_column: true,
- }
- let Assign = function(listview) {
- let docnames = listview.get_checked_items(true);
- let d = new frappe.ui.Dialog({
- title: 'Add to ToDo',
- fields: [
- {
- label: 'User',
- fieldname: 'user',
- fieldtype: 'Link',
- options:"User",
- reqd: 1,
- get_query: function () {
- return {
- query : 'idms.idms.utils.user_query',
- };
- }
- },
- {
- fieldtype: 'Section Break'
- },
- {
- label: __("Complete By"),
- fieldtype: 'Date',
- fieldname: 'date'
- },
- {
- fieldtype: 'Column Break'
- },
- {
- label: __("Priority"),
- fieldtype: 'Select',
- fieldname: 'priority',
- options: [
- {
- value: 'Low',
- label: __('Low')
- },
- {
- value: 'Medium',
- label: __('Medium')
- },
- {
- value: 'High',
- label: __('High')
- }
- ],
- // Pick up priority from the source document, if it exists and is available in ToDo
- default: 'Medium',
- },
- {
- fieldtype: 'Section Break'
- },
- {
- label: __("Comment"),
- fieldtype: 'Small Text',
- fieldname: 'description'
- },
- ],
- primary_action_label: 'Submit',
- primary_action(values) {
- set_assign_to(values, docnames, listview)
- d.hide();
- }
- });
- d.show();
- }
- let set_assign_to = function (values, docnames, listview) {
- frappe.call({
- method: "idms.idms.doc_events.opportunity.set_assign_to",
- args: {
- 'docnames': docnames,
- 'user':values.user,
- 'priority':values.priority,
- 'date':values.date,
- 'description':values.description
- },
- callback: function(r) {
- listview.refresh()
- }
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement