fix: linting issues

This commit is contained in:
Afshan
2021-09-21 11:09:07 +05:30
parent 9688d745f8
commit 9da6d21e75
3 changed files with 29 additions and 32 deletions

View File

@@ -2,16 +2,16 @@
// For license information, please see license.txt
frappe.ui.form.on('Process Sales Commission', {
setup: function(frm){
setup: function(frm) {
frm.set_query("department", function() {
if (!frm.doc.company) {
frappe.throw(__("Please select company first"))
frappe.throw(__("Please select company first"));
}
return {
filters: {
company: frm.doc.company
}
}
};
});
},
});

View File

@@ -25,7 +25,7 @@ class ProcessSalesCommission(Document):
def process_sales_commission(self):
filter_date = "transaction_date" if self.commission_based_on=="Sales Order" else "posting_date"
records = [entry.name for entry in frappe.db.get_all(self.commission_based_on, filters={ "company": self.company, filter_date: ('between', [self.from_date, self.to_date])})]
records = [entry.name for entry in frappe.db.get_all(self.commission_based_on, filters={"company": self.company, filter_date: ('between', [self.from_date, self.to_date])})]
sales_persons_details = frappe.get_all("Sales Team", filters={"parent": ['in', records]}, fields=["sales_person", "commission_rate", "incentives", "allocated_percentage", "allocated_amount", "parent"])
if len(sales_persons_details):
sales_persons = set(e['sales_person'] for e in sales_persons_details)

View File

@@ -2,13 +2,13 @@
// For license information, please see license.txt
frappe.ui.form.on('Sales Commission', {
setup: function(frm){
setup: function(frm) {
frm.set_query("commission_based_on", function() {
return {
filters: [
['name', 'in', ["Sales Order", "Sales Invoice"]]
]
}
};
});
},
refresh: function(frm) {
@@ -58,39 +58,36 @@ const create_payment_entry = function (frm) {
d.hide();
var arg = d.get_values();
frappe.confirm(__("Creating Payment Entry. Do you want to proceed?"),
function () {
frappe.call({
method: 'payout_entry',
args: {
"mode_of_payment": arg.mode_of_payment
},
callback: function () {
frappe.set_route(
'Form', "Payment Entry", {
"Payment Entry Reference.reference_name": frm.doc.name
}
);
},
doc: frm.doc,
freeze: true,
freeze_message: __('Creating Payment Entry')
});
},
function () {
if (frappe.dom.freeze_count) {
frappe.dom.unfreeze();
frm.events.refresh(frm);
function () {
frappe.call({
method: 'payout_entry',
args: {
"mode_of_payment": arg.mode_of_payment
},
callback: function () {
frappe.set_route(
'Form', "Payment Entry", {
"Payment Entry Reference.reference_name": frm.doc.name
}
);
},
doc: frm.doc,
freeze: true,
freeze_message: __('Creating Payment Entry')
});
},
function () {
if (frappe.dom.freeze_count) {
frappe.dom.unfreeze();
frm.events.refresh(frm);
}
}
}
);
});
d.show();
};
const create_additional_salary = function (frm) {
if (!frm.doc.employee) {
frappe.throw(__("No employee is linked to Sales Person {0}. Please select an employee for {1} to process this Commission.").format(frappe.bold(frm.doc.sales_person), get_link_to_form("Sales Person", frm.doc.sales_person)))
}
frappe.confirm(__("Creating Additional Salary. Do you want to proceed?"),
function () {
frappe.call({