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 // For license information, please see license.txt
frappe.ui.form.on('Process Sales Commission', { frappe.ui.form.on('Process Sales Commission', {
setup: function(frm){ setup: function(frm) {
frm.set_query("department", function() { frm.set_query("department", function() {
if (!frm.doc.company) { if (!frm.doc.company) {
frappe.throw(__("Please select company first")) frappe.throw(__("Please select company first"));
} }
return { return {
filters: { filters: {
company: frm.doc.company company: frm.doc.company
} }
} };
}); });
}, },
}); });

View File

@@ -25,7 +25,7 @@ class ProcessSalesCommission(Document):
def process_sales_commission(self): def process_sales_commission(self):
filter_date = "transaction_date" if self.commission_based_on=="Sales Order" else "posting_date" 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"]) 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): if len(sales_persons_details):
sales_persons = set(e['sales_person'] for e in 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 // For license information, please see license.txt
frappe.ui.form.on('Sales Commission', { frappe.ui.form.on('Sales Commission', {
setup: function(frm){ setup: function(frm) {
frm.set_query("commission_based_on", function() { frm.set_query("commission_based_on", function() {
return { return {
filters: [ filters: [
['name', 'in', ["Sales Order", "Sales Invoice"]] ['name', 'in', ["Sales Order", "Sales Invoice"]]
] ]
} };
}); });
}, },
refresh: function(frm) { refresh: function(frm) {
@@ -58,39 +58,36 @@ const create_payment_entry = function (frm) {
d.hide(); d.hide();
var arg = d.get_values(); var arg = d.get_values();
frappe.confirm(__("Creating Payment Entry. Do you want to proceed?"), frappe.confirm(__("Creating Payment Entry. Do you want to proceed?"),
function () { function () {
frappe.call({ frappe.call({
method: 'payout_entry', method: 'payout_entry',
args: { args: {
"mode_of_payment": arg.mode_of_payment "mode_of_payment": arg.mode_of_payment
}, },
callback: function () { callback: function () {
frappe.set_route( frappe.set_route(
'Form', "Payment Entry", { 'Form', "Payment Entry", {
"Payment Entry Reference.reference_name": frm.doc.name "Payment Entry Reference.reference_name": frm.doc.name
} }
); );
}, },
doc: frm.doc, doc: frm.doc,
freeze: true, freeze: true,
freeze_message: __('Creating Payment Entry') freeze_message: __('Creating Payment Entry')
}); });
}, },
function () { function () {
if (frappe.dom.freeze_count) { if (frappe.dom.freeze_count) {
frappe.dom.unfreeze(); frappe.dom.unfreeze();
frm.events.refresh(frm); frm.events.refresh(frm);
}
} }
}
); );
}); });
d.show(); d.show();
}; };
const create_additional_salary = function (frm) { 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?"), frappe.confirm(__("Creating Additional Salary. Do you want to proceed?"),
function () { function () {
frappe.call({ frappe.call({